1
0

minor, code style, imports

This commit is contained in:
Sander van Grieken
2024-02-05 21:25:13 +01:00
parent 4228911609
commit 482ec89b5d
5 changed files with 15 additions and 15 deletions

View File

@@ -9,8 +9,8 @@ from typing import TYPE_CHECKING, Set
from PyQt6.QtCore import (pyqtSlot, pyqtSignal, pyqtProperty, QObject, QT_VERSION_STR, PYQT_VERSION_STR, from PyQt6.QtCore import (pyqtSlot, pyqtSignal, pyqtProperty, QObject, QT_VERSION_STR, PYQT_VERSION_STR,
qInstallMessageHandler, QTimer, QSortFilterProxyModel) qInstallMessageHandler, QTimer, QSortFilterProxyModel)
from PyQt6.QtGui import QGuiApplication, QFontDatabase, QScreen from PyQt6.QtGui import QGuiApplication, QFontDatabase
from PyQt6.QtQml import qmlRegisterType, qmlRegisterUncreatableType, QQmlApplicationEngine from PyQt6.QtQml import qmlRegisterType, QQmlApplicationEngine
import electrum import electrum
from electrum import version, constants from electrum import version, constants
@@ -219,7 +219,7 @@ class QEAppController(BaseCrashReporter, QObject):
self.logger.debug(f'now {self._plugins.count()} plugins loaded') self.logger.debug(f'now {self._plugins.count()} plugins loaded')
plugin = self._plugins.get(plugin_name) plugin = self._plugins.get(plugin_name)
self.logger.debug(f'plugin with name {plugin_name} is {str(type(plugin))}') self.logger.debug(f'plugin with name {plugin_name} is {str(type(plugin))}')
if plugin and hasattr(plugin,'so'): if plugin and hasattr(plugin, 'so'):
return plugin.so return plugin.so
else: else:
self.logger.debug('None!') self.logger.debug('None!')
@@ -264,9 +264,9 @@ class QEAppController(BaseCrashReporter, QObject):
'reportstring': self.get_report_string() 'reportstring': self.get_report_string()
} }
@pyqtSlot(object,object,object,object) @pyqtSlot(object, object, object, object)
def crash(self, config, e, text, tb): def crash(self, config, e, text, tb):
self.exc_args = (e, text, tb) # for BaseCrashReporter self.exc_args = (e, text, tb) # for BaseCrashReporter
self.showException.emit(self.crashData()) self.showException.emit(self.crashData())
@pyqtSlot() @pyqtSlot()
@@ -305,7 +305,7 @@ class QEAppController(BaseCrashReporter, QObject):
# if traceback contains special HTML characters, e.g. '<', # if traceback contains special HTML characters, e.g. '<',
# they need to be escaped to avoid formatting issues. # they need to be escaped to avoid formatting issues.
traceback_str = super()._get_traceback_str_to_display() traceback_str = super()._get_traceback_str_to_display()
return html.escape(traceback_str).replace('&#x27;','&apos;') return html.escape(traceback_str).replace('&#x27;', '&apos;')
def get_user_description(self): def get_user_description(self):
return self._crash_user_text return self._crash_user_text

View File

@@ -23,7 +23,7 @@ from .qewallet import QEWallet
class QEChannelOpener(QObject, AuthMixin): class QEChannelOpener(QObject, AuthMixin):
_logger = get_logger(__name__) _logger = get_logger(__name__)
validationError = pyqtSignal([str,str], arguments=['code','message']) validationError = pyqtSignal([str, str], arguments=['code', 'message'])
conflictingBackup = pyqtSignal([str], arguments=['message']) conflictingBackup = pyqtSignal([str], arguments=['message'])
channelOpening = pyqtSignal([str], arguments=['peer']) channelOpening = pyqtSignal([str], arguments=['peer'])
channelOpenError = pyqtSignal([str], arguments=['message']) channelOpenError = pyqtSignal([str], arguments=['message'])

View File

@@ -76,7 +76,7 @@ class QEWalletListModel(QAbstractListModel):
available.append(i.path) available.append(i.path)
for path in sorted(available): for path in sorted(available):
wallet = self.daemon.get_wallet(path) wallet = self.daemon.get_wallet(path)
self.add_wallet(wallet_path = path) self.add_wallet(wallet_path=path)
def add_wallet(self, wallet_path): def add_wallet(self, wallet_path):
self.beginInsertRows(QModelIndex(), len(self._wallets), len(self._wallets)) self.beginInsertRows(QModelIndex(), len(self._wallets), len(self._wallets))
@@ -142,10 +142,10 @@ class QEDaemon(AuthMixin, QObject):
loadingChanged = pyqtSignal() loadingChanged = pyqtSignal()
requestNewPassword = pyqtSignal() requestNewPassword = pyqtSignal()
walletLoaded = pyqtSignal([str,str], arguments=['name','path']) walletLoaded = pyqtSignal([str, str], arguments=['name', 'path'])
walletRequiresPassword = pyqtSignal([str,str], arguments=['name','path']) walletRequiresPassword = pyqtSignal([str, str], arguments=['name', 'path'])
walletOpenError = pyqtSignal([str], arguments=["error"]) walletOpenError = pyqtSignal([str], arguments=["error"])
walletDeleteError = pyqtSignal([str,str], arguments=['code', 'message']) walletDeleteError = pyqtSignal([str, str], arguments=['code', 'message'])
def __init__(self, daemon: 'Daemon', plugins: 'Plugins', parent=None): def __init__(self, daemon: 'Daemon', plugins: 'Plugins', parent=None):
super().__init__(parent) super().__init__(parent)

View File

@@ -138,7 +138,7 @@ class QENetwork(QObject, QtEventListener):
if not histogram: if not histogram:
histogram = [[FEERATE_DEFAULT_RELAY/1000,1]] histogram = [[FEERATE_DEFAULT_RELAY/1000,1]]
# cap the histogram to a limited number of megabytes # cap the histogram to a limited number of megabytes
bytes_limit=10*1000*1000 bytes_limit = 10*1000*1000
bytes_current = 0 bytes_current = 0
capped_histogram = [] capped_histogram = []
for item in sorted(histogram, key=lambda x: x[0], reverse=True): for item in sorted(histogram, key=lambda x: x[0], reverse=True):

View File

@@ -236,7 +236,7 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
tx['timestamp'] = info.timestamp tx['timestamp'] = info.timestamp
tx['section'] = self.get_section_by_timestamp(info.timestamp) tx['section'] = self.get_section_by_timestamp(info.timestamp)
tx['date'] = self.format_date_by_section(tx['section'], datetime.fromtimestamp(info.timestamp)) tx['date'] = self.format_date_by_section(tx['section'], datetime.fromtimestamp(info.timestamp))
index = self.index(i,0) index = self.index(i, 0)
roles = [self._ROLE_RMAP[x] for x in ['section', 'height', 'confirmations', 'timestamp', 'date']] roles = [self._ROLE_RMAP[x] for x in ['section', 'height', 'confirmations', 'timestamp', 'date']]
self.dataChanged.emit(index, index, roles) self.dataChanged.emit(index, index, roles)
return return
@@ -264,7 +264,7 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
for i, tx in enumerate(self.tx_history): for i, tx in enumerate(self.tx_history):
if tx['key'] == key: if tx['key'] == key:
tx['label'] = label tx['label'] = label
index = self.index(i,0) index = self.index(i, 0)
self.dataChanged.emit(index, index, [self._ROLE_RMAP['label']]) self.dataChanged.emit(index, index, [self._ROLE_RMAP['label']])
return return
@@ -275,7 +275,7 @@ class QETransactionListModel(QAbstractListModel, QtEventListener):
if 'height' in tx_item: if 'height' in tx_item:
if tx_item['height'] > 0: if tx_item['height'] > 0:
tx_item['confirmations'] = height - tx_item['height'] + 1 tx_item['confirmations'] = height - tx_item['height'] + 1
index = self.index(i,0) index = self.index(i, 0)
roles = [self._ROLE_RMAP['confirmations']] roles = [self._ROLE_RMAP['confirmations']]
self.dataChanged.emit(index, index, roles) self.dataChanged.emit(index, index, roles)
elif tx_item['height'] in (TX_HEIGHT_FUTURE, TX_HEIGHT_LOCAL): elif tx_item['height'] in (TX_HEIGHT_FUTURE, TX_HEIGHT_LOCAL):