Browse Source

qml: move user_knowns_press_and_hold to config

master
Sander van Grieken 3 years ago
parent
commit
4c87773174
  1. 2
      electrum/gui/qml/components/Invoices.qml
  2. 2
      electrum/gui/qml/components/ReceiveRequests.qml
  3. 2
      electrum/gui/qml/components/WalletMainView.qml
  4. 12
      electrum/gui/qml/qeconfig.py
  5. 10
      electrum/gui/qml/qewallet.py

2
electrum/gui/qml/components/Invoices.qml

@ -17,7 +17,7 @@ Pane {
InfoTextArea { InfoTextArea {
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: constants.paddingLarge Layout.bottomMargin: constants.paddingLarge
visible: !Daemon.currentWallet.userKnowsPressAndHold visible: !Config.userKnowsPressAndHold
text: qsTr('To access this list from the main screen, press and hold the Send button') text: qsTr('To access this list from the main screen, press and hold the Send button')
} }

2
electrum/gui/qml/components/ReceiveRequests.qml

@ -20,7 +20,7 @@ Pane {
InfoTextArea { InfoTextArea {
Layout.fillWidth: true Layout.fillWidth: true
Layout.bottomMargin: constants.paddingLarge Layout.bottomMargin: constants.paddingLarge
visible: !Daemon.currentWallet.userKnowsPressAndHold visible: !Config.userKnowsPressAndHold
text: qsTr('To access this list from the main screen, press and hold the Receive button') text: qsTr('To access this list from the main screen, press and hold the Receive button')
} }

2
electrum/gui/qml/components/WalletMainView.qml

@ -192,7 +192,7 @@ Item {
dialog.open() dialog.open()
} }
onPressAndHold: { onPressAndHold: {
Daemon.currentWallet.userKnowsPressAndHold = true Config.userKnowsPressAndHold = true
Daemon.currentWallet.delete_expired_requests() Daemon.currentWallet.delete_expired_requests()
app.stack.push(Qt.resolvedUrl('ReceiveRequests.qml')) app.stack.push(Qt.resolvedUrl('ReceiveRequests.qml'))
} }

12
electrum/gui/qml/qeconfig.py

@ -199,6 +199,18 @@ class QEConfig(AuthMixin, QObject):
self.config.set_key('preferred_request_type', preferred_request_type) self.config.set_key('preferred_request_type', preferred_request_type)
self.preferredRequestTypeChanged.emit() self.preferredRequestTypeChanged.emit()
userKnowsPressAndHoldChanged = pyqtSignal()
@pyqtProperty(bool, notify=userKnowsPressAndHoldChanged)
def userKnowsPressAndHold(self):
return self.config.get('user_knows_press_and_hold', False)
@userKnowsPressAndHold.setter
def userKnowsPressAndHold(self, userKnowsPressAndHold):
if userKnowsPressAndHold != self.config.get('user_knows_press_and_hold', False):
self.config.set_key('user_knows_press_and_hold', userKnowsPressAndHold)
self.userKnowsPressAndHoldChanged.emit()
@pyqtSlot('qint64', result=str) @pyqtSlot('qint64', result=str)
@pyqtSlot('qint64', bool, result=str) @pyqtSlot('qint64', bool, result=str)
@pyqtSlot(QEAmount, result=str) @pyqtSlot(QEAmount, result=str)

10
electrum/gui/qml/qewallet.py

@ -125,18 +125,8 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
self.register_callbacks() self.register_callbacks()
self.destroyed.connect(lambda: self.on_destroy()) self.destroyed.connect(lambda: self.on_destroy())
self._user_knows_press_and_hold = False # maybe save in config?
self.synchronizing = not wallet.is_up_to_date() self.synchronizing = not wallet.is_up_to_date()
userKnowsPressAndHoldChanged = pyqtSignal()
@pyqtProperty(bool, notify=userKnowsPressAndHoldChanged)
def userKnowsPressAndHold(self):
return self._user_knows_press_and_hold
@userKnowsPressAndHold.setter
def userKnowsPressAndHold(self, userKnowsPressAndHold):
self._user_knows_press_and_hold = userKnowsPressAndHold
synchronizingChanged = pyqtSignal() synchronizingChanged = pyqtSignal()
@pyqtProperty(bool, notify=synchronizingChanged) @pyqtProperty(bool, notify=synchronizingChanged)
def synchronizing(self): def synchronizing(self):

Loading…
Cancel
Save