use QStackedLayout in install wizard
This commit is contained in:
parent
d8626793bc
commit
c8cd187bd4
|
@ -24,6 +24,15 @@ class InstallWizard(QDialog):
|
||||||
self.setWindowTitle('Electrum')
|
self.setWindowTitle('Electrum')
|
||||||
self.connect(self, QtCore.SIGNAL('accept'), self.accept)
|
self.connect(self, QtCore.SIGNAL('accept'), self.accept)
|
||||||
|
|
||||||
|
self.stack = QStackedLayout()
|
||||||
|
self.setLayout(self.stack)
|
||||||
|
|
||||||
|
|
||||||
|
def set_layout(self, layout):
|
||||||
|
w = QWidget()
|
||||||
|
w.setLayout(layout)
|
||||||
|
self.stack.setCurrentIndex(self.stack.addWidget(w))
|
||||||
|
|
||||||
|
|
||||||
def restore_or_create(self):
|
def restore_or_create(self):
|
||||||
|
|
||||||
|
@ -51,9 +60,10 @@ class InstallWizard(QDialog):
|
||||||
grid.addWidget(b2,2,0)
|
grid.addWidget(b2,2,0)
|
||||||
grid.addWidget(b3,3,0)
|
grid.addWidget(b3,3,0)
|
||||||
|
|
||||||
vbox = QVBoxLayout(self)
|
vbox = QVBoxLayout()
|
||||||
vbox.addLayout(grid)
|
self.set_layout(vbox)
|
||||||
|
|
||||||
|
vbox.addLayout(grid)
|
||||||
vbox.addStretch(1)
|
vbox.addStretch(1)
|
||||||
vbox.addLayout(ok_cancel_buttons(self, _('Next')))
|
vbox.addLayout(ok_cancel_buttons(self, _('Next')))
|
||||||
|
|
||||||
|
@ -84,9 +94,7 @@ class InstallWizard(QDialog):
|
||||||
|
|
||||||
def seed_dialog(self, is_restore=True):
|
def seed_dialog(self, is_restore=True):
|
||||||
|
|
||||||
if self.layout(): QWidget().setLayout(self.layout())
|
vbox = QVBoxLayout()
|
||||||
|
|
||||||
vbox = QVBoxLayout(self)
|
|
||||||
if is_restore:
|
if is_restore:
|
||||||
msg = _("Please enter your wallet seed.") + "\n"
|
msg = _("Please enter your wallet seed.") + "\n"
|
||||||
else:
|
else:
|
||||||
|
@ -111,10 +119,10 @@ class InstallWizard(QDialog):
|
||||||
|
|
||||||
vbox.addLayout(grid)
|
vbox.addLayout(grid)
|
||||||
|
|
||||||
|
|
||||||
vbox.addStretch(1)
|
vbox.addStretch(1)
|
||||||
vbox.addLayout(ok_cancel_buttons(self, _('Next')))
|
vbox.addLayout(ok_cancel_buttons(self, _('Next')))
|
||||||
|
|
||||||
|
self.set_layout(vbox)
|
||||||
if not self.exec_():
|
if not self.exec_():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -133,10 +141,10 @@ class InstallWizard(QDialog):
|
||||||
task()
|
task()
|
||||||
self.emit(QtCore.SIGNAL('accept'))
|
self.emit(QtCore.SIGNAL('accept'))
|
||||||
|
|
||||||
if self.layout(): QWidget().setLayout(self.layout())
|
vbox = QVBoxLayout()
|
||||||
vbox = QVBoxLayout(self)
|
|
||||||
self.waiting_label = QLabel(msg)
|
self.waiting_label = QLabel(msg)
|
||||||
vbox.addWidget(self.waiting_label)
|
vbox.addWidget(self.waiting_label)
|
||||||
|
self.set_layout(vbox)
|
||||||
t = threading.Thread(target = target)
|
t = threading.Thread(target = target)
|
||||||
t.start()
|
t.start()
|
||||||
self.exec_()
|
self.exec_()
|
||||||
|
@ -145,10 +153,7 @@ class InstallWizard(QDialog):
|
||||||
|
|
||||||
def mpk_dialog(self):
|
def mpk_dialog(self):
|
||||||
|
|
||||||
if self.layout(): QWidget().setLayout(self.layout())
|
vbox = QVBoxLayout()
|
||||||
|
|
||||||
vbox = QVBoxLayout(self)
|
|
||||||
|
|
||||||
vbox.addWidget(QLabel(_("Please enter your master public key.")))
|
vbox.addWidget(QLabel(_("Please enter your master public key.")))
|
||||||
|
|
||||||
grid = QGridLayout()
|
grid = QGridLayout()
|
||||||
|
@ -171,6 +176,7 @@ class InstallWizard(QDialog):
|
||||||
vbox.addStretch(1)
|
vbox.addStretch(1)
|
||||||
vbox.addLayout(ok_cancel_buttons(self, _('Next')))
|
vbox.addLayout(ok_cancel_buttons(self, _('Next')))
|
||||||
|
|
||||||
|
self.set_layout(vbox)
|
||||||
if not self.exec_(): return None, None
|
if not self.exec_(): return None, None
|
||||||
|
|
||||||
mpk = str(mpk_e.toPlainText()).strip()
|
mpk = str(mpk_e.toPlainText()).strip()
|
||||||
|
@ -180,8 +186,6 @@ class InstallWizard(QDialog):
|
||||||
|
|
||||||
def network_dialog(self):
|
def network_dialog(self):
|
||||||
|
|
||||||
if self.layout(): QWidget().setLayout(self.layout())
|
|
||||||
|
|
||||||
grid = QGridLayout()
|
grid = QGridLayout()
|
||||||
grid.setSpacing(5)
|
grid.setSpacing(5)
|
||||||
|
|
||||||
|
@ -206,12 +210,13 @@ class InstallWizard(QDialog):
|
||||||
grid.addWidget(b2,2,0)
|
grid.addWidget(b2,2,0)
|
||||||
#grid.addWidget(b3,3,0)
|
#grid.addWidget(b3,3,0)
|
||||||
|
|
||||||
vbox = QVBoxLayout(self)
|
vbox = QVBoxLayout()
|
||||||
vbox.addLayout(grid)
|
vbox.addLayout(grid)
|
||||||
|
|
||||||
vbox.addStretch(1)
|
vbox.addStretch(1)
|
||||||
vbox.addLayout(ok_cancel_buttons(self, _('Next')))
|
vbox.addLayout(ok_cancel_buttons(self, _('Next')))
|
||||||
|
|
||||||
|
self.set_layout(vbox)
|
||||||
if not self.exec_():
|
if not self.exec_():
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -235,9 +240,7 @@ class InstallWizard(QDialog):
|
||||||
vbox = make_seed_dialog(wallet.get_mnemonic(None), wallet.imported_keys)
|
vbox = make_seed_dialog(wallet.get_mnemonic(None), wallet.imported_keys)
|
||||||
vbox.addLayout(ok_cancel_buttons(self, _("Next")))
|
vbox.addLayout(ok_cancel_buttons(self, _("Next")))
|
||||||
|
|
||||||
if self.layout(): QWidget().setLayout(self.layout())
|
self.set_layout(vbox)
|
||||||
self.setLayout(vbox)
|
|
||||||
|
|
||||||
if not self.exec_():
|
if not self.exec_():
|
||||||
exit()
|
exit()
|
||||||
|
|
||||||
|
@ -246,8 +249,8 @@ class InstallWizard(QDialog):
|
||||||
msg = _("Please choose a password to encrypt your wallet keys.")+'\n'\
|
msg = _("Please choose a password to encrypt your wallet keys.")+'\n'\
|
||||||
+_("Leave these fields empty if you want to disable encryption.")
|
+_("Leave these fields empty if you want to disable encryption.")
|
||||||
from password_dialog import make_password_dialog, run_password_dialog
|
from password_dialog import make_password_dialog, run_password_dialog
|
||||||
if self.layout(): QWidget().setLayout(self.layout())
|
self.set_layout( make_password_dialog(self, wallet, msg) )
|
||||||
make_password_dialog(self, wallet, msg)
|
|
||||||
run_password_dialog(self, wallet, self)
|
run_password_dialog(self, wallet, self)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ def make_password_dialog(self, wallet, msg):
|
||||||
|
|
||||||
vbox.addStretch(1)
|
vbox.addStretch(1)
|
||||||
vbox.addLayout(ok_cancel_buttons(self))
|
vbox.addLayout(ok_cancel_buttons(self))
|
||||||
self.setLayout(vbox)
|
return vbox
|
||||||
|
|
||||||
|
|
||||||
def run_password_dialog(self, wallet, parent):
|
def run_password_dialog(self, wallet, parent):
|
||||||
|
@ -119,7 +119,7 @@ class PasswordDialog(QDialog):
|
||||||
msg = (_('Your wallet is encrypted. Use this dialog to change your password.') + ' '\
|
msg = (_('Your wallet is encrypted. Use this dialog to change your password.') + ' '\
|
||||||
+_('To disable wallet encryption, enter an empty new password.')) \
|
+_('To disable wallet encryption, enter an empty new password.')) \
|
||||||
if wallet.use_encryption else _('Your wallet keys are not encrypted')
|
if wallet.use_encryption else _('Your wallet keys are not encrypted')
|
||||||
make_password_dialog(self, wallet, msg)
|
self.setLayout(make_password_dialog(self, wallet, msg))
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
|
Loading…
Reference in New Issue