moment/src/gui/PythonBridge/PythonRootBridge.qml
2021-03-03 17:14:55 -04:00

41 lines
1.3 KiB
QML

// Copyright Mirage authors & contributors <https://github.com/mirukana/mirage>
// SPDX-License-Identifier: LGPL-3.0-or-later
import QtQuick 2.12
import "."
PythonBridge {
property bool ready: false
property bool startupAnyAccountsSaved: false
readonly property EventHandlers eventHandlers: EventHandlers {}
Component.onCompleted: {
for (var func in eventHandlers) {
if (! eventHandlers.hasOwnProperty(func)) continue
if (! func.startsWith("on")) continue
setHandler(func.replace(/^on/, ""), eventHandlers[func])
}
addImportPath("src")
addImportPath("qrc:/src")
importNames("backend.qml_bridge", ["BRIDGE"], () => {
callCoro("get_settings", [], ([settings, state, hist, theme]) => {
window.settings = settings
window.uiState = state
window.history = hist
window.theme = Qt.createQmlObject(theme, window, "theme")
utils.theme = window.theme
callCoro("saved_accounts.any_saved", [], any => {
if (any) { callCoro("load_saved_accounts", []) }
startupAnyAccountsSaved = any
ready = true
})
})
})
}
}