예제 #1
0
    def __init__(self, parent):
        super(MatrixDialog, self).__init__(parent)
        self.setWindowTitle(_("Trezor Matrix Recovery"))
        self.setWindowIcon(read_QIcon("electrum-sv.png"))
        self.num = 9
        self.loop = QEventLoop()

        vbox = QVBoxLayout(self)
        vbox.addWidget(WWLabel(MATRIX_RECOVERY))

        grid = QGridLayout()
        grid.setSpacing(0)
        self.char_buttons = []
        for y in range(3):
            for x in range(3):
                button = QPushButton('?')
                button.clicked.connect(
                    partial(self.process_key,
                            ord('1') + y * 3 + x))
                grid.addWidget(button, 3 - y, x)
                self.char_buttons.append(button)
        vbox.addLayout(grid)

        self.backspace_button = QPushButton("<=")
        self.backspace_button.clicked.connect(
            partial(self.process_key, Qt.Key_Backspace))
        self.cancel_button = QPushButton(_("Cancel"))
        self.cancel_button.clicked.connect(
            partial(self.process_key, Qt.Key_Escape))
        buttons = Buttons(self.backspace_button, self.cancel_button)
        vbox.addSpacing(40)
        vbox.addLayout(buttons)
        self.refresh()
        self.show()
예제 #2
0
    def replace_gui_handler(self, window, keystore):
        handler = self.create_handler(window)
        keystore.handler = handler
        keystore.plugin = self

        tooltip = keystore.label or _('Unnamed')
        action = QAction(read_QIcon(self.icon_unpaired), tooltip, window)
        action.triggered.connect(
            partial(self.show_settings_wrapped, window, keystore))
        window.toolbar.addAction(action)
        handler.action = action
        handler.icon_unpaired = self.icon_unpaired
        handler.icon_paired = self.icon_paired
예제 #3
0
    def replace_gui_handler(self, window, keystore):
        handler = self.create_handler(window)
        keystore.handler = handler
        keystore.plugin = self

        action_label = keystore.label.strip() or _('Unnamed')
        action = QAction(read_QIcon(self.icon_unpaired), action_label, window)
        action.triggered.connect(
            partial(self.show_settings_wrapped, window, keystore))
        action.setToolTip(_("Hardware Wallet"))
        window.add_toolbar_action(action)
        handler.action = action
        handler.icon_unpaired = self.icon_unpaired
        handler.icon_paired = self.icon_paired
예제 #4
0
파일: qt.py 프로젝트: spilop/electrumsv
    def replace_gui_handler(self, window: ElectrumWindow, keystore: Hardware_KeyStore):
        handler = self.create_handler(window)
        keystore.handler = handler # type: ignore
        keystore.plugin = self # type: ignore

        action_label = _('Unnamed')
        if keystore.label and keystore.label.strip():
            action_label = keystore.label.strip()
        action = QAction(read_QIcon(self.icon_unpaired), action_label, window)
        action.triggered.connect(partial(self.show_settings_wrapped, weakref.proxy(window),
            keystore))
        action.setToolTip(_("Hardware Wallet"))
        window.add_toolbar_action(action)
        handler.action = action
        handler.icon_unpaired = self.icon_unpaired
        handler.icon_paired = self.icon_paired
예제 #5
0
    def __init__(self):
        super().__init__()

        self.setWindowTitle('ElectrumSV - ' + _('Update Check'))
        self.setWindowIcon(read_QIcon("electrum-sv.png"))
        self.resize(600, 400)

        widget: QWidget = read_qt_ui("updater_widget.ui")

        layout: QVBoxLayout = widget.findChild(QVBoxLayout, "vertical_layout")
        self._title_label: QLabel = widget.findChild(QLabel, "title_label")
        self._title_label.setText(_(MSG_TITLE_CHECK))
        self._progressbar: QProgressBar = widget.findChild(QProgressBar)
        self._progressbar.setValue(1)
        self._message_label: QLabel = widget.findChild(QLabel, "message_label")
        self._message_label.setText(_(MSG_BODY_CHECK))
        self._buttonbar: QDialogButtonBox = widget.findChild(QDialogButtonBox)
        self._buttonbar.rejected.connect(self.close)

        self.setLayout(layout)

        self.show()

        # The timer is to update the progress bar while the request is blocking the thread.
        counter = 0
        def _on_timer_event():
            nonlocal counter
            counter += 1
            progress_fraction = counter / (10 * 10)
            self._set_progress(progress_fraction)

        self._timer = QTimer()
        self._timer.timeout.connect(_on_timer_event)
        self._timer.start(1000/10)

        app_state.app.update_check_signal.connect(self._on_update_result)
        app_state.app.update_check()
예제 #6
0
    def __init__(self, parent):
        super(CharacterDialog, self).__init__(parent)
        self.setWindowTitle(_("KeepKey Seed Recovery"))
        self.setWindowIcon(read_QIcon("electrum-sv.png"))
        self.character_pos = 0
        self.word_pos = 0
        self.loop = QEventLoop()
        self.word_help = QLabel()
        self.char_buttons = []

        vbox = QVBoxLayout(self)
        vbox.addWidget(WWLabel(CHARACTER_RECOVERY))
        hbox = QHBoxLayout()
        hbox.addWidget(self.word_help)
        for i in range(4):
            char_button = CharacterButton('*')
            char_button.setMaximumWidth(36)
            self.char_buttons.append(char_button)
            hbox.addWidget(char_button)
        self.accept_button = CharacterButton(_("Accept Word"))
        self.accept_button.clicked.connect(partial(self.process_key, 32))
        self.rejected.connect(partial(self.loop.exit, 1))
        hbox.addWidget(self.accept_button)
        hbox.addStretch(1)
        vbox.addLayout(hbox)

        self.finished_button = QPushButton(_("Seed Entered"))
        self.cancel_button = QPushButton(_("Cancel"))
        self.finished_button.clicked.connect(
            partial(self.process_key, Qt.Key_Return))
        self.cancel_button.clicked.connect(self.rejected)
        buttons = Buttons(self.finished_button, self.cancel_button)
        vbox.addSpacing(40)
        vbox.addLayout(buttons)
        self.refresh()
        self.show()
예제 #7
0
파일: qt.py 프로젝트: jolonf/electrumsv
 def _update_status(self, paired):
     icon = self.icon_paired if paired else self.icon_unpaired
     self.action.setIcon(read_QIcon(icon))
예제 #8
0
    def __init__(self, handler, data):
        '''Ask user for 2nd factor authentication. Support text, security card and paired mobile
        methods.  Use last method from settings, but support new pairing and downgrade.
        '''
        QDialog.__init__(self, handler.top_level_window())
        self.handler = handler
        self.txdata = data
        self.idxs = self.txdata[
            'keycardData'] if self.txdata['confirmationType'] > 1 else ''
        self.setMinimumWidth(600)
        self.setWindowTitle(_("Ledger Wallet Authentication"))
        self.setWindowIcon(read_QIcon("electrum-sv.png"))
        self.cfg = copy.deepcopy(self.handler.win.wallet.get_keystore().cfg)
        self.dongle = self.handler.win.wallet.get_keystore().get_client(
        ).dongle
        self.ws = None
        self.pin = ''

        self.devmode = self.getDevice2FAMode()
        if self.devmode == 0x11 or self.txdata['confirmationType'] == 1:
            self.cfg['mode'] = 0

        vbox = QVBoxLayout()
        self.setLayout(vbox)

        def on_change_mode(idx):
            if idx < 2 and self.ws:
                self.ws.stop()
                self.ws = None
            self.cfg[
                'mode'] = 0 if self.devmode == 0x11 else idx if idx > 0 else 1
            if self.cfg['mode'] > 1 and self.cfg['pair'] and not self.ws:
                self.req_validation()
            if self.cfg['mode'] > 0:
                self.handler.win.wallet.get_keystore().cfg = self.cfg
                self.handler.win.wallet.save_keystore()
            self.update_dlg()

        def add_pairing():
            self.do_pairing()

        def return_pin():
            self.pin = (self.pintxt.text() if self.txdata['confirmationType']
                        == 1 else self.cardtxt.text())
            self.pin.setText('')
            self.cardtxt.setText('')
            if self.cfg['mode'] == 1:
                self.pin = ''.join(chr(int(str(i), 16)) for i in self.pin)
            self.accept()

        self.modebox = QWidget()
        modelayout = QHBoxLayout()
        self.modebox.setLayout(modelayout)
        modelayout.addWidget(QLabel(_("Method:")))
        self.modes = QComboBox()
        modelayout.addWidget(self.modes, 2)
        self.addPair = QPushButton(_("Pair"))
        self.addPair.setMaximumWidth(60)
        modelayout.addWidget(self.addPair)
        modelayout.addStretch(1)
        self.modebox.setMaximumHeight(50)
        vbox.addWidget(self.modebox)

        self.populate_modes()
        self.modes.currentIndexChanged.connect(on_change_mode)
        self.addPair.clicked.connect(add_pairing)

        self.helpmsg = QTextEdit()
        self.helpmsg.setStyleSheet(
            "QTextEdit { background-color: lightgray; }")
        self.helpmsg.setReadOnly(True)
        vbox.addWidget(self.helpmsg)

        self.pinbox = QWidget()
        pinlayout = QHBoxLayout()
        self.pinbox.setLayout(pinlayout)
        self.pintxt = PasswordLineEdit()
        self.pintxt.setMaxLength(4)
        self.pintxt.returnPressed.connect(return_pin)
        pinlayout.addWidget(QLabel(_("Enter PIN:")))
        pinlayout.addWidget(self.pintxt)
        pinlayout.addWidget(QLabel(_("NOT DEVICE PIN - see above")))
        pinlayout.addStretch(1)
        self.pinbox.setVisible(self.cfg['mode'] == 0)
        vbox.addWidget(self.pinbox)

        self.cardbox = QWidget()
        card = QVBoxLayout()
        self.cardbox.setLayout(card)
        self.addrtext = QTextEdit()
        self.addrtext.setStyleSheet(
            "QTextEdit { color:blue; background-color:lightgray; "
            "padding:15px 10px; border:none; font-size:20pt; }")
        self.addrtext.setReadOnly(True)
        self.addrtext.setMaximumHeight(120)
        card.addWidget(self.addrtext)

        def pin_changed(s):
            if len(s) < len(self.idxs):
                i = self.idxs[len(s)]
                addr = self.txdata['address']
                addr = addr[:i] + '<u><b>' + addr[i:i +
                                                  1] + '</u></b>' + addr[i +
                                                                         1:]
                self.addrtext.setHtml(str(addr))
            else:
                self.addrtext.setHtml(_("Press Enter"))

        pin_changed('')
        cardpin = QHBoxLayout()
        cardpin.addWidget(QLabel(_("Enter PIN:")))
        self.cardtxt = PasswordLineEdit()
        self.cardtxt.setMaxLength(len(self.idxs))
        self.cardtxt.textChanged.connect(pin_changed)
        self.cardtxt.returnPressed.connect(return_pin)
        cardpin.addWidget(self.cardtxt)
        cardpin.addWidget(QLabel(_("NOT DEVICE PIN - see above")))
        cardpin.addStretch(1)
        card.addLayout(cardpin)
        self.cardbox.setVisible(self.cfg['mode'] == 1)
        vbox.addWidget(self.cardbox)

        self.pairbox = QWidget()
        pairlayout = QVBoxLayout()
        self.pairbox.setLayout(pairlayout)
        pairhelp = QTextEdit(helpTxt[5])
        pairhelp.setStyleSheet("QTextEdit { background-color: lightgray; }")
        pairhelp.setReadOnly(True)
        pairlayout.addWidget(pairhelp, 1)
        self.pairqr = QRCodeWidget()
        pairlayout.addWidget(self.pairqr, 4)
        self.pairbox.setVisible(False)
        vbox.addWidget(self.pairbox)
        self.update_dlg()

        if self.cfg['mode'] > 1 and not self.ws:
            self.req_validation()