storage upgrade as part of the wizard. fix storage upgrade on kivy.
This commit is contained in:
@@ -503,7 +503,7 @@ class ElectrumWindow(App):
|
||||
self.load_wallet(wallet)
|
||||
else:
|
||||
Logger.debug('Electrum: Wallet not found. Launching install wizard')
|
||||
storage = WalletStorage(path)
|
||||
storage = WalletStorage(path, manual_upgrades=True)
|
||||
wizard = Factory.InstallWizard(self.electrum_config, storage)
|
||||
wizard.bind(on_wizard_complete=self.on_wizard_complete)
|
||||
action = wizard.storage.get_action()
|
||||
|
||||
@@ -744,7 +744,7 @@ class InstallWizard(BaseWizard, Widget):
|
||||
"""overriden by main_window"""
|
||||
pass
|
||||
|
||||
def waiting_dialog(self, task, msg):
|
||||
def waiting_dialog(self, task, msg, on_finished=None):
|
||||
'''Perform a blocking task in the background by running the passed
|
||||
method in a thread.
|
||||
'''
|
||||
@@ -756,6 +756,8 @@ class InstallWizard(BaseWizard, Widget):
|
||||
self.show_error(str(err))
|
||||
# on completion hide message
|
||||
Clock.schedule_once(lambda dt: app.info_bubble.hide(now=True), -1)
|
||||
if on_finished:
|
||||
Clock.schedule_once(lambda dt: on_finished(), -1)
|
||||
|
||||
app = App.get_running_app()
|
||||
app.show_info_bubble(
|
||||
|
||||
@@ -284,13 +284,8 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||
self.show_warning(_('The file was removed'))
|
||||
return
|
||||
|
||||
if self.storage.requires_upgrade():
|
||||
self.storage.upgrade()
|
||||
self.wallet = Wallet(self.storage)
|
||||
return self.wallet
|
||||
|
||||
action = self.storage.get_action()
|
||||
if action and action != 'new':
|
||||
if action and action not in ('new', 'upgrade_storage'):
|
||||
self.hide()
|
||||
msg = _("The file '{}' contains an incompletely created wallet.\n"
|
||||
"Do you want to complete its creation now?").format(path)
|
||||
@@ -473,12 +468,26 @@ class InstallWizard(QDialog, MessageBoxMixin, BaseWizard):
|
||||
def terminate(self):
|
||||
self.accept_signal.emit()
|
||||
|
||||
def waiting_dialog(self, task, msg):
|
||||
self.please_wait.setText(msg)
|
||||
self.refresh_gui()
|
||||
t = threading.Thread(target = task)
|
||||
def waiting_dialog(self, task, msg, on_finished=None):
|
||||
label = WWLabel(msg)
|
||||
vbox = QVBoxLayout()
|
||||
vbox.addSpacing(100)
|
||||
label.setMinimumWidth(300)
|
||||
label.setAlignment(Qt.AlignCenter)
|
||||
vbox.addWidget(label)
|
||||
self.set_layout(vbox, next_enabled=False)
|
||||
self.back_button.setEnabled(False)
|
||||
|
||||
t = threading.Thread(target=task)
|
||||
t.start()
|
||||
t.join()
|
||||
while True:
|
||||
t.join(1.0/60)
|
||||
if t.is_alive():
|
||||
self.refresh_gui()
|
||||
else:
|
||||
break
|
||||
if on_finished:
|
||||
on_finished()
|
||||
|
||||
@wizard_dialog
|
||||
def choice_dialog(self, title, message, choices, run_next):
|
||||
|
||||
Reference in New Issue
Block a user