mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-31 14:33:54 -04:00
keyboard shortcut to toggle layout (Alt+Shift+L)
This commit is contained in:
parent
a57fa0d6a9
commit
8f928644fe
@ -959,3 +959,5 @@ calibre has several keyboard shortcuts to save you time and mouse movement. Thes
|
|||||||
- Browse annotations (highlights and bookmarks) made in the calibre viewer for all books in the library
|
- Browse annotations (highlights and bookmarks) made in the calibre viewer for all books in the library
|
||||||
* - :kbd:`Ctrl+Shift+N`
|
* - :kbd:`Ctrl+Shift+N`
|
||||||
- Browse notes associated with authors/series/tags/etc.
|
- Browse notes associated with authors/series/tags/etc.
|
||||||
|
* - :kbd:`Alt+Shift+L`
|
||||||
|
- Toggle the layout between wide and narrow views
|
||||||
|
@ -28,6 +28,9 @@ class LayoutActions(InterfaceAction):
|
|||||||
action_add_menu = True
|
action_add_menu = True
|
||||||
dont_add_to = frozenset({'context-menu-device', 'menubar-device'})
|
dont_add_to = frozenset({'context-menu-device', 'menubar-device'})
|
||||||
|
|
||||||
|
def toggle_layout(self):
|
||||||
|
self.gui.layout_container.toggle_layout()
|
||||||
|
|
||||||
def gui_layout_complete(self):
|
def gui_layout_complete(self):
|
||||||
m = self.qaction.menu()
|
m = self.qaction.menu()
|
||||||
m.aboutToShow.connect(self.populate_layout_menu)
|
m.aboutToShow.connect(self.populate_layout_menu)
|
||||||
|
@ -327,6 +327,8 @@ class CentralContainer(QWidget):
|
|||||||
self.wide_is_visible = Visibility()
|
self.wide_is_visible = Visibility()
|
||||||
self.narrow_is_visible = Visibility()
|
self.narrow_is_visible = Visibility()
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
self.action_toggle_layout = QAction(self)
|
||||||
|
self.action_toggle_layout.triggered.connect(self.toggle_layout)
|
||||||
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||||
if for_develop:
|
if for_develop:
|
||||||
self.tag_browser = Placeholder('tag browser', self)
|
self.tag_browser = Placeholder('tag browser', self)
|
||||||
@ -378,6 +380,9 @@ class CentralContainer(QWidget):
|
|||||||
self.set_widget('book_details', gui.book_details)
|
self.set_widget('book_details', gui.book_details)
|
||||||
self.set_widget('tag_browser', gui.tb_widget)
|
self.set_widget('tag_browser', gui.tb_widget)
|
||||||
self.set_widget('book_list', book_list_widget)
|
self.set_widget('book_list', book_list_widget)
|
||||||
|
gui.keyboard.register_shortcut(
|
||||||
|
'toggle_layout_type', _('Toggle layout between wide and narrow'), default_keys=('Alt+Shift+L',), action=self.action_toggle_layout)
|
||||||
|
gui.addAction(self.action_toggle_layout)
|
||||||
# cover browser is set in CoverFlowMixin
|
# cover browser is set in CoverFlowMixin
|
||||||
# Quickview is set in quickview.py code
|
# Quickview is set in quickview.py code
|
||||||
|
|
||||||
@ -547,6 +552,11 @@ class CentralContainer(QWidget):
|
|||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def toggle_layout(self):
|
def toggle_layout(self):
|
||||||
|
from calibre.gui2.ui import get_gui
|
||||||
|
gui = get_gui()
|
||||||
|
if gui:
|
||||||
|
self.change_layout(gui, self.layout is Layout.narrow)
|
||||||
|
else:
|
||||||
self.layout = Layout.narrow if self.layout is Layout.wide else Layout.wide
|
self.layout = Layout.narrow if self.layout is Layout.wide else Layout.wide
|
||||||
self.relayout()
|
self.relayout()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user