diff --git a/ftl/core/browsing.ftl b/ftl/core/browsing.ftl index e2f05b275..e07435e9c 100644 --- a/ftl/core/browsing.ftl +++ b/ftl/core/browsing.ftl @@ -12,6 +12,8 @@ browsing-browser-appearance = Browser Appearance browsing-browser-options = Browser Options browsing-buried = Buried 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-state = Card State 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-no-flag = No Flag browsing-note = Note +# Exactly one character representing 'Notes'; should differ from browsing-card-initial. +browsing-note-initial = N browsing-notes-tagged = Notes tagged. browsing-nothing = Nothing browsing-only-new-cards-can-be-repositioned = Only new cards can be repositioned. diff --git a/qt/aqt/browser.py b/qt/aqt/browser.py index e1da7001c..56e313c2a 100644 --- a/qt/aqt/browser.py +++ b/qt/aqt/browser.py @@ -37,6 +37,7 @@ from aqt.scheduling_ops import ( unsuspend_cards, ) from aqt.sidebar import SidebarTreeView +from aqt.switch import Switch from aqt.table import Table from aqt.tag_ops import add_tags, clear_unused_tags, remove_tags_for_notes from aqt.utils import ( @@ -374,10 +375,11 @@ class Browser(QMainWindow): def setup_table(self) -> None: 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) - 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 add_preview_button(leftbuttons: List[str], editor: Editor) -> None: @@ -430,10 +432,10 @@ class Browser(QMainWindow): self._update_flags_menu() gui_hooks.browser_did_change_row(self) - @ensure_editor_saved_on_trigger - def on_table_state_changed(self) -> None: + @ensure_editor_saved + def on_table_state_changed(self, checked: bool) -> None: 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() # Sidebar diff --git a/qt/aqt/forms/browser.ui b/qt/aqt/forms/browser.ui index 5ed6506fd..76217999f 100644 --- a/qt/aqt/forms/browser.ui +++ b/qt/aqt/forms/browser.ui @@ -91,7 +91,7 @@ 0 - + @@ -109,30 +109,6 @@ - - - - 5 - - - - - qt_accel_cards - - - true - - - - - - - qt_accel_notes - - - - -