URI: 
       tmaster privae keys dialog - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 5136e59e14e3974ba3290fa100ffd1c12c3d5577
   DIR parent a8ad85de688bbf2c22644f343e1ddb881edf52da
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Tue,  1 Oct 2013 17:33:39 +0200
       
       master privae keys dialog
       
       Diffstat:
         M gui/qt/main_window.py               |      36 ++++++++++++++++++++-----------
         M gui/qt/seed_dialog.py               |      29 ++++++++++++++++++++---------
         M lib/wallet.py                       |       4 ++++
       
       3 files changed, 47 insertions(+), 22 deletions(-)
       ---
   DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -259,7 +259,7 @@ class ElectrumWindow(QMainWindow):
                self.wallet = wallet
        
                title = 'Electrum ' + self.wallet.electrum_version + '  -  ' + self.wallet.storage.path
       -        if not self.wallet.seed: title += ' [%s]' % (_('seedless'))
       +        if self.wallet.is_watching_only(): title += ' [%s]' % (_('watching only'))
                self.setWindowTitle( title )
                self.update_wallet()
                # Once GUI has been initialized check if we want to announce something since the callback has been called before the GUI was initialized
       t@@ -376,7 +376,6 @@ class ElectrumWindow(QMainWindow):
        
                wallet_menu.addSeparator()
        
       -        #if self.wallet.seed:
                show_seed = wallet_menu.addAction(_("&Seed"))
                show_seed.triggered.connect(self.show_seed_dialog)
        
       t@@ -1347,7 +1346,7 @@ class ElectrumWindow(QMainWindow):
        
        
            def update_buttons_on_seed(self):
       -        if self.wallet.seed:
       +        if not self.wallet.is_watching_only():
                   self.seed_button.show()
                   self.password_button.show()
                   self.send_button.setText(_("Send"))
       t@@ -1487,18 +1486,29 @@ class ElectrumWindow(QMainWindow):
        
            @protected
            def show_seed_dialog(self, password):
       -        if not self.wallet.seed:
       -            QMessageBox.information(self, _('Message'), _('No seed'), _('OK'))
       -            return
       -        try:
       -            seed = self.wallet.decode_seed(password)
       -        except:
       -            QMessageBox.warning(self, _('Error'), _('Incorrect Password'), _('OK'))
       +        if self.wallet.is_watching_only():
       +            QMessageBox.information(self, _('Message'), _('This is a watching-only wallet'), _('OK'))
                    return
        
       -        from seed_dialog import SeedDialog
       -        d = SeedDialog(self)
       -        d.show_seed(seed, self.wallet.imported_keys)
       +        if self.wallet.seed:
       +            try:
       +                seed = self.wallet.decode_seed(password)
       +            except:
       +                QMessageBox.warning(self, _('Error'), _('Incorrect Password'), _('OK'))
       +                return
       +            from seed_dialog import SeedDialog
       +            d = SeedDialog(self)
       +            d.show_seed(seed, self.wallet.imported_keys)
       +        else:
       +            l = {}
       +            for k in self.wallet.master_private_keys.keys():
       +                pk = self.wallet.get_master_private_key(k, password)
       +                l[k] = pk
       +            from seed_dialog import PrivateKeysDialog
       +            d = PrivateKeysDialog(self,l)
       +            d.exec_()
       +
       +
        
        
        
   DIR diff --git a/gui/qt/seed_dialog.py b/gui/qt/seed_dialog.py
       t@@ -22,6 +22,7 @@ import PyQt4.QtCore as QtCore
        from electrum.i18n import _
        from electrum import mnemonic
        from qrcodewidget import QRCodeWidget
       +from util import close_button
        
        class SeedDialog(QDialog):
            def __init__(self, parent):
       t@@ -35,6 +36,24 @@ class SeedDialog(QDialog):
                self.exec_()
        
        
       +class PrivateKeysDialog(QDialog):
       +    def __init__(self, parent, private_keys):
       +        QDialog.__init__(self, parent)
       +        self.setModal(1)
       +        self.setWindowTitle('Electrum' + ' - ' + _('Master Private Keys'))
       +        self.parent = parent
       +        vbox = QVBoxLayout(self)
       +        vbox.addWidget(QLabel(_("The seed has been removed from the wallet. It contains the following master private keys")+ ":"))
       +        for k,v in sorted(private_keys.items()):
       +            vbox.addWidget(QLabel(k))
       +            vbox.addWidget(QLineEdit(v))
       +
       +        vbox.addLayout(close_button(self))
       +
       +
       +
       +
       +
        def make_seed_dialog(self, seed, imported_keys):
        
                brainwallet = ' '.join(mnemonic.mn_encode(seed))
       t@@ -60,12 +79,7 @@ def make_seed_dialog(self, seed, imported_keys):
        
                qrw = QRCodeWidget(seed)
        
       -        ok_button = QPushButton(_("OK"))
       -        ok_button.setDefault(True)
       -        ok_button.clicked.connect(self.accept)
       -
                grid = QGridLayout()
       -        #main_layout.addWidget(logo, 0, 0)
        
                grid.addWidget(logo, 0, 0)
                grid.addWidget(label1, 0, 1)
       t@@ -78,9 +92,6 @@ def make_seed_dialog(self, seed, imported_keys):
                vbox.addLayout(grid)
                vbox.addWidget(label2)
        
       -        hbox = QHBoxLayout()
       -        hbox.addStretch(1)
       -        hbox.addWidget(ok_button)
       -        vbox.addLayout(hbox)
       +        vbox.addLayout(close_button(self))
        
                self.setLayout(vbox)
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -333,6 +333,10 @@ class Wallet:
                self.master_private_keys.pop(k)
                self.storage.put('master_private_keys', self.master_private_keys, True)
        
       +    def is_watching_only(self):
       +        return (self.seed == '') and (self.master_private_keys == {})
       +
       +
        
            def account_id(self, account_type, i):
                if account_type == '1':