qml: ElectrumGui to inherit BaseElectrumGui
This commit is contained in:
@@ -23,6 +23,7 @@ from electrum.i18n import set_language, languages, language
|
||||
from electrum.plugin import run_hook
|
||||
from electrum.util import profiler
|
||||
from electrum.logging import Logger
|
||||
from electrum.gui import BaseElectrumGui
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from electrum.daemon import Daemon
|
||||
@@ -42,10 +43,11 @@ class ElectrumTranslator(QTranslator):
|
||||
return language.gettext(source_text)
|
||||
|
||||
|
||||
class ElectrumGui(Logger):
|
||||
class ElectrumGui(BaseElectrumGui, Logger):
|
||||
|
||||
@profiler
|
||||
def __init__(self, config: 'SimpleConfig', daemon: 'Daemon', plugins: 'Plugins'):
|
||||
BaseElectrumGui.__init__(self, config=config, daemon=daemon, plugins=plugins)
|
||||
Logger.__init__(self)
|
||||
set_language(config.get('language', self.get_default_language()))
|
||||
|
||||
@@ -80,8 +82,7 @@ class ElectrumGui(Logger):
|
||||
os.environ["QT_QUICK_CONTROLS_STYLE"] = "Material"
|
||||
|
||||
self.gui_thread = threading.current_thread()
|
||||
self.plugins = plugins
|
||||
self.app = ElectrumQmlApplication(sys.argv, config, daemon, plugins)
|
||||
self.app = ElectrumQmlApplication(sys.argv, config=config, daemon=daemon, plugins=plugins)
|
||||
self.translator = ElectrumTranslator()
|
||||
self.app.installTranslator(self.translator)
|
||||
|
||||
|
||||
@@ -44,6 +44,8 @@ from .qemodelfilter import QEFilterProxyModel
|
||||
if TYPE_CHECKING:
|
||||
from electrum.simple_config import SimpleConfig
|
||||
from electrum.wallet import Abstract_Wallet
|
||||
from electrum.daemon import Daemon
|
||||
from electrum.plugin import Plugins
|
||||
|
||||
notification = None
|
||||
|
||||
@@ -290,7 +292,7 @@ class ElectrumQmlApplication(QGuiApplication):
|
||||
|
||||
_valid = True
|
||||
|
||||
def __init__(self, args, config, daemon, plugins):
|
||||
def __init__(self, args, *, config: 'SimpleConfig', daemon: 'Daemon', plugins: 'Plugins'):
|
||||
super().__init__(args)
|
||||
|
||||
self.logger = get_logger(__name__)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject
|
||||
|
||||
from electrum.logging import get_logger
|
||||
@@ -8,6 +10,11 @@ from electrum.simple_config import FEERATE_DEFAULT_RELAY
|
||||
from .util import QtEventListener, event_listener
|
||||
from .qeserverlistmodel import QEServerListModel
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .qeconfig import QEConfig
|
||||
from electrum.network import Network
|
||||
|
||||
|
||||
class QENetwork(QObject, QtEventListener):
|
||||
_logger = get_logger(__name__)
|
||||
|
||||
@@ -38,7 +45,7 @@ class QENetwork(QObject, QtEventListener):
|
||||
_gossipDbChannels = 0
|
||||
_gossipDbPolicies = 0
|
||||
|
||||
def __init__(self, network, qeconfig, parent=None):
|
||||
def __init__(self, network: 'Network', qeconfig: 'QEConfig', parent=None):
|
||||
super().__init__(parent)
|
||||
self.network = network
|
||||
self._qeconfig = qeconfig
|
||||
|
||||
Reference in New Issue
Block a user