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 = Clear Unused
browsing-clear-unused-tags = Clear Unused Tags browsing-clear-unused-tags = Clear Unused Tags
browsing-created = Created 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-ctrlandshiftande = Ctrl+Shift+E
browsing-current-deck = Current Deck browsing-current-deck = Current Deck
browsing-current-note-type = Current note type: browsing-current-note-type = Current note type:

View File

@ -450,6 +450,11 @@ class Browser(QMainWindow):
card: Optional[Card] = None, card: Optional[Card] = None,
search: Optional[Tuple[Union[str, SearchTerm]]] = None, search: Optional[Tuple[Union[str, SearchTerm]]] = None,
) -> 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) QMainWindow.__init__(self, None, Qt.Window)
self.mw = mw self.mw = mw
self.col = self.mw.col self.col = self.mw.col
@ -489,9 +494,7 @@ class Browser(QMainWindow):
if not isMac: if not isMac:
f.actionClose.setVisible(False) f.actionClose.setVisible(False)
qconnect(f.actionCreateFilteredDeck.triggered, self.createFilteredDeck) qconnect(f.actionCreateFilteredDeck.triggered, self.createFilteredDeck)
qconnect(f.actionCreateFilteredDeck2.triggered, self.createFilteredDeck2) f.actionCreateFilteredDeck.setShortcuts(["Ctrl+G", "Ctrl+Alt+G"])
if self.mw.col.schedVer() == 1:
f.menuEdit.removeAction(f.actionCreateFilteredDeck2)
# notes # notes
qconnect(f.actionAdd.triggered, self.mw.onAddCard) qconnect(f.actionAdd.triggered, self.mw.onAddCard)
qconnect(f.actionAdd_Tags.triggered, lambda: self.addTags()) qconnect(f.actionAdd_Tags.triggered, lambda: self.addTags())
@ -1201,11 +1204,13 @@ where id in %s"""
def createFilteredDeck(self) -> None: def createFilteredDeck(self) -> None:
search = self.form.searchEdit.lineEdit().text() search = self.form.searchEdit.lineEdit().text()
aqt.dialogs.open("DynDeckConfDialog", self.mw, search=search) if (
self.mw.col.schedVer() != 1
def createFilteredDeck2(self) -> None: and self.mw.app.keyboardModifiers() & Qt.AltModifier
search = self.form.searchEdit.lineEdit().text() ):
aqt.dialogs.open("DynDeckConfDialog", self.mw, search_2=search) aqt.dialogs.open("DynDeckConfDialog", self.mw, search_2=search)
else:
aqt.dialogs.open("DynDeckConfDialog", self.mw, search=search)
# Preview # Preview
###################################################################### ######################################################################

View File

@ -84,10 +84,6 @@ class DeckConf(QDialog):
without_unicode_isolation(tr(TR.ACTIONS_OPTIONS_FOR, val=self.deck["name"])) 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.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: if self.mw.col.schedVer() == 1:
self.form.secondFilter.setVisible(False) self.form.secondFilter.setVisible(False)
restoreGeom(self, "dyndeckconf") restoreGeom(self, "dyndeckconf")

View File

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

View File

@ -16,6 +16,8 @@ disallow_untyped_defs=true
disallow_untyped_defs=true disallow_untyped_defs=true
[mypy-aqt.utils] [mypy-aqt.utils]
disallow_untyped_defs=true disallow_untyped_defs=true
[mypy-aqt.dyndeckconf]
disallow_untyped_defs=true
[mypy-aqt.mpv] [mypy-aqt.mpv]