Viewer: Add a keyboard shortcut (Ctrl+m) to toggle between paged mode and flow mode

This commit is contained in:
Kovid Goyal 2019-10-06 08:58:19 +05:30
parent 91438dd8f1
commit db583073de
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 15 additions and 0 deletions

View File

@ -221,6 +221,12 @@ SHORTCUTS = {
_('Toggle full screen'),
),
'toggle_paged_mode': desc(
'Ctrl+m',
'ui',
_('Toggle between Paged mode and Flow mode for text layout')
),
'reload_book': desc(
v"['F5', 'Ctrl+r']",
'ui',

View File

@ -295,6 +295,8 @@ class View:
ui_operations.toggle_inspector()
elif data.name is 'toggle_lookup':
ui_operations.toggle_lookup()
elif data.name is 'toggle_paged_mode':
self.toggle_paged_mode()
elif data.name is 'quit':
ui_operations.quit()
elif data.name is 'start_search':
@ -325,6 +327,13 @@ class View:
if ui_operations.selection_changed:
ui_operations.selection_changed(data.text)
def toggle_paged_mode(self):
sd = get_session_data()
mode = sd.get('read_mode')
new_mode = 'flow' if mode is 'paged' else 'paged'
sd.set('read_mode', new_mode)
ui_operations.redisplay_book()
def find(self, text, backwards):
self.iframe_wrapper.send_message('find', text=text, backwards=backwards, searched_in_spine=False)