From 198ca10cd06a33a7fc4d49a999fb9a3a024b0911 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Sun, 2 Apr 2023 11:15:28 +0200 Subject: [PATCH] qml: add InfoTextArea about PressAndHold --- electrum/gui/qml/components/Invoices.qml | 7 +++++++ electrum/gui/qml/components/ReceiveRequests.qml | 7 +++++++ electrum/gui/qml/components/WalletMainView.qml | 2 ++ electrum/gui/qml/qewallet.py | 12 ++++++++++-- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/electrum/gui/qml/components/Invoices.qml b/electrum/gui/qml/components/Invoices.qml index 5535837b1..596427976 100644 --- a/electrum/gui/qml/components/Invoices.qml +++ b/electrum/gui/qml/components/Invoices.qml @@ -14,6 +14,13 @@ Pane { ColumnLayout { anchors.fill: parent + InfoTextArea { + Layout.fillWidth: true + Layout.bottomMargin: constants.paddingLarge + visible: !Daemon.currentWallet.userKnowsPressAndHold + text: qsTr('To access this list from the main screen, press and hold the Send button') + } + Heading { text: qsTr('Saved Invoices') } diff --git a/electrum/gui/qml/components/ReceiveRequests.qml b/electrum/gui/qml/components/ReceiveRequests.qml index 3de544f5b..f33ab8dea 100644 --- a/electrum/gui/qml/components/ReceiveRequests.qml +++ b/electrum/gui/qml/components/ReceiveRequests.qml @@ -17,6 +17,13 @@ Pane { ColumnLayout { anchors.fill: parent + InfoTextArea { + Layout.fillWidth: true + Layout.bottomMargin: constants.paddingLarge + visible: !Daemon.currentWallet.userKnowsPressAndHold + text: qsTr('To access this list from the main screen, press and hold the Receive button') + } + Heading { text: qsTr('Pending requests') } diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index c0a1cbfff..7d89e80a3 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -192,6 +192,7 @@ Item { dialog.open() } onPressAndHold: { + Daemon.currentWallet.userKnowsPressAndHold = true Daemon.currentWallet.delete_expired_requests() app.stack.push(Qt.resolvedUrl('ReceiveRequests.qml')) } @@ -204,6 +205,7 @@ Item { text: qsTr('Send') onClicked: openSendDialog() onPressAndHold: { + Daemon.currentWallet.userKnowsPressAndHold = true app.stack.push(Qt.resolvedUrl('Invoices.qml')) } } diff --git a/electrum/gui/qml/qewallet.py b/electrum/gui/qml/qewallet.py index 5e723acff..605f9acc2 100644 --- a/electrum/gui/qml/qewallet.py +++ b/electrum/gui/qml/qewallet.py @@ -125,9 +125,18 @@ class QEWallet(AuthMixin, QObject, QtEventListener): self.register_callbacks() 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() + 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() @pyqtProperty(bool, notify=synchronizingChanged) def synchronizing(self): @@ -629,7 +638,6 @@ class QEWallet(AuthMixin, QObject, QtEventListener): elif lightning_only: addr = None else: - has_lightning = self.wallet.has_lightning() msg = [ _('No address available.'), _('All your addresses are used in pending requests.'),