E-book viewer: Add shortcut option for syncing

Add a shortcut option for syncing last position and annotations. The option is
only added for non-standalone viewer mode since book syncing only applies
there. No default binding is assigned.
This commit is contained in:
Jiahao Li 2021-01-26 23:59:38 -05:00
parent 6ee1c3d10c
commit 75b426cc8f
2 changed files with 12 additions and 0 deletions

View file

@ -4,6 +4,8 @@
from gettext import gettext as _
from read_book.globals import runtime
def parse_key_repr(sc):
parts = sc.split('+')
@ -363,6 +365,14 @@ def shortcuts_definition():
),
}
if not runtime.is_standalone_viewer:
ans['sync_book'] = desc(
v"[]",
'ui',
_('Sync last read position/annotations'),
)
return ans

View file

@ -530,6 +530,8 @@ def on_handle_shortcut(self, data):
self.toggle_read_aloud()
elif data.name is 'reload_book':
ui_operations.reload_book()
elif data.name is 'sync_book':
self.overlay.sync_book()
elif data.name is 'next_section':
self.on_next_section({'forward': True})
elif data.name is 'previous_section':