Exemplo n.º 1
0
    def _flags_tree(self, root: SidebarItem) -> None:
        icon = ":/icons/flag.svg"
        icon_outline = ":/icons/flag-outline.svg"

        root = self._section_root(
            root=root,
            name=tr.browsing_sidebar_flags(),
            icon=icon_outline,
            collapse_key=Config.Bool.COLLAPSE_FLAGS,
            type=SidebarItemType.FLAG_ROOT,
        )
        root.search_node = SearchNode(flag=SearchNode.FLAG_ANY)

        for flag in self.mw.flags.all():
            root.add_child(
                SidebarItem(
                    name=flag.label,
                    icon=flag.icon,
                    search_node=flag.search_node,
                    item_type=SidebarItemType.FLAG,
                    id=flag.index,
                ))

        root.add_simple(
            tr.browsing_no_flag(),
            icon=icon_outline,
            type=SidebarItemType.FLAG,
            search_node=SearchNode(flag=SearchNode.FLAG_NONE),
        )
Exemplo n.º 2
0
    def _flags_tree(self, root: SidebarItem) -> None:
        icon = ColoredIcon(path=":/icons/flag.svg", color=colors.DISABLED)
        root = self._section_root(
            root=root,
            name=tr.browsing_sidebar_flags(),
            icon=icon,
            collapse_key=Config.Bool.COLLAPSE_FLAGS,
            type=SidebarItemType.FLAG_ROOT,
        )
        root.search_node = SearchNode(flag=SearchNode.FLAG_ANY)

        for flag in load_flags(self.col):
            root.add_child(
                SidebarItem(
                    name=flag.label,
                    icon=flag.icon,
                    search_node=flag.search_node,
                    item_type=SidebarItemType.FLAG,
                    id=flag.index,
                ))

        root.add_simple(
            tr.browsing_no_flag(),
            icon=icon,
            type=SidebarItemType.FLAG,
            search_node=SearchNode(flag=SearchNode.FLAG_NONE),
        )
Exemplo n.º 3
0
    def _flags_tree(self, root: SidebarItem) -> None:
        icon = ColoredIcon(path=":/icons/flag.svg", color=colors.DISABLED)
        root = self._section_root(
            root=root,
            name=tr.browsing_sidebar_flags(),
            icon=icon,
            collapse_key=Config.Bool.COLLAPSE_FLAGS,
            type=SidebarItemType.FLAG_ROOT,
        )
        root.search_node = SearchNode(flag=SearchNode.FLAG_ANY)

        type = SidebarItemType.FLAG
        root.add_simple(
            tr.actions_red_flag(),
            icon=icon.with_color(colors.FLAG1_FG),
            type=type,
            search_node=SearchNode(flag=SearchNode.FLAG_RED),
        )
        root.add_simple(
            tr.actions_orange_flag(),
            icon=icon.with_color(colors.FLAG2_FG),
            type=type,
            search_node=SearchNode(flag=SearchNode.FLAG_ORANGE),
        )
        root.add_simple(
            tr.actions_green_flag(),
            icon=icon.with_color(colors.FLAG3_FG),
            type=type,
            search_node=SearchNode(flag=SearchNode.FLAG_GREEN),
        )
        root.add_simple(
            tr.actions_blue_flag(),
            icon=icon.with_color(colors.FLAG4_FG),
            type=type,
            search_node=SearchNode(flag=SearchNode.FLAG_BLUE),
        )
        root.add_simple(
            tr.browsing_no_flag(),
            icon=icon.with_color(colors.DISABLED),
            type=type,
            search_node=SearchNode(flag=SearchNode.FLAG_NONE),
        )