move lite window initialization in the constructor of the main window
This commit is contained in:
@@ -79,46 +79,6 @@ class ElectrumGui:
|
||||
init_plugins(self)
|
||||
|
||||
|
||||
|
||||
def expand(self):
|
||||
"""Hide the lite mode window and show pro-mode."""
|
||||
self.config.set_key('lite_mode', False, True)
|
||||
self.mini.hide()
|
||||
self.expert.show()
|
||||
|
||||
def minimize(self):
|
||||
self.config.set_key('lite_mode', True, True)
|
||||
self.expert.hide()
|
||||
self.mini.show()
|
||||
|
||||
def init_lite(self, wallet, expert, url):
|
||||
import lite_window
|
||||
if not self.check_qt_version():
|
||||
return
|
||||
|
||||
actuator = lite_window.MiniActuator(self.config, wallet)
|
||||
# Should probably not modify the current path but instead
|
||||
# change the behaviour of rsrc(...)
|
||||
old_path = QDir.currentPath()
|
||||
actuator.load_theme()
|
||||
|
||||
mini = lite_window.MiniWindow(actuator, self.expand, self.config)
|
||||
driver = lite_window.MiniDriver(wallet, mini)
|
||||
|
||||
# Reset path back to original value now that loading the GUI
|
||||
# is completed.
|
||||
QDir.setCurrent(old_path)
|
||||
if url:
|
||||
payto, amount, label, message, signature, identity, url = parse_url(url)
|
||||
mini.set_payment_fields(payto, amount)
|
||||
|
||||
return mini
|
||||
|
||||
def check_qt_version(self):
|
||||
qtVersion = qVersion()
|
||||
return int(qtVersion[0]) >= 4 and int(qtVersion[2]) >= 7
|
||||
|
||||
|
||||
def main(self, url):
|
||||
|
||||
storage = WalletStorage(self.config)
|
||||
@@ -132,9 +92,8 @@ class ElectrumGui:
|
||||
wallet = Wallet(storage)
|
||||
|
||||
wallet.start_threads(self.network)
|
||||
|
||||
|
||||
self.main_window = w = ElectrumWindow(self.config, self.network, self.minimize)
|
||||
self.main_window = w = ElectrumWindow(self.config, self.network)
|
||||
|
||||
# plugins that need to change the GUI do it here
|
||||
run_hook('init')
|
||||
@@ -150,21 +109,6 @@ class ElectrumGui:
|
||||
w.connect_slots(s)
|
||||
w.update_wallet()
|
||||
|
||||
self.expert = w
|
||||
self.mini = self.init_lite(wallet, w, url)
|
||||
|
||||
if self.config.get('lite_mode'):
|
||||
if not self.mini:
|
||||
QMessageBox.warning(None,"Could not start Lite GUI.", "Electrum was unable to load the 'Lite GUI' because it needs Qt version >= 4.7.\nChanging your config to use the 'Classic' GUI")
|
||||
self.config.set_key('lite_mode', False, True)
|
||||
sys.exit(0)
|
||||
else:
|
||||
self.minimize()
|
||||
else:
|
||||
w.show()
|
||||
if self.mini:
|
||||
self.mini.hide()
|
||||
|
||||
self.app.exec_()
|
||||
|
||||
wallet.stop_threads()
|
||||
|
||||
Reference in New Issue
Block a user