From 16462941abbca4ff1899cacebf815979f46c501e Mon Sep 17 00:00:00 2001 From: RumovZ Date: Tue, 2 Feb 2021 09:29:09 +0100 Subject: [PATCH 1/4] Remove actionCreateFilteredDeck2 and use modifier --- ftl/core/browsing.ftl | 2 -- qt/aqt/browser.py | 16 ++++++++-------- qt/aqt/forms/browser.ui | 11 +---------- 3 files changed, 9 insertions(+), 20 deletions(-) diff --git a/ftl/core/browsing.ftl b/ftl/core/browsing.ftl index 8ce372e8f..bf408f834 100644 --- a/ftl/core/browsing.ftl +++ b/ftl/core/browsing.ftl @@ -24,8 +24,6 @@ browsing-change-to = Change { $val } to: browsing-clear-unused = Clear Unused browsing-clear-unused-tags = Clear Unused Tags browsing-created = Created -browsing-create-filtered-deck = Create Filtered Deck... -browsing-create-filtered-deck_2 = Create Filtered Deck (2nd Filter)... browsing-ctrlandshiftande = Ctrl+Shift+E browsing-current-deck = Current Deck browsing-current-note-type = Current note type: diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index ca51dce3d..cd0026f63 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -489,9 +489,7 @@ class Browser(QMainWindow): if not isMac: f.actionClose.setVisible(False) qconnect(f.actionCreateFilteredDeck.triggered, self.createFilteredDeck) - qconnect(f.actionCreateFilteredDeck2.triggered, self.createFilteredDeck2) - if self.mw.col.schedVer() == 1: - f.menuEdit.removeAction(f.actionCreateFilteredDeck2) + f.actionCreateFilteredDeck.setShortcuts(["Ctrl+G", "Ctrl+Alt+G"]) # notes qconnect(f.actionAdd.triggered, self.mw.onAddCard) qconnect(f.actionAdd_Tags.triggered, lambda: self.addTags()) @@ -1199,11 +1197,13 @@ where id in %s""" def createFilteredDeck(self) -> None: search = self.form.searchEdit.lineEdit().text() - aqt.dialogs.open("DynDeckConfDialog", self.mw, search=search) - - def createFilteredDeck2(self) -> None: - search = self.form.searchEdit.lineEdit().text() - aqt.dialogs.open("DynDeckConfDialog", self.mw, search_2=search) + if ( + self.mw.col.schedVer() != 1 + and self.mw.app.keyboardModifiers() & Qt.AltModifier + ): + aqt.dialogs.open("DynDeckConfDialog", self.mw, search_2=search) + else: + aqt.dialogs.open("DynDeckConfDialog", self.mw, search=search) # Preview ###################################################################### diff --git a/qt/aqt/forms/browser.ui b/qt/aqt/forms/browser.ui index 72d24f97c..d94235fc6 100644 --- a/qt/aqt/forms/browser.ui +++ b/qt/aqt/forms/browser.ui @@ -232,7 +232,6 @@ - @@ -588,20 +587,12 @@ - BROWSING_CREATE_FILTERED_DECK + QT_MISC_CREATE_FILTERED_DECK Ctrl+G - - - BROWSING_CREATE_FILTERED_DECK_2 - - - Ctrl+Shift+G - - From c3ae1a3049343024c3bebebd6bd422c0ff81966a Mon Sep 17 00:00:00 2001 From: RumovZ Date: Tue, 2 Feb 2021 09:40:05 +0100 Subject: [PATCH 2/4] Disallow untyped defs for dyndeckconf --- qt/mypy.ini | 2 ++ 1 file changed, 2 insertions(+) diff --git a/qt/mypy.ini b/qt/mypy.ini index d04edadc8..05e2fb127 100644 --- a/qt/mypy.ini +++ b/qt/mypy.ini @@ -16,6 +16,8 @@ disallow_untyped_defs=true disallow_untyped_defs=true [mypy-aqt.utils] disallow_untyped_defs=true +[mypy-aqt.dyndeckconf] +disallow_untyped_defs=true [mypy-aqt.mpv] From 14775445dfd1cfdaa4d60cf5c6a111b1b1914f29 Mon Sep 17 00:00:00 2001 From: RumovZ Date: Tue, 2 Feb 2021 09:48:55 +0100 Subject: [PATCH 3/4] Add docstring to browser.__ini__ --- qt/aqt/browser.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index cd0026f63..de67796ba 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -450,6 +450,11 @@ class Browser(QMainWindow): card: Optional[Card] = None, search: Optional[Tuple[Union[str, SearchTerm]]] = None, ) -> None: + """ + card : try to search for its note and select it + search: set and perform search; caller must ensure validity + """ + QMainWindow.__init__(self, None, Qt.Window) self.mw = mw self.col = self.mw.col From 2499f2ae34835316c1c5cea252b55d202f299637 Mon Sep 17 00:00:00 2001 From: RumovZ Date: Tue, 2 Feb 2021 11:57:35 +0100 Subject: [PATCH 4/4] Remove standard button translations --- qt/aqt/dyndeckconf.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/qt/aqt/dyndeckconf.py b/qt/aqt/dyndeckconf.py index c32a6e3f2..fe1d794c6 100644 --- a/qt/aqt/dyndeckconf.py +++ b/qt/aqt/dyndeckconf.py @@ -84,10 +84,6 @@ class DeckConf(QDialog): without_unicode_isolation(tr(TR.ACTIONS_OPTIONS_FOR, val=self.deck["name"])) ) self.form.buttonBox.button(QDialogButtonBox.Ok).setText(label) - self.form.buttonBox.button(QDialogButtonBox.Cancel).setText( - tr(TR.ACTIONS_CANCEL) - ) - self.form.buttonBox.button(QDialogButtonBox.Help).setText(tr(TR.ACTIONS_HELP)) if self.mw.col.schedVer() == 1: self.form.secondFilter.setVisible(False) restoreGeom(self, "dyndeckconf")