Viewer toolbar: Add an action to toggle the inspector

This commit is contained in:
Kovid Goyal 2019-12-15 14:42:13 +05:30
parent 4b077904c0
commit 6ca7282fd9
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -50,6 +50,7 @@ def all_actions():
'previous': Action('previous.png', _('Previous page'), 'previous'),
'toc': Action('toc.png', _('Table of Contents'), 'toggle_toc'),
'bookmarks': Action('bookmarks.png', _('Bookmarks'), 'toggle_bookmarks'),
'inspector': Action('debug.png', _('Inspector'), 'toggle_inspector'),
'reference': Action('reference.png', _('Toggle Reference mode'), 'toggle_reference_mode'),
'lookup': Action('generic-library.png', _('Lookup words'), 'toggle_lookup'),
'chrome': Action('tweaks.png', _('Show viewer controls'), 'show_chrome'),
@ -64,7 +65,7 @@ def all_actions():
DEFAULT_ACTIONS = (
'back', 'forward', None, 'open', 'copy', 'increase_font_size', 'decrease_font_size', 'fullscreen',
None, 'previous', 'next', None, 'toc', 'bookmarks', 'lookup', 'reference', 'chrome', None, 'mode', 'print', 'preferences',
'metadata'
'metadata', 'inspector'
)
@ -155,6 +156,8 @@ class ActionsToolBar(ToolBar):
a.setCheckable(True)
self.lookup_action = a = shortcut_action('lookup')
a.setCheckable(True)
self.inspector_action = a = shortcut_action('inspector')
a.setCheckable(True)
self.chrome_action = shortcut_action('chrome')
self.mode_action = a = shortcut_action('mode')
@ -191,7 +194,7 @@ class ActionsToolBar(ToolBar):
self.reference_action.setChecked(enabled)
def update_dock_actions(self, visibility_map):
for k in ('toc', 'bookmarks', 'lookup'):
for k in ('toc', 'bookmarks', 'lookup', 'inspector'):
ac = getattr(self, '{}_action'.format(k))
ac.setChecked(visibility_map[k])