コード例 #1
0
    def add_io(self, vbox):

        if self.tx.locktime > 0:
            vbox.addWidget(QLabel("LockTime: %d\n" % self.tx.locktime))

        vbox.addWidget(QLabel(_("Inputs")))

        def format_input(x):
            if x.get('is_coinbase'):
                return 'coinbase'
            else:
                _hash = x.get('prevout_hash')
                return _hash[0:16] + '...' + _hash[-8:] + ":%d" % x.get(
                    'prevout_n') + u'\t' + "%s" % x.get('address')

        lines = map(format_input, self.tx.inputs)
        i_text = QTextEdit()
        i_text.setText('\n'.join(lines))
        i_text.setReadOnly(True)
        i_text.setMaximumHeight(100)
        vbox.addWidget(i_text)

        vbox.addWidget(QLabel(_("Outputs")))
        lines = map(lambda x: x[1] + u'\t\t' + self.parent.format_amount(x[2]),
                    self.tx.get_outputs())
        o_text = QTextEdit()
        o_text.setText('\n'.join(lines))
        o_text.setReadOnly(True)
        o_text.setMaximumHeight(100)
        vbox.addWidget(o_text)
コード例 #2
0
    def mouseReleaseEvent(self, event):
        dialog = QDialog(self)
        dialog.setWindowTitle(_('Electrum update'))
        dialog.setModal(1)

        main_layout = QGridLayout()
        main_layout.addWidget(QLabel(_("A new version of Electrum is available:")+" " + self.latest_version), 0,0,1,3)
        
        ignore_version = QPushButton(_("Ignore this version"))
        ignore_version.clicked.connect(self.ignore_this_version)

        ignore_all_versions = QPushButton(_("Ignore all versions"))
        ignore_all_versions.clicked.connect(self.ignore_all_version)

        open_website = QPushButton(_("Goto download page"))
        open_website.clicked.connect(self.open_website)

        main_layout.addWidget(ignore_version, 1, 0)
        main_layout.addWidget(ignore_all_versions, 1, 1)
        main_layout.addWidget(open_website, 1, 2)

        dialog.setLayout(main_layout)

        self.dialog = dialog
        
        if not dialog.exec_(): return
コード例 #3
0
ファイル: __init__.py プロジェクト: Geopay/electrum-nvc
 def build_tray_menu(self):
     m = QMenu()
     m.addAction(_("Show/Hide"), self.show_or_hide)
     m.addAction(_("Dark/Light"), self.toggle_tray_icon)
     m.addSeparator()
     m.addAction(_("Exit Electrum"), self.close)
     self.tray.setContextMenu(m)
コード例 #4
0
    def __init__(self, transaction_id, parent):
        super(TransactionWindow, self).__init__()

        self.tx_id = str(transaction_id)
        self.parent = parent

        self.setModal(True)
        self.resize(200, 100)
        self.setWindowTitle(_("Transaction successfully sent"))

        self.layout = QGridLayout(self)
        history_label = "%s\n%s" % (
            _("Your transaction has been sent."),
            _("Please enter a label for this transaction for future reference."
              ))
        self.layout.addWidget(QLabel(history_label))

        self.label_edit = QLineEdit()
        self.label_edit.setPlaceholderText(_("Transaction label"))
        self.label_edit.setObjectName("label_input")
        self.label_edit.setAttribute(Qt.WA_MacShowFocusRect, 0)
        self.label_edit.setFocusPolicy(Qt.ClickFocus)
        self.layout.addWidget(self.label_edit)

        self.save_button = QPushButton(_("Save"))
        self.layout.addWidget(self.save_button)
        self.save_button.clicked.connect(self.set_label)

        self.exec_()
コード例 #5
0
ファイル: qrtextedit.py プロジェクト: Geopay/electrum-nvc
 def contextMenuEvent(self, e):
     m = self.createStandardContextMenu()
     if self.isReadOnly():
         m.addAction(_("Show as QR code"), self.qr_show)
     else:
         m.addAction(_("Read QR code"), self.qr_input)
     m.exec_(e.globalPos())
コード例 #6
0
 def save(self):
     name = 'signed_%s.txn' % (self.tx.hash()[0:8]) if self.tx.is_complete() else 'unsigned.txn'
     fileName = self.parent.getSaveFileName(_("Select where to save your signed transaction"), name, "*.txn")
     if fileName:
         with open(fileName, "w+") as f:
             f.write(json.dumps(self.tx.as_dict(),indent=4) + '\n')
         self.show_message(_("Transaction saved successfully"))
コード例 #7
0
    def context_menu(self):
        view_menu = QMenu()
        themes_menu = view_menu.addMenu(_("&Themes"))
        selected_theme = self.actuator.selected_theme()
        theme_group = QActionGroup(self)
        for theme_name in self.actuator.theme_names():
            theme_action = themes_menu.addAction(theme_name)
            theme_action.setCheckable(True)
            if selected_theme == theme_name:
                theme_action.setChecked(True)
            class SelectThemeFunctor:
                def __init__(self, theme_name, toggle_theme):
                    self.theme_name = theme_name
                    self.toggle_theme = toggle_theme
                def __call__(self, checked):
                    if checked:
                        self.toggle_theme(self.theme_name)
            delegate = SelectThemeFunctor(theme_name, self.toggle_theme)
            theme_action.toggled.connect(delegate)
            theme_group.addAction(theme_action)
        view_menu.addSeparator()

        show_receiving = view_menu.addAction(_("Show Receiving addresses"))
        show_receiving.setCheckable(True)
        show_receiving.toggled.connect(self.toggle_receiving_layout)
        show_receiving.setChecked(self.config.get("gui_show_receiving",False))

        show_history = view_menu.addAction(_("Show History"))
        show_history.setCheckable(True)
        show_history.toggled.connect(self.show_history)
        show_history.setChecked(self.config.get("gui_show_history",False))

        return view_menu
コード例 #8
0
    def __init__(self, transaction_id, parent):
        super(TransactionWindow, self).__init__()

        self.tx_id = str(transaction_id)
        self.parent = parent

        self.setModal(True)
        self.resize(200,100)
        self.setWindowTitle(_("Transaction successfully sent"))

        self.layout = QGridLayout(self)
        history_label = "%s\n%s" % (_("Your transaction has been sent."), _("Please enter a label for this transaction for future reference."))
        self.layout.addWidget(QLabel(history_label))

        self.label_edit = QLineEdit()
        self.label_edit.setPlaceholderText(_("Transaction label"))
        self.label_edit.setObjectName("label_input")
        self.label_edit.setAttribute(Qt.WA_MacShowFocusRect, 0)
        self.label_edit.setFocusPolicy(Qt.ClickFocus)
        self.layout.addWidget(self.label_edit)

        self.save_button = QPushButton(_("Save"))
        self.layout.addWidget(self.save_button)
        self.save_button.clicked.connect(self.set_label)

        self.exec_()
コード例 #9
0
    def add_io(self, vbox):

        if self.tx.locktime > 0:
            vbox.addWidget(QLabel("LockTime: %d\n" % self.tx.locktime))

        vbox.addWidget(QLabel(_("Inputs")))
        def format_input(x):
            if x.get('is_coinbase'):
                return 'coinbase'
            else:
                _hash = x.get('prevout_hash')
                return _hash[0:16] + '...' + _hash[-8:] + ":%d"%x.get('prevout_n') + u'\t' + "%s"%x.get('address')
        lines = map(format_input, self.tx.inputs )
        i_text = QTextEdit()
        i_text.setText('\n'.join(lines))
        i_text.setReadOnly(True)
        i_text.setMaximumHeight(100)
        vbox.addWidget(i_text)

        vbox.addWidget(QLabel(_("Outputs")))
        lines = map(lambda x: x[1] + u'\t\t' + self.parent.format_amount(x[2]), self.tx.get_outputs())
        o_text = QTextEdit()
        o_text.setText('\n'.join(lines))
        o_text.setReadOnly(True)
        o_text.setMaximumHeight(100)
        vbox.addWidget(o_text)
コード例 #10
0
    def mouseReleaseEvent(self, event):
        dialog = QDialog(self)
        dialog.setWindowTitle(_('Electrum update'))
        dialog.setModal(1)

        main_layout = QGridLayout()
        main_layout.addWidget(
            QLabel(
                _("A new version of Electrum is available:") + " " +
                self.latest_version), 0, 0, 1, 3)

        ignore_version = QPushButton(_("Ignore this version"))
        ignore_version.clicked.connect(self.ignore_this_version)

        ignore_all_versions = QPushButton(_("Ignore all versions"))
        ignore_all_versions.clicked.connect(self.ignore_all_version)

        open_website = QPushButton(_("Goto download page"))
        open_website.clicked.connect(self.open_website)

        main_layout.addWidget(ignore_version, 1, 0)
        main_layout.addWidget(ignore_all_versions, 1, 1)
        main_layout.addWidget(open_website, 1, 2)

        dialog.setLayout(main_layout)

        self.dialog = dialog

        if not dialog.exec_(): return
コード例 #11
0
 def ignore_this_version(self):
     self.setText("")
     self.config.set_key("last_seen_version", self.latest_version, True)
     QMessageBox.information(
         self, _("Preference saved"),
         _("Notifications about this update will not be shown again."))
     self.dialog.done(0)
コード例 #12
0
 def ignore_all_version(self):
     self.setText("")
     self.config.set_key("last_seen_version", "9.9.9", True)
     QMessageBox.information(
         self, _("Preference saved"),
         _("No more notifications about version updates will be shown."))
     self.dialog.done(0)
コード例 #13
0
 def save(self):
     name = 'signed_%s.txn' % (
         self.tx.hash()[0:8]) if self.tx.is_complete() else 'unsigned.txn'
     fileName = self.parent.getSaveFileName(
         _("Select where to save your signed transaction"), name, "*.txn")
     if fileName:
         with open(fileName, "w+") as f:
             f.write(json.dumps(self.tx.as_dict(), indent=4) + '\n')
         self.show_message(_("Transaction saved successfully"))
コード例 #14
0
    def verify_seed(self, seed, sid):
        r = self.enter_seed_dialog(MSG_VERIFY_SEED, sid)
        if not r:
            return

        if r != seed:
            QMessageBox.warning(None, _('Error'), _('Incorrect seed'), _('OK'))
            return False
        else:
            return True
コード例 #15
0
def ok_cancel_buttons(dialog):
    row_layout = QHBoxLayout()
    row_layout.addStretch(1)
    ok_button = QPushButton(_("OK"))
    row_layout.addWidget(ok_button)
    ok_button.clicked.connect(dialog.accept)
    cancel_button = QPushButton(_("Cancel"))
    row_layout.addWidget(cancel_button)
    cancel_button.clicked.connect(dialog.reject)
    return row_layout
コード例 #16
0
def ok_cancel_buttons(dialog):
    row_layout = QHBoxLayout()
    row_layout.addStretch(1)
    ok_button = QPushButton(_("OK"))
    row_layout.addWidget(ok_button)
    ok_button.clicked.connect(dialog.accept)
    cancel_button = QPushButton(_("Cancel"))
    row_layout.addWidget(cancel_button)
    cancel_button.clicked.connect(dialog.reject)
    return row_layout
コード例 #17
0
ファイル: installwizard.py プロジェクト: Geopay/electrum-nvc
    def verify_seed(self, seed, sid):
        r = self.enter_seed_dialog(MSG_VERIFY_SEED, sid)
        if not r:
            return

        if r != seed:
            QMessageBox.warning(None, _('Error'), _('Incorrect seed'), _('OK'))
            return False
        else:
            return True
コード例 #18
0
ファイル: util.py プロジェクト: CryptoManiac/electrum-nvc
def ok_cancel_buttons2(dialog, ok_label=_("OK") ):
    hbox = QHBoxLayout()
    hbox.addStretch(1)
    b = QPushButton(_("Cancel"))
    hbox.addWidget(b)
    b.clicked.connect(dialog.reject)
    b = QPushButton(ok_label)
    hbox.addWidget(b)
    b.clicked.connect(dialog.accept)
    b.setDefault(True)
    return hbox, b
コード例 #19
0
    def __init__(self, owner=None):
        self.owner = owner
        self.editing = False

        QTreeWidget.__init__(self, owner)
        self.setColumnCount(3)
        self.setHeaderLabels([_("Address"), _("Label"), _("Used")])
        self.setIndentation(0)

        self.hide_used = True
        self.setColumnHidden(2, True)
コード例 #20
0
ファイル: util.py プロジェクト: CryptoManiac/electrum-nvc
    def close(self):
        self.d.accept()
        if self.error:
            QMessageBox.warning(self.parent, _('Error'), self.error, _('OK'))
            return

        if self.on_complete:
            if type(self.result) is tuple:
                self.on_complete(*self.result)
            else:
                self.on_complete(self.result)
コード例 #21
0
    def __init__(self, owner=None):
        self.owner = owner
        self.editing = False

        QTreeWidget.__init__(self, owner)
        self.setColumnCount(3)
        self.setHeaderLabels([_("Address"), _("Label"), _("Used")])
        self.setIndentation(0)

        self.hide_used = True
        self.setColumnHidden(2, True)
コード例 #22
0
ファイル: history_widget.py プロジェクト: Geopay/electrum-nvc
 def append(self, address, amount, date):
     if address is None:
         address = _("Unknown")
     if amount is None:
         amount = _("Unknown")
     if date is None:
         date = _("Unknown")
     item = QTreeWidgetItem([amount, address, date])
     if float(amount) < 0:
         item.setForeground(0, QBrush(QColor("#BC1E1E")))
     self.insertTopLevelItem(0, item)
コード例 #23
0
ファイル: seed_dialog.py プロジェクト: Geopay/electrum-nvc
 def __init__(self, parent, seed, imported_keys):
     QDialog.__init__(self, parent)
     self.setModal(1)
     self.setMinimumWidth(400)
     self.setWindowTitle('Electrum' + ' - ' + _('Seed'))
     vbox = show_seed_box(seed)
     if imported_keys:
         vbox.addWidget(
             QLabel("<b>" + _("WARNING") + ":</b> " + _(
                 "Your wallet contains imported keys. These keys cannot be recovered from seed."
             ) + "</b><p>"))
     vbox.addLayout(close_button(self))
     self.setLayout(vbox)
コード例 #24
0
ファイル: seed_dialog.py プロジェクト: Geopay/electrum-nvc
def show_seed_box(seed, sid=None):

    save_msg = _("Please save these %d words on paper (order is important)."
                 ) % len(seed.split()) + " "
    qr_msg = _(
        "Your seed is also displayed as QR code, in case you want to transfer it to a mobile phone."
    ) + "<p>"
    warning_msg = "<b>" + _("WARNING") + ":</b> " + _(
        "Never disclose your seed. Never type it on a website.") + "</b><p>"

    if sid is None:
        msg = _("Your wallet generation seed is")
        msg2 = save_msg + " " \
               + _("This seed will allow you to recover your wallet in case of computer failure.") + "<br/>" \
               + warning_msg

    elif sid == 'cold':
        msg = _("Your cold storage seed is")
        msg2 = save_msg + " " \
               + _("This seed will be permanently deleted from your wallet file. Make sure you have saved it before you press 'next'") + " " \

    elif sid == 'hot':
        msg = _("Your hot seed is")
        msg2 = save_msg + " " \
               + _("If you ever need to recover your wallet from seed, you will need both this seed and your cold seed.") + " " \

    label1 = QLabel(msg + ":")
    seed_text = QRTextEdit(seed)
    seed_text.setReadOnly(True)
    seed_text.setMaximumHeight(130)

    label2 = QLabel(msg2)
    label2.setWordWrap(True)

    logo = QLabel()

    logo.setPixmap(QPixmap(icon_filename(sid)).scaledToWidth(56))
    logo.setMaximumWidth(60)

    grid = QGridLayout()
    grid.addWidget(logo, 0, 0)
    grid.addWidget(label1, 0, 1)
    grid.addWidget(seed_text, 1, 0, 1, 2)
    #qrw = QRCodeWidget(seed)
    #grid.addWidget(qrw, 0, 2, 2, 1)
    vbox = QVBoxLayout()
    vbox.addLayout(grid)
    vbox.addWidget(label2)
    vbox.addStretch(1)

    return vbox
コード例 #25
0
    def setup(self, address):
        label = QLabel(_("Copied your Novacoin address to the clipboard!"))
        address_display = QLineEdit(address)
        address_display.setReadOnly(True)
        resize_line_edit_width(address_display, address)

        main_layout = QVBoxLayout(self)
        main_layout.addWidget(label)
        main_layout.addWidget(address_display)

        self.setMouseTracking(True)
        self.setWindowTitle("Electrum - " + _("Receive Novacoin payment"))
        self.setWindowFlags(Qt.Window | Qt.FramelessWindowHint
                            | Qt.MSWindowsFixedSizeDialogHint)
        self.layout().setSizeConstraint(QLayout.SetFixedSize)
コード例 #26
0
    def setup(self, address):
        label = QLabel(_("Copied your Novacoin address to the clipboard!"))
        address_display = QLineEdit(address)
        address_display.setReadOnly(True)
        resize_line_edit_width(address_display, address)

        main_layout = QVBoxLayout(self)
        main_layout.addWidget(label)
        main_layout.addWidget(address_display)

        self.setMouseTracking(True)
        self.setWindowTitle("Electrum - " + _("Receive Novacoin payment"))
        self.setWindowFlags(Qt.Window|Qt.FramelessWindowHint|
                            Qt.MSWindowsFixedSizeDialogHint)
        self.layout().setSizeConstraint(QLayout.SetFixedSize)
コード例 #27
0
ファイル: qrcodewidget.py プロジェクト: Geopay/electrum-nvc
    def __init__(self, data, parent=None, title="", show_text=False):
        QDialog.__init__(self, parent)

        d = self
        d.setWindowTitle(title)
        vbox = QVBoxLayout()
        qrw = QRCodeWidget(data)
        vbox.addWidget(qrw, 1)
        if show_text:
            text = QTextEdit()
            text.setText(data)
            text.setReadOnly(True)
            vbox.addWidget(text)
        hbox = QHBoxLayout()
        hbox.addStretch(1)

        config = electrum_nvc.get_config()
        if config:
            filename = os.path.join(config.path, "qrcode.bmp")

            def print_qr():
                bmp.save_qrcode(qrw.qr, filename)
                QMessageBox.information(
                    None, _('Message'),
                    _("QR code saved to file") + " " + filename, _('OK'))

            def copy_to_clipboard():
                bmp.save_qrcode(qrw.qr, filename)
                self.parent().app.clipboard().setImage(QImage(filename))
                QMessageBox.information(None, _('Message'),
                                        _("QR code saved to clipboard"),
                                        _('OK'))

            b = QPushButton(_("Copy"))
            hbox.addWidget(b)
            b.clicked.connect(copy_to_clipboard)

            b = QPushButton(_("Save"))
            hbox.addWidget(b)
            b.clicked.connect(print_qr)

        b = QPushButton(_("Close"))
        hbox.addWidget(b)
        b.clicked.connect(d.accept)
        b.setDefault(True)

        vbox.addLayout(hbox)
        d.setLayout(vbox)
コード例 #28
0
ファイル: installwizard.py プロジェクト: Geopay/electrum-nvc
    def multi_seed_dialog(self, n):
        vbox = QVBoxLayout()
        vbox1, seed_e1 = seed_dialog.enter_seed_box(MSG_ENTER_SEED_OR_MPK,
                                                    'hot')
        vbox.addLayout(vbox1)
        entries = [seed_e1]
        for i in range(n):
            vbox2, seed_e2 = seed_dialog.enter_seed_box(
                MSG_ENTER_SEED_OR_MPK, 'cold')
            vbox.addLayout(vbox2)
            entries.append(seed_e2)
        vbox.addStretch(1)
        hbox, button = ok_cancel_buttons2(self, _('Next'))
        vbox.addLayout(hbox)
        button.setEnabled(False)

        f = lambda: button.setEnabled(
            map(lambda e: self.is_any(e), entries) == [True] * len(entries))
        for e in entries:
            e.textChanged.connect(f)

        self.set_layout(vbox)
        if not self.exec_():
            return
        return map(lambda e: self.get_seed_text(e), entries)
コード例 #29
0
 def __init__(self, change_quote_currency, parent=None):
     super(QLabel, self).__init__(_("Connecting..."), parent)
     self.change_quote_currency = change_quote_currency
     self.state = self.SHOW_CONNECTING
     self.balance_text = ""
     self.amount_text = ""
     self.parent = parent
コード例 #30
0
 def __init__(self, change_quote_currency, parent=None):
     super(QLabel, self).__init__(_("Connecting..."), parent)
     self.change_quote_currency = change_quote_currency
     self.state = self.SHOW_CONNECTING
     self.balance_text = ""
     self.amount_text = ""
     self.parent = parent
コード例 #31
0
ファイル: installwizard.py プロジェクト: Geopay/electrum-nvc
    def network_dialog(self):

        grid = QGridLayout()
        grid.setSpacing(5)

        label = QLabel(_("Electrum communicates with remote servers to get information about your transactions and addresses. The servers all fulfil the same purpose only differing in hardware. In most cases you simply want to let Electrum pick one at random if you have a preference though feel free to select a server manually.") + "\n\n" \
                      + _("How do you want to connect to a server:")+" ")
        label.setWordWrap(True)
        grid.addWidget(label, 0, 0)

        gb = QGroupBox()

        b1 = QRadioButton(gb)
        b1.setText(_("Auto connect"))
        b1.setChecked(True)

        b2 = QRadioButton(gb)
        b2.setText(_("Select server manually"))

        #b3 = QRadioButton(gb)
        #b3.setText(_("Stay offline"))

        grid.addWidget(b1, 1, 0)
        grid.addWidget(b2, 2, 0)
        #grid.addWidget(b3,3,0)

        vbox = QVBoxLayout()
        vbox.addLayout(grid)

        vbox.addStretch(1)
        vbox.addLayout(ok_cancel_buttons(self, _('Next')))

        self.set_layout(vbox)
        if not self.exec_():
            return

        if b2.isChecked():
            return NetworkDialog(self.network, self.config, None).do_exec()

        elif b1.isChecked():
            self.config.set_key('auto_cycle', True, True)
            return

        else:
            self.config.set_key("server", None, True)
            self.config.set_key('auto_cycle', False, True)
            return
コード例 #32
0
    def network_dialog(self):
        
        grid = QGridLayout()
        grid.setSpacing(5)

        label = QLabel(_("Electrum communicates with remote servers to get information about your transactions and addresses. The servers all fulfil the same purpose only differing in hardware. In most cases you simply want to let Electrum pick one at random if you have a preference though feel free to select a server manually.") + "\n\n" \
                      + _("How do you want to connect to a server:")+" ")
        label.setWordWrap(True)
        grid.addWidget(label, 0, 0)

        gb = QGroupBox()

        b1 = QRadioButton(gb)
        b1.setText(_("Auto connect"))
        b1.setChecked(True)

        b2 = QRadioButton(gb)
        b2.setText(_("Select server manually"))

        #b3 = QRadioButton(gb)
        #b3.setText(_("Stay offline"))

        grid.addWidget(b1,1,0)
        grid.addWidget(b2,2,0)
        #grid.addWidget(b3,3,0)

        vbox = QVBoxLayout()
        vbox.addLayout(grid)

        vbox.addStretch(1)
        vbox.addLayout(ok_cancel_buttons(self, _('Next')))

        self.set_layout(vbox)
        if not self.exec_():
            return
        
        if b2.isChecked():
            return NetworkDialog(self.network, self.config, None).do_exec()

        elif b1.isChecked():
            self.config.set_key('auto_cycle', True, True)
            return

        else:
            self.config.set_key("server", None, True)
            self.config.set_key('auto_cycle', False, True)
            return
コード例 #33
0
ファイル: util.py プロジェクト: CryptoManiac/electrum-nvc
def close_button(dialog, label=_("Close") ):
    hbox = QHBoxLayout()
    hbox.addStretch(1)
    b = QPushButton(label)
    hbox.addWidget(b)
    b.clicked.connect(dialog.close)
    b.setDefault(True)
    return hbox
コード例 #34
0
ファイル: seed_dialog.py プロジェクト: Geopay/electrum-nvc
 def __init__(self, parent, seed, imported_keys):
     QDialog.__init__(self, parent)
     self.setModal(1)
     self.setMinimumWidth(400)
     self.setWindowTitle("Electrum" + " - " + _("Seed"))
     vbox = show_seed_box(seed)
     if imported_keys:
         vbox.addWidget(
             QLabel(
                 "<b>"
                 + _("WARNING")
                 + ":</b> "
                 + _("Your wallet contains imported keys. These keys cannot be recovered from seed.")
                 + "</b><p>"
             )
         )
     vbox.addLayout(close_button(self))
     self.setLayout(vbox)
コード例 #35
0
    def __init__(self, data, parent=None, title = "", show_text=False):
        QDialog.__init__(self, parent)

        d = self
        d.setWindowTitle(title)
        vbox = QVBoxLayout()
        qrw = QRCodeWidget(data)
        vbox.addWidget(qrw, 1)
        if show_text:
            text = QTextEdit()
            text.setText(data)
            text.setReadOnly(True)
            vbox.addWidget(text)
        hbox = QHBoxLayout()
        hbox.addStretch(1)

        config = electrum_nvc.get_config()
        if config:
            filename = os.path.join(config.path, "qrcode.bmp")

            def print_qr():
                bmp.save_qrcode(qrw.qr, filename)
                QMessageBox.information(None, _('Message'), _("QR code saved to file") + " " + filename, _('OK'))

            def copy_to_clipboard():
                bmp.save_qrcode(qrw.qr, filename)
                self.parent().app.clipboard().setImage(QImage(filename))
                QMessageBox.information(None, _('Message'), _("QR code saved to clipboard"), _('OK'))

            b = QPushButton(_("Copy"))
            hbox.addWidget(b)
            b.clicked.connect(copy_to_clipboard)

            b = QPushButton(_("Save"))
            hbox.addWidget(b)
            b.clicked.connect(print_qr)

        b = QPushButton(_("Close"))
        hbox.addWidget(b)
        b.clicked.connect(d.accept)
        b.setDefault(True)

        vbox.addLayout(hbox)
        d.setLayout(vbox)
コード例 #36
0
ファイル: util.py プロジェクト: CryptoManiac/electrum-nvc
def filename_field(parent, config, defaultname, select_msg):

    vbox = QVBoxLayout()
    vbox.addWidget(QLabel(_("Format")))
    gb = QGroupBox("format", parent)
    b1 = QRadioButton(gb)
    b1.setText(_("CSV"))
    b1.setChecked(True)
    b2 = QRadioButton(gb)
    b2.setText(_("json"))
    vbox.addWidget(b1)
    vbox.addWidget(b2)
        
    hbox = QHBoxLayout()

    directory = config.get('io_dir', unicode(os.path.expanduser('~')))
    path = os.path.join( directory, defaultname )
    filename_e = QLineEdit()
    filename_e.setText(path)

    def func():
        text = unicode(filename_e.text())
        _filter = "*.csv" if text.endswith(".csv") else "*.json" if text.endswith(".json") else None
        p = unicode( QFileDialog.getSaveFileName(None, select_msg, text, _filter))
        if p:
            filename_e.setText(p)

    button = QPushButton(_('File'))
    button.clicked.connect(func)
    hbox.addWidget(button)
    hbox.addWidget(filename_e)
    vbox.addLayout(hbox)

    def set_csv(v):
        text = unicode(filename_e.text())
        text = text.replace(".json",".csv") if v else text.replace(".csv",".json")
        filename_e.setText(text)

    b1.clicked.connect(lambda: set_csv(True))
    b2.clicked.connect(lambda: set_csv(False))

    return vbox, filename_e, b1
コード例 #37
0
 def enter_seed_dialog(self, msg, sid):
     vbox, seed_e = seed_dialog.enter_seed_box(msg, sid)
     vbox.addStretch(1)
     hbox, button = ok_cancel_buttons2(self, _('Next'))
     vbox.addLayout(hbox)
     button.setEnabled(False)
     seed_e.textChanged.connect(lambda: button.setEnabled(self.is_any(seed_e)))
     self.set_layout(vbox)
     if not self.exec_():
         return
     return self.get_seed_text(seed_e)
コード例 #38
0
    def __init__(self, parent):
        super(QDialog, self).__init__(parent)

        self.setModal(True)

        self.password_input = QLineEdit()
        self.password_input.setEchoMode(QLineEdit.Password)

        main_layout = QVBoxLayout(self)
        message = _('Please enter your password')
        main_layout.addWidget(QLabel(message))

        grid = QGridLayout()
        grid.setSpacing(8)
        grid.addWidget(QLabel(_('Password')), 1, 0)
        grid.addWidget(self.password_input, 1, 1)
        main_layout.addLayout(grid)

        main_layout.addLayout(ok_cancel_buttons(self))
        self.setLayout(main_layout)
コード例 #39
0
    def __init__(self, parent):
        super(QDialog, self).__init__(parent)

        self.setModal(True)

        self.password_input = QLineEdit()
        self.password_input.setEchoMode(QLineEdit.Password)

        main_layout = QVBoxLayout(self)
        message = _('Please enter your password')
        main_layout.addWidget(QLabel(message))

        grid = QGridLayout()
        grid.setSpacing(8)
        grid.addWidget(QLabel(_('Password')), 1, 0)
        grid.addWidget(self.password_input, 1, 1)
        main_layout.addLayout(grid)

        main_layout.addLayout(ok_cancel_buttons(self))
        self.setLayout(main_layout) 
コード例 #40
0
ファイル: installwizard.py プロジェクト: Geopay/electrum-nvc
 def enter_seed_dialog(self, msg, sid):
     vbox, seed_e = seed_dialog.enter_seed_box(msg, sid)
     vbox.addStretch(1)
     hbox, button = ok_cancel_buttons2(self, _('Next'))
     vbox.addLayout(hbox)
     button.setEnabled(False)
     seed_e.textChanged.connect(
         lambda: button.setEnabled(self.is_any(seed_e)))
     self.set_layout(vbox)
     if not self.exec_():
         return
     return self.get_seed_text(seed_e)
コード例 #41
0
 def show_message(self, msg, icon=None):
     vbox = QVBoxLayout()
     self.set_layout(vbox)
     if icon:
         logo = QLabel()
         logo.setPixmap(icon)
         vbox.addWidget(logo)
     vbox.addWidget(QLabel(msg))
     vbox.addStretch(1)
     vbox.addLayout(close_button(self, _('Next')))
     if not self.exec_(): 
         return None
コード例 #42
0
    def waiting_dialog(self, task, msg= _("Electrum is generating your addresses, please wait.")):
        def target():
            task()
            self.emit(QtCore.SIGNAL('accept'))

        vbox = QVBoxLayout()
        self.waiting_label = QLabel(msg)
        vbox.addWidget(self.waiting_label)
        self.set_layout(vbox)
        t = threading.Thread(target = target)
        t.start()
        self.exec_()
コード例 #43
0
ファイル: installwizard.py プロジェクト: Geopay/electrum-nvc
 def show_message(self, msg, icon=None):
     vbox = QVBoxLayout()
     self.set_layout(vbox)
     if icon:
         logo = QLabel()
         logo.setPixmap(icon)
         vbox.addWidget(logo)
     vbox.addWidget(QLabel(msg))
     vbox.addStretch(1)
     vbox.addLayout(close_button(self, _('Next')))
     if not self.exec_():
         return None
コード例 #44
0
 def question(self, msg, icon=None):
     vbox = QVBoxLayout()
     self.set_layout(vbox)
     if icon:
         logo = QLabel()
         logo.setPixmap(icon)
         vbox.addWidget(logo)
     vbox.addWidget(QLabel(msg))
     vbox.addStretch(1)
     vbox.addLayout(ok_cancel_buttons(self, _('OK')))
     if not self.exec_(): 
         return None
     return True
コード例 #45
0
ファイル: installwizard.py プロジェクト: Geopay/electrum-nvc
 def question(self, msg, icon=None):
     vbox = QVBoxLayout()
     self.set_layout(vbox)
     if icon:
         logo = QLabel()
         logo.setPixmap(icon)
         vbox.addWidget(logo)
     vbox.addWidget(QLabel(msg))
     vbox.addStretch(1)
     vbox.addLayout(ok_cancel_buttons(self, _('OK')))
     if not self.exec_():
         return None
     return True
コード例 #46
0
ファイル: util.py プロジェクト: CryptoManiac/electrum-nvc
def address_field(addresses):
    hbox = QHBoxLayout()
    address_e = QLineEdit()
    if addresses:
        address_e.setText(addresses[0])
    def func():
        i = addresses.index(str(address_e.text())) + 1
        i = i % len(addresses)
        address_e.setText(addresses[i])
    button = QPushButton(_('Address'))
    button.clicked.connect(func)
    hbox.addWidget(button)
    hbox.addWidget(address_e)
    return hbox, address_e
コード例 #47
0
    def context_menu(self):
        view_menu = QMenu()
        themes_menu = view_menu.addMenu(_("&Themes"))
        selected_theme = self.actuator.selected_theme()
        theme_group = QActionGroup(self)
        for theme_name in self.actuator.theme_names():
            theme_action = themes_menu.addAction(theme_name)
            theme_action.setCheckable(True)
            if selected_theme == theme_name:
                theme_action.setChecked(True)

            class SelectThemeFunctor:
                def __init__(self, theme_name, toggle_theme):
                    self.theme_name = theme_name
                    self.toggle_theme = toggle_theme

                def __call__(self, checked):
                    if checked:
                        self.toggle_theme(self.theme_name)

            delegate = SelectThemeFunctor(theme_name, self.toggle_theme)
            theme_action.toggled.connect(delegate)
            theme_group.addAction(theme_action)
        view_menu.addSeparator()

        show_receiving = view_menu.addAction(_("Show Receiving addresses"))
        show_receiving.setCheckable(True)
        show_receiving.toggled.connect(self.toggle_receiving_layout)
        show_receiving.setChecked(self.config.get("gui_show_receiving", False))

        show_history = view_menu.addAction(_("Show History"))
        show_history.setCheckable(True)
        show_history.toggled.connect(self.show_history)
        show_history.setChecked(self.config.get("gui_show_history", False))

        return view_menu
コード例 #48
0
ファイル: installwizard.py プロジェクト: Geopay/electrum-nvc
    def waiting_dialog(
        self,
        task,
        msg=_("Electrum is generating your addresses, please wait.")):
        def target():
            task()
            self.emit(QtCore.SIGNAL('accept'))

        vbox = QVBoxLayout()
        self.waiting_label = QLabel(msg)
        vbox.addWidget(self.waiting_label)
        self.set_layout(vbox)
        t = threading.Thread(target=target)
        t.start()
        self.exec_()
コード例 #49
0
 def waiting_dialog(self, f):
     s = Timer()
     s.start()
     w = QDialog()
     w.resize(200, 70)
     w.setWindowTitle('Electrum')
     l = QLabel(_('Sending transaction, please wait.'))
     vbox = QVBoxLayout()
     vbox.addWidget(l)
     w.setLayout(vbox)
     w.show()
     def ff():
         s = f()
         if s: l.setText(s)
         else: w.close()
     w.connect(s, QtCore.SIGNAL('timersignal'), ff)
     w.exec_()
     w.destroy()
コード例 #50
0
    def waiting_dialog(self, f):
        s = Timer()
        s.start()
        w = QDialog()
        w.resize(200, 70)
        w.setWindowTitle('Electrum')
        l = QLabel(_('Sending transaction, please wait.'))
        vbox = QVBoxLayout()
        vbox.addWidget(l)
        w.setLayout(vbox)
        w.show()

        def ff():
            s = f()
            if s: l.setText(s)
            else: w.close()

        w.connect(s, QtCore.SIGNAL('timersignal'), ff)
        w.exec_()
        w.destroy()
コード例 #51
0
 def multi_mpk_dialog(self, xpub_hot, n):
     vbox = QVBoxLayout()
     vbox0, seed_e0 = seed_dialog.enter_seed_box(MSG_SHOW_MPK, 'hot')
     vbox.addLayout(vbox0)
     seed_e0.setText(xpub_hot)
     seed_e0.setReadOnly(True)
     entries = []
     for i in range(n):
         vbox2, seed_e2 = seed_dialog.enter_seed_box(MSG_ENTER_COLD_MPK, 'cold')
         vbox.addLayout(vbox2)
         entries.append(seed_e2)
     vbox.addStretch(1)
     hbox, button = ok_cancel_buttons2(self, _('Next'))
     vbox.addLayout(hbox)
     button.setEnabled(False)
     f = lambda: button.setEnabled( map(lambda e: self.is_xpub(e), entries) == [True]*len(entries))
     for e in entries:
         e.textChanged.connect(f)
     self.set_layout(vbox)
     if not self.exec_():
         return
     return map(lambda e: self.get_seed_text(e), entries)
コード例 #52
0
    def multi_seed_dialog(self, n):
        vbox = QVBoxLayout()
        vbox1, seed_e1 = seed_dialog.enter_seed_box(MSG_ENTER_SEED_OR_MPK, 'hot')
        vbox.addLayout(vbox1)
        entries = [seed_e1]
        for i in range(n):
            vbox2, seed_e2 = seed_dialog.enter_seed_box(MSG_ENTER_SEED_OR_MPK, 'cold')
            vbox.addLayout(vbox2)
            entries.append(seed_e2)
        vbox.addStretch(1)
        hbox, button = ok_cancel_buttons2(self, _('Next'))
        vbox.addLayout(hbox)
        button.setEnabled(False)

        f = lambda: button.setEnabled( map(lambda e: self.is_any(e), entries) == [True]*len(entries))
        for e in entries:
            e.textChanged.connect(f)

        self.set_layout(vbox)
        if not self.exec_():
            return 
        return map(lambda e: self.get_seed_text(e), entries)
コード例 #53
0
ファイル: installwizard.py プロジェクト: Geopay/electrum-nvc
 def multi_mpk_dialog(self, xpub_hot, n):
     vbox = QVBoxLayout()
     vbox0, seed_e0 = seed_dialog.enter_seed_box(MSG_SHOW_MPK, 'hot')
     vbox.addLayout(vbox0)
     seed_e0.setText(xpub_hot)
     seed_e0.setReadOnly(True)
     entries = []
     for i in range(n):
         vbox2, seed_e2 = seed_dialog.enter_seed_box(
             MSG_ENTER_COLD_MPK, 'cold')
         vbox.addLayout(vbox2)
         entries.append(seed_e2)
     vbox.addStretch(1)
     hbox, button = ok_cancel_buttons2(self, _('Next'))
     vbox.addLayout(hbox)
     button.setEnabled(False)
     f = lambda: button.setEnabled(
         map(lambda e: self.is_xpub(e), entries) == [True] * len(entries))
     for e in entries:
         e.textChanged.connect(f)
     self.set_layout(vbox)
     if not self.exec_():
         return
     return map(lambda e: self.get_seed_text(e), entries)
コード例 #54
0
    def create_cold_seed(self, wallet):
        from electrum.bitcoin import mnemonic_to_seed, bip32_root
        msg = _('You are about to generate the cold storage seed of your wallet.') + '\n' \
              + _('For safety, you should do this on an offline computer.')
        icon = QPixmap( ':icons/cold_seed.png').scaledToWidth(56)
        if not self.question(msg, icon):
            return

        cold_seed = wallet.make_seed()
        if not self.show_seed(cold_seed, 'cold'):
            return
        if not self.verify_seed(cold_seed, 'cold'):
            return

        hex_seed = mnemonic_to_seed(cold_seed,'').encode('hex')
        xpriv, xpub = bip32_root(hex_seed)
        wallet.add_master_public_key('cold/', xpub)

        msg = _('Your master public key was saved in your wallet file.') + '\n'\
              + _('Your cold seed must be stored on paper; it is not in the wallet file.')+ '\n\n' \
              + _('This program is about to close itself.') + '\n'\
              + _('You will need to reopen your wallet on an online computer, in order to complete the creation of your wallet')
        self.show_message(msg)
コード例 #55
0
ファイル: installwizard.py プロジェクト: Geopay/electrum-nvc
    def create_cold_seed(self, wallet):
        from electrum.bitcoin import mnemonic_to_seed, bip32_root
        msg = _('You are about to generate the cold storage seed of your wallet.') + '\n' \
              + _('For safety, you should do this on an offline computer.')
        icon = QPixmap(':icons/cold_seed.png').scaledToWidth(56)
        if not self.question(msg, icon):
            return

        cold_seed = wallet.make_seed()
        if not self.show_seed(cold_seed, 'cold'):
            return
        if not self.verify_seed(cold_seed, 'cold'):
            return

        hex_seed = mnemonic_to_seed(cold_seed, '').encode('hex')
        xpriv, xpub = bip32_root(hex_seed)
        wallet.add_master_public_key('cold/', xpub)

        msg = _('Your master public key was saved in your wallet file.') + '\n'\
              + _('Your cold seed must be stored on paper; it is not in the wallet file.')+ '\n\n' \
              + _('This program is about to close itself.') + '\n'\
              + _('You will need to reopen your wallet on an online computer, in order to complete the creation of your wallet')
        self.show_message(msg)
コード例 #56
0
ファイル: util.py プロジェクト: CryptoManiac/electrum-nvc
def ok_cancel_buttons(dialog, ok_label=_("OK") ):
    hbox, b = ok_cancel_buttons2(dialog, ok_label)
    return hbox
コード例 #57
0
    def __init__(self, tx, parent):
        self.tx = tx
        tx_dict = tx.as_dict()
        self.parent = parent
        self.wallet = parent.wallet

        QDialog.__init__(self)
        self.setMinimumWidth(600)
        self.setWindowTitle(_("Transaction"))
        self.setModal(1)

        vbox = QVBoxLayout()
        self.setLayout(vbox)

        vbox.addWidget(QLabel(_("Transaction ID:")))
        self.tx_hash_e = QLineEdit()
        self.tx_hash_e.setReadOnly(True)
        vbox.addWidget(self.tx_hash_e)
        self.status_label = QLabel()
        vbox.addWidget(self.status_label)

        self.date_label = QLabel()
        vbox.addWidget(self.date_label)
        self.amount_label = QLabel()
        vbox.addWidget(self.amount_label)
        self.fee_label = QLabel()
        vbox.addWidget(self.fee_label)

        self.add_io(vbox)

        vbox.addStretch(1)

        self.buttons = buttons = QHBoxLayout()
        vbox.addLayout(buttons)

        buttons.addStretch(1)

        self.sign_button = b = QPushButton(_("Sign"))
        b.clicked.connect(self.sign)
        buttons.addWidget(b)

        self.broadcast_button = b = QPushButton(_("Broadcast"))
        b.clicked.connect(lambda: self.parent.broadcast_transaction(self.tx))

        b.hide()
        buttons.addWidget(b)

        self.save_button = b = QPushButton(_("Save"))
        b.clicked.connect(self.save)
        buttons.addWidget(b)

        cancelButton = QPushButton(_("Close"))
        cancelButton.clicked.connect(lambda: self.done(0))
        buttons.addWidget(cancelButton)
        cancelButton.setDefault(True)

        b = QPushButton()
        b.setIcon(QIcon(":icons/qrcode.png"))
        b.clicked.connect(self.show_qr)
        buttons.insertWidget(1, b)

        run_hook('transaction_dialog', self)

        self.update()
コード例 #58
0
 def show_message(self, msg):
     QMessageBox.information(self, _('Message'), msg, _('OK'))