mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 08:46:37 -04:00
add toggle for browser sidebar (#3953)
* add toggle for browser sidebar * Update CONTRIBUTORS
This commit is contained in:
parent
90f2e06b17
commit
62bad44eed
4 changed files with 17 additions and 7 deletions
|
@ -223,6 +223,7 @@ derivativeoflog7 <https://github.com/derivativeoflog7>
|
|||
rreemmii-dev <https://github.com/rreemmii-dev>
|
||||
babofitos <https://github.com/babofitos>
|
||||
Jonathan Schoreels <https://github.com/JSchoreels>
|
||||
JL710
|
||||
|
||||
********************
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ qt-accel-layout-horizontal = &Horizontal
|
|||
qt-accel-zoom-in = Zoom &In
|
||||
qt-accel-zoom-out = Zoom &Out
|
||||
qt-accel-reset-zoom = &Reset Zoom
|
||||
qt-accel-toggle-sidebar = Toggle Sidebar
|
||||
qt-accel-zoom-editor-in = Zoom Editor &In
|
||||
qt-accel-zoom-editor-out = Zoom Editor &Out
|
||||
qt-accel-create-backup = Create &Backup
|
||||
|
|
|
@ -366,6 +366,7 @@ class Browser(QMainWindow):
|
|||
qconnect(f.actionFind.triggered, self.onFind)
|
||||
qconnect(f.actionNote.triggered, self.onNote)
|
||||
qconnect(f.actionSidebar.triggered, self.focusSidebar)
|
||||
qconnect(f.actionToggleSidebar.triggered, self.toggle_sidebar)
|
||||
qconnect(f.actionCardList.triggered, self.onCardList)
|
||||
|
||||
# help
|
||||
|
@ -695,7 +696,7 @@ class Browser(QMainWindow):
|
|||
|
||||
def setupSidebar(self) -> None:
|
||||
dw = self.sidebarDockWidget = QDockWidget(tr.browsing_sidebar(), self)
|
||||
dw.setFeatures(QDockWidget.DockWidgetFeature.NoDockWidgetFeatures)
|
||||
dw.setFeatures(QDockWidget.DockWidgetFeature.DockWidgetClosable)
|
||||
dw.setObjectName("Sidebar")
|
||||
dock_area = (
|
||||
Qt.DockWidgetArea.RightDockWidgetArea
|
||||
|
@ -729,8 +730,11 @@ class Browser(QMainWindow):
|
|||
# UI is more responsive
|
||||
self.mw.progress.timer(10, self.sidebar.refresh, False, parent=self.sidebar)
|
||||
|
||||
def showSidebar(self) -> None:
|
||||
self.sidebarDockWidget.setVisible(True)
|
||||
def showSidebar(self, show: bool = True) -> None:
|
||||
want_visible = not self.sidebarDockWidget.isVisible()
|
||||
self.sidebarDockWidget.setVisible(show)
|
||||
if want_visible and show:
|
||||
self.sidebar.refresh()
|
||||
|
||||
def focusSidebar(self) -> None:
|
||||
self.showSidebar()
|
||||
|
@ -741,10 +745,7 @@ class Browser(QMainWindow):
|
|||
self.sidebar.searchBar.setFocus()
|
||||
|
||||
def toggle_sidebar(self) -> None:
|
||||
want_visible = not self.sidebarDockWidget.isVisible()
|
||||
self.sidebarDockWidget.setVisible(want_visible)
|
||||
if want_visible:
|
||||
self.sidebar.refresh()
|
||||
self.showSidebar(not self.sidebarDockWidget.isVisible())
|
||||
|
||||
# legacy
|
||||
|
||||
|
|
|
@ -317,6 +317,8 @@
|
|||
<addaction name="separator"/>
|
||||
<addaction name="actionFullScreen"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionToggleSidebar"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionZoomIn"/>
|
||||
<addaction name="actionZoomOut"/>
|
||||
<addaction name="actionResetZoom"/>
|
||||
|
@ -702,6 +704,11 @@
|
|||
<string>qt_accel_full_screen</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionToggleSidebar">
|
||||
<property name="text">
|
||||
<string>qt_accel_toggle_sidebar</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionZoomIn">
|
||||
<property name="text">
|
||||
<string>qt_accel_zoom_editor_in</string>
|
||||
|
|
Loading…
Reference in a new issue