From dea30f96a18ffa9350cb19f7c9a7787cc35aaad0 Mon Sep 17 00:00:00 2001 From: Sander van Grieken Date: Wed, 24 Aug 2022 12:38:25 +0200 Subject: [PATCH] qml: small fixes, cleanup --- electrum/gui/qml/components/ChannelDetails.qml | 1 - electrum/gui/qml/components/History.qml | 4 ++-- electrum/gui/qml/components/WalletMainView.qml | 8 ++++---- electrum/gui/qml/components/Wallets.qml | 12 ++++++------ electrum/gui/qml/qetransactionlistmodel.py | 2 +- 5 files changed, 13 insertions(+), 14 deletions(-) diff --git a/electrum/gui/qml/components/ChannelDetails.qml b/electrum/gui/qml/components/ChannelDetails.qml index e0050c93e..a4d741b37 100644 --- a/electrum/gui/qml/components/ChannelDetails.qml +++ b/electrum/gui/qml/components/ChannelDetails.qml @@ -22,7 +22,6 @@ Pane { icon.color: 'transparent' action: Action { text: qsTr('Backup'); - enabled: true onTriggered: { var dialog = app.genericShareDialog.createObject(root, { diff --git a/electrum/gui/qml/components/History.qml b/electrum/gui/qml/components/History.qml index 0594c485d..bae7cca81 100644 --- a/electrum/gui/qml/components/History.qml +++ b/electrum/gui/qml/components/History.qml @@ -84,7 +84,7 @@ Pane { height: postext.height + constants.paddingXXLarge radius: constants.paddingXSmall - color: constants._alpha(Material.accentColor, 0.33) + color: constants.colorAlpha(Material.accentColor, 0.33) border.color: Material.accentColor opacity : vdragscroll.drag.active ? 1 : 0 Behavior on opacity { NumberAnimation { duration: 300 } } @@ -92,8 +92,8 @@ Pane { onYChanged: { if (vdragscroll.drag.active) { listview.contentY = - Math.min(listview.contentHeight - listview.height + listview.originY, Math.max(listview.originY, + Math.min(listview.contentHeight - listview.height + listview.originY, (y/vdragscroll.height) * listview.contentHeight)) } } diff --git a/electrum/gui/qml/components/WalletMainView.qml b/electrum/gui/qml/components/WalletMainView.qml index 262c88525..8382a8e0c 100644 --- a/electrum/gui/qml/components/WalletMainView.qml +++ b/electrum/gui/qml/components/WalletMainView.qml @@ -15,7 +15,7 @@ Item { action: Action { text: qsTr('Addresses'); onTriggered: menu.openPage(Qt.resolvedUrl('Addresses.qml')); - enabled: Daemon.currentWallet != null + enabled: Daemon.currentWallet icon.source: '../../icons/tab_addresses.png' } } @@ -39,7 +39,7 @@ Item { icon.color: 'transparent' action: Action { text: qsTr('Channels'); - enabled: Daemon.currentWallet != null && Daemon.currentWallet.isLightning + enabled: Daemon.currentWallet && Daemon.currentWallet.isLightning onTriggered: menu.openPage(Qt.resolvedUrl('Channels.qml')) icon.source: '../../icons/lightning.png' } @@ -73,7 +73,7 @@ Item { anchors.centerIn: parent width: parent.width spacing: 2*constants.paddingXLarge - visible: Daemon.currentWallet == null + visible: !Daemon.currentWallet Label { text: qsTr('No wallet loaded') @@ -92,7 +92,7 @@ Item { ColumnLayout { anchors.fill: parent - visible: Daemon.currentWallet != null + visible: Daemon.currentWallet SwipeView { id: swipeview diff --git a/electrum/gui/qml/components/Wallets.qml b/electrum/gui/qml/components/Wallets.qml index 4ccac677c..4b2954d90 100644 --- a/electrum/gui/qml/components/Wallets.qml +++ b/electrum/gui/qml/components/Wallets.qml @@ -59,7 +59,7 @@ Pane { id: changePasswordComp MenuItem { icon.color: 'transparent' - enabled: Daemon.currentWallet // != null + enabled: Daemon.currentWallet action: Action { text: qsTr('Change Password'); onTriggered: rootItem.changePassword() @@ -71,7 +71,7 @@ Pane { id: deleteWalletComp MenuItem { icon.color: 'transparent' - enabled: Daemon.currentWallet // != null + enabled: Daemon.currentWallet action: Action { text: qsTr('Delete Wallet'); onTriggered: rootItem.deleteWallet() @@ -87,7 +87,7 @@ Pane { action: Action { text: qsTr('Enable Lightning'); onTriggered: rootItem.enableLightning() - enabled: Daemon.currentWallet != null && Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning + enabled: Daemon.currentWallet && Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning icon.source: '../../icons/lightning.png' } } @@ -100,7 +100,7 @@ Pane { // add items dynamically, if using visible: false property the menu item isn't removed but empty Component.onCompleted: { - if (Daemon.currentWallet != null) { + if (Daemon.currentWallet) { menu.insertItem(0, sepComp.createObject(menu)) if (Daemon.currentWallet.canHaveLightning && !Daemon.currentWallet.isLightning) { menu.insertItem(0, enableLightningComp.createObject(menu)) @@ -118,7 +118,7 @@ Pane { GridLayout { id: detailsLayout - visible: Daemon.currentWallet != null + visible: Daemon.currentWallet Layout.preferredWidth: parent.width columns: 4 @@ -183,7 +183,7 @@ Pane { } ColumnLayout { - visible: Daemon.currentWallet == null + visible: !Daemon.currentWallet Layout.alignment: Qt.AlignHCenter Layout.bottomMargin: constants.paddingXXLarge diff --git a/electrum/gui/qml/qetransactionlistmodel.py b/electrum/gui/qml/qetransactionlistmodel.py index db4148069..04cc1c9db 100644 --- a/electrum/gui/qml/qetransactionlistmodel.py +++ b/electrum/gui/qml/qetransactionlistmodel.py @@ -54,7 +54,7 @@ class QETransactionListModel(QAbstractListModel): self.endResetModel() def tx_to_model(self, tx): - self._logger.debug(str(tx)) + #self._logger.debug(str(tx)) item = tx item['key'] = item['txid'] if 'txid' in item else item['payment_hash']