mirror of
https://github.com/kovidgoyal/calibre.git
synced 2026-03-11 12:23:42 -04:00
Viewer: Fix shortcut changes not being applied after pressing OK if shortcut list is closed by pressing Esc. Fixes #1846765 [ebook viewer preferences not saved](https://bugs.launchpad.net/calibre/+bug/1846765)
This commit is contained in:
parent
67aca61d0c
commit
95c71e3cd0
@ -83,6 +83,7 @@ def close_customize_shortcut(apply_changes):
|
||||
item.dataset.userData = JSON.stringify(q)
|
||||
break
|
||||
get_container().dataset.changed = 'true'
|
||||
commit_keyboard(create_keyboard_panel.onchange)
|
||||
|
||||
|
||||
def add_key_widget():
|
||||
@ -143,7 +144,8 @@ def customize_shortcut(sc_name):
|
||||
|
||||
|
||||
|
||||
def create_keyboard_panel(container, close_func):
|
||||
def create_keyboard_panel(container, close_func, onchange):
|
||||
create_keyboard_panel.onchange = onchange
|
||||
container.appendChild(E.div(id=unique_id('keyboard-settings'), style='margin: 1rem'))
|
||||
container = container.lastChild
|
||||
container.dataset.changed = 'false'
|
||||
@ -189,5 +191,6 @@ def commit_keyboard(onchange):
|
||||
if shortcuts_differ(q.shortcuts, SHORTCUTS[q.name].shortcuts):
|
||||
vals[q.name] = q.shortcuts
|
||||
sd.set('keyboard_shortcuts', vals)
|
||||
create_keyboard_panel.onchange = None
|
||||
if get_container().dataset.changed is 'true':
|
||||
onchange()
|
||||
|
||||
@ -124,7 +124,7 @@ class Prefs:
|
||||
|
||||
def display_keyboard(self, container):
|
||||
document.getElementById(self.title_id).textContent = _('Keyboard shortcuts')
|
||||
create_keyboard_panel(container, self.onclose)
|
||||
create_keyboard_panel(container, self.onclose, self.onchange)
|
||||
|
||||
def close_keyboard(self):
|
||||
commit_keyboard(self.onchange, self.container)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user