Browse Source

qml: wallet loading indicator as modal dialog, unclosable

master
Sander van Grieken 3 years ago
parent
commit
32d00b2982
  1. 41
      electrum/gui/qml/components/LoadingWalletDialog.qml
  2. 3
      electrum/gui/qml/components/OpenWalletDialog.qml
  3. 15
      electrum/gui/qml/components/Wallets.qml
  4. 39
      electrum/gui/qml/components/main.qml
  5. 13
      electrum/gui/qml/qewallet.py

41
electrum/gui/qml/components/LoadingWalletDialog.qml

@ -0,0 +1,41 @@
import QtQuick 2.6
import QtQuick.Layouts 1.0
import QtQuick.Controls 2.3
import QtQuick.Controls.Material 2.0
import org.electrum 1.0
ElDialog {
id: dialog
title: qsTr('Loading Wallet')
iconSource: Qt.resolvedUrl('../../icons/wallet.png')
modal: true
parent: Overlay.overlay
Overlay.modal: Rectangle {
color: "#aa000000"
}
x: Math.floor((parent.width - implicitWidth) / 2)
y: Math.floor((parent.height - implicitHeight) / 2)
// anchors.centerIn: parent // this strangely pixelates the spinner
ColumnLayout {
width: parent.width
BusyIndicator {
Layout.alignment: Qt.AlignHCenter
running: Daemon.loading
}
}
Connections {
target: Daemon
function onLoadingChanged() {
if (!Daemon.loading)
dialog.close()
}
}
}

3
electrum/gui/qml/components/OpenWalletDialog.qml

@ -45,7 +45,7 @@ ElDialog {
InfoTextArea {
id: notice
text: qsTr("Wallet <b>%1</b> requires password to unlock").arg(name)
// visible: false //wallet_db.needsPassword
visible: wallet_db.needsPassword
iconStyle: InfoTextArea.IconStyle.Warn
Layout.fillWidth: true
}
@ -96,7 +96,6 @@ ElDialog {
FlatButton {
id: unlockButton
// Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
visible: wallet_db.needsPassword
icon.source: '../../icons/unlock.png'

15
electrum/gui/qml/components/Wallets.qml

@ -20,7 +20,6 @@ Pane {
Daemon.availableWallets.reload()
// and load the new wallet
Daemon.load_wallet(dialog.path, dialog.wizard_data['password'])
app.stack.pop()
})
}
@ -57,8 +56,10 @@ Pane {
height: row.height
onClicked: {
Daemon.load_wallet(model.path)
app.stack.pop()
if (Daemon.currentWallet.name != model.name)
Daemon.load_wallet(model.path)
else
app.stack.pop()
}
RowLayout {
@ -120,4 +121,12 @@ Pane {
}
}
Connections {
target: Daemon
function onWalletLoaded() {
if (app.stack.currentItem.objectName == 'Wallets')
app.stack.pop()
}
}
}

39
electrum/gui/qml/components/main.qml

@ -171,30 +171,6 @@ ApplicationWindow
}
}
Pane {
id: walletLoadingPane
parent: Overlay.overlay
anchors.fill: parent
background: Rectangle { color: Material.dialogColor }
visible: Daemon.loading
ColumnLayout {
anchors.centerIn: parent
spacing: 2 * constants.paddingXLarge
Label {
Layout.alignment: Qt.AlignHCenter
text: qsTr('Opening wallet...')
font.pixelSize: constants.fontSizeXXLarge
}
BusyIndicator {
Layout.alignment: Qt.AlignHCenter
running: Daemon.loading
}
}
}
Timer {
id: coverTimer
interval: 10
@ -283,6 +259,14 @@ ApplicationWindow
}
}
property alias loadingWalletDialog: _loadingWalletDialog
Component {
id: _loadingWalletDialog
LoadingWalletDialog {
onClosed: destroy()
}
}
property alias channelOpenProgressDialog: _channelOpenProgressDialog
ChannelOpenProgressDialog {
id: _channelOpenProgressDialog
@ -409,6 +393,13 @@ ApplicationWindow
function onAuthRequired(method) {
handleAuthRequired(Daemon, method)
}
function onLoadingChanged() {
if (!Daemon.loading)
return
console.log('wallet loading')
var dialog = loadingWalletDialog.createObject(app, { allowClose: false } )
dialog.open()
}
}
Connections {

13
electrum/gui/qml/qewallet.py

@ -126,19 +126,6 @@ class QEWallet(AuthMixin, QObject, QtEventListener):
self.synchronizing = True # start in sync state
# @pyqtSlot()
# def qt_init(self):
# self.notification_timer = QTimer(self)
# self.notification_timer.setSingleShot(False)
# self.notification_timer.setInterval(500) # msec
# self.notification_timer.timeout.connect(self.notify_transactions)
#
# self.sync_progress_timer = QTimer(self)
# self.sync_progress_timer.setSingleShot(False)
# self.sync_progress_timer.setInterval(2000)
# self.sync_progress_timer.timeout.connect(self.update_sync_progress)
@pyqtProperty(bool, notify=isUptodateChanged)
def isUptodate(self):
return self._isUpToDate

Loading…
Cancel
Save