Add cross links for second dyndeck filter
This commit is contained in:
parent
0d37254238
commit
8065e73ef8
@ -25,6 +25,7 @@ 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:
|
||||
|
@ -482,6 +482,9 @@ 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)
|
||||
# notes
|
||||
qconnect(f.actionAdd.triggered, self.mw.onAddCard)
|
||||
qconnect(f.actionAdd_Tags.triggered, lambda: self.addTags())
|
||||
@ -1194,6 +1197,10 @@ where id in %s"""
|
||||
search = self.form.searchEdit.lineEdit().text()
|
||||
aqt.dialogs.open("DynDeckConfDialog", self.mw, search=search)
|
||||
|
||||
def createFilteredDeck2(self):
|
||||
search = self.form.searchEdit.lineEdit().text()
|
||||
aqt.dialogs.open("DynDeckConfDialog", self.mw, search_2=search)
|
||||
|
||||
# Preview
|
||||
######################################################################
|
||||
|
||||
|
@ -29,7 +29,11 @@ class DeckConf(QDialog):
|
||||
"""Dialogue to modify and build a filtered deck."""
|
||||
|
||||
def __init__(
|
||||
self, mw: AnkiQt, search: Optional[str] = None, deck: Optional[Deck] = None
|
||||
self,
|
||||
mw: AnkiQt,
|
||||
search: Optional[str] = None,
|
||||
search_2: Optional[str] = None,
|
||||
deck: Optional[Deck] = None,
|
||||
):
|
||||
"""If 'deck' is an existing filtered deck, load and modify its settings.
|
||||
Otherwise, build a new one and derive settings from the current deck.
|
||||
@ -60,10 +64,10 @@ class DeckConf(QDialog):
|
||||
self.new_dyn_deck()
|
||||
self.loadConf()
|
||||
self.set_default_searches(self.old_deck["name"])
|
||||
if search is not None:
|
||||
self.form.search.setText(search)
|
||||
|
||||
self.set_custom_searches(search, search_2)
|
||||
qconnect(self.form.search_button.clicked, self.on_search_button)
|
||||
qconnect(self.form.search_button_2.clicked, self.on_search_button_2)
|
||||
color = theme_manager.str_color("link")
|
||||
self.setStyleSheet(
|
||||
f"""QPushButton[flat=true] {{ text-align: left; color: {color}; padding: 0; border: 0 }}
|
||||
@ -78,8 +82,6 @@ class DeckConf(QDialog):
|
||||
without_unicode_isolation(tr(TR.ACTIONS_OPTIONS_FOR, val=self.deck["name"]))
|
||||
)
|
||||
self.form.buttonBox.addButton(label, QDialogButtonBox.AcceptRole)
|
||||
self.form.search.setFocus()
|
||||
self.form.search.selectAll()
|
||||
if self.mw.col.schedVer() == 1:
|
||||
self.form.secondFilter.setVisible(False)
|
||||
restoreGeom(self, "dyndeckconf")
|
||||
@ -87,12 +89,13 @@ class DeckConf(QDialog):
|
||||
self.show()
|
||||
|
||||
def reopen(
|
||||
self, _mw: AnkiQt, search: Optional[str] = None, _deck: Optional[Deck] = None
|
||||
self,
|
||||
_mw: AnkiQt,
|
||||
search: Optional[str] = None,
|
||||
search_2: Optional[str] = None,
|
||||
_deck: Optional[Deck] = None,
|
||||
):
|
||||
if search is not None:
|
||||
self.form.search.setText(search)
|
||||
self.form.search.setFocus()
|
||||
self.form.search.selectAll()
|
||||
self.set_custom_searches(search, search_2)
|
||||
|
||||
def new_dyn_deck(self):
|
||||
suffix: int = 1
|
||||
@ -118,6 +121,20 @@ class DeckConf(QDialog):
|
||||
)
|
||||
)
|
||||
|
||||
def set_custom_searches(
|
||||
self, search: Optional[str], search_2: Optional[str]
|
||||
) -> None:
|
||||
if search is not None:
|
||||
self.form.search.setText(search)
|
||||
self.form.search.setFocus()
|
||||
self.form.search.selectAll()
|
||||
if search_2 is not None:
|
||||
self.form.secondFilter.setChecked(True)
|
||||
self.form.filter2group.setVisible(True)
|
||||
self.form.search_2.setText(search_2)
|
||||
self.form.search_2.setFocus()
|
||||
self.form.search_2.selectAll()
|
||||
|
||||
def initialSetup(self):
|
||||
import anki.consts as cs
|
||||
|
||||
@ -126,12 +143,18 @@ class DeckConf(QDialog):
|
||||
|
||||
qconnect(self.form.resched.stateChanged, self._onReschedToggled)
|
||||
|
||||
def on_search_button(self):
|
||||
def on_search_button(self) -> None:
|
||||
self._on_search_button(self.form.search)
|
||||
|
||||
def on_search_button_2(self) -> None:
|
||||
self._on_search_button(self.form.search_2)
|
||||
|
||||
def _on_search_button(self, line: QLineEdit) -> None:
|
||||
try:
|
||||
search = self.mw.col.build_search_string(self.form.search.text())
|
||||
search = self.mw.col.build_search_string(line.text())
|
||||
except InvalidInput as err:
|
||||
self.form.search.setFocus()
|
||||
self.form.search.selectAll()
|
||||
line.setFocus()
|
||||
line.selectAll()
|
||||
show_invalid_search_error(err)
|
||||
else:
|
||||
aqt.dialogs.open("Browser", self.mw, search=(search,))
|
||||
|
@ -232,6 +232,7 @@
|
||||
<addaction name="actionClose"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionCreateFilteredDeck"/>
|
||||
<addaction name="actionCreateFilteredDeck2"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuJump">
|
||||
<property name="title">
|
||||
@ -593,6 +594,14 @@
|
||||
<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"/>
|
||||
|
@ -20,22 +20,6 @@
|
||||
<string>ACTIONS_FILTER</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="search_button">
|
||||
<property name="toolTip">
|
||||
<string>SEARCH_VIEW_IN_BROWSER</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ACTIONS_SEARCH</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_5">
|
||||
<property name="text">
|
||||
@ -43,12 +27,8 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>DECKS_CARDS_SELECTED_BY</string>
|
||||
</property>
|
||||
</widget>
|
||||
<item row="1" column="2" colspan="4">
|
||||
<widget class="QLineEdit" name="search"/>
|
||||
</item>
|
||||
<item row="2" column="2">
|
||||
<widget class="QSpinBox" name="limit">
|
||||
@ -69,8 +49,28 @@
|
||||
<item row="2" column="4" colspan="2">
|
||||
<widget class="QComboBox" name="order"/>
|
||||
</item>
|
||||
<item row="1" column="2" colspan="4">
|
||||
<widget class="QLineEdit" name="search"/>
|
||||
<item row="2" column="3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>DECKS_CARDS_SELECTED_BY</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="search_button">
|
||||
<property name="toolTip">
|
||||
<string>SEARCH_VIEW_IN_BROWSER</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ACTIONS_SEARCH</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
@ -94,13 +94,6 @@
|
||||
<item row="0" column="1" colspan="4">
|
||||
<widget class="QLineEdit" name="search_2"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>ACTIONS_SEARCH</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QSpinBox" name="limit_2">
|
||||
<property name="maximumSize">
|
||||
@ -124,6 +117,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QPushButton" name="search_button_2">
|
||||
<property name="toolTip">
|
||||
<string>SEARCH_VIEW_IN_BROWSER</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>ACTIONS_SEARCH</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
Loading…
Reference in New Issue
Block a user