Merge pull request #970 from RumovZ/cleanup-967

Cleanup 967
This commit is contained in:
Damien Elmes 2021-02-02 22:03:43 +10:00 committed by GitHub
commit 33319e1691
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 24 deletions

View File

@ -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:

View File

@ -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
@ -489,9 +494,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())
@ -1201,11 +1204,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
######################################################################

View File

@ -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")

View File

@ -232,7 +232,6 @@
<addaction name="actionClose"/>
<addaction name="separator"/>
<addaction name="actionCreateFilteredDeck"/>
<addaction name="actionCreateFilteredDeck2"/>
</widget>
<widget class="QMenu" name="menuJump">
<property name="title">
@ -588,20 +587,12 @@
</action>
<action name="actionCreateFilteredDeck">
<property name="text">
<string>BROWSING_CREATE_FILTERED_DECK</string>
<string>QT_MISC_CREATE_FILTERED_DECK</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+G</string>
</property>
</action>
<action name="actionCreateFilteredDeck2">
<property name="text">
<string>BROWSING_CREATE_FILTERED_DECK_2</string>
</property>
<property name="shortcut">
<string notr="true">Ctrl+Shift+G</string>
</property>
</action>
</widget>
<resources>
<include location="icons.qrc"/>

View File

@ -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]