commit dabeae9f9508a1a59b86c2e8fef81327b0ee688d
parent 7a1af24eda848e025c8f830ace77065d898db67f
Author: ThomasV <thomasv@electrum.org>
Date: Tue, 14 Jun 2016 11:16:57 +0200
multisig wizard: use sliders
Diffstat:
1 file changed, 23 insertions(+), 16 deletions(-)
diff --git a/gui/qt/installwizard.py b/gui/qt/installwizard.py
@@ -352,32 +352,39 @@ class InstallWizard(QDialog, MessageBoxMixin, WizardBase):
def query_multisig(self, action):
cw = CosignWidget(2, 2)
- m_edit = QSpinBox()
- n_edit = QSpinBox()
- m_edit.setValue(2)
- n_edit.setValue(2)
+ m_edit = QSlider(Qt.Horizontal, self)
+ n_edit = QSlider(Qt.Horizontal, self)
n_edit.setMinimum(2)
n_edit.setMaximum(15)
m_edit.setMinimum(1)
m_edit.setMaximum(2)
- n_edit.valueChanged.connect(m_edit.setMaximum)
-
- n_edit.valueChanged.connect(cw.set_n)
- m_edit.valueChanged.connect(cw.set_m)
+ n_edit.setValue(2)
+ m_edit.setValue(2)
- hbox = QHBoxLayout()
- hbox.addWidget(QLabel(_('Require')))
- hbox.addWidget(m_edit)
- hbox.addWidget(QLabel(_('of')))
- hbox.addWidget(n_edit)
- hbox.addWidget(QLabel(_('signatures')))
- hbox.addStretch(1)
+ n_label = QLabel()
+ m_label = QLabel()
+ grid = QGridLayout()
+ grid.addWidget(n_label, 0, 0)
+ grid.addWidget(n_edit, 0, 1)
+ grid.addWidget(m_label, 1, 0)
+ grid.addWidget(m_edit, 1, 1)
+ def on_m(m):
+ m_label.setText(_('Require %d signatures')%m)
+ cw.set_m(m)
+ def on_n(n):
+ n_label.setText(_('From %d cosigners')%n)
+ cw.set_n(n)
+ m_edit.setMaximum(n)
+ n_edit.valueChanged.connect(on_n)
+ m_edit.valueChanged.connect(on_m)
+ on_n(2)
+ on_m(2)
vbox = QVBoxLayout()
vbox.addWidget(cw)
vbox.addWidget(WWLabel(_("Choose the number of signatures needed "
"to unlock funds in your wallet:")))
- vbox.addLayout(hbox)
+ vbox.addLayout(grid)
self.set_main_layout(vbox, _("Multi-Signature Wallet"))
m = int(m_edit.value())
n = int(n_edit.value())