mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Viewer: Add a keyboard shortcut (Ctrl+w) to toggle the scrollbar. Fixes #1864356 [[Enhancement] Hide scrollbar by right clicking on it](https://bugs.launchpad.net/calibre/+bug/1864356)
This commit is contained in:
parent
d6184e16a1
commit
a9c8b0c807
@ -210,6 +210,8 @@ class EbookViewer(MainWindow):
|
||||
m.addSeparator()
|
||||
a(_('Start of current file'), 'start_of_file')
|
||||
a(_('End of current file'), 'end_of_file')
|
||||
m.addSeparator()
|
||||
a(_('Hide this scrollbar'), 'toggle_scrollbar')
|
||||
|
||||
q = m.exec_(QCursor.pos())
|
||||
if not q:
|
||||
|
@ -228,6 +228,12 @@ def shortcuts_definition():
|
||||
_('Toggle between Paged mode and Flow mode for text layout')
|
||||
),
|
||||
|
||||
'toggle_scrollbar': desc(
|
||||
'Ctrl+w',
|
||||
'ui',
|
||||
_('Toggle the scrollbar')
|
||||
),
|
||||
|
||||
'toggle_reference_mode': desc(
|
||||
'Ctrl+x',
|
||||
'ui',
|
||||
|
@ -269,6 +269,15 @@ class View:
|
||||
def reference_mode_overlay(self):
|
||||
return document.getElementById('reference-mode-overlay')
|
||||
|
||||
def set_scrollbar_visibility(self, visible):
|
||||
sd = get_session_data()
|
||||
sd.set('book_scrollbar', bool(visible))
|
||||
self.book_scrollbar.apply_visibility()
|
||||
|
||||
def toggle_scrollbar(self):
|
||||
sd = get_session_data()
|
||||
self.set_scrollbar_visibility(not sd.get('book_scrollbar'))
|
||||
|
||||
def on_lookup_word(self, data):
|
||||
if runtime.is_standalone_viewer:
|
||||
ui_operations.selection_changed(data.word)
|
||||
@ -388,6 +397,8 @@ class View:
|
||||
self.toggle_paged_mode()
|
||||
elif data.name is 'toggle_toolbar':
|
||||
self.toggle_toolbar()
|
||||
elif data.name is 'toggle_scrollbar':
|
||||
self.toggle_scrollbar()
|
||||
elif data.name is 'quit':
|
||||
ui_operations.quit()
|
||||
elif data.name is 'start_search':
|
||||
|
Loading…
x
Reference in New Issue
Block a user