URI: 
       tfixes for label plugin - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 1e346404dde636ea682d3d9590bcf6a80ed12bd1
   DIR parent 6101abda5dea619ad04b957f376ed7ddda274cb7
  HTML Author: ThomasV <thomasv@gitorious>
       Date:   Thu,  4 Sep 2014 16:37:51 +0200
       
       fixes for label plugin
       
       Diffstat:
         M gui/qt/main_window.py               |       1 +
         M lib/plugins.py                      |       6 +++++-
         M plugins/labels.py                   |      33 ++++++++++++-------------------
       
       3 files changed, 19 insertions(+), 21 deletions(-)
       ---
   DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py
       t@@ -2727,6 +2727,7 @@ class ElectrumWindow(QMainWindow):
                            p.close()
                    else:
                        if p.enable():
       +                    p.load_wallet(self.wallet)
                            p.init_qt(self.gui_object)
                    r = p.is_enabled()
                    cb.setChecked(r)
   DIR diff --git a/lib/plugins.py b/lib/plugins.py
       t@@ -88,7 +88,11 @@ class BasePlugin:
                self.set_enabled(False)
                return True
        
       -    def init(self): pass
       +    def init_qt(self, gui): pass
       +
       +    def load_wallet(self, wallet): pass
       +
       +    #def init(self): pass
        
            def close(self): pass
        
   DIR diff --git a/plugins/labels.py b/plugins/labels.py
       t@@ -23,6 +23,8 @@ from electrum_gui.qt import HelpButton, EnterButton
        
        class Plugin(BasePlugin):
        
       +    target_host = 'labelectrum.herokuapp.com'
       +
            def fullname(self):
                return _('Label Sync')
        
       t@@ -40,21 +42,26 @@ class Plugin(BasePlugin):
        
            def decode(self, message):
                decoded_message = aes.decryptData(self.encode_password, base64.b64decode(unicode(message)) )
       -
                return decoded_message
        
       +    
       +
            @hook
            def init_qt(self, gui):
       -        self.target_host = 'labelectrum.herokuapp.com'
                self.window = gui.main_window
       +        if not self.auth_token(): # First run, throw plugin settings in your face
       +            self.load_wallet(self.window.wallet)
       +            if self.settings_dialog():
       +                self.set_enabled(True)
       +                return True
       +            else:
       +                self.set_enabled(False)
       +                return False
        
            @hook
            def load_wallet(self, wallet):
                self.wallet = wallet
       -        if self.wallet.get_master_public_key():
       -            mpk = self.wallet.get_master_public_key()
       -        else:
       -            mpk = self.wallet.master_public_keys["m/0'/"][1]
       +        mpk = self.wallet.get_master_public_key()
                self.encode_password = hashlib.sha1(mpk).digest().encode('hex')[:32]
                self.wallet_id = hashlib.sha256(mpk).digest().encode('hex')
        
       t@@ -151,20 +158,6 @@ class Plugin(BasePlugin):
                else:
                  return False
        
       -    def enable(self):
       -        if not self.auth_token(): # First run, throw plugin settings in your face
       -            self.init()
       -            self.load_wallet(self.window.wallet)
       -            if self.settings_dialog():
       -                self.set_enabled(True)
       -                return True
       -            else:
       -                self.set_enabled(False)
       -                return False
       -
       -        self.set_enabled(True)
       -        return True
       -
        
            def full_push(self):
                if self.do_full_push():