NF: factorize browser.current_search
I was looking at search code and find out that's already slightly more clear/short even if NF
This commit is contained in:
parent
7b2b4528b3
commit
be44d4eeed
@ -281,7 +281,7 @@ class Browser(QMainWindow):
|
||||
# search triggered by user
|
||||
@ensure_editor_saved
|
||||
def onSearchActivated(self) -> None:
|
||||
text = self.form.searchEdit.lineEdit().text()
|
||||
text = self.current_search()
|
||||
try:
|
||||
normed = self.col.build_search_string(text)
|
||||
except Exception as err:
|
||||
@ -580,7 +580,7 @@ where id in %s"""
|
||||
ChangeModel(self, nids)
|
||||
|
||||
def createFilteredDeck(self) -> None:
|
||||
search = self.form.searchEdit.lineEdit().text()
|
||||
search = self.current_search()
|
||||
if self.mw.col.schedVer() != 1 and KeyboardModifiersPressed().alt:
|
||||
aqt.dialogs.open("FilteredDeckConfigDialog", self.mw, search_2=search)
|
||||
else:
|
||||
|
@ -933,9 +933,7 @@ class SidebarTreeView(QTreeView):
|
||||
|
||||
def _get_current_search(self) -> Optional[str]:
|
||||
try:
|
||||
return self.col.build_search_string(
|
||||
self.browser.form.searchEdit.lineEdit().text()
|
||||
)
|
||||
return self.col.build_search_string(self.browser.current_search())
|
||||
except Exception as e:
|
||||
showWarning(str(e))
|
||||
return None
|
||||
|
Loading…
Reference in New Issue
Block a user