URI: 
       tset_label - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit cd6832df2ee9f09c973485f13f7e6abfd64dd62d
   DIR parent 328315f94baeccaa646c713a5626960709879c0a
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Sun,  8 Sep 2013 20:10:43 +0200
       
       set_label
       
       Diffstat:
         M gui/gui_classic.py                  |       3 +--
         M lib/commands.py                     |       7 +++----
         M lib/wallet.py                       |      14 +++++++++-----
       
       3 files changed, 13 insertions(+), 11 deletions(-)
       ---
   DIR diff --git a/gui/gui_classic.py b/gui/gui_classic.py
       t@@ -1948,8 +1948,7 @@ class ElectrumWindow(QMainWindow):
                    data = f.read()
                    f.close()
                    for key, value in json.loads(data).items():
       -                self.wallet.labels[key] = value
       -            self.wallet.save()
       +                self.wallet.set_label(key, value)
                    QMessageBox.information(None, _("Labels imported"), _("Your labels were imported from")+" '%s'" % str(labelsFile))
                except (IOError, os.error), reason:
                    QMessageBox.critical(None, _("Unable to import labels"), _("Electrum was unable to import your labels.")+"\n" + str(reason))
   DIR diff --git a/lib/commands.py b/lib/commands.py
       t@@ -194,7 +194,6 @@ class Commands:
            def importprivkey(self, sec):
                try:
                    addr = self.wallet.import_key(sec,self.password)
       -            self.wallet.save()
                    out = "Keypair imported: ", addr
                except BaseException as e:
                    out = "Error: Keypair import failed: " + str(e)
       t@@ -286,9 +285,9 @@ class Commands:
        
        
        
       -    def setlabel(self, tx, label):
       -        self.wallet.labels[tx] = label
       -        self.wallet.save()
       +    def setlabel(self, key, label):
       +        self.wallet.set_labels(key, label)
       +
                    
        
            def contacts(self):
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -390,13 +390,17 @@ class Wallet:
                return account_id, account
        
        
       +    def set_label(self, key, value):
       +        self.labels[account_id] = name
       +        self.storage.put('labels', self.labels, True)
       +
       +
            def create_account(self, account_type = '1', name = None):
                account_id, account = self.next_account(account_type)
                self.accounts[account_id] = account
                self.save_accounts()
       -        if name: 
       -            self.labels[account_id] = name
       -        self.storage.put('labels', self.labels, True)
       +        if name:
       +            self.set_label(account_id, name)
        
        
            def create_old_account(self):
       t@@ -758,8 +762,8 @@ class Wallet:
                self.addressbook.append(address)
                self.storage.put('contacts', self.addressbook, True)
                if label:  
       -            self.labels[address] = label
       -            self.storage.put('labels', self.labels, True)
       +            self.set_label(address, label)
       +
        
            def delete_contact(self, addr):
                if addr in self.addressbook: