Add switch for browser states
This commit is contained in:
parent
a3e3e56f2b
commit
ad7ac06398
@ -12,6 +12,8 @@ browsing-browser-appearance = Browser Appearance
|
|||||||
browsing-browser-options = Browser Options
|
browsing-browser-options = Browser Options
|
||||||
browsing-buried = Buried
|
browsing-buried = Buried
|
||||||
browsing-card = Card
|
browsing-card = Card
|
||||||
|
# Exactly one character representing 'Cards'; should differ from browsing-note-initial.
|
||||||
|
browsing-card-initial = C
|
||||||
browsing-card-list = Card List
|
browsing-card-list = Card List
|
||||||
browsing-card-state = Card State
|
browsing-card-state = Card State
|
||||||
browsing-cards-cant-be-manually-moved-into = Cards can't be manually moved into a filtered deck.
|
browsing-cards-cant-be-manually-moved-into = Cards can't be manually moved into a filtered deck.
|
||||||
@ -63,6 +65,8 @@ browsing-new = (new)
|
|||||||
browsing-new-note-type = New note type:
|
browsing-new-note-type = New note type:
|
||||||
browsing-no-flag = No Flag
|
browsing-no-flag = No Flag
|
||||||
browsing-note = Note
|
browsing-note = Note
|
||||||
|
# Exactly one character representing 'Notes'; should differ from browsing-card-initial.
|
||||||
|
browsing-note-initial = N
|
||||||
browsing-notes-tagged = Notes tagged.
|
browsing-notes-tagged = Notes tagged.
|
||||||
browsing-nothing = Nothing
|
browsing-nothing = Nothing
|
||||||
browsing-only-new-cards-can-be-repositioned = Only new cards can be repositioned.
|
browsing-only-new-cards-can-be-repositioned = Only new cards can be repositioned.
|
||||||
|
@ -37,6 +37,7 @@ from aqt.scheduling_ops import (
|
|||||||
unsuspend_cards,
|
unsuspend_cards,
|
||||||
)
|
)
|
||||||
from aqt.sidebar import SidebarTreeView
|
from aqt.sidebar import SidebarTreeView
|
||||||
|
from aqt.switch import Switch
|
||||||
from aqt.table import Table
|
from aqt.table import Table
|
||||||
from aqt.tag_ops import add_tags, clear_unused_tags, remove_tags_for_notes
|
from aqt.tag_ops import add_tags, clear_unused_tags, remove_tags_for_notes
|
||||||
from aqt.utils import (
|
from aqt.utils import (
|
||||||
@ -374,10 +375,11 @@ class Browser(QMainWindow):
|
|||||||
|
|
||||||
def setup_table(self) -> None:
|
def setup_table(self) -> None:
|
||||||
self.table = Table(self)
|
self.table = Table(self)
|
||||||
self.form.radio_cards.setChecked(self.table.is_card_state())
|
|
||||||
self.form.radio_notes.setChecked(not self.table.is_card_state())
|
|
||||||
self.table.set_view(self.form.tableView)
|
self.table.set_view(self.form.tableView)
|
||||||
qconnect(self.form.radio_cards.toggled, self.on_table_state_changed)
|
switch = Switch(11, tr.browsing_card_initial(), tr.browsing_note_initial())
|
||||||
|
switch.setChecked(self.table.is_card_state())
|
||||||
|
qconnect(switch.toggled, self.on_table_state_changed)
|
||||||
|
self.form.gridLayout.addWidget(switch, 0, 0)
|
||||||
|
|
||||||
def setupEditor(self) -> None:
|
def setupEditor(self) -> None:
|
||||||
def add_preview_button(leftbuttons: List[str], editor: Editor) -> None:
|
def add_preview_button(leftbuttons: List[str], editor: Editor) -> None:
|
||||||
@ -430,10 +432,10 @@ class Browser(QMainWindow):
|
|||||||
self._update_flags_menu()
|
self._update_flags_menu()
|
||||||
gui_hooks.browser_did_change_row(self)
|
gui_hooks.browser_did_change_row(self)
|
||||||
|
|
||||||
@ensure_editor_saved_on_trigger
|
@ensure_editor_saved
|
||||||
def on_table_state_changed(self) -> None:
|
def on_table_state_changed(self, checked: bool) -> None:
|
||||||
self.mw.progress.start()
|
self.mw.progress.start()
|
||||||
self.table.toggle_state(self.form.radio_cards.isChecked(), self._lastSearchTxt)
|
self.table.toggle_state(checked, self._lastSearchTxt)
|
||||||
self.mw.progress.finish()
|
self.mw.progress.finish()
|
||||||
|
|
||||||
# Sidebar
|
# Sidebar
|
||||||
|
@ -91,7 +91,7 @@
|
|||||||
<property name="verticalSpacing">
|
<property name="verticalSpacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="1">
|
||||||
<widget class="QComboBox" name="searchEdit">
|
<widget class="QComboBox" name="searchEdit">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
@ -109,30 +109,6 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="view_state" stretch="0,1">
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>5</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="radio_cards">
|
|
||||||
<property name="text">
|
|
||||||
<string>qt_accel_cards</string>
|
|
||||||
</property>
|
|
||||||
<property name="checked">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QRadioButton" name="radio_notes">
|
|
||||||
<property name="text">
|
|
||||||
<string>qt_accel_notes</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="tableView">
|
<widget class="QTableView" name="tableView">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
Loading…
Reference in New Issue
Block a user