1
0

qml: don't initialize instance variables on class scope for non-singletons

(this somehow escaped attention before, as most objects usually don't have multiple instances,
unless multiple wallets are open at the same time.)
Also, move all signal declarations, class constants and variables to the top of class definitions.
This commit is contained in:
Sander van Grieken
2023-01-12 13:09:21 +01:00
parent 58d25d4a5d
commit 0bc8460005
22 changed files with 250 additions and 240 deletions

View File

@@ -44,14 +44,14 @@ class QEInvoice(QObject):
_logger = get_logger(__name__)
_wallet = None
_canSave = False
_canPay = False
_key = None
def __init__(self, parent=None):
super().__init__(parent)
self._wallet = None
self._canSave = False
self._canPay = False
self._key = None
walletChanged = pyqtSignal()
@pyqtProperty(QEWallet, notify=walletChanged)
def wallet(self):
@@ -117,15 +117,8 @@ class QEInvoice(QObject):
return self._wallet.wallet.lnworker.num_sats_can_send()
class QEInvoiceParser(QEInvoice):
_logger = get_logger(__name__)
_invoiceType = QEInvoice.Type.Invalid
_recipient = ''
_effectiveInvoice = None
_amount = QEAmount()
_userinfo = ''
invoiceChanged = pyqtSignal()
invoiceSaved = pyqtSignal([str], arguments=['key'])
@@ -140,6 +133,13 @@ class QEInvoiceParser(QEInvoice):
def __init__(self, parent=None):
super().__init__(parent)
self._invoiceType = QEInvoice.Type.Invalid
self._recipient = ''
self._effectiveInvoice = None
self._amount = QEAmount()
self._userinfo = ''
self.clear()
@pyqtProperty(int, notify=invoiceChanged)