Ejemplo n.º 1
0
def animation_config_color():
    i = 0
    logging.info("start animation config_color")
    conf = core.get_item_configuration("##Config")
    helper = core.get_item_configuration("##Help")
    if helper["show"] is True:
        core.configure_item("##Help", show=False)
        core.configure_item("##Config_Colors", show=True)
        core.configure_item("##Web", show=False)
        return
    if conf["width"] < 350:
        core.configure_item("##Config_Colors", show=True)
        core.configure_item("##Help", show=False)
        core.configure_item("##Web", show=False)
        while i <= 1:
            x_pos = int((1 - math.pow((1 - i), 8)) * 50)
            i += 0.03
            core.configure_item("##Config", x_pos=0, width=380 + x_pos)
            sleep(0.001)
    else:
        core.configure_item("##Config_Colors", show=False)
        core.configure_item("##Help", show=False)
        core.configure_item("##Web", show=False)
        while i <= 1:
            x_pos = int((1 - math.pow((1 - i), 8)) * 50)
            i += 0.03
            core.configure_item("##Config", x_pos=0, width=60 - x_pos)
            sleep(0.001)
    logging.info("end animation config_color")
Ejemplo n.º 2
0
def get_item_rect_max(item: int) -> List[int]:
    """Returns item's maximum content region.

    Returns:
        position
    """
    return internal_dpg.get_item_configuration(item)["rect_max"]
Ejemplo n.º 3
0
def get_item_rect_size(item: int) -> List[int]:
    """Returns item's available content region.

    Returns:
        position
    """
    return internal_dpg.get_item_configuration(item)["rect_size"]
Ejemplo n.º 4
0
def get_item_pos(item: int) -> List[int]:
    """Returns item's position.

    Returns:
        position
    """
    return internal_dpg.get_item_configuration(item)["pos"]
Ejemplo n.º 5
0
def is_item_shown(item: str) -> Union[bool, None]:
    """Checks if item is shown.

    Returns:
        status as a bool
    """
    return internal_dpg.get_item_configuration(item)["show"]
Ejemplo n.º 6
0
def get_item_indent(item: int) -> Union[int, None]:
    """Gets the item's indent.

    Returns:
        indent as a int or None
    """
    return internal_dpg.get_item_configuration(item)["indent"]
Ejemplo n.º 7
0
def is_item_search_delayed(item: int) -> Union[bool, None]:
    """Checks if item is search delayed.

    Returns:
        tracked as a bool or None
    """
    return internal_dpg.get_item_configuration(item)["delay_search"]
Ejemplo n.º 8
0
def get_item_popup(item: str) -> Union[str, None]:
    """Gets the item's popup.

    Returns:
        popup as a string or None
    """
    return internal_dpg.get_item_configuration(item)["popup"]
Ejemplo n.º 9
0
def get_item_filter_key(item: int) -> Union[str, None]:
    """Gets the item's filter key.

    Returns:
        filter key as a string or None
    """
    return internal_dpg.get_item_configuration(item)["filter_key"]
Ejemplo n.º 10
0
    def __save_file(self, sender, data):
        try:
            path = data[0]
            if data[1].endswith(".task"):
                filename = data[1]
            else:
                filename = data[1] + ".task"

            tab = self.tab_tracker.tabs[self.last_tab_saved]
            page = tab.page

            page.path = path
            page.filename = filename

            data = page.render_data_dict()
            full_path = os.path.join(path, filename)

            if os.path.exists(full_path):
                os.remove(full_path)

            with open(full_path, "w") as file:
                yaml.dump(data, file)

            item = dpg.get_item_configuration(f"tab{tab.id}")
            dpg.configure_item(f"tab{tab.id}",
                               label=item["label"].replace("!", ""))
            page.changes = False
        except Exception as e:
            # TODO: Do something about it
            raise e
Ejemplo n.º 11
0
def get_item_label(item: str) -> Union[str, None]:
    """Gets the item's label.

    Returns:
        label as a string or None
    """
    return internal_dpg.get_item_configuration(item)["label"]
Ejemplo n.º 12
0
def get_item_width(item: str) -> Union[int, None]:
    """Gets the item's width.

    Returns:
        width as a int or None
    """
    return internal_dpg.get_item_configuration(item)["width"]
Ejemplo n.º 13
0
def get_item_height(item: str) -> Union[int, None]:
    """Gets the item's height.

    Returns:
        height as a int or None
    """
    return internal_dpg.get_item_configuration(item)["height"]
Ejemplo n.º 14
0
 def __imgChange(self, sender, data):
     data = core.get_item_configuration(sender)
     idx = core.get_value(sender)
     puzzle = self.__puzzles[data['items'][idx]]
     if puzzle != self.__puzzle:
         self.__puzzle = puzzle
         self.__clearBoard(self, self.__rows, True)
Ejemplo n.º 15
0
def get_item_tip(item: str) -> Union[str, None]:
    """Gets the item's tip.

    Returns:
        tip as a string or None
    """
    return internal_dpg.get_item_configuration(item)["tip"]
Ejemplo n.º 16
0
def is_item_tracked(item: int) -> Union[bool, None]:
    """Checks if item is tracked.

    Returns:
        tracked as a bool or None
    """
    return internal_dpg.get_item_configuration(item)["tracked"]
Ejemplo n.º 17
0
def get_item_track_offset(item: int) -> Union[float, None]:
    """Gets the item's track offset.

    Returns:
        track offset as a int or None
    """
    return internal_dpg.get_item_configuration(item)["track_offset"]
Ejemplo n.º 18
0
def get_item_source(item: str) -> Union[str, None]:
    """Gets the item's source.

    Returns:
        source as a string or None
    """
    return internal_dpg.get_item_configuration(item)["source"]
Ejemplo n.º 19
0
def debug_get_window_pos(sender, data):
    """
    Debug setup for getting location configs of windows
    """
    log_info(sender, logger=data)
    window_name_to_search = get_value("Window Name##input")
    show_invisible = get_value("Print invisible")
    log_info(window_name_to_search, logger=data)
    log_info(show_invisible, logger=data)
    window_list = list()

    if window_name_to_search:
        log_debug(window_name_to_search, logger=data)
        for window_name in get_windows():
            if window_name_to_search.lower() in window_name.lower():
                window_list.append(window_name)
    else:
        window_list = get_windows()

    for window_name in window_list:
        config = get_item_configuration(window_name)
        if show_invisible is False:
            if config.get("show") is False:
                continue

        x_pos = config.get("x_pos", 0)
        y_pos = config.get("y_pos", 0)
        name = config.get("name")

        if len(name) > 6:
            name = name[:5]
        log_debug(f"{name} : {x_pos}, {y_pos}", logger=data)
Ejemplo n.º 20
0
def get_item_user_data(item: str) -> Union[Any, None]:
    """Gets the item's callback data.

    Returns:
        callback data as a python object or None
    """
    return internal_dpg.get_item_configuration(item)["user_data"]
Ejemplo n.º 21
0
def is_item_enabled(item: str) -> Union[bool, None]:
    """Checks if item is enabled.

    Returns:
        status as a bool
    """
    return internal_dpg.get_item_configuration(item)["enabled"]
Ejemplo n.º 22
0
def get_item_callback(item: str) -> Union[str, None]:
    """Gets the item's callback.

    Returns:
        callback as a string or None
    """
    return internal_dpg.get_item_configuration(item)["callback"]
Ejemplo n.º 23
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})
Ejemplo n.º 24
0
    def __configSave(self):
        blob = {}
        for ctrl in core.get_all_items():
            if ctrl.endswith('##standard') or ctrl in ['filedialog']:
                continue
            blob[ctrl] = core.get_item_configuration(ctrl)

        with open(self.__configFile, 'w') as fp:
            json.dump(blob, fp, sort_keys=True, indent=4)
Ejemplo n.º 25
0
def get_drawing_size(drawing: str) -> Union[List[int], None]:
    """Gets the drawing's scale.

    Args:
        drawing: Drawing that will be set.

    Returns:
        list as [width, height] or None
    """
    config = internal_dpg.get_item_configuration(drawing)
    return [config["width"], config["height"]]
Ejemplo n.º 26
0
def get_drawing_origin(drawing: str) -> Union[List[float], None]:
    """Gets the drawing's origin, (bottom left corner).

    Args:
        drawing: Drawing that will be set.

    Returns:
        list as [x,y] or None
    """
    config = internal_dpg.get_item_configuration(drawing)
    return [config["originx"], config["originy"]]
Ejemplo n.º 27
0
def get_drawing_scale(drawing: str) -> Union[List[float], None]:
    """Gets the drawing's scale.

    Args:
        drawing: Drawing that will be set.

    Returns:
        list as [x,y] or None
    """
    config = internal_dpg.get_item_configuration(drawing)
    return [config["scalex"], config["scaley"]]
Ejemplo n.º 28
0
 def move_task_down(self, sender, data):
     dpg.move_item_down(data["item"])
     task_tracker = self.page.category_tracker.get_category(self.category_id).tasks
     task = task_tracker.get_task(self.id)
     task_index = task_tracker.tasks.index(task)
     if task_index < len(task_tracker.tasks) - 1:
         task_tracker.tasks.insert(task_index + 1, task_tracker.tasks.pop(task_index))
         if not self.page.changes:
             item = dpg.get_item_configuration(self.page.parent)
             dpg.configure_item(self.page.parent, label="!" + item["label"])
             self.page.changes = True
Ejemplo n.º 29
0
def get_window_pos(window: str) -> Union[List[int], None]:
    """Gets the top left corner of the window to the specified position.

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

    Returns:
        list as [x,y] or None
    """
    config = internal_dpg.get_item_configuration(window)
    return [config["x_pos"], config["y_pos"]]
Ejemplo n.º 30
0
    def __clearBoard(self, sender, data, reset=False):
        """."""
        label = None
        if isinstance(sender, str):
            label = core.get_item_configuration(sender)['label']

        dim = data or int(label.split(" ")[0])

        if self.__rows != dim or reset:
            makeImage(self.__puzzle, dim, dim)
            self.__cap = dim * dim - 1
            self.__board = np.arange(0, dim * dim)

        np.random.shuffle(self.__board)
        self.__rows = dim
        self._resize()