From 491fa0ab1a7ce7f69cc3c38135d7e9ae33503ec1 Mon Sep 17 00:00:00 2001 From: Jonathan Hoffstadt Date: Thu, 14 Mar 2024 21:33:45 -0500 Subject: [PATCH] fix: m1 runners & sandbox app --- .github/workflows/Deployment.yml | 2 +- dearpygui/_dearpygui.pyi | 4 ++++ dearpygui/_dearpygui_RTD.py | 10 ++++++++ dearpygui/dearpygui.py | 33 ++++++++++++++------------- sandbox/sandbox.py | 39 ++++++++++++++++---------------- 5 files changed, 52 insertions(+), 36 deletions(-) diff --git a/.github/workflows/Deployment.yml b/.github/workflows/Deployment.yml index b33bf3439..de2dccca6 100644 --- a/.github/workflows/Deployment.yml +++ b/.github/workflows/Deployment.yml @@ -116,7 +116,7 @@ jobs: build-mac-silicon-wheels: - runs-on: macos-latest-large + runs-on: macos-latest-xlarge strategy: matrix: python-version: [ "3.10", "3.11", "3.12" ] diff --git a/dearpygui/_dearpygui.pyi b/dearpygui/_dearpygui.pyi index 7dece3aff..6a648f217 100644 --- a/dearpygui/_dearpygui.pyi +++ b/dearpygui/_dearpygui.pyi @@ -842,6 +842,10 @@ def get_file_dialog_info(file_dialog : Union[int, str]) -> dict: """Returns information related to the file dialog. Typically used while the file dialog is in use to query data about the state or info related to the file dialog.""" ... +def get_focused_item() -> Union[int, str]: + """Returns the item currently having focus.""" + ... + def get_frame_count() -> int: """Returns frame count.""" ... diff --git a/dearpygui/_dearpygui_RTD.py b/dearpygui/_dearpygui_RTD.py index a5ef97be6..d5a85fda6 100644 --- a/dearpygui/_dearpygui_RTD.py +++ b/dearpygui/_dearpygui_RTD.py @@ -7421,6 +7421,16 @@ def get_file_dialog_info(file_dialog): return internal_dpg.get_file_dialog_info(file_dialog) +def get_focused_item(): + """ Returns the item currently having focus. + + Args: + Returns: + Union[int, str] + """ + + return internal_dpg.get_focused_item() + def get_frame_count(): """ Returns frame count. diff --git a/dearpygui/dearpygui.py b/dearpygui/dearpygui.py index de59f2eb2..2c02b3771 100644 --- a/dearpygui/dearpygui.py +++ b/dearpygui/dearpygui.py @@ -8028,7 +8028,7 @@ def draw_quad(p1 : Union[List[float], Tuple[float, ...]], p2 : Union[List[float] return internal_dpg.draw_quad(p1, p2, p3, p4, label=label, user_data=user_data, use_internal_label=use_internal_label, tag=tag, parent=parent, before=before, show=show, color=color, fill=fill, thickness=thickness, **kwargs) -def draw_rectangle(pmin : Union[List[float], Tuple[float, ...]], pmax : Union[List[float], Tuple[float, ...]], *, label: str =None, user_data: Any =None, use_internal_label: bool =True, tag: Union[int, str] =0, parent: Union[int, str] =0, before: Union[int, str] =0, show: bool =True, color: Union[List[int], Tuple[int, ...]] =(255, 255, 255, 255), fill: Union[List[int], Tuple[int, ...]] =(0, 0, 0, -255), multicolor: bool =False, rounding: float =0.0, thickness: float =1.0, corner_colors: Union[List, Tuple, None] =None, **kwargs) -> Union[int, str]: +def draw_rectangle(pmin : Union[List[float], Tuple[float, ...]], pmax : Union[List[float], Tuple[float, ...]], *, label: str =None, user_data: Any =None, use_internal_label: bool =True, tag: Union[int, str] =0, parent: Union[int, str] =0, before: Union[int, str] =0, show: bool =True, color: Union[List[int], Tuple[int, ...]] =(255, 255, 255, 255), color_upper_left: Union[List[int], Tuple[int, ...]] =(255, 255, 255, 255), color_upper_right: Union[List[int], Tuple[int, ...]] =(255, 255, 255, 255), color_bottom_right: Union[List[int], Tuple[int, ...]] =(255, 255, 255, 255), color_bottom_left: Union[List[int], Tuple[int, ...]] =(255, 255, 255, 255), fill: Union[List[int], Tuple[int, ...]] =(0, 0, 0, -255), multicolor: bool =False, rounding: float =0.0, thickness: float =1.0, corner_colors: Any =[(255, 255, 255, 255), (255, 255, 255, 255), (255, 255, 255, 255), (255, 255, 255, 255)], **kwargs) -> Union[int, str]: """ Adds a rectangle. Args: @@ -8042,11 +8042,15 @@ def draw_rectangle(pmin : Union[List[float], Tuple[float, ...]], pmax : Union[Li before (Union[int, str], optional): This item will be displayed before the specified item in the parent. show (bool, optional): Attempt to render widget. color (Union[List[int], Tuple[int, ...]], optional): + color_upper_left (Union[List[int], Tuple[int, ...]], optional): 'multicolor' must be set to 'True' + color_upper_right (Union[List[int], Tuple[int, ...]], optional): 'multicolor' must be set to 'True' + color_bottom_right (Union[List[int], Tuple[int, ...]], optional): 'multicolor' must be set to 'True' + color_bottom_left (Union[List[int], Tuple[int, ...]], optional): 'multicolor' must be set to 'True' fill (Union[List[int], Tuple[int, ...]], optional): multicolor (bool, optional): rounding (float, optional): Number of pixels of the radius that will round the corners of the rectangle. Note: doesn't work with multicolor thickness (float, optional): - corner_colors (Union[List, Tuple], optional): Corner colors in a list, starting with upper-left and going clockwise: (upper-left, upper-right, bottom-right, bottom-left). 'multicolor' must be set to 'True'. + corner_colors (Any, optional): Corner colors in a list, starting with upper-left and going clockwise: (upper-left, upper-right, bottom-right, bottom-left). 'multicolor' must be set to 'True'. id (Union[int, str], optional): (deprecated) Returns: Union[int, str] @@ -8056,10 +8060,7 @@ def draw_rectangle(pmin : Union[List[float], Tuple[float, ...]], pmax : Union[Li warnings.warn('id keyword renamed to tag', DeprecationWarning, 2) tag=kwargs['id'] - if any(parm in kwargs.keys() for parm in ("color_upper_left", "color_upper_right", "color_bottom_left", "color_bottom_right")): - warnings.warn('Use corner_colors instead of color_x_y', DeprecationWarning, 2) - - return internal_dpg.draw_rectangle(pmin, pmax, label=label, user_data=user_data, use_internal_label=use_internal_label, tag=tag, parent=parent, before=before, show=show, color=color, fill=fill, multicolor=multicolor, rounding=rounding, thickness=thickness, corner_colors=corner_colors, **kwargs) + return internal_dpg.draw_rectangle(pmin, pmax, label=label, user_data=user_data, use_internal_label=use_internal_label, tag=tag, parent=parent, before=before, show=show, color=color, color_upper_left=color_upper_left, color_upper_right=color_upper_right, color_bottom_right=color_bottom_right, color_bottom_left=color_bottom_left, fill=fill, multicolor=multicolor, rounding=rounding, thickness=thickness, corner_colors=corner_colors, **kwargs) def draw_text(pos : Union[List[float], Tuple[float, ...]], text : str, *, label: str =None, user_data: Any =None, use_internal_label: bool =True, tag: Union[int, str] =0, parent: Union[int, str] =0, before: Union[int, str] =0, show: bool =True, color: Union[List[int], Tuple[int, ...]] =(255, 255, 255, 255), size: float =10.0, **kwargs) -> Union[int, str]: """ Adds text (drawlist). @@ -8167,16 +8168,6 @@ def get_active_window(**kwargs) -> Union[int, str]: return internal_dpg.get_active_window(**kwargs) -def get_focused_item(**kwargs) -> Union[int, str]: - """ Returns the item currently having focus. - - Args: - Returns: - Union[int, str] - """ - - return internal_dpg.get_focused_item(**kwargs) - def get_alias_id(alias : str, **kwargs) -> Union[int, str]: """ Returns the ID associated with an alias. @@ -8292,6 +8283,16 @@ def get_file_dialog_info(file_dialog : Union[int, str], **kwargs) -> dict: return internal_dpg.get_file_dialog_info(file_dialog, **kwargs) +def get_focused_item(**kwargs) -> Union[int, str]: + """ Returns the item currently having focus. + + Args: + Returns: + Union[int, str] + """ + + return internal_dpg.get_focused_item(**kwargs) + def get_frame_count(**kwargs) -> int: """ Returns frame count. diff --git a/sandbox/sandbox.py b/sandbox/sandbox.py index 77f55dc13..b172f0727 100644 --- a/sandbox/sandbox.py +++ b/sandbox/sandbox.py @@ -1,30 +1,31 @@ - import dearpygui.dearpygui as dpg -import time +import dearpygui.demo as demo +from dearpygui_ext.logger import mvLogger dpg.create_context() +#dpg.configure_app(manual_callback_management=True) dpg.create_viewport() dpg.setup_dearpygui() -i = 0 - -def resize_viewport_callback(): - dpg.set_value("ViewportWidthText", f"Viewport Width: {dpg.get_viewport_width()}") - dpg.set_value("ViewportHeightText", f"Viewport Height: {dpg.get_viewport_height()}") - dpg.set_value("LastViewportSizeUpdateText", f"Time: {time.time_ns()}") - global i - print(i) - i+=1 +log = mvLogger() +log.log("log") +log.log_debug("log debug") +log.log_info("log info") +log.log_warning("log warning") +log.log_error("log error") +log.log_critical("log critical") -dpg.set_viewport_resize_callback(resize_viewport_callback) +with dpg.font_registry(): + with dpg.font("../../assets/NotoSerifCJKjp-Medium.otf", 20, tag="custom font"): + dpg.add_font_range_hint(dpg.mvFontRangeHint_Default) + dpg.bind_font(dpg.last_container()) -with dpg.window(label="Example Window", tag="Window"): - dpg.add_text("Viewport Width: ", tag="ViewportWidthText") - dpg.add_text("Viewport Height: ", tag="ViewportHeightText") - dpg.add_text("Time: ", tag="LastViewportSizeUpdateText") - -dpg.set_primary_window("Window", True) +demo.show_demo() +# main loop dpg.show_viewport() -dpg.start_dearpygui() +while dpg.is_dearpygui_running(): + #dpg.run_callbacks(dpg.get_callback_queue()) + dpg.render_dearpygui_frame() + dpg.destroy_context() \ No newline at end of file