Browse Source

minor, code style, imports

master
Sander van Grieken 2 years ago
parent
commit
482ec89b5d
No known key found for this signature in database
GPG Key ID: 9BCF8209EA402EBA
  1. 12
      electrum/gui/qml/qeapp.py
  2. 2
      electrum/gui/qml/qechannelopener.py
  3. 8
      electrum/gui/qml/qedaemon.py
  4. 2
      electrum/gui/qml/qenetwork.py
  5. 6
      electrum/gui/qml/qetransactionlistmodel.py

12
electrum/gui/qml/qeapp.py

@ -9,8 +9,8 @@ from typing import TYPE_CHECKING, Set
from PyQt6.QtCore import (pyqtSlot, pyqtSignal, pyqtProperty, QObject, QT_VERSION_STR, PYQT_VERSION_STR,
qInstallMessageHandler, QTimer, QSortFilterProxyModel)
from PyQt6.QtGui import QGuiApplication, QFontDatabase, QScreen
from PyQt6.QtQml import qmlRegisterType, qmlRegisterUncreatableType, QQmlApplicationEngine
from PyQt6.QtGui import QGuiApplication, QFontDatabase
from PyQt6.QtQml import qmlRegisterType, QQmlApplicationEngine
import electrum
from electrum import version, constants
@ -219,7 +219,7 @@ class QEAppController(BaseCrashReporter, QObject):
self.logger.debug(f'now {self._plugins.count()} plugins loaded')
plugin = self._plugins.get(plugin_name)
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
else:
self.logger.debug('None!')
@ -264,9 +264,9 @@ class QEAppController(BaseCrashReporter, QObject):
'reportstring': self.get_report_string()
}
@pyqtSlot(object,object,object,object)
@pyqtSlot(object, object, object, object)
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())
@pyqtSlot()
@ -305,7 +305,7 @@ class QEAppController(BaseCrashReporter, QObject):
# if traceback contains special HTML characters, e.g. '<',
# they need to be escaped to avoid formatting issues.
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):
return self._crash_user_text

2
electrum/gui/qml/qechannelopener.py

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

8
electrum/gui/qml/qedaemon.py

@ -76,7 +76,7 @@ class QEWalletListModel(QAbstractListModel):
available.append(i.path)
for path in sorted(available):
wallet = self.daemon.get_wallet(path)
self.add_wallet(wallet_path = path)
self.add_wallet(wallet_path=path)
def add_wallet(self, wallet_path):
self.beginInsertRows(QModelIndex(), len(self._wallets), len(self._wallets))
@ -142,10 +142,10 @@ class QEDaemon(AuthMixin, QObject):
loadingChanged = pyqtSignal()
requestNewPassword = pyqtSignal()
walletLoaded = pyqtSignal([str,str], arguments=['name','path'])
walletRequiresPassword = pyqtSignal([str,str], arguments=['name','path'])
walletLoaded = pyqtSignal([str, str], arguments=['name', 'path'])
walletRequiresPassword = pyqtSignal([str, str], arguments=['name', 'path'])
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):
super().__init__(parent)

2
electrum/gui/qml/qenetwork.py

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

6
electrum/gui/qml/qetransactionlistmodel.py

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

Loading…
Cancel
Save