def add_send_edit(self): self.send_fiat_e = AmountEdit(self.fiat_unit) btc_e = self.win.amount_e fee_e = self.win.fee_e self.connect_fields(btc_e, self.send_fiat_e, fee_e) self.win.send_grid.addWidget(self.send_fiat_e, 4, 3, Qt.AlignHCenter) btc_e.frozen.connect( lambda: self.send_fiat_e.setFrozen(btc_e.isReadOnly()))
def auth_dialog(self): d = QDialog(self.window) d.setModal(1) vbox = QVBoxLayout(d) pw = AmountEdit(None, is_int=True) msg = _('Please enter your Google Authenticator code') vbox.addWidget(QLabel(msg)) grid = QGridLayout() grid.setSpacing(8) grid.addWidget(QLabel(_('Code')), 1, 0) grid.addWidget(pw, 1, 1) vbox.addLayout(grid) vbox.addLayout(Buttons(CancelButton(d), OkButton(d))) if not d.exec_(): return return pw.get_amount()
def setup_google_auth(self, window, _id, otp_secret): vbox = QVBoxLayout() window.set_layout(vbox) if otp_secret is not None: uri = "otpauth://totp/%s?secret=%s" % ('trustedcoin.com', otp_secret) vbox.addWidget( QLabel("Please scan this QR code in Google Authenticator.")) qrw = QRCodeWidget(uri) vbox.addWidget(qrw, 1) msg = _('Then, enter your Google Authenticator code:') else: label = QLabel( "This wallet is already registered, but it was never authenticated. To finalize your registration, please enter your Google Authenticator Code. If you do not have this code, delete the wallet file and start a new registration" ) label.setWordWrap(1) vbox.addWidget(label) msg = _('Google Authenticator code:') hbox = QHBoxLayout() hbox.addWidget(QLabel(msg)) pw = AmountEdit(None, is_int=True) pw.setFocus(True) hbox.addWidget(pw) hbox.addStretch(1) vbox.addLayout(hbox) b = OkButton(window, _('Next')) b.setEnabled(False) vbox.addLayout(Buttons(CancelButton(window), b)) pw.textChanged.connect(lambda: b.setEnabled(len(pw.text()) == 6)) while True: if not window.exec_(): return False otp = pw.get_amount() try: server.auth(_id, otp) return True except: QMessageBox.information(self.window, _('Message'), _('Incorrect password'), _('OK')) pw.setText('')
def add_receive_edit(self): self.receive_fiat_e = AmountEdit(self.fiat_unit) btc_e = self.win.receive_amount_e self.connect_fields(btc_e, self.receive_fiat_e, None) self.win.receive_grid.addWidget(self.receive_fiat_e, 2, 3, Qt.AlignHCenter)