From ddbd785a469963bd7020dc64253a6a209cd230d5 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Fri, 1 Apr 2022 16:19:04 +0200 Subject: [PATCH] add version information to QML context --- electrum/gui/qml/__init__.py | 2 -- electrum/gui/qml/qeapp.py | 8 +++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/electrum/gui/qml/__init__.py b/electrum/gui/qml/__init__.py index b8ed7f2d8..818ed39c6 100644 --- a/electrum/gui/qml/__init__.py +++ b/electrum/gui/qml/__init__.py @@ -63,8 +63,6 @@ class ElectrumGui(Logger): os.environ["QT_QUICK_CONTROLS_STYLE"] = "Material" self.gui_thread = threading.current_thread() - #self.config = config - #self.daemon = daemon self.plugins = plugins self.app = ElectrumQmlApplication(sys.argv, config, daemon) # timer diff --git a/electrum/gui/qml/qeapp.py b/electrum/gui/qml/qeapp.py index 83dccbfe2..00c95bb62 100644 --- a/electrum/gui/qml/qeapp.py +++ b/electrum/gui/qml/qeapp.py @@ -7,6 +7,7 @@ from PyQt5.QtGui import QGuiApplication, QFontDatabase from PyQt5.QtQml import qmlRegisterType, QQmlApplicationEngine #, QQmlComponent from electrum.logging import Logger, get_logger +from electrum import version from .qeconfig import QEConfig from .qedaemon import QEDaemon, QEWalletListModel @@ -82,7 +83,7 @@ class ElectrumQmlApplication(QGuiApplication): self.logger = get_logger(__name__) - ElectrumQmlApplication._config = config + #ElectrumQmlApplication._config = config ElectrumQmlApplication._daemon = daemon qmlRegisterType(QEWalletListModel, 'org.electrum', 1, 0, 'WalletListModel') @@ -114,6 +115,11 @@ class ElectrumQmlApplication(QGuiApplication): self.context.setContextProperty('Network', self._qenetwork) self.context.setContextProperty('Daemon', self._qedaemon) self.context.setContextProperty('FixedFont', self.fixedFont) + self.context.setContextProperty('BUILD', { + 'electrum_version': version.ELECTRUM_VERSION, + 'apk_version': version.APK_VERSION, + 'protocol_version': version.PROTOCOL_VERSION + }) qInstallMessageHandler(self.message_handler)