URI: 
       tnew methods: init_menubar and load_wallet - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 4a60db97338282b50f40867cf2f0d8fb11eba6b8
   DIR parent fd5ee59a2984215e95928f713446d8d45e04a1d5
  HTML Author: thomasv <thomasv@gitorious>
       Date:   Wed, 15 May 2013 10:53:49 +0200
       
       new methods: init_menubar and load_wallet
       
       Diffstat:
         M gui/gui_classic.py                  |      80 +++++++++++++++++++++----------
         M lib/wallet.py                       |       1 +
       
       2 files changed, 56 insertions(+), 25 deletions(-)
       ---
   DIR diff --git a/gui/gui_classic.py b/gui/gui_classic.py
       t@@ -277,12 +277,46 @@ class ElectrumWindow(QMainWindow):
                if not self.wallet.seed: title += ' [%s]' % (_('seedless'))
                self.setWindowTitle( title )
        
       +        self.init_menubar()
       +
       +        QShortcut(QKeySequence("Ctrl+W"), self, self.close)
       +        QShortcut(QKeySequence("Ctrl+Q"), self, self.close)
       +        QShortcut(QKeySequence("Ctrl+PgUp"), self, lambda: tabs.setCurrentIndex( (tabs.currentIndex() - 1 )%tabs.count() ))
       +        QShortcut(QKeySequence("Ctrl+PgDown"), self, lambda: tabs.setCurrentIndex( (tabs.currentIndex() + 1 )%tabs.count() ))
       +        
       +        self.connect(self, QtCore.SIGNAL('update_status'), self.update_status)
       +        self.connect(self, QtCore.SIGNAL('banner_signal'), lambda: self.console.showMessage(self.wallet.interface.banner) )
       +        self.history_list.setFocus(True)
       +        
       +        self.exchanger = exchange_rate.Exchanger(self)
       +        self.connect(self, SIGNAL("refresh_balance()"), self.update_wallet)
       +
       +        # dark magic fix by flatfly; https://bitcointalk.org/index.php?topic=73651.msg959913#msg959913
       +        if platform.system() == 'Windows':
       +            n = 3 if self.wallet.seed else 2
       +            tabs.setCurrentIndex (n)
       +            tabs.setCurrentIndex (0)
       +
       +        # fix fee
       +        if self.wallet.fee < 50000:
       +            self.wallet.set_fee(50000)
       +            self.show_message("Note: Your default fee was raised to 0.0005 BTC/kilobyte")
       +
       +        # set initial message
       +        self.console.showMessage(self.wallet.interface.banner)
       +
       +        # plugins that need to change the GUI do it here
       +        self.run_hook('init_gui')
       +
       +
       +
       +    def init_menubar(self):
                menubar = QMenuBar()
        
                electrum_menu = menubar.addMenu(_("&File"))
                preferences_name = _("Preferences")
                if sys.platform == 'darwin':
       -          preferences_name = _("Electrum preferences") # Settings / Preferences are all reserved keywords in OSX using this as work around
       +            preferences_name = _("Electrum preferences") # Settings / Preferences are all reserved keywords in OSX using this as work around
        
                preferences_menu = electrum_menu.addAction(preferences_name)
                electrum_menu.addSeparator()
       t@@ -323,35 +357,31 @@ class ElectrumWindow(QMainWindow):
                self.setMenuBar(menubar)
        
        
       -        QShortcut(QKeySequence("Ctrl+W"), self, self.close)
       -        QShortcut(QKeySequence("Ctrl+Q"), self, self.close)
       -        QShortcut(QKeySequence("Ctrl+PgUp"), self, lambda: tabs.setCurrentIndex( (tabs.currentIndex() - 1 )%tabs.count() ))
       -        QShortcut(QKeySequence("Ctrl+PgDown"), self, lambda: tabs.setCurrentIndex( (tabs.currentIndex() + 1 )%tabs.count() ))
       -        
       -        self.connect(self, QtCore.SIGNAL('update_status'), self.update_status)
       -        self.connect(self, QtCore.SIGNAL('banner_signal'), lambda: self.console.showMessage(self.wallet.interface.banner) )
       -        self.history_list.setFocus(True)
       -        
       -        self.exchanger = exchange_rate.Exchanger(self)
       -        self.connect(self, SIGNAL("refresh_balance()"), self.update_wallet)
        
       -        # dark magic fix by flatfly; https://bitcointalk.org/index.php?topic=73651.msg959913#msg959913
       -        if platform.system() == 'Windows':
       -            n = 3 if self.wallet.seed else 2
       -            tabs.setCurrentIndex (n)
       -            tabs.setCurrentIndex (0)
       +    def load_wallet(self, filename):
       +        import electrum
        
       -        # fix fee
       -        if self.wallet.fee < 50000:
       -            self.wallet.set_fee(50000)
       -            self.show_message("Note: Your default fee was raised to 0.0005 BTC/kilobyte")
       +        config = electrum.SimpleConfig({'wallet_path': filename})
       +        if not config.wallet_file_exists:
       +            self.show_message("file not found "+ filename)
       +            return
        
       -        # set initial message
       -        self.console.showMessage(self.wallet.interface.banner)
       +        #self.wallet.verifier.stop()
       +        interface = self.wallet.interface
       +        verifier = self.wallet.verifier
       +        self.wallet.synchronizer.stop()
       +        
       +        self.config = config
       +        self.wallet = electrum.Wallet(self.config)
       +        self.wallet.interface = interface
       +        self.wallet.verifier = verifier
        
       -        # plugins that need to change the GUI do it here
       -        self.run_hook('init_gui')
       +        synchronizer = electrum.WalletSynchronizer(self.wallet, self.config)
       +        synchronizer.start()
       +
       +        self.update_wallet()
        
       +        
        
            # plugins
            def init_plugins(self):
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -1037,6 +1037,7 @@ class WalletSynchronizer(threading.Thread):
                threading.Thread.__init__(self)
                self.daemon = True
                self.wallet = wallet
       +        wallet.synchronizer = self
                self.interface = self.wallet.interface
                self.interface.register_channel('synchronizer')
                self.wallet.interface.register_callback('connected', lambda: self.wallet.set_up_to_date(False))