Add clickable hint to dyndeckconf
This commit is contained in:
parent
5a37b8e2af
commit
ae88f7e593
@ -31,6 +31,7 @@ decks-reschedule-cards-based-on-my-answers = Reschedule cards based on my answer
|
||||
decks-study = Study
|
||||
decks-study-deck = Study Deck
|
||||
decks-the-provided-search-did-not-match = The provided search did not match any cards. Would you like to revise it?
|
||||
decks-unmovable-cards = Some cards may be excluded despite matching the search.
|
||||
decks-it-has-card =
|
||||
{ $count ->
|
||||
[one] It has { $count } card.
|
||||
|
@ -70,6 +70,7 @@ class DeckConf(QDialog):
|
||||
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)
|
||||
qconnect(self.form.hint_button.clicked, self.on_hint_button)
|
||||
color = theme_manager.color(colors.LINK)
|
||||
self.setStyleSheet(
|
||||
f"""QPushButton[flat=true] {{ text-align: left; color: {color}; padding: 0; border: 0 }}
|
||||
@ -161,6 +162,54 @@ class DeckConf(QDialog):
|
||||
else:
|
||||
aqt.dialogs.open("Browser", self.mw, search=(search,))
|
||||
|
||||
def on_hint_button(self) -> None:
|
||||
"""Open the browser to show cards that match the typed-in filters but cannot be included
|
||||
due to internal limitations.
|
||||
"""
|
||||
manual_filters = [self.form.search.text()]
|
||||
if self.form.secondFilter.isChecked():
|
||||
manual_filters.append(self.form.search_2.text())
|
||||
|
||||
implicit_filters = [
|
||||
SearchNode(card_state=SearchNode.CARD_STATE_SUSPENDED),
|
||||
SearchNode(card_state=SearchNode.CARD_STATE_BURIED),
|
||||
]
|
||||
|
||||
if self.col.schedVer() == 1:
|
||||
# v1 scheduler cannot include learning cards
|
||||
if self.did is None:
|
||||
# rebuild will reset learning cards from this deck so they can be included
|
||||
implicit_filters.append(
|
||||
self.col.group_searches(
|
||||
SearchNode(card_state=SearchNode.CARD_STATE_LEARN),
|
||||
SearchNode(negated=SearchNode(deck=self.deck["name"])),
|
||||
)
|
||||
)
|
||||
else:
|
||||
implicit_filters.append(
|
||||
SearchNode(card_state=SearchNode.CARD_STATE_LEARN)
|
||||
)
|
||||
|
||||
if self.did is None:
|
||||
# rebuild; old filtered deck will be emptied, so cards can be included
|
||||
implicit_filters.append(
|
||||
self.col.group_searches(
|
||||
SearchNode(deck="filtered"),
|
||||
SearchNode(negated=SearchNode(deck=self.deck["name"])),
|
||||
)
|
||||
)
|
||||
else:
|
||||
implicit_filters.append(SearchNode(deck="filtered"))
|
||||
|
||||
manual_filter = self.col.group_searches(*manual_filters, joiner="OR")
|
||||
implicit_filter = self.col.group_searches(*implicit_filters, joiner="OR")
|
||||
try:
|
||||
search = self.col.build_search_string(manual_filter, implicit_filter)
|
||||
except InvalidInput as err:
|
||||
show_invalid_search_error(err)
|
||||
else:
|
||||
aqt.dialogs.open("Browser", self.mw, search=(search,))
|
||||
|
||||
def _onReschedToggled(self, _state: int) -> None:
|
||||
self.form.previewDelayWidget.setVisible(
|
||||
not self.form.resched.isChecked() and self.col.schedVer() > 1
|
||||
|
@ -250,6 +250,25 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="hint_button">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::NoFocus</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>SEARCH_VIEW_IN_BROWSER</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DECKS_UNMOVABLE_CARDS</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
Loading…
Reference in New Issue
Block a user