mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-01 09:45:18 +00:00
fix: lite mode switch
This commit is contained in:
parent
06d0c67b9c
commit
462ddd252d
2 changed files with 27 additions and 25 deletions
|
@ -81,34 +81,38 @@ class ElectrumGui:
|
||||||
self.mini.hide()
|
self.mini.hide()
|
||||||
self.expert.show()
|
self.expert.show()
|
||||||
|
|
||||||
def minimize(self, wallet, expert, url):
|
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
|
import lite_window
|
||||||
|
if not self.check_qt_version():
|
||||||
|
return
|
||||||
|
|
||||||
actuator = lite_window.MiniActuator(self.config, wallet)
|
actuator = lite_window.MiniActuator(self.config, wallet)
|
||||||
# Should probably not modify the current path but instead
|
# Should probably not modify the current path but instead
|
||||||
# change the behaviour of rsrc(...)
|
# change the behaviour of rsrc(...)
|
||||||
old_path = QDir.currentPath()
|
old_path = QDir.currentPath()
|
||||||
actuator.load_theme()
|
actuator.load_theme()
|
||||||
|
|
||||||
self.mini = lite_window.MiniWindow(actuator, self.expand, self.config)
|
mini = lite_window.MiniWindow(actuator, self.expand, self.config)
|
||||||
driver = lite_window.MiniDriver(wallet, self.mini)
|
driver = lite_window.MiniDriver(wallet, mini)
|
||||||
|
|
||||||
# Reset path back to original value now that loading the GUI
|
# Reset path back to original value now that loading the GUI
|
||||||
# is completed.
|
# is completed.
|
||||||
QDir.setCurrent(old_path)
|
QDir.setCurrent(old_path)
|
||||||
|
|
||||||
if url:
|
if url:
|
||||||
payto, amount, label, message, signature, identity, url = parse_url(url)
|
payto, amount, label, message, signature, identity, url = parse_url(url)
|
||||||
self.mini.set_payment_fields(payto, amount)
|
self.mini.set_payment_fields(payto, amount)
|
||||||
|
|
||||||
self.expert = expert
|
return mini
|
||||||
|
|
||||||
def check_qt_version(self):
|
def check_qt_version(self):
|
||||||
qtVersion = qVersion()
|
qtVersion = qVersion()
|
||||||
if not(int(qtVersion[0]) >= 4 and int(qtVersion[2]) >= 7):
|
return int(qtVersion[0]) >= 4 and int(qtVersion[2]) >= 7
|
||||||
app = QApplication(sys.argv)
|
|
||||||
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)
|
|
||||||
|
|
||||||
def main(self, url):
|
def main(self, url):
|
||||||
|
|
||||||
|
@ -127,7 +131,7 @@ class ElectrumGui:
|
||||||
s = Timer()
|
s = Timer()
|
||||||
s.start()
|
s.start()
|
||||||
|
|
||||||
w = ElectrumWindow(self.config, self.network)
|
w = ElectrumWindow(self.config, self.network, self.minimize)
|
||||||
w.load_wallet(wallet)
|
w.load_wallet(wallet)
|
||||||
|
|
||||||
self.windows.append(w)
|
self.windows.append(w)
|
||||||
|
@ -136,11 +140,19 @@ class ElectrumGui:
|
||||||
w.connect_slots(s)
|
w.connect_slots(s)
|
||||||
w.update_wallet()
|
w.update_wallet()
|
||||||
|
|
||||||
|
self.expert = w
|
||||||
|
self.mini = self.init_lite(wallet, w, url)
|
||||||
|
|
||||||
if self.config.get('lite_mode'):
|
if self.config.get('lite_mode'):
|
||||||
self.check_qt_version()
|
if not self.mini:
|
||||||
self.minimize(wallet, w, url)
|
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:
|
else:
|
||||||
w.show()
|
w.show()
|
||||||
|
self.mini.hide()
|
||||||
|
|
||||||
self.app.exec_()
|
self.app.exec_()
|
||||||
|
|
||||||
|
|
|
@ -151,11 +151,12 @@ class ElectrumWindow(QMainWindow):
|
||||||
self.showNormal()
|
self.showNormal()
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, config, network):
|
def __init__(self, config, network, go_lite):
|
||||||
QMainWindow.__init__(self)
|
QMainWindow.__init__(self)
|
||||||
|
|
||||||
self.config = config
|
self.config = config
|
||||||
self.network = network
|
self.network = network
|
||||||
|
self.go_lite = go_lite
|
||||||
self.init_plugins()
|
self.init_plugins()
|
||||||
|
|
||||||
self._close_electrum = False
|
self._close_electrum = False
|
||||||
|
@ -1373,17 +1374,6 @@ class ElectrumWindow(QMainWindow):
|
||||||
d.run()
|
d.run()
|
||||||
self.update_lock_icon()
|
self.update_lock_icon()
|
||||||
|
|
||||||
|
|
||||||
def go_lite(self):
|
|
||||||
import lite_window
|
|
||||||
self.config.set_key('lite_mode', True, True)
|
|
||||||
self.hide()
|
|
||||||
if self.lite:
|
|
||||||
self.lite.mini.show()
|
|
||||||
else:
|
|
||||||
self.lite = lite_window.ElectrumGui(self.config, None, None, self)
|
|
||||||
self.lite.main(None)
|
|
||||||
|
|
||||||
|
|
||||||
def new_contact_dialog(self):
|
def new_contact_dialog(self):
|
||||||
text, ok = QInputDialog.getText(self, _('New Contact'), _('Address') + ':')
|
text, ok = QInputDialog.getText(self, _('New Contact'), _('Address') + ':')
|
||||||
|
|
Loading…
Add table
Reference in a new issue