Beispiel #1
0
 def setupSearch(
     self,
     card: Optional[Card] = None,
     search: Optional[Tuple[Union[str, SearchNode]]] = None,
 ) -> None:
     qconnect(self.form.searchEdit.lineEdit().returnPressed,
              self.onSearchActivated)
     self.form.searchEdit.setCompleter(None)
     self.form.searchEdit.lineEdit().setPlaceholderText(
         tr.browsing_search_bar_hint())
     self.form.searchEdit.addItems(self.mw.pm.profile["searchHistory"])
     if search is not None:
         self.search_for_terms(*search)
     else:
         self._default_search(card)
     self.form.searchEdit.setFocus()
     if card:
         self.table.select_single_card(card.id)
Beispiel #2
0
 def setupSearch(
     self,
     card: Optional[Card] = None,
     search: Optional[Tuple[Union[str, SearchNode]]] = None,
 ) -> None:
     qconnect(self.form.searchEdit.lineEdit().returnPressed,
              self.onSearchActivated)
     self.form.searchEdit.setCompleter(None)
     self.form.searchEdit.lineEdit().setPlaceholderText(
         tr.browsing_search_bar_hint())
     self.form.searchEdit.addItems(self.mw.pm.profile["searchHistory"])
     if search is not None:
         self.search_for_terms(*search)
     elif card:
         self.show_single_card(card)
     else:
         self.search_for(
             self.col.build_search_string(SearchNode(deck="current")), "")
     self.form.searchEdit.setFocus()