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
|
# search triggered by user
|
||||||
@ensure_editor_saved
|
@ensure_editor_saved
|
||||||
def onSearchActivated(self) -> None:
|
def onSearchActivated(self) -> None:
|
||||||
text = self.form.searchEdit.lineEdit().text()
|
text = self.current_search()
|
||||||
try:
|
try:
|
||||||
normed = self.col.build_search_string(text)
|
normed = self.col.build_search_string(text)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
@ -580,7 +580,7 @@ where id in %s"""
|
|||||||
ChangeModel(self, nids)
|
ChangeModel(self, nids)
|
||||||
|
|
||||||
def createFilteredDeck(self) -> None:
|
def createFilteredDeck(self) -> None:
|
||||||
search = self.form.searchEdit.lineEdit().text()
|
search = self.current_search()
|
||||||
if self.mw.col.schedVer() != 1 and KeyboardModifiersPressed().alt:
|
if self.mw.col.schedVer() != 1 and KeyboardModifiersPressed().alt:
|
||||||
aqt.dialogs.open("FilteredDeckConfigDialog", self.mw, search_2=search)
|
aqt.dialogs.open("FilteredDeckConfigDialog", self.mw, search_2=search)
|
||||||
else:
|
else:
|
||||||
|
@ -933,9 +933,7 @@ class SidebarTreeView(QTreeView):
|
|||||||
|
|
||||||
def _get_current_search(self) -> Optional[str]:
|
def _get_current_search(self) -> Optional[str]:
|
||||||
try:
|
try:
|
||||||
return self.col.build_search_string(
|
return self.col.build_search_string(self.browser.current_search())
|
||||||
self.browser.form.searchEdit.lineEdit().text()
|
|
||||||
)
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
showWarning(str(e))
|
showWarning(str(e))
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user