Browse Source

new methods: init_menubar and load_wallet

283
thomasv 12 years ago
committed by Maran
parent
commit
4a60db9733
  1. 74
      gui/gui_classic.py
  2. 1
      lib/wallet.py

74
gui/gui_classic.py

@ -277,6 +277,40 @@ class ElectrumWindow(QMainWindow):
if not self.wallet.seed: title += ' [%s]' % (_('seedless')) if not self.wallet.seed: title += ' [%s]' % (_('seedless'))
self.setWindowTitle( title ) 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() menubar = QMenuBar()
electrum_menu = menubar.addMenu(_("&File")) electrum_menu = menubar.addMenu(_("&File"))
@ -323,34 +357,30 @@ class ElectrumWindow(QMainWindow):
self.setMenuBar(menubar) 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) def load_wallet(self, filename):
self.connect(self, QtCore.SIGNAL('banner_signal'), lambda: self.console.showMessage(self.wallet.interface.banner) ) import electrum
self.history_list.setFocus(True)
self.exchanger = exchange_rate.Exchanger(self) config = electrum.SimpleConfig({'wallet_path': filename})
self.connect(self, SIGNAL("refresh_balance()"), self.update_wallet) if not config.wallet_file_exists:
self.show_message("file not found "+ filename)
return
# dark magic fix by flatfly; https://bitcointalk.org/index.php?topic=73651.msg959913#msg959913 #self.wallet.verifier.stop()
if platform.system() == 'Windows': interface = self.wallet.interface
n = 3 if self.wallet.seed else 2 verifier = self.wallet.verifier
tabs.setCurrentIndex (n) self.wallet.synchronizer.stop()
tabs.setCurrentIndex (0)
# fix fee self.config = config
if self.wallet.fee < 50000: self.wallet = electrum.Wallet(self.config)
self.wallet.set_fee(50000) self.wallet.interface = interface
self.show_message("Note: Your default fee was raised to 0.0005 BTC/kilobyte") self.wallet.verifier = verifier
# set initial message synchronizer = electrum.WalletSynchronizer(self.wallet, self.config)
self.console.showMessage(self.wallet.interface.banner) synchronizer.start()
self.update_wallet()
# plugins that need to change the GUI do it here
self.run_hook('init_gui')
# plugins # plugins

1
lib/wallet.py

@ -1037,6 +1037,7 @@ class WalletSynchronizer(threading.Thread):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.daemon = True self.daemon = True
self.wallet = wallet self.wallet = wallet
wallet.synchronizer = self
self.interface = self.wallet.interface self.interface = self.wallet.interface
self.interface.register_channel('synchronizer') self.interface.register_channel('synchronizer')
self.wallet.interface.register_callback('connected', lambda: self.wallet.set_up_to_date(False)) self.wallet.interface.register_callback('connected', lambda: self.wallet.set_up_to_date(False))

Loading…
Cancel
Save