daemon: refactor load_wallet to not just return None, but raise specific exceptions.
The following exceptions should be expected: FileNotFoundError: given wallet path does not exist StorageReadWriteError: given file is not readable/writable or containing folder is not writable InvalidPassword: wallet requires a password but no password or an invalid password was given WalletFileException: any internal wallet data issue. specific subclasses can be caught separately: - WalletRequiresSplit: wallet needs splitting (split_data passed in Exception) - WalletRequiresUpgrade: wallet needs upgrade, and no upgrade=True was passed to load_wallet - WalletUnfinished: wallet file contains an action and needs additional information to finalize. (WalletDB passed in exception) Removed qml/qewalletdb.py This patch also fixes load_wallet calls in electrum/scripts and adds a qml workaround for dialogs opening and closing so fast that the dialog opened==true property change is missed (which we need to manage the dialog/page stack)
This commit is contained in:
@@ -19,6 +19,10 @@ ElDialog {
|
||||
y: Math.floor((parent.height - implicitHeight) / 2)
|
||||
// anchors.centerIn: parent // this strangely pixelates the spinner
|
||||
|
||||
function open() {
|
||||
showTimer.start()
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
width: parent.width
|
||||
|
||||
@@ -32,8 +36,18 @@ ElDialog {
|
||||
Connections {
|
||||
target: Daemon
|
||||
function onLoadingChanged() {
|
||||
if (!Daemon.loading)
|
||||
console.log('daemon loading ' + Daemon.loading)
|
||||
if (!Daemon.loading) {
|
||||
showTimer.stop()
|
||||
dialog.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: showTimer
|
||||
interval: 250
|
||||
repeat: false
|
||||
onTriggered: dialog.visible = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ Dialog {
|
||||
property bool resizeWithKeyboard: true
|
||||
|
||||
property bool _result: false
|
||||
// workaround: remember opened state, to inhibit closed -> closed event
|
||||
property bool _wasOpened: false
|
||||
|
||||
// called to finally close dialog after checks by onClosing handler in main.qml
|
||||
function doClose() {
|
||||
@@ -46,7 +48,10 @@ Dialog {
|
||||
onOpenedChanged: {
|
||||
if (opened) {
|
||||
app.activeDialogs.push(abstractdialog)
|
||||
_wasOpened = true
|
||||
} else {
|
||||
if (!_wasOpened)
|
||||
return
|
||||
if (app.activeDialogs.indexOf(abstractdialog) < 0) {
|
||||
console.log('dialog should exist in activeDialogs!')
|
||||
app.activeDialogs.pop()
|
||||
|
||||
@@ -498,17 +498,21 @@ ApplicationWindow
|
||||
|
||||
property var _opendialog: undefined
|
||||
|
||||
function showOpenWalletDialog(name, path) {
|
||||
if (_opendialog == undefined) {
|
||||
_opendialog = openWalletDialog.createObject(app, { name: name, path: path })
|
||||
_opendialog.closed.connect(function() {
|
||||
_opendialog = undefined
|
||||
})
|
||||
_opendialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
Connections {
|
||||
target: Daemon
|
||||
function onWalletRequiresPassword(name, path) {
|
||||
console.log('wallet requires password')
|
||||
if (_opendialog == undefined) {
|
||||
_opendialog = openWalletDialog.createObject(app, { path: path, name: name })
|
||||
_opendialog.closed.connect(function() {
|
||||
_opendialog = undefined
|
||||
})
|
||||
_opendialog.open()
|
||||
}
|
||||
showOpenWalletDialog(name, path)
|
||||
}
|
||||
function onWalletOpenError(error) {
|
||||
console.log('wallet open error')
|
||||
|
||||
Reference in New Issue
Block a user