コード例 #1
0
ファイル: installwizard.py プロジェクト: nordcz/electrum
    def seed_dialog(self, is_restore=True):
        d = QDialog()
        d.setModal(1)

        vbox = QVBoxLayout()
        if is_restore:
            msg = _("Please enter your wallet seed (or your master public key if you want to create a watching-only wallet)." + ' ')
        else:
            msg = _("Your seed is important! To make sure that you have properly saved your seed, please type it here." + ' ')

        msg += _("Your seed can be entered as a sequence of words, or as a hexadecimal string."+ '\n')
        
        label=QLabel(msg)
        label.setWordWrap(True)
        vbox.addWidget(label)

        seed_e = QTextEdit()
        seed_e.setMaximumHeight(100)
        vbox.addWidget(seed_e)

        if is_restore:
            grid = QGridLayout()
            grid.setSpacing(8)
            gap_e = AmountEdit(None, True)
            gap_e.setText("5")
            grid.addWidget(QLabel(_('Gap limit')), 2, 0)
            grid.addWidget(gap_e, 2, 1)
            grid.addWidget(HelpButton(_('Keep the default value unless you modified this parameter in your wallet.')), 2, 3)
            vbox.addLayout(grid)

        vbox.addLayout(ok_cancel_buttons(d, _('Next')))
        d.setLayout(vbox) 

        if not d.exec_(): return

        try:
            seed = str(seed_e.toPlainText())
            seed.decode('hex')
        except:
            try:
                seed = mnemonic.mn_decode( seed.split() )
            except:
                QMessageBox.warning(None, _('Error'), _('I cannot decode this'), _('OK'))
                return

        if not seed:
            QMessageBox.warning(None, _('Error'), _('No seed'), _('OK'))
            return

        if not is_restore:
            return seed
        else:
            try:
                gap = int(unicode(gap_e.text()))
            except:
                QMessageBox.warning(None, _('Error'), 'error', 'OK')
                return
            return seed, gap
コード例 #2
0
ファイル: installwizard.py プロジェクト: nordcz/electrum
    def mpk_dialog(self):
        d = QDialog()
        d.setModal(1)

        vbox = QVBoxLayout()
        msg = _("Please enter your master public key.")

        label = QLabel(msg)
        label.setWordWrap(True)
        vbox.addWidget(label)

        mpk_e = QTextEdit()
        mpk_e.setMaximumHeight(100)
        vbox.addWidget(mpk_e)

        grid = QGridLayout()
        grid.setSpacing(8)
        gap_e = AmountEdit(None, True)
        gap_e.setText("5")
        grid.addWidget(QLabel(_('Gap limit')), 2, 0)
        grid.addWidget(gap_e, 2, 1)
        grid.addWidget(
            HelpButton(
                _('Keep the default value unless you modified this parameter in your wallet.'
                  )), 2, 3)
        vbox.addLayout(grid)

        vbox.addLayout(ok_cancel_buttons(d, _('Next')))
        d.setLayout(vbox)

        if not d.exec_(): return

        mpk = str(mpk_e.toPlainText())

        try:
            gap = int(unicode(gap_e.text()))
        except:
            QMessageBox.warning(None, _('Error'), 'error', 'OK')
            return

        return mpk, gap
コード例 #3
0
ファイル: installwizard.py プロジェクト: nordcz/electrum
    def mpk_dialog(self):
        d = QDialog()
        d.setModal(1)

        vbox = QVBoxLayout()
        msg = _("Please enter your master public key.")

        label=QLabel(msg)
        label.setWordWrap(True)
        vbox.addWidget(label)

        mpk_e = QTextEdit()
        mpk_e.setMaximumHeight(100)
        vbox.addWidget(mpk_e)

        grid = QGridLayout()
        grid.setSpacing(8)
        gap_e = AmountEdit(None, True)
        gap_e.setText("5")
        grid.addWidget(QLabel(_('Gap limit')), 2, 0)
        grid.addWidget(gap_e, 2, 1)
        grid.addWidget(HelpButton(_('Keep the default value unless you modified this parameter in your wallet.')), 2, 3)
        vbox.addLayout(grid)

        vbox.addLayout(ok_cancel_buttons(d, _('Next')))
        d.setLayout(vbox) 

        if not d.exec_(): return

        mpk = str(mpk_e.toPlainText())

        try:
            gap = int(unicode(gap_e.text()))
        except:
            QMessageBox.warning(None, _('Error'), 'error', 'OK')
            return

        return mpk, gap
コード例 #4
0
ファイル: installwizard.py プロジェクト: nordcz/electrum
    def seed_dialog(self, is_restore=True):
        d = QDialog()
        d.setModal(1)

        vbox = QVBoxLayout()
        if is_restore:
            msg = _(
                "Please enter your wallet seed (or your master public key if you want to create a watching-only wallet)."
                + ' ')
        else:
            msg = _(
                "Your seed is important! To make sure that you have properly saved your seed, please type it here."
                + ' ')

        msg += _(
            "Your seed can be entered as a sequence of words, or as a hexadecimal string."
            + '\n')

        label = QLabel(msg)
        label.setWordWrap(True)
        vbox.addWidget(label)

        seed_e = QTextEdit()
        seed_e.setMaximumHeight(100)
        vbox.addWidget(seed_e)

        if is_restore:
            grid = QGridLayout()
            grid.setSpacing(8)
            gap_e = AmountEdit(None, True)
            gap_e.setText("5")
            grid.addWidget(QLabel(_('Gap limit')), 2, 0)
            grid.addWidget(gap_e, 2, 1)
            grid.addWidget(
                HelpButton(
                    _('Keep the default value unless you modified this parameter in your wallet.'
                      )), 2, 3)
            vbox.addLayout(grid)

        vbox.addLayout(ok_cancel_buttons(d, _('Next')))
        d.setLayout(vbox)

        if not d.exec_(): return

        try:
            seed = str(seed_e.toPlainText())
            seed.decode('hex')
        except:
            try:
                seed = mnemonic.mn_decode(seed.split())
            except:
                QMessageBox.warning(None, _('Error'),
                                    _('I cannot decode this'), _('OK'))
                return

        if not seed:
            QMessageBox.warning(None, _('Error'), _('No seed'), _('OK'))
            return

        if not is_restore:
            return seed
        else:
            try:
                gap = int(unicode(gap_e.text()))
            except:
                QMessageBox.warning(None, _('Error'), 'error', 'OK')
                return
            return seed, gap