Add keybind to reload config file (default Alt+R)

This commit is contained in:
miruka 2019-07-24 17:26:40 -04:00
parent cf5d76dd10
commit eb97f08d6a
3 changed files with 18 additions and 7 deletions

View File

@ -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"],
},
}

View File

@ -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)

View File

@ -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") }
}