URI: 
       twallet.has_seed - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 9c37ed68f481cbf06c92dcb13e444a344efe8a1d
   DIR parent 56e8ad3397a63d06fb20840945b8de9d41e77d62
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Wed, 30 Apr 2014 11:40:53 +0200
       
       wallet.has_seed
       
       Diffstat:
         M gui/qt/main_window.py               |      38 ++++++++++++-------------------
         M lib/wallet.py                       |      25 ++++++++++++++++++++++---
       
       2 files changed, 37 insertions(+), 26 deletions(-)
       ---
   DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -1354,13 +1354,16 @@ class ElectrumWindow(QMainWindow):
        
        
            def update_buttons_on_seed(self):
       -        if not self.wallet.is_watching_only():
       +        if self.wallet.has_seed():
                   self.seed_button.show()
       +        else:
       +           self.seed_button.hide()
       +
       +        if not self.wallet.is_watching_only():
                   self.password_button.show()
                   self.send_button.setText(_("Send"))
                else:
                   self.password_button.hide()
       -           self.seed_button.hide()
                   self.send_button.setText(_("Create unsigned transaction"))
        
        
       t@@ -1469,29 +1472,18 @@ class ElectrumWindow(QMainWindow):
        
            @protected
            def show_seed_dialog(self, password):
       -        if self.wallet.is_watching_only():
       -            QMessageBox.information(self, _('Message'), _('This is a watching-only wallet'), _('OK'))
       +        if not self.wallet.has_seed():
       +            QMessageBox.information(self, _('Message'), _('This wallet has no seed'), _('OK'))
                    return
        
       -        if self.wallet.seed:
       -            try:
       -                mnemonic = self.wallet.get_mnemonic(password)
       -            except Exception:
       -                QMessageBox.warning(self, _('Error'), _('Incorrect Password'), _('OK'))
       -                return
       -            from seed_dialog import SeedDialog
       -            d = SeedDialog(self, mnemonic, self.wallet.imported_keys)
       -            d.exec_()
       -        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_()
       -
       -
       +        try:
       +            mnemonic = self.wallet.get_mnemonic(password)
       +        except Exception:
       +            QMessageBox.warning(self, _('Error'), _('Incorrect Password'), _('OK'))
       +            return
       +        from seed_dialog import SeedDialog
       +        d = SeedDialog(self, mnemonic, self.wallet.imported_keys)
       +        d.exec_()
        
        
        
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -244,12 +244,20 @@ class Abstract_Wallet:
                pass
        
            def load_accounts(self):
       +        self.accounts = {}
       +
       +    def synchronize(self):
                pass
        
       +    def get_pending_accounts(self):
       +        return {}
                    
            def can_create_accounts(self):
                return False
        
       +    def check_password(self, password):
       +        pass
       +
        
            def set_up_to_date(self,b):
                with self.lock: self.up_to_date = b
       t@@ -266,8 +274,7 @@ class Abstract_Wallet:
        
        
            def import_key(self, sec, password):
       -        # check password
       -        seed = self.get_seed(password)
       +        self.check_password(password)
                try:
                    address = address_from_private_key(sec)
                except Exception:
       t@@ -1094,6 +1101,9 @@ class Abstract_Wallet:
                    self.verifier.stop()
                    self.synchronizer.stop()
        
       +    def restore(self, cb):
       +        pass
       +
        
        
        class Imported_Wallet(Abstract_Wallet):
       t@@ -1105,6 +1115,9 @@ class Imported_Wallet(Abstract_Wallet):
                n = self.imported_keys.values()
                return n == [''] * len(n)
        
       +    def has_seed(self):
       +        return False
       +
        
        
        class Deterministic_Wallet(Abstract_Wallet):
       t@@ -1112,8 +1125,14 @@ class Deterministic_Wallet(Abstract_Wallet):
            def __init__(self, storage):
                Abstract_Wallet.__init__(self, storage)
        
       +    def has_seed(self):
       +        return self.seed == ''
       +
            def is_watching_only(self):
       -        return (self.seed == '') and (self.master_private_keys == {})
       +        return self.has_seed()
       +
       +    def check_password(self, password):
       +        self.get_seed(password)
        
            def get_seed(self, password):
                s = pw_decode(self.seed, password)