mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -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>
|
rreemmii-dev <https://github.com/rreemmii-dev>
|
||||||
babofitos <https://github.com/babofitos>
|
babofitos <https://github.com/babofitos>
|
||||||
Jonathan Schoreels <https://github.com/JSchoreels>
|
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-in = Zoom &In
|
||||||
qt-accel-zoom-out = Zoom &Out
|
qt-accel-zoom-out = Zoom &Out
|
||||||
qt-accel-reset-zoom = &Reset Zoom
|
qt-accel-reset-zoom = &Reset Zoom
|
||||||
|
qt-accel-toggle-sidebar = Toggle Sidebar
|
||||||
qt-accel-zoom-editor-in = Zoom Editor &In
|
qt-accel-zoom-editor-in = Zoom Editor &In
|
||||||
qt-accel-zoom-editor-out = Zoom Editor &Out
|
qt-accel-zoom-editor-out = Zoom Editor &Out
|
||||||
qt-accel-create-backup = Create &Backup
|
qt-accel-create-backup = Create &Backup
|
||||||
|
|
|
@ -366,6 +366,7 @@ class Browser(QMainWindow):
|
||||||
qconnect(f.actionFind.triggered, self.onFind)
|
qconnect(f.actionFind.triggered, self.onFind)
|
||||||
qconnect(f.actionNote.triggered, self.onNote)
|
qconnect(f.actionNote.triggered, self.onNote)
|
||||||
qconnect(f.actionSidebar.triggered, self.focusSidebar)
|
qconnect(f.actionSidebar.triggered, self.focusSidebar)
|
||||||
|
qconnect(f.actionToggleSidebar.triggered, self.toggle_sidebar)
|
||||||
qconnect(f.actionCardList.triggered, self.onCardList)
|
qconnect(f.actionCardList.triggered, self.onCardList)
|
||||||
|
|
||||||
# help
|
# help
|
||||||
|
@ -695,7 +696,7 @@ class Browser(QMainWindow):
|
||||||
|
|
||||||
def setupSidebar(self) -> None:
|
def setupSidebar(self) -> None:
|
||||||
dw = self.sidebarDockWidget = QDockWidget(tr.browsing_sidebar(), self)
|
dw = self.sidebarDockWidget = QDockWidget(tr.browsing_sidebar(), self)
|
||||||
dw.setFeatures(QDockWidget.DockWidgetFeature.NoDockWidgetFeatures)
|
dw.setFeatures(QDockWidget.DockWidgetFeature.DockWidgetClosable)
|
||||||
dw.setObjectName("Sidebar")
|
dw.setObjectName("Sidebar")
|
||||||
dock_area = (
|
dock_area = (
|
||||||
Qt.DockWidgetArea.RightDockWidgetArea
|
Qt.DockWidgetArea.RightDockWidgetArea
|
||||||
|
@ -729,8 +730,11 @@ class Browser(QMainWindow):
|
||||||
# UI is more responsive
|
# UI is more responsive
|
||||||
self.mw.progress.timer(10, self.sidebar.refresh, False, parent=self.sidebar)
|
self.mw.progress.timer(10, self.sidebar.refresh, False, parent=self.sidebar)
|
||||||
|
|
||||||
def showSidebar(self) -> None:
|
def showSidebar(self, show: bool = True) -> None:
|
||||||
self.sidebarDockWidget.setVisible(True)
|
want_visible = not self.sidebarDockWidget.isVisible()
|
||||||
|
self.sidebarDockWidget.setVisible(show)
|
||||||
|
if want_visible and show:
|
||||||
|
self.sidebar.refresh()
|
||||||
|
|
||||||
def focusSidebar(self) -> None:
|
def focusSidebar(self) -> None:
|
||||||
self.showSidebar()
|
self.showSidebar()
|
||||||
|
@ -741,10 +745,7 @@ class Browser(QMainWindow):
|
||||||
self.sidebar.searchBar.setFocus()
|
self.sidebar.searchBar.setFocus()
|
||||||
|
|
||||||
def toggle_sidebar(self) -> None:
|
def toggle_sidebar(self) -> None:
|
||||||
want_visible = not self.sidebarDockWidget.isVisible()
|
self.showSidebar(not self.sidebarDockWidget.isVisible())
|
||||||
self.sidebarDockWidget.setVisible(want_visible)
|
|
||||||
if want_visible:
|
|
||||||
self.sidebar.refresh()
|
|
||||||
|
|
||||||
# legacy
|
# legacy
|
||||||
|
|
||||||
|
|
|
@ -317,6 +317,8 @@
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionFullScreen"/>
|
<addaction name="actionFullScreen"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionToggleSidebar"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
<addaction name="actionZoomIn"/>
|
<addaction name="actionZoomIn"/>
|
||||||
<addaction name="actionZoomOut"/>
|
<addaction name="actionZoomOut"/>
|
||||||
<addaction name="actionResetZoom"/>
|
<addaction name="actionResetZoom"/>
|
||||||
|
@ -702,6 +704,11 @@
|
||||||
<string>qt_accel_full_screen</string>
|
<string>qt_accel_full_screen</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionToggleSidebar">
|
||||||
|
<property name="text">
|
||||||
|
<string>qt_accel_toggle_sidebar</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="actionZoomIn">
|
<action name="actionZoomIn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>qt_accel_zoom_editor_in</string>
|
<string>qt_accel_zoom_editor_in</string>
|
||||||
|
|
Loading…
Reference in a new issue