Browse Source

show pubkeys and redeem script in address dialog

2.9.x
ThomasV 8 years ago
parent
commit
73e69284d1
  1. 22
      gui/qt/address_dialog.py
  2. 3
      gui/qt/address_list.py
  3. 22
      gui/qt/main_window.py

22
gui/qt/address_dialog.py

@ -31,6 +31,7 @@ from PyQt4.QtCore import *
from util import * from util import *
from history_list import HistoryList from history_list import HistoryList
from qrtextedit import ShowQRTextEdit
class AddressDialog(WindowModalDialog): class AddressDialog(WindowModalDialog):
@ -54,6 +55,27 @@ class AddressDialog(WindowModalDialog):
self.addr_e.setReadOnly(True) self.addr_e.setReadOnly(True)
vbox.addWidget(self.addr_e) vbox.addWidget(self.addr_e)
try:
pubkeys = self.wallet.get_public_keys(address)
except BaseException as e:
pubkeys = None
if pubkeys:
vbox.addWidget(QLabel(_("Public keys") + ':'))
for pubkey in pubkeys:
pubkey_e = ButtonsLineEdit(pubkey)
pubkey_e.addCopyButton(self.app)
vbox.addWidget(pubkey_e)
try:
redeem_script = self.wallet.pubkeys_to_redeem_script(pubkeys)
except BaseException as e:
redeem_script = None
if redeem_script:
vbox.addWidget(QLabel(_("Redeem Script") + ':'))
redeem_e = ShowQRTextEdit(text=redeem_script)
redeem_e.addCopyButton(self.app)
vbox.addWidget(redeem_e)
vbox.addWidget(QLabel(_("History"))) vbox.addWidget(QLabel(_("History")))
self.hw = HistoryList(self.parent) self.hw = HistoryList(self.parent)
self.hw.get_domain = self.get_domain self.hw.get_domain = self.get_domain

3
gui/qt/address_list.py

@ -109,11 +109,10 @@ class AddressList(MyTreeWidget):
if not multi_select: if not multi_select:
column_title = self.headerItem().text(col) column_title = self.headerItem().text(col)
menu.addAction(_("Copy %s")%column_title, lambda: self.parent.app.clipboard().setText(item.text(col))) menu.addAction(_("Copy %s")%column_title, lambda: self.parent.app.clipboard().setText(item.text(col)))
menu.addAction(_('Details'), lambda: self.parent.show_address(addr))
if col in self.editable_columns: if col in self.editable_columns:
menu.addAction(_("Edit %s")%column_title, lambda: self.editItem(item, col)) menu.addAction(_("Edit %s")%column_title, lambda: self.editItem(item, col))
menu.addAction(_("Request payment"), lambda: self.parent.receive_at(addr)) menu.addAction(_("Request payment"), lambda: self.parent.receive_at(addr))
menu.addAction(_('History'), lambda: self.parent.show_address(addr))
menu.addAction(_('Public Keys'), lambda: self.parent.show_public_keys(addr))
if self.wallet.can_export(): if self.wallet.can_export():
menu.addAction(_("Private key"), lambda: self.parent.show_private_key(addr)) menu.addAction(_("Private key"), lambda: self.parent.show_private_key(addr))
if not is_multisig and not self.wallet.is_watching_only(): if not is_multisig and not self.wallet.is_watching_only():

22
gui/qt/main_window.py

@ -1833,34 +1833,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
d = SeedDialog(self, seed, passphrase) d = SeedDialog(self, seed, passphrase)
d.exec_() d.exec_()
def show_qrcode(self, data, title = _("QR code"), parent=None): def show_qrcode(self, data, title = _("QR code"), parent=None):
if not data: if not data:
return return
d = QRDialog(data, parent or self, title) d = QRDialog(data, parent or self, title)
d.exec_() d.exec_()
def show_public_keys(self, address):
if not address: return
try:
pubkey_list = self.wallet.get_public_keys(address)
except Exception as e:
traceback.print_exc(file=sys.stdout)
self.show_message(str(e))
return
d = WindowModalDialog(self, _("Public key"))
d.setMinimumSize(600, 200)
vbox = QVBoxLayout()
vbox.addWidget( QLabel(_("Address") + ': ' + address))
vbox.addWidget(QLabel(_("Public key") + ':'))
keys_e = ShowQRTextEdit(text='\n'.join(pubkey_list))
keys_e.addCopyButton(self.app)
vbox.addWidget(keys_e)
vbox.addLayout(Buttons(CloseButton(d)))
d.setLayout(vbox)
d.exec_()
@protected @protected
def show_private_key(self, address, password): def show_private_key(self, address, password):
if not address: if not address:

Loading…
Cancel
Save