Exemple #1
0
def custom_modelTree_since_2_1_17(self, root, _old):
    types = SidebarItem(_("Note Types"), icon_notetype)
    for m in sorted(self.col.models.all(), key=itemgetter("name")):
        item = SidebarItem(
            m["name"],
            icon_notetype,
            lambda m=m: self.setFilter("note", m["name"]),  # type: ignore
        )
        types.addChild(item)
    root.addChild(types)
Exemple #2
0
def custom_stdTree_since_2_1_17(self, root):
    if config['show_item_marked']:
        item = SidebarItem(_("Marked"), icon_tag, self._filterFunc("tag:marked"))
        root.addChild(item)
    if config['show_item_suspended']:
        item = SidebarItem(_("Suspended"), icon_tag, self._filterFunc("is:suspended"))
        root.addChild(item)
    if config['show_item_leech']:
        item = SidebarItem(_("Leech"), icon_tag, self._filterFunc("tag:leech"))
        root.addChild(item)
    if config['show_tree_today']:
        today = SidebarItem(_("Today"), icon_tag)
        item = SidebarItem(_("Added Today"), "", self._filterFunc("added:1"))
        today.addChild(item)
        item = SidebarItem(_("Studied Today"), "", self._filterFunc("rated:1"))
        today.addChild(item)
        item = SidebarItem(_("Again Today"), "", self._filterFunc("rated:1:1"))
        today.addChild(item)
        root.addChild(today)
    if config['show_tree_flags']:
        flags = SidebarItem(_("Flags"), icon_tag)
        item = SidebarItem(_("Red"), "", self._filterFunc("flag:1"))
        flags.addChild(item)
        item = SidebarItem(_("Orange"), "", self._filterFunc("flag:2"))
        flags.addChild(item)
        item = SidebarItem(_("Green"), "", self._filterFunc("flag:3"))
        flags.addChild(item)
        item = SidebarItem(_("Blue"), "", self._filterFunc("flag:4"))
        flags.addChild(item)
        item = SidebarItem(_("No"), "", self._filterFunc("flag:0"))
        flags.addChild(item)
        item = SidebarItem(_("Any"), "", self._filterFunc("-flag:0"))
        flags.addChild(item)
        root.addChild(flags)
Exemple #3
0
def custom_favTree_since_2_1_17(self, root, _old):
    favs = SidebarItem(_("My Filters"), icon_heart)
    for name, filt in sorted(self.col.conf.get('savedFilters', {}).items()):
        item = SidebarItem(name, icon_heart, lambda s=filt: self.setFilter(s))
        favs.addChild(item)
    root.addChild(favs)