예제 #1
0
    def start(self):

        dpg.setup_registries()
        dpg.setup_viewport()
        dpg.set_viewport_title("Simple Data Flow")
        node_editor = NodeEditor()

        with dpg.window() as main_window:

            with dpg.menu_bar():

                with dpg.menu(label="Operations"):

                    dpg.add_menu_item(label="Reset", callback=lambda: dpg.delete_item(node_editor.uuid, children_only=True))

                with dpg.menu(label="Plugins"):
                    for plugin in self.plugins:
                        dpg.add_menu_item(label=plugin[0], callback=plugin[1])

            with dpg.group(horizontal=True) as group:

                # left panel
                with dpg.group(id=self.left_panel):
                    self.data_set_container.submit(self.left_panel)
                    self.modifier_container.submit(self.left_panel)

                # center panel
                node_editor.submit(group)

                # right panel
                with dpg.group(id=self.right_panel):
                    self.inspector_container.submit(self.right_panel)
                    self.tool_container.submit(self.right_panel)

        dpg.set_primary_window(main_window, True)
        dpg.start_dearpygui()
예제 #2
0
def configure_pygui(renderer, widgets, update=True):
    if not dearpygui_imported:
        raise RuntimeError(
            "Attempted to use DearPyGUI when it isn't imported.")
    if update:
        dpg.delete_item(window)
    else:
        dpg.setup_viewport()
    dpg.set_viewport_title(title=f"Manim Community v{__version__}")
    dpg.set_viewport_width(1015)
    dpg.set_viewport_height(540)

    def rerun_callback(sender, data):
        renderer.scene.queue.put(("rerun_gui", [], {}))

    def continue_callback(sender, data):
        renderer.scene.queue.put(("exit_gui", [], {}))

    def scene_selection_callback(sender, data):
        config["scene_names"] = (dpg.get_value(sender), )
        renderer.scene.queue.put(("rerun_gui", [], {}))

    scene_classes = scene_classes_from_file(Path(config["input_file"]),
                                            full_list=True)
    scene_names = [scene_class.__name__ for scene_class in scene_classes]

    with dpg.window(
            id=window,
            label="Manim GUI",
            pos=[config["gui_location"][0], config["gui_location"][1]],
            width=1000,
            height=500,
    ):
        dpg.set_global_font_scale(2)
        dpg.add_button(label="Rerun", callback=rerun_callback)
        dpg.add_button(label="Continue", callback=continue_callback)
        dpg.add_combo(
            label="Selected scene",
            items=scene_names,
            callback=scene_selection_callback,
            default_value=config["scene_names"][0],
        )
        dpg.add_separator()
        if len(widgets) != 0:
            with dpg.collapsing_header(
                    label=f"{config['scene_names'][0]} widgets",
                    default_open=True):
                for widget_config in widgets:
                    widget_config_copy = widget_config.copy()
                    name = widget_config_copy["name"]
                    widget = widget_config_copy["widget"]
                    if widget != "separator":
                        del widget_config_copy["name"]
                        del widget_config_copy["widget"]
                        getattr(dpg, f"add_{widget}")(name,
                                                      **widget_config_copy)
                    else:
                        dpg.add_separator()

    if not update:
        dpg.start_dearpygui()
                                          id=f'{s}',
                                          callback=update_param,
                                          user_data=s,
                                          min_value=p - 0.1,
                                          max_value=p + 0.1,
                                          width=200,
                                          default_value=p)

    draw_shelves(shelf, params, world, vis, steps=5)

    signal.signal(signal.SIGINT, handle_sigint)

    dpg.setup_viewport()
    dpg.set_viewport_width(300)
    dpg.set_viewport_height(200)
    dpg.set_viewport_title('Nobilia Test')
    dpg.start_dearpygui()

    # start = rospy.Time.now()

    # max_length_v = 0

    # while not rospy.is_shutdown():
    #   state_range = shelf.joints['hinge'].limit_upper - shelf.joints['hinge'].limit_lower
    #   state = {shelf_pos: shelf.joints['hinge'].limit_lower + (math.cos((rospy.Time.now() - start).to_sec()) + 1) * 0.5 * state_range }
    #   world.update_world(state)
    #   vis.begin_draw_cycle('world', 'poses', 'vectors')
    #   vis.draw_world('world', world)
    #   vis.draw_poses('poses', np.eye(4), 0.1, 0.01, [gm.subs(p, state) for p in debug.poses])

    #   for point, vector in debug.vectors:
        dpg.add_line_series([], [], label="X_value", id="X_value", parent="y_axis")
        dpg.add_line_series([], [], label="Y_value", id="Y_value", parent="y_axis")
        dpg.add_line_series([], [], label="Z_value", id="Z_value", parent="y_axis")


def resize_group( sender, data, user ):
    dpg.configure_item('Ploter', height = data[1], width = data[0] ) 
    dpg.configure_item('Graph', height = data[1]*0.9, width = data[0]*0.9, pos=[ data[0]*0.05, data[1]*0.05] ) 


dpg.setup_viewport()

dpg.set_primary_window     ( main_window, True              )
dpg.set_viewport_min_height( height = 700                   ) 
dpg.set_viewport_min_width ( width  = 800                   ) 
dpg.set_viewport_title     ( title  = 'Ploter Acelerometro' )

dpg.maximize_viewport() 

dpg.add_resize_handler(main_window, callback=resize_group)



x_data, y_data, z_data = 0.0, 0.0, 0.0 

while dpg.is_dearpygui_running():
    dpg.render_dearpygui_frame() 
    count = dpg.get_frame_count() 
    try: 
        pBytes = b''
        while comp.in_waiting: 
예제 #5
0
import dearpygui.dearpygui as dpg

dpg.setup_viewport()
dpg.set_viewport_title(title='Custom Title')
dpg.set_viewport_width(500)
dpg.set_viewport_height(200)

with dpg.window() as mainwindow:
    dpg.add_text("Hello, world")
    dpg.add_input_text(label='Viewport Title',
                       hint="yoyo",
                       callback=lambda sender: dpg.set_viewport_title(
                           title=dpg.get_value(sender)))

dpg.set_primary_window(mainwindow, True)

dpg.start_dearpygui()
예제 #6
0
    dpg.add_same_line()
    dpg.add_button(label="Initialize", callback=search_directory)

    dpg.add_node_editor(label="Editor", id=editor_id)

# files window
with dpg.window(label="All Files", pos=(75, 65), show=False, no_resize=True, autosize=True, id=all_files_id):

    dpg.add_listbox(label="Headers", width=200, num_items=15, callback=callback, id=headers_id)
    dpg.add_same_line()
    dpg.add_listbox(label="Cpp", width=200, num_items=15, callback=callback, id=cpp_id)
    dpg.add_same_line()
    dpg.add_listbox(label="Other", width=200, num_items=15, callback=callback, id=other_id)

# ignore options window
with dpg.window(label="Ignore Options", pos=(75, 400), show=False, no_resize=True, autosize=True) as ignore_options_id:

    with dpg.group():
        dpg.add_button(label="Ignore File", callback=ignore)
        dpg.add_same_line()
        dpg.add_button(label="Unignore File", callback=unignore)
        dpg.add_listbox(label="Ignore", width=200, num_items=15, id=ignore_id)
        dpg.add_same_line()
        dpg.add_listbox(label="Files", width=200, num_items=15, id=files_id)

dpg.setup_viewport()
dpg.set_viewport_title("Header Analyzer")
dpg.set_primary_window(main_id, True)
dpg.start_dearpygui()