def _name_multisig_account(self): dialog = WindowModalDialog(None, "Create Multisig Account") vbox = QVBoxLayout() label = QLabel( _( "Enter a descriptive name for your multisig account.\nYou should later be able to use the name to uniquely identify this multisig account" ) ) hl = QHBoxLayout() hl.addWidget(label) name = QLineEdit() name.setMaxLength(30) name.resize(200, 40) he = QHBoxLayout() he.addWidget(name) okButton = OkButton(dialog) hlb = QHBoxLayout() hlb.addWidget(okButton) hlb.addStretch(2) vbox.addLayout(hl) vbox.addLayout(he) vbox.addLayout(hlb) dialog.setLayout(vbox) dialog.exec_() return name.text().strip()
def passphrase_dialog(self, msg, confirm): # If confirm is true, require the user to enter the passphrase twice parent = self.top_level_window() d = WindowModalDialog(parent, _("Enter Passphrase")) if confirm: OK_button = OkButton(d) playout = PasswordLayout(msg=msg, kind=PW_PASSPHRASE, OK_button=OK_button) vbox = QVBoxLayout() vbox.addLayout(playout.layout()) vbox.addLayout(Buttons(CancelButton(d), OK_button)) d.setLayout(vbox) passphrase = playout.new_password() if d.exec_() else None else: pw = QLineEdit() pw.setEchoMode(2) pw.setMinimumWidth(200) vbox = QVBoxLayout() vbox.addWidget(WWLabel(msg)) vbox.addWidget(pw) vbox.addLayout(Buttons(CancelButton(d), OkButton(d))) d.setLayout(vbox) passphrase = pw.text() if d.exec_() else None self.passphrase = passphrase self.done.set()
def pin_dialog(self, msg, show_strength): # Needed e.g. when resetting a device self.clear_dialog() dialog = WindowModalDialog(self.top_level_window(), _("Enter PIN")) matrix = self.pin_matrix_widget_class(show_strength) vbox = QVBoxLayout() vbox.addWidget(QLabel(msg)) vbox.addWidget(matrix) vbox.addLayout(Buttons(CancelButton(dialog), OkButton(dialog))) dialog.setLayout(vbox) dialog.exec_() self.response = str(matrix.get_value()) self.done.set()
def passphrase_dialog(self, msg, confirm): # If confirm is true, require the user to enter the passphrase twice parent = self.top_level_window() d = WindowModalDialog(parent, _('Enter Passphrase')) OK_button = OkButton(d, _('Enter Passphrase')) OnDevice_button = QPushButton(_('Enter Passphrase on Device')) new_pw = PasswordLineEdit() conf_pw = PasswordLineEdit() vbox = QVBoxLayout() label = QLabel(msg + "\n") label.setWordWrap(True) grid = QGridLayout() grid.setSpacing(8) grid.setColumnMinimumWidth(0, 150) grid.setColumnMinimumWidth(1, 100) grid.setColumnStretch(1, 1) vbox.addWidget(label) grid.addWidget(QLabel(_('Passphrase:')), 0, 0) grid.addWidget(new_pw, 0, 1) if confirm: grid.addWidget(QLabel(_('Confirm Passphrase:')), 1, 0) grid.addWidget(conf_pw, 1, 1) vbox.addLayout(grid) def enable_OK(): if not confirm: ok = True else: ok = new_pw.text() == conf_pw.text() OK_button.setEnabled(ok) new_pw.textChanged.connect(enable_OK) conf_pw.textChanged.connect(enable_OK) vbox.addWidget(OK_button) if self.passphrase_on_device: vbox.addWidget(OnDevice_button) d.setLayout(vbox) self.passphrase = None def ok_clicked(): self.passphrase = new_pw.text() def on_device_clicked(): self.passphrase = PASSPHRASE_ON_DEVICE OK_button.clicked.connect(ok_clicked) OnDevice_button.clicked.connect(on_device_clicked) OnDevice_button.clicked.connect(d.accept) d.exec_() self.done.set()