Exemplo n.º 1
0
 def _maybe_add_type_specific_actions(self, menu: QMenu,
                                      item: SidebarItem) -> None:
     if item.item_type in (SidebarItemType.NOTETYPE,
                           SidebarItemType.NOTETYPE_ROOT):
         menu.addAction(tr.browsing_manage_note_types(),
                        lambda: self.manage_notetype(item))
     elif item.item_type == SidebarItemType.NOTETYPE_TEMPLATE:
         menu.addAction(tr.notetypes_cards(),
                        lambda: self.manage_template(item))
     elif item.item_type == SidebarItemType.NOTETYPE_FIELD:
         menu.addAction(tr.notetypes_fields(),
                        lambda: self.manage_fields(item))
     elif item.item_type == SidebarItemType.SAVED_SEARCH_ROOT:
         menu.addAction(tr.browsing_sidebar_save_current_search(),
                        self.save_current_search)
     elif item.item_type == SidebarItemType.SAVED_SEARCH:
         menu.addAction(
             tr.browsing_update_saved_search(),
             lambda: self.update_saved_search(item),
         )
     elif item.item_type == SidebarItemType.TAG:
         if all(s.item_type == item.item_type
                for s in self._selected_items()):
             menu.addAction(tr.browsing_add_to_selected_notes(),
                            self.add_tags_to_selected_notes)
             menu.addAction(
                 tr.browsing_remove_from_selected_notes(),
                 self.remove_tags_from_selected_notes,
             )
Exemplo n.º 2
0
 def _maybe_add_type_specific_actions(self, menu: QMenu, item: SidebarItem) -> None:
     if item.item_type in (SidebarItemType.NOTETYPE, SidebarItemType.NOTETYPE_ROOT):
         menu.addAction(
             tr.browsing_manage_note_types(), lambda: self.manage_notetype(item)
         )
     elif item.item_type == SidebarItemType.NOTETYPE_TEMPLATE:
         menu.addAction(tr.notetypes_cards(), lambda: self.manage_template(item))
     elif item.item_type == SidebarItemType.SAVED_SEARCH_ROOT:
         menu.addAction(
             tr.browsing_sidebar_save_current_search(), self.save_current_search
         )
     elif item.item_type == SidebarItemType.SAVED_SEARCH:
         menu.addAction(
             tr.browsing_update_saved_search(),
             lambda: self.update_saved_search(item),
         )