diff --git a/src/python/config_files.py b/src/python/config_files.py index 7b489d09..ae95b70d 100644 --- a/src/python/config_files.py +++ b/src/python/config_files.py @@ -108,10 +108,10 @@ class UISettings(JSONConfigFile): "theme": "Default.qpl", "writeAliases": {}, "keys": { + "reloadConfig": ["Alt+R"], "scrollUp": ["Alt+Up", "Alt+K"], "scrollDown": ["Alt+Down", "Alt+J"], "startDebugger": ["Alt+Shift+D"], - "reloadConfig": ["Alt+R"], }, } diff --git a/src/qml/Python.qml b/src/qml/Python.qml index f2e082f1..fe666c77 100644 --- a/src/qml/Python.qml +++ b/src/qml/Python.qml @@ -40,6 +40,16 @@ Python { callCoro(backend_attribute + ".write", [data], callback) } + function loadSettings(callback=null) { + callCoro("load_settings", [], ([settings, uiState, theme]) => { + window.settings = settings + window.uiState = uiState + window.theme = Qt.createQmlObject(theme, window, "theme") + + if (callback) { callback(settings, uiState, theme) } + }) + } + Component.onCompleted: { for (var func in EventHandlers) { if (EventHandlers.hasOwnProperty(func)) { @@ -53,11 +63,7 @@ Python { call("APP.is_debug_on", [Qt.application.arguments], on => { window.debug = on - callCoro("load_settings", [], ([settings, uiState, theme]) => { - window.settings = settings - window.uiState = uiState - window.theme = Qt.createQmlObject(theme, window, "theme") - + loadSettings(() => { callCoro("saved_accounts.any_saved", [], any => { py.ready = true willLoadAccounts(any) diff --git a/src/qml/Shortcuts.qml b/src/qml/Shortcuts.qml index 258909a5..912bb1fc 100644 --- a/src/qml/Shortcuts.qml +++ b/src/qml/Shortcuts.qml @@ -17,6 +17,11 @@ Item { flickTarget.flick(0, baseVelocity * (fast ? fastMultiply : 1)) } + Shortcut { + sequences: settings.keys ? settings.keys.reloadConfig : [] + onActivated: py.loadSettings() + } + Shortcut { sequences: settings.keys ? settings.keys.scrollUp : [] onActivated: smartVerticalFlick(-335) @@ -28,7 +33,7 @@ Item { } Shortcut { - sequence: settings.keys ? settings.keys.startDebugger : [] + sequences: settings.keys ? settings.keys.startDebugger : [] onActivated: if (window.debug) { py.call("APP.pdb") } }