Example #1
0
def update_control_graph_buttons(is_graph_running):
    """
    Used to enable and disable (grey out) the Start Graph or the End Graph according to whether the Graph is running or
    not
    :param is_graph_running: Is the graph running bool
    :return: Nothing
    """
    with dpg.theme() as theme_active:
        with dpg.theme_component(0):
            dpg.add_theme_color(dpg.mvThemeCol_Button, [50, 50, 180, 255], category=dpg.mvThemeCat_Core)

    with dpg.theme() as theme_non_active:
        with dpg.theme_component(0):
            dpg.add_theme_color(dpg.mvThemeCol_Button, [150, 150, 150, 255], category=dpg.mvThemeCat_Core)

    if is_graph_running:
        dpg.configure_item(start_graph_button_id, enabled=False)
        dpg.bind_item_theme(start_graph_button_id, theme_non_active)
        dpg.configure_item(end_graph_button_id, enabled=True)
        dpg.bind_item_theme(end_graph_button_id, theme_active)
    else:
        dpg.configure_item(start_graph_button_id, enabled=True)
        dpg.bind_item_theme(start_graph_button_id, theme_active)
        dpg.configure_item(end_graph_button_id, enabled=False)
        dpg.bind_item_theme(end_graph_button_id, theme_non_active)
Example #2
0
def add_bbands_series(w, s, dates, ta, parent):
    values = ta.bollinger_bands(w, s)
    bbdates = dates[w - 1:]
    upper_band = values[1].to_list()[w - 1:]
    lower_band = values[2].to_list()[w - 1:]
    with dpg.theme() as b_theme:
        dpg.add_theme_color(dpg.mvPlotCol_Fill, (100, 100, 150, 64),
                            category=dpg.mvThemeCat_Plots)
    dpg.add_shade_series(bbdates,
                         upper_band,
                         y2=lower_band,
                         label="BBANDS",
                         parent=parent)
    dpg.set_item_theme(dpg.last_item(), b_theme)
    dpg.add_button(label="Delete Series",
                   user_data=dpg.last_item(),
                   parent=dpg.last_item(),
                   callback=lambda s, a, u: dpg.delete_item(u))
Example #3
0
    def start_com_process(self):
        self.initialise_proof_of_life_socket()
        arguments_list = [
            'python', self.operation.executable, self.starting_port
        ]

        num_of_inputs = len(self.topics_in)
        num_of_outputs = len(self.topics_out)
        arguments_list.append(str(num_of_inputs))
        if 'Input' in self.operation.attribute_types:
            for topic_in in self.topics_in:
                arguments_list.append(topic_in)
        arguments_list.append(str(num_of_outputs))
        if 'Output' in self.operation.attribute_types:
            for topic_out in self.topics_out:
                arguments_list.append(topic_out)
        arguments_list.append(self.name.replace(" ", "_"))

        self.update_verbosity(
            None, None
        )  # This is required to make the debugger work because in debug this callback
        # is never called
        arguments_list.append(str(self.verbose))
        arguments_list.append(self.ssh_local_server.split(
            ' ')[0])  # pass only the ID part of the 'ID name' string
        arguments_list.append(self.ssh_remote_server.split(' ')[0])
        arguments_list.append(self.worker_executable)
        self.process = subprocess.Popen(
            arguments_list, creationflags=subprocess.CREATE_NEW_PROCESS_GROUP)
        print('Started COM {}_{} process with PID = {}'.format(
            self.name, self.node_index, self.process.pid))
        # Wait until the worker_exec sends a proof_of_life signal (i.e. it is up and running).
        self.wait_for_proof_of_life()

        # Then update the parameters
        self.update_parameters()
        self.start_thread_to_send_parameters_multiple_times()

        with dpg.theme_component(0, parent=self.theme_id):
            dpg.add_theme_color(dpg.mvNodeCol_NodeOutline,
                                [255, 255, 255, 255],
                                category=dpg.mvThemeCat_Nodes)
Example #4
0
    def stop_com_process(self):
        try:
            self.socket_sub_proof_of_life.disconnect(
                r"tcp://127.0.0.1:{}".format(
                    ct.PROOF_OF_LIFE_FORWARDER_PUBLISH_PORT))
            self.socket_sub_proof_of_life.close()
        except:
            pass

        if platform.system() == 'Windows':
            self.process.send_signal(signal.CTRL_BREAK_EVENT)
        elif platform.system() == 'Linux':
            self.process.terminate()
        time.sleep(0.5)
        self.process.kill()
        self.process = None

        with dpg.theme_component(0, parent=self.theme_id):
            dpg.add_theme_color(dpg.mvNodeCol_NodeOutline, [50, 50, 50, 255],
                                category=dpg.mvThemeCat_Nodes)
Example #5
0
def create_node_selector_window():
    with dpg.window(label='Node Selector', pos=[10, 60], width=300, height=890) as node_selector:
        # Create the window of the Node selector

        node_tree = generate_node_tree()
        base_id = node_tree[0][0]
        base_name = node_tree[0][1]
        with dpg.tree_node(label=base_name, parent=node_selector, default_open=True, id=base_id, open_on_arrow=True):

            # Read what *_com files exist in the Heron/Operations dir and sub dirs and create the correct
            # tree_node widget
            for parent_id, parent, node_id, node in node_tree:
                with dpg.tree_node(label=node, parent=parent_id, default_open=True, id=node_id):
                    for op in operations_list:
                        if node == op.parent_dir:
                            colour = gu.choose_color_according_to_operations_type(node)
                            button = dpg.add_button(label=op.name, width=200, height=30, callback=on_add_node)
                            with dpg.theme() as theme_id:
                                with dpg.theme_component(0):
                                    dpg.add_theme_color(dpg.mvThemeCol_Button, colour, category=dpg.mvThemeCat_Core)
                                    dpg.add_theme_style(dpg.mvStyleVar_FrameRounding, 5, category=dpg.mvThemeCat_Core)

                            dpg.bind_item_theme(button, theme_id)
        return node_selector
Example #6
0
    def __init__(self, label: str, data):
        super().__init__(label, data)

        self.add_input_attribute(InputNodeAttribute("Value"))

        self.expected_id = dpg.generate_uuid()
        self.min_id = dpg.generate_uuid()
        self.max_id = dpg.generate_uuid()
        self.status_id = dpg.generate_uuid()

        with dpg.theme() as self.success:
            dpg.add_theme_color(dpg.mvThemeCol_CheckMark, [0, 255, 0], category=dpg.mvThemeCat_Core, id=self.success)

        with dpg.theme() as self.fail:
            dpg.add_theme_color(dpg.mvThemeCol_CheckMark, [255, 0, 0], category=dpg.mvThemeCat_Core, id=self.fail)

        with dpg.theme() as self.neutral:
            dpg.add_theme_color(dpg.mvThemeCol_CheckMark, [255, 255, 0], category=dpg.mvThemeCat_Core, id=self.neutral)
Example #7
0
    def __init__(self):

        self.log_level = 0
        self._auto_scroll = True
        self.filter_id = None
        self.window_id = dpg.add_window(label="mvLogger", pos=(200, 200), width=500, height=500)
        self.count = 0
        self.flush_count = 1000
        self.level_options = {"Trace": 0, "Debug": 1, "Info": 2,  "Warning": 3, "Error": 4, "Critical": 5}

        with dpg.group(horizontal=True, parent=self.window_id):
            dpg.add_checkbox(label="Auto-scroll", default_value=True,
                             callback=lambda sender: self.auto_scroll(dpg.get_value(sender)))
            dpg.add_button(label="Clear", callback=lambda: dpg.delete_item(self.filter_id, children_only=True))
        dpg.add_input_text(label="Filter", callback=lambda sender: dpg.set_value(self.filter_id, dpg.get_value(sender)),
                           parent=self.window_id)
        dpg.add_radio_button(list(self.level_options.keys()), parent=self.window_id,
                             callback=lambda sender: self.set_level(self.level_options[dpg.get_value(sender)]))
        dpg.add_same_line(parent=self.window_id)
        self.child_id = dpg.add_child(parent=self.window_id, autosize_x=True, autosize_y=True)
        self.filter_id = dpg.add_filter_set(parent=self.child_id)

        with dpg.theme() as self.trace_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (0, 255, 0, 255))

        with dpg.theme() as self.debug_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (64, 128, 255, 255))

        with dpg.theme() as self.info_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 255, 255, 255))

        with dpg.theme() as self.warning_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 255, 0, 255))

        with dpg.theme() as self.error_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))

        with dpg.theme() as self.critical_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))
Example #8
0
    def __init__(self, parent=None):
        
        self.log_level = 0
        self._auto_scroll = True
        self.filter_id = None
        if parent:
            self.window_id = parent
        else:
            self.window_id = dpg.add_window(label="mvLogger", pos=(200, 200), width=500, height=500)
        self.count = 0
        self.flush_count = 1000

        with dpg.group(horizontal=True, parent=self.window_id):
            dpg.add_checkbox(label="Auto-scroll", default_value=True, callback=lambda sender:self.auto_scroll(dpg.get_value(sender)))
            dpg.add_button(label="Clear", callback=lambda: dpg.delete_item(self.filter_id, children_only=True))

        dpg.add_input_text(label="Filter", callback=lambda sender: dpg.set_value(self.filter_id, dpg.get_value(sender)), 
                    parent=self.window_id)
        self.child_id = dpg.add_child(parent=self.window_id, autosize_x=True, autosize_y=True)
        self.filter_id = dpg.add_filter_set(parent=self.child_id)

        with dpg.theme() as self.trace_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (0, 255, 0, 255))

        with dpg.theme() as self.debug_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (64, 128, 255, 255))

        with dpg.theme() as self.info_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 255, 255, 255))

        with dpg.theme() as self.warning_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 255, 0, 255))

        with dpg.theme() as self.error_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))

        with dpg.theme() as self.critical_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))
Example #9
0
    def __init__(self):
        self.log_level = 0
        self._auto_scroll = True
        self.filter_id = None
        self.window_id = 0
        self.count = 0
        self.flush_count = 1000
        self.child_id = 0
        self.filter_id = 0

        with dpg.theme() as self.trace_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (0, 255, 0, 255))

        with dpg.theme() as self.debug_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (64, 128, 255, 255))

        with dpg.theme() as self.info_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 255, 255, 255))

        with dpg.theme() as self.warning_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 255, 0, 255))

        with dpg.theme() as self.error_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))

        with dpg.theme() as self.critical_theme:
            dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))
Example #10
0
def create_theme_imgui_dark():

    print("1111111111111111")
    with dpg.theme() as theme_id:
        print("22222222222")
        dpg.add_theme_color(dpg.mvThemeCol_Text,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TextDisabled,
                            (0.50 * 255, 0.50 * 255, 0.50 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_WindowBg,
                            (0.06 * 255, 0.06 * 255, 0.06 * 255, 0.94 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ChildBg,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_PopupBg,
                            (0.08 * 255, 0.08 * 255, 0.08 * 255, 0.94 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_Border,
                            (0.43 * 255, 0.43 * 255, 0.50 * 255, 0.50 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_BorderShadow,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_FrameBg,
                            (0.16 * 255, 0.29 * 255, 0.48 * 255, 0.54 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_FrameBgHovered,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.40 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_FrameBgActive,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.67 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TitleBg,
                            (0.04 * 255, 0.04 * 255, 0.04 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TitleBgActive,
                            (0.16 * 255, 0.29 * 255, 0.48 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TitleBgCollapsed,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.51 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_MenuBarBg,
                            (0.14 * 255, 0.14 * 255, 0.14 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ScrollbarBg,
                            (0.02 * 255, 0.02 * 255, 0.02 * 255, 0.53 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ScrollbarGrab,
                            (0.31 * 255, 0.31 * 255, 0.31 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ScrollbarGrabHovered,
                            (0.41 * 255, 0.41 * 255, 0.41 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ScrollbarGrabActive,
                            (0.51 * 255, 0.51 * 255, 0.51 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_CheckMark,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_SliderGrab,
                            (0.24 * 255, 0.52 * 255, 0.88 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_SliderGrabActive,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_Button,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.40 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ButtonActive,
                            (0.06 * 255, 0.53 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_Header,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.31 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_HeaderHovered,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.80 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_HeaderActive,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_Separator,
                            (0.43 * 255, 0.43 * 255, 0.50 * 255, 0.50 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_SeparatorHovered,
                            (0.10 * 255, 0.40 * 255, 0.75 * 255, 0.78 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_SeparatorActive,
                            (0.10 * 255, 0.40 * 255, 0.75 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ResizeGrip,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.20 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ResizeGripHovered,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.67 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ResizeGripActive,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.95 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_Tab,
                            (0.18 * 255, 0.35 * 255, 0.58 * 255, 0.86 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TabHovered,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.80 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TabActive,
                            (0.20 * 255, 0.41 * 255, 0.68 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TabUnfocused,
                            (0.07 * 255, 0.10 * 255, 0.15 * 255, 0.97 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TabUnfocusedActive,
                            (0.14 * 255, 0.26 * 255, 0.42 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_DockingPreview,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.70 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_DockingEmptyBg,
                            (0.20 * 255, 0.20 * 255, 0.20 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_PlotLines,
                            (0.61 * 255, 0.61 * 255, 0.61 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_PlotLinesHovered,
                            (1.00 * 255, 0.43 * 255, 0.35 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_PlotHistogram,
                            (0.90 * 255, 0.70 * 255, 0.00 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_PlotHistogramHovered,
                            (1.00 * 255, 0.60 * 255, 0.00 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TableHeaderBg,
                            (0.19 * 255, 0.19 * 255, 0.20 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TableBorderStrong,
                            (0.31 * 255, 0.31 * 255, 0.35 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TableBorderLight,
                            (0.23 * 255, 0.23 * 255, 0.25 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TableRowBg,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TableRowBgAlt,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.06 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TextSelectedBg,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.35 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_DragDropTarget,
                            (1.00 * 255, 1.00 * 255, 0.00 * 255, 0.90 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_NavHighlight,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_NavWindowingHighlight,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.70 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_NavWindowingDimBg,
                            (0.80 * 255, 0.80 * 255, 0.80 * 255, 0.20 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ModalWindowDimBg,
                            (0.80 * 255, 0.80 * 255, 0.80 * 255, 0.35 * 255))
        dpg.add_theme_color(dpg.mvPlotCol_FrameBg,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.07 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_PlotBg,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.50 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_PlotBorder,
                            (0.43 * 255, 0.43 * 255, 0.50 * 255, 0.50 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_LegendBg,
                            (0.08 * 255, 0.08 * 255, 0.08 * 255, 0.94 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_LegendBorder,
                            (0.43 * 255, 0.43 * 255, 0.50 * 255, 0.50 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_LegendText,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_TitleText,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_InlayText,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_XAxis,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_XAxisGrid,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.25 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxis,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxisGrid,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.25 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxis2,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxisGrid2,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.25 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxis3,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxisGrid3,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.25 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_Selection,
                            (1.00 * 255, 0.60 * 255, 0.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_Query,
                            (0.00 * 255, 1.00 * 255, 0.44 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_Crosshairs,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.50 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvNodeCol_NodeBackground, (50, 50, 50, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_NodeBackgroundHovered,
                            (75, 75, 75, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_NodeBackgroundSelected,
                            (75, 75, 75, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_NodeOutline, (100, 100, 100, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_TitleBar, (41, 74, 122, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_TitleBarHovered, (66, 150, 250, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_TitleBarSelected,
                            (66, 150, 250, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_Link, (61, 133, 224, 200),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_LinkHovered, (66, 150, 250, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_LinkSelected, (66, 150, 250, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_Pin, (53, 150, 250, 180),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_PinHovered, (53, 150, 250, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_BoxSelector, (61, 133, 224, 30),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_BoxSelectorOutline,
                            (61, 133, 224, 150),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_GridBackground, (40, 40, 50, 200),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_GridLine, (200, 200, 200, 40),
                            category=dpg.mvThemeCat_Nodes)

    return theme_id
Example #11
0
def create_theme_imgui_light():

    with dpg.theme() as theme_id:
        dpg.add_theme_color(dpg.mvThemeCol_Text,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TextDisabled,
                            (0.60 * 255, 0.60 * 255, 0.60 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_WindowBg,
                            (0.94 * 255, 0.94 * 255, 0.94 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ChildBg,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_PopupBg,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.98 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_Border,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.30 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_BorderShadow,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_FrameBg,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_FrameBgHovered,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.40 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_FrameBgActive,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.67 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TitleBg,
                            (0.96 * 255, 0.96 * 255, 0.96 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TitleBgActive,
                            (0.82 * 255, 0.82 * 255, 0.82 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TitleBgCollapsed,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.51 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_MenuBarBg,
                            (0.86 * 255, 0.86 * 255, 0.86 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ScrollbarBg,
                            (0.98 * 255, 0.98 * 255, 0.98 * 255, 0.53 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ScrollbarGrab,
                            (0.69 * 255, 0.69 * 255, 0.69 * 255, 0.80 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ScrollbarGrabHovered,
                            (0.49 * 255, 0.49 * 255, 0.49 * 255, 0.80 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ScrollbarGrabActive,
                            (0.49 * 255, 0.49 * 255, 0.49 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_CheckMark,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_SliderGrab,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.78 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_SliderGrabActive,
                            (0.46 * 255, 0.54 * 255, 0.80 * 255, 0.60 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_Button,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.40 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ButtonActive,
                            (0.06 * 255, 0.53 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_Header,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.31 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_HeaderHovered,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.80 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_HeaderActive,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_Separator,
                            (0.39 * 255, 0.39 * 255, 0.39 * 255, 0.62 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_SeparatorHovered,
                            (0.14 * 255, 0.44 * 255, 0.80 * 255, 0.78 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_SeparatorActive,
                            (0.14 * 255, 0.44 * 255, 0.80 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ResizeGrip,
                            (0.35 * 255, 0.35 * 255, 0.35 * 255, 0.17 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ResizeGripHovered,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.67 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ResizeGripActive,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.95 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_Tab,
                            (0.76 * 255, 0.80 * 255, 0.84 * 255, 0.93 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TabHovered,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.80 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TabActive,
                            (0.60 * 255, 0.73 * 255, 0.88 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TabUnfocused,
                            (0.92 * 255, 0.93 * 255, 0.94 * 255, 0.99 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TabUnfocusedActive,
                            (0.74 * 255, 0.82 * 255, 0.91 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_DockingPreview,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.22 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_DockingEmptyBg,
                            (0.20 * 255, 0.20 * 255, 0.20 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_PlotLines,
                            (0.39 * 255, 0.39 * 255, 0.39 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_PlotLinesHovered,
                            (1.00 * 255, 0.43 * 255, 0.35 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_PlotHistogram,
                            (0.90 * 255, 0.70 * 255, 0.00 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_PlotHistogramHovered,
                            (1.00 * 255, 0.45 * 255, 0.00 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TableHeaderBg,
                            (0.78 * 255, 0.87 * 255, 0.98 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TableBorderStrong,
                            (0.57 * 255, 0.57 * 255, 0.64 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TableBorderLight,
                            (0.68 * 255, 0.68 * 255, 0.74 * 255, 1.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TableRowBg,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.00 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TableRowBgAlt,
                            (0.30 * 255, 0.30 * 255, 0.30 * 255, 0.09 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_TextSelectedBg,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.35 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_DragDropTarget,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.95 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_NavHighlight,
                            (0.26 * 255, 0.59 * 255, 0.98 * 255, 0.80 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_NavWindowingHighlight,
                            (0.70 * 255, 0.70 * 255, 0.70 * 255, 0.70 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_NavWindowingDimBg,
                            (0.20 * 255, 0.20 * 255, 0.20 * 255, 0.20 * 255))
        dpg.add_theme_color(dpg.mvThemeCol_ModalWindowDimBg,
                            (0.20 * 255, 0.20 * 255, 0.20 * 255, 0.35 * 255))
        dpg.add_theme_color(dpg.mvPlotCol_FrameBg,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_PlotBg,
                            (0.42 * 255, 0.57 * 255, 1.00 * 255, 0.13 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_PlotBorder,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_LegendBg,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 0.98 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_LegendBorder,
                            (0.82 * 255, 0.82 * 255, 0.82 * 255, 0.80 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_LegendText,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_TitleText,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_InlayText,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_XAxis,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_XAxisGrid,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxis,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxisGrid,
                            (1.00 * 255, 1.00 * 255, 1.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxis2,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxisGrid2,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.50 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxis3,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_YAxisGrid3,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.50 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_Selection,
                            (0.82 * 255, 0.64 * 255, 0.03 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_Query,
                            (0.00 * 255, 0.84 * 255, 0.37 * 255, 1.00 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvPlotCol_Crosshairs,
                            (0.00 * 255, 0.00 * 255, 0.00 * 255, 0.50 * 255),
                            category=dpg.mvThemeCat_Plots)
        dpg.add_theme_color(dpg.mvNodeCol_NodeBackground, (240, 240, 240, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_NodeBackgroundHovered,
                            (240, 240, 240, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_NodeBackgroundSelected,
                            (240, 240, 240, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_NodeOutline, (100, 100, 100, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_TitleBar, (248, 248, 248, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_TitleBarHovered,
                            (209, 209, 209, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_TitleBarSelected,
                            (209, 209, 209, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_Link, (66, 150, 250, 100),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_LinkHovered, (66, 150, 250, 242),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_LinkSelected, (66, 150, 250, 242),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_Pin, (66, 150, 250, 160),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_PinHovered, (66, 150, 250, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_BoxSelector, (90, 170, 250, 30),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_BoxSelectorOutline,
                            (90, 170, 250, 150),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_GridBackground, (225, 225, 225, 255),
                            category=dpg.mvThemeCat_Nodes)
        dpg.add_theme_color(dpg.mvNodeCol_GridLine, (180, 180, 180, 100),
                            category=dpg.mvThemeCat_Nodes)

    return theme_id
Example #12
0
color_2 = tuple(int(color_2_hex.replace("#", "")[i:i+2], 16) for i in (0, 2, 4))
color_3 = tuple(int(color_3_hex.replace("#", "")[i:i+2], 16) for i in (0, 2, 4))
color_4 = tuple(int(color_4_hex.replace("#", "")[i:i+2], 16) for i in (0, 2, 4))
color_5 = tuple(int(color_5_hex.replace("#", "")[i:i+2], 16) for i in (0, 2, 4))




def save_callback():
    print("Save Clicked")

# dpg.set_main_window_size(500,500)
with dpg.window(label="Main Controls", width=426, height=900) as window_id:
    with dpg.theme() as theme:
        dpg.add_theme_style(dpg.mvStyleVar_FrameRounding, 25)
        dpg.add_theme_color(dpg.mvThemeCol_Button, color_2)
        dpg.add_theme_color(dpg.mvThemeCol_ButtonActive, color_4)
        dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, color_2)
        dpg.add_theme_color(dpg.mvThemeCol_Border, color_2)
        dpg.add_theme_color(dpg.mvThemeCol_FrameBg, color_2)
        dpg.add_theme_color(dpg.mvThemeCol_WindowBg, color_1)


        # dpg.add_theme_style(dpg.mvStyleVar_FramePadding, i*3, i*3)

    master_toggle = dpg.add_checkbox(label="Master")
    autoclicker_toggle = dpg.add_checkbox(label="Autoclicker")
    timer_toggle = dpg.add_checkbox(label="Timer")
    volume_up_button = dpg.add_button(label="Volume Up", callback=lambda: android.send_keycode(keycodes.AKEYCODE_VOLUME_UP))
    volume_down_button = dpg.add_button(label="Volume Down", callback=lambda: android.send_keycode(keycodes.AKEYCODE_VOLUME_DOWN))
    dpg.set_item_theme(window_id, theme)
Example #13
0
    def spawn_node_on_editor(self):
        self.context = zmq.Context()
        self.initialise_parameters_socket()

        with dpg.node(label=self.name,
                      parent=self.parent,
                      pos=[self.coordinates[0],
                           self.coordinates[1]]) as self.id:
            colour = choose_color_according_to_operations_type(
                self.operation.parent_dir)
            with dpg.theme() as self.theme_id:
                with dpg.theme_component(0):
                    dpg.add_theme_color(dpg.mvNodeCol_TitleBar,
                                        colour,
                                        category=dpg.mvThemeCat_Nodes)
                    dpg.add_theme_color(dpg.mvNodeCol_TitleBarSelected,
                                        colour,
                                        category=dpg.mvThemeCat_Nodes)
                    dpg.add_theme_color(dpg.mvNodeCol_TitleBarHovered,
                                        colour,
                                        category=dpg.mvThemeCat_Nodes)
                    dpg.add_theme_color(dpg.mvNodeCol_NodeBackgroundSelected,
                                        [120, 120, 120, 255],
                                        category=dpg.mvThemeCat_Nodes)
                    dpg.add_theme_color(dpg.mvNodeCol_NodeBackground,
                                        [70, 70, 70, 255],
                                        category=dpg.mvThemeCat_Nodes)
                    dpg.add_theme_color(dpg.mvNodeCol_NodeBackgroundHovered,
                                        [80, 80, 80, 255],
                                        category=dpg.mvThemeCat_Nodes)
                    dpg.add_theme_color(dpg.mvNodeCol_NodeOutline,
                                        [50, 50, 50, 255],
                                        category=dpg.mvThemeCat_Nodes)
                    dpg.add_theme_style(dpg.mvNodeStyleVar_NodeBorderThickness,
                                        x=4,
                                        category=dpg.mvThemeCat_Nodes)
            dpg.bind_item_theme(self.id, self.theme_id)

            # Loop through all the attributes defined in the operation (as seen in the *_com.py file) and put them on
            # the node
            same_line_widget_ids = []
            for i, attr in enumerate(self.operation.attributes):

                if self.operation.attribute_types[i] == 'Input':
                    attribute_type = dpg.mvNode_Attr_Input
                elif self.operation.attribute_types[i] == 'Output':
                    attribute_type = dpg.mvNode_Attr_Output
                elif self.operation.attribute_types[i] == 'Static':
                    attribute_type = dpg.mvNode_Attr_Static

                attribute_name = attr + '##{}##{}'.format(
                    self.operation.name, self.node_index)

                with dpg.node_attribute(label=attribute_name,
                                        parent=self.id,
                                        attribute_type=attribute_type):
                    if attribute_type == 1:
                        dpg.add_spacer()
                    dpg.add_text(label='##' + attr + ' Name{}##{}'.format(
                        self.operation.name, self.node_index),
                                 default_value=attr)

                    if 'Parameters' in attr:
                        for k, parameter in enumerate(
                                self.operation.parameters):
                            if self.operation.parameter_types[k] == 'int':
                                id = dpg.add_input_int(
                                    label='{}##{}'.format(
                                        parameter, attribute_name),
                                    default_value=self.node_parameters[k],
                                    callback=self.update_parameters,
                                    width=100,
                                    min_clamped=False,
                                    max_clamped=False,
                                    min_value=int(-1e8),
                                    max_value=int(1e8),
                                    on_enter=True)
                            elif self.operation.parameter_types[k] == 'str':
                                id = dpg.add_input_text(
                                    label='{}##{}'.format(
                                        parameter, attribute_name),
                                    default_value=self.node_parameters[k],
                                    callback=self.update_parameters,
                                    width=100,
                                    on_enter=True)
                            elif self.operation.parameter_types[k] == 'float':
                                id = dpg.add_input_float(
                                    label='{}##{}'.format(
                                        parameter, attribute_name),
                                    default_value=self.node_parameters[k],
                                    callback=self.update_parameters,
                                    width=100,
                                    min_clamped=False,
                                    max_clamped=False,
                                    min_value=-1e10,
                                    max_value=1e10,
                                    on_enter=True)
                            elif self.operation.parameter_types[k] == 'bool':
                                id = dpg.add_checkbox(
                                    label='{}##{}'.format(
                                        parameter, attribute_name),
                                    default_value=self.node_parameters[k],
                                    callback=self.update_parameters)
                            elif self.operation.parameter_types[k] == 'list':
                                default_value = self.node_parameters[k][0]
                                if type(self.node_parameters[k]) == str:
                                    default_value = self.node_parameters[k]
                                id = dpg.add_combo(
                                    label='{}##{}'.format(
                                        parameter, attribute_name),
                                    items=self.node_parameters_combos_items[k],
                                    default_value=default_value,
                                    callback=self.update_parameters,
                                    width=100)

                            self.parameter_inputs_ids[parameter] = id

                    dpg.add_spacer(label='##Spacing##' + attribute_name,
                                   indent=3)

            # Add the extra input button with its popup window for extra inputs like ssh and verbosity
            self.extra_input_window()
Example #14
0
#     b. Retrieve input attribute data.
#     c. Perform your operations.
#     d. Call "execute" methods of your output attributes (modifiers).
#     e. Call "finish".
#   3. Create a static method called "factory" that creates a returns a "NewNode".
#   4. Call either add_tool, add_modifier, or add_inspector method of app like so:
#     a. "app.add_modifier("NewNode", NewNode.factory, None)"
#     b. The 3rd argument of DragSource can be any data and will be passed into the factory's second argument
########################################################################################################################

########################################################################################################################
# Themes
########################################################################################################################

with dpg.theme() as _source_theme:
    dpg.add_theme_color(dpg.mvThemeCol_Button, [25, 119, 0])
    dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, [25, 255, 0])
    dpg.add_theme_color(dpg.mvThemeCol_ButtonActive, [25, 119, 0])

with dpg.theme() as _completion_theme:
    dpg.add_theme_color(dpg.mvNodeCol_TitleBar, [37, 28, 138], category=dpg.mvThemeCat_Nodes)
    dpg.add_theme_color(dpg.mvNodeCol_TitleBarHovered, [37, 28, 138], category=dpg.mvThemeCat_Nodes)
    dpg.add_theme_color(dpg.mvNodeCol_TitleBarSelected, [37, 28, 138], category=dpg.mvThemeCat_Nodes)


########################################################################################################################
# Node DPG Wrappings
########################################################################################################################
class OutputNodeAttribute:

    def __init__(self, label: str = "output"):
Example #15
0
import dearpygui.dearpygui as dpg

# Themes can consist of a colors and styles

# You can use the style editor to test themes at runtime and find the right constants for colors and styles
dpg.show_style_editor()

# Create a theme container and color and styles
with dpg.theme() as our_theme:

    dpg.add_theme_color(dpg.mvThemeCol_Button, (0, 255, 0, 255))
    dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, (0, 255, 255, 255))
    dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))

    # Some styles use only one variable "x" and some use 2 "x,"y" looking at the style editor can help
    dpg.add_theme_style(dpg.mvStyleVar_FrameRounding, 20)
    dpg.add_theme_style(dpg.mvStyleVar_FramePadding, 10, 10)

with dpg.window(label="Tutorial", width=500, height=500):
    dpg.add_button(label="Default Theme")

    # Setting theme at start up
    our_button = dpg.add_button(label="Set At Start-up")
    dpg.set_item_theme(our_button, our_theme)

    # Themes can be set at runtime using a lambda
    dpg.add_button(
        label="Set Theme at Runtime",
        callback=lambda sender: dpg.set_item_theme(sender, our_theme))

    # Themes can be set to all items of a specific type at runtime using a callback
Example #16
0
from math import sin

# creating data to use in the series
sindatax = []
sindatay = []
for i in range(0, 100):
    sindatax.append(i / 100)
    sindatay.append(0.5 + 0.5 * sin(50 * i / 100))

# You can use the style editor to test themes at runtime and find the right constants for colors and styles
dpg.show_style_editor()

# themes applied to plots REQUIRE category to be set to plots
# because plots are containers plots will propagate themes
with dpg.theme() as our_plot_theme:
    dpg.add_theme_color(dpg.mvPlotCol_PlotBg, (100, 0, 0, 50),
                        category=dpg.mvThemeCat_Plots)
    dpg.add_theme_color(dpg.mvPlotCol_Line, (0, 255, 0, 255),
                        category=dpg.mvThemeCat_Plots)
    dpg.add_theme_color(dpg.mvPlotCol_XAxis, (0, 255, 255, 255),
                        category=dpg.mvThemeCat_Plots)

with dpg.theme() as series_theme:
    dpg.add_theme_color(dpg.mvPlotCol_Line, (150, 0, 100, 255),
                        category=dpg.mvThemeCat_Plots)

with dpg.window(label="Tutorial"):

    # create plot
    with dpg.plot(label="Line Series", height=400, width=400) as plot:

        # REQUIRED: create x and y axes
Example #17
0
    f = (h * 6.) - i;
    p, q, t = v * (1. - s), v * (1. - s * f), v * (1. - s * (1. - f));
    i %= 6
    if i == 0: return (255 * v, 255 * t, 255 * p)
    if i == 1: return (255 * q, 255 * v, 255 * p)
    if i == 2: return (255 * p, 255 * v, 255 * t)
    if i == 3: return (255 * p, 255 * q, 255 * v)
    if i == 4: return (255 * t, 255 * p, 255 * v)
    if i == 5: return (255 * v, 255 * p, 255 * q)


button_themes = 7 * [0]

for i_t in range(0, 7):
    with dpg.theme() as button_themes[i_t]:
        dpg.add_theme_color(dpg.mvThemeCol_Button, _hsv_to_rgb(i_t / 7.0, 0.6, 0.6))
        dpg.add_theme_color(dpg.mvThemeCol_ButtonActive, _hsv_to_rgb(i_t / 7.0, 0.8, 0.8))
        dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, _hsv_to_rgb(i_t / 7.0, 0.7, 0.7))
        dpg.add_theme_style(dpg.mvStyleVar_FrameRounding, i_t * 5)
        dpg.add_theme_style(dpg.mvStyleVar_FramePadding, i_t * 3, i_t * 3)

logger = mvLogger()
logger.log_level = 0

exchange: BinanceExchange = None

tickers = ['BTC', 'ETH']
prices = {}


class WindowData:
Example #18
0
import dearpygui.dearpygui as dpg

# You can use the style editor to test themes at runtime and find the right constants for colors and styles
dpg.show_style_editor()

# Create a theme container and color and styles
with dpg.theme() as our_theme:

    dpg.add_theme_color(dpg.mvThemeCol_Button, (0, 255, 0, 255))
    dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, (0, 255, 255, 255))
    dpg.add_theme_color(dpg.mvThemeCol_Text, (255, 0, 0, 255))

    dpg.add_theme_color(dpg.mvThemeCol_TitleBg, (100, 150, 0, 255))
    dpg.add_theme_color(dpg.mvThemeCol_ScrollbarGrab, (0, 255, 0, 255))

    # Some styles use only one variable "x" and some use 2 "x,"y" looking at the style editor can help
    dpg.add_theme_style(dpg.mvStyleVar_FrameRounding, 20)
    dpg.add_theme_style(dpg.mvStyleVar_FramePadding, 10, 10)

# Themes applied to containers and will propagate to any children that use that theme constant
with dpg.window(label="Theme applied to child that propagates",
                width=300,
                height=300):
    dpg.add_button(label="Default Theme Because above theme")
    with dpg.child() as top_container:
        dpg.add_button(label="Button")
        dpg.add_combo(label="recursive theme Radio Button")
        with dpg.child():
            dpg.add_button(label="recursive theme Button")
            dpg.add_combo(label="recursive theme Radio Button")
    with dpg.group():