コード例 #1
0
ファイル: model.py プロジェクト: rye761/anki
 def search(self, context: SearchContext) -> None:
     self.begin_reset()
     try:
         if context.order is True:
             try:
                 context.order = self.columns[self._state.sort_column]
             except KeyError:
                 # invalid sort column in config
                 context.order = self.columns["noteCrt"]
             context.reverse = self._state.sort_backwards
         gui_hooks.browser_will_search(context)
         if context.ids is None:
             context.ids = self._state.find_items(context.search,
                                                  context.order,
                                                  context.reverse)
         gui_hooks.browser_did_search(context)
         self._items = context.ids
         self._rows = {}
     finally:
         self.end_reset()
コード例 #2
0
 def toggle_state(self, is_notes_mode: bool, last_search: str) -> None:
     if is_notes_mode == self.is_notes_mode():
         return
     self._save_header()
     self._save_selection()
     self._state = self._model.toggle_state(
         SearchContext(search=last_search, browser=self.browser))
     self.col.set_config_bool(Config.Bool.BROWSER_TABLE_SHOW_NOTES_MODE,
                              self.is_notes_mode())
     self._restore_header()
     self._restore_selection(self._toggled_selection)
コード例 #3
0
ファイル: table.py プロジェクト: mark-stone/anki
 def search(self, txt: str) -> None:
     self._save_selection()
     self._model.search(SearchContext(search=txt, browser=self.browser))
     self._restore_selection(self._intersected_selection)