Esempio n. 1
0
def set_item_source(item: str, source: str):
    """Sets the item's value, to the source's value. Widget's value will now be "linked" to source's value.

    Args:
        item: Item to me linked.
        source: Source to link to.

    Returns:
        None
    """
    internal_dpg.configure_item(item, source=source)
Esempio n. 2
0
def set_item_width(item: str, width: int):
    """Sets the item's width.

    Args:
        item: Item the Width will be applied to.
        width: Width to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, width=width)
Esempio n. 3
0
def set_item_tip(item: str, tip: str):
    """Sets the item's tip.

    Args:
        item: Item the tip will be applied to.
        tip: tip to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, tip=tip)
Esempio n. 4
0
def set_item_label(item: str, label: str):
    """Sets the item's displayed label, anything after the characters "##" in the name will not be shown.

    Args:
        item: Item label will be applied to.
        label: Displayed name to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, label=label)
Esempio n. 5
0
def set_item_callback(item: str, callback: Callable):
    """Sets the item's callack.

    Args:
        item: Item the callback will be applied to.
        callback: Callback to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, callback=callback)
Esempio n. 6
0
def set_item_popup(item: str, popup: str):
    """Sets the item's popup.

    Args:
        item: Item the Popup will be applied to.
        popup: Popup to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, popup=popup)
Esempio n. 7
0
def set_item_payload_type(item: int, payload_type: str):
    """Sets the item's payload type.

    Args:
        item: Item the Height will be applied to.
        height: Height to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, payload_type=str)
Esempio n. 8
0
def untrack_item(item: int):
    """Track item in scroll region.

    Args:
        item: Item the callback will be applied to.
        callback: Callback to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, tracked=False)
Esempio n. 9
0
def set_item_track_offset(item: int, offset: float):
    """Sets the item's track offset.

    Args:
        item: Item the Height will be applied to.
        height: Height to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, track_offset=offset)
Esempio n. 10
0
def set_item_indent(item: int, indent: int):
    """Sets the item's indent.

    Args:
        item: Item the Height will be applied to.
        height: Height to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, indent=indent)
Esempio n. 11
0
def set_item_pos(item: int, pos: List[float]):
    """Sets the item's position.

    Args:
        item: Item the Width will be applied to.
        width: Width to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, pos=pos)
Esempio n. 12
0
def set_item_height(item: str, height: int):
    """Sets the item's height.

    Args:
        item: Item the Height will be applied to.
        height: Height to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, height=height)
Esempio n. 13
0
def set_item_callback_data(item: str, callback_data: Any):
    """Sets the item's callack_data to any python object.

    Args:
        item: Item the callback will be applied to.
        callback_data: Callback_data to be applied.

    Returns:
        None
    """
    internal_dpg.configure_item(item, callback_data=callback_data)
Esempio n. 14
0
def set_drawing_size(drawing: str, width: int, height: int):
    """Sets the drawing's size, width and height.

    Args:
        drawing: Drawing that will be set.
        width: x axis width to set
        height: y axis height to set

    Returns:
        None
    """
    internal_dpg.configure_item(drawing, width=width, height=height)
Esempio n. 15
0
def checkCustomConnections(sender, data):
    # colect and process the connections between nodes
    for node_name in gui.arbitrary_node_list:
        connections = core.get_value(
            "connections to node {}##node_connection_{}".format(
                node_name, node_name))
        connections = list(item.strip(" ") for item in connections.split(","))
        gui.arbitrary_node_connections[node_name] = connections

    # transition the window to the next state
    core.delete_item('connection creation##100')
    core.configure_item('finalization##110', show=True)
Esempio n. 16
0
def set_window_pos(window: str, x: int, y: int):
    """Sets the top left corner of the window to the specified position.

    Args:
        window: window to position
        x: The x position.
        y: The y position.

    Returns:
        None
    """
    internal_dpg.configure_item(window, x_pos=x, y_pos=y)
Esempio n. 17
0
def set_drawing_scale(drawing: str, x: float, y: float):
    """Sets the drawing's scale.

    Args:
        drawing: Drawing that will be set.
        x: x scale to set
        y: y scale to set

    Returns:
        None
    """
    internal_dpg.configure_item(drawing, scalex=x, scaley=y)
Esempio n. 18
0
def set_drawing_origin(drawing: str, x: float, y: float):
    """Sets the drawing's origin (the bottom left corner) to the specified position.

    Args:
        drawing: Drawing that will be set.
        x: x position to set
        y: y position to set

    Returns:
        None
    """
    internal_dpg.configure_item(drawing, originx=x, originy=y)
Esempio n. 19
0
 def select_project(self, _sender, data: str):
     """
     Selects project in menu
     :param _sender: Menu item clicked
     :param data: data which contains selected project name
     :return: Sets main window title and self.selected_project
     """
     if self.selected_project is not None:
         c.configure_item(self.selected_project, check=False)
     self.selected_project = data
     c.set_main_window_title(f"{self.title} - {data}")
     c.configure_item(data, check=True)
Esempio n. 20
0
    def __scanDir(self):
        ret = []
        for f in listdir(self.__root):
            full = f"{self.__root}/{f}"
            if path.isfile(full):
                for x in ['.mp4', '.avi']:
                    if f.lower().endswith(x):
                        ret.append(f)
                        break

        core.configure_item("Listing", items=ret)
        if len(ret) > 0:
            self.__threadRestart(ret[0])
Esempio n. 21
0
def set_item_name(item: str, name: str):
    """Sets the item's name, anything after the characters "##" in the name will not be shown.

        If no label is specified then by default this will be the displayed label.

    Args:
        item: Item name will be applied to.
        name: Unique name used to programmatically refer to the item. If label is unused this will be the label,
            anything after "##" that occurs in the name will not be shown on screen.

    Returns:
        None
    """
    internal_dpg.configure_item(item, name=name)
Esempio n. 22
0
def hide_item(item: str, *, children_only: bool = False):
    """Hides the item.

    Args:
        **item: Item to hide.

    Returns:
        None
    """
    if children_only:
        children = internal_dpg.get_item_children(item)
        for child in children:
            internal_dpg.configure_item(child, show=False)
    else:
        internal_dpg.configure_item(item, show=False)
Esempio n. 23
0
    def __play(self, direction):
        """Continue playback from head index in <- / -> direction.

		Direction can be negative for reverse playback, and can be
		greater than 1 or fractional, or stopped (0).
		"""
        if direction != 0:
            core.configure_item("Shuttle#Forwards", label='||')
            core.set_item_callback("Shuttle#Forwards",
                                   callback=lambda: self.__play(0))
        else:
            core.configure_item("Shuttle#Forwards", label='->')
            core.set_item_callback("Shuttle#Forwards",
                                   callback=lambda: self.__play(1))
        self.__direction = direction
Esempio n. 24
0
def popup(parent: int,
          mousebutton: int = internal_dpg.mvMouseButton_Right,
          modal: bool = False) -> int:

    try:
        _internal_popup_id = internal_dpg.generate_uuid()
        internal_dpg.add_clicked_handler(
            parent,
            mousebutton,
            callback=lambda: internal_dpg.configure_item(_internal_popup_id,
                                                         show=True))
        if modal:
            internal_dpg.add_window(modal=True,
                                    show=False,
                                    id=_internal_popup_id,
                                    autosize=True)
        else:
            internal_dpg.add_window(popup=True,
                                    show=False,
                                    id=_internal_popup_id,
                                    autosize=True)
        internal_dpg.push_container_stack(internal_dpg.last_container())
        yield _internal_popup_id

    finally:
        internal_dpg.pop_container_stack()
Esempio n. 25
0
    def flip_timer_state(self, *_args):
        """
        Flips tracking bool, sets starting time, and flips button label
        :arg sender: Callback widget name in pos 0
        :arg data: callback_data setting in widget in pos 1
        """
        if self.tracking:
            label = "Start Timer"
            c.configure_item("Switch Task", show=False)
            self.save_new_entry()
        else:
            label = "End Timer"
            c.configure_item("Switch Task", show=True)

        s.set_item_label("Start Timer", label=label)
        self.set_tracking()
        self.set_start_time()
Esempio n. 26
0
def _config(sender, data):

    widget_type = dpg.get_item_info(sender)["type"]
    items = data
    value = dpg.get_value(sender)

    if widget_type == "mvAppItemType::mvCheckbox":
        keyword = dpg.get_item_configuration(sender)["label"]

    elif widget_type == "mvAppItemType::mvRadioButton":
        keyword = dpg.get_item_configuration(sender)["items"][value]

    if isinstance(data, list):
        for item in items:
            dpg.configure_item(item, **{keyword: value})
    else:
        dpg.configure_item(items, **{keyword: value})
Esempio n. 27
0
 def remove_tab(self, *args, **kwargs):
     """Close a tab"""
     # Due to https://github.com/hoffstadt/DearPyGui/issues/429, when a tab is closed, we have to
     # search for the tab to remove the profile itself
     remove = set()
     for label in self._profiles:
         if dpg_core.is_item_shown(label):
             dpg_core.configure_item(label,
                                     closable=dpg_core.get_value(label))
         else:
             dpg_core.delete_item(label)
             remove.add(label)
     self._profiles = {
         label: self._profiles[label]
         for label in self._profiles if label not in remove
     }
     dpg_core.log_info(f"Profiles {remove} successfully closed")
Esempio n. 28
0
def _switch_group(sender):

    data = dpg.get_value(sender)
    if data == "Line":
        dpg.configure_item(line_group, show=True)
        dpg.configure_item(circle_group, show=False)

    elif data == "Circle":
        dpg.configure_item(line_group, show=False)
        dpg.configure_item(circle_group, show=True)
Esempio n. 29
0
    def run(self):
        """
        Cycle function to update the Overlay every minute
        """
        global start_threading
        while 1:
            refresh_rate = config_functions.get_refresh()
            sleep(refresh_rate)
            try:
                name = sqlite3db.TExecSqlReadMany(
                    DBNAME, """
                                    SELECT name FROM CFG_FACEIT_NAME
                                    """)
                if name:
                    if start_threading == 1:
                        refreshSymbol = config_functions.get_refresh_sign()
                        logging.info("Get stats and refresh them")
                        winLoss = config_functions.get_win_loss()
                        if winLoss[0][0] == "1":
                            mode = 0
                        else:
                            mode = 1
                        if refreshSymbol in "True":
                            core.configure_item("##reload_same_line",
                                                show=True)
                            core.configure_item("##reload_image", show=True)
                        self.iElo, self.acEloToday, self.iRank, \
                        self.acResult, self.acScore, self.acKd, \
                        self.acMap, self.iStreak, self.iMatches, \
                        self.iMatchesWon, self.acEloDiff, self.iKills, \
                        self.iDeath, self.iWin, self.iLoss = faceit_api.get_faceit_data_from_api(mode)
                        core.set_value("elotoday##", f"{self.acEloToday}")
                        core.set_value("streak##", f"{self.iStreak}")
                        core.set_value("map##", f"\t{self.acMap}:")
                        core.set_value("result##", f"{self.acResult}")
                        core.set_value("elo##", f"{self.iElo}")
                        core.set_value("rank##", f"{self.iRank}")
                        core.set_value("score##", f"{self.acScore}")
                        core.set_value("matches##", f"{self.iMatches}")
                        core.set_value("matcheswon##", f"{self.iMatchesWon}")
                        core.set_value("elodiffmap##", f"{self.acEloDiff}")
                        core.set_value("kill##", f"{self.iKills}")
                        core.set_value("death##", f"{self.iDeath}")
                        core.set_value("kd##", f"{self.acKd}")
                        core.set_value("Win/LossperDay##",
                                       f"{self.iWin} / {self.iLoss}")
                        core.set_value("Win/LossperWeek##",
                                       f"{self.iWin} / {self.iLoss}")
                        if core.does_item_exist("##reload_same_line"):
                            core.configure_item("##reload_same_line",
                                                show=False)
                            core.configure_item("##reload_image", show=False)

            except:
                self.run()
Esempio n. 30
0
def checkCustomNodes(sender, data):
    # colect and process the names of nodes
    nodes_list = core.get_value("##nodes_list_input")
    nodes_list = list(item.strip(" ") for item in nodes_list.split(","))
    gui.arbitrary_node_list = nodes_list

    # transition the window to the next state
    core.delete_item('node creation##90')
    core.configure_item('connection creation##100', show=True)
    for node_name in nodes_list:
        core.add_input_text(
            "connections to node {}##node_connection_{}".format(
                node_name, node_name),
            width=380,
            parent="connection creation##100")
    core.add_button("Enter##b",
                    callback=checkCustomConnections,
                    parent="connection creation##100")