Browse Source

add switch-gui button for qt

283
bkkcoins 12 years ago
committed by thomasv
parent
commit
2d031013a5
  1. 1
      icons.qrc
  2. BIN
      icons/switchgui.png
  3. 26
      lib/gui_lite.py
  4. 13
      lib/gui_qt.py

1
icons.qrc

@ -13,6 +13,7 @@
<file>icons/status_connected.png</file>
<file>icons/status_disconnected.png</file>
<file>icons/status_waiting.png</file>
<file>icons/switchgui.png</file>
<file>icons/unconfirmed.png</file>
<file>icons/network.png</file>
</qresource>

BIN
icons/switchgui.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

26
lib/gui_lite.py

@ -131,14 +131,17 @@ def csv_transaction(wallet):
class ElectrumGui(QObject):
def __init__(self, wallet, config):
def __init__(self, wallet, config, expert=None):
super(QObject, self).__init__()
self.wallet = wallet
self.config = config
self.check_qt_version()
self.app = QApplication(sys.argv)
self.expert = expert
if self.expert != None:
self.app = self.expert.app
else:
self.app = QApplication(sys.argv)
def check_qt_version(self):
qtVersion = qVersion()
@ -165,14 +168,15 @@ class ElectrumGui(QObject):
if url:
self.set_url(url)
timer = Timer()
timer.start()
self.expert = gui_qt.ElectrumWindow(self.wallet, self.config)
self.expert.app = self.app
self.expert.connect_slots(timer)
self.expert.update_wallet()
self.app.exec_()
if self.expert == None:
timer = Timer()
timer.start()
self.expert = gui_qt.ElectrumWindow(self.wallet, self.config)
self.expert.app = self.app
self.expert.connect_slots(timer)
self.expert.update_wallet()
self.app.exec_()
def expand(self):
"""Hide the lite mode window and show pro-mode."""

13
lib/gui_qt.py

@ -296,6 +296,7 @@ class ElectrumWindow(QMainWindow):
def __init__(self, wallet, config):
QMainWindow.__init__(self)
self.lite = None
self.wallet = wallet
self.config = config
self.wallet.interface.register_callback('updated', self.update_callback)
@ -1135,6 +1136,9 @@ class ElectrumWindow(QMainWindow):
self.status_text = ""
sb = QStatusBar()
sb.setFixedHeight(35)
qtVersion = qVersion()
if (int(qtVersion[0]) >= 4 and int(qtVersion[2]) >= 7):
sb.addPermanentWidget( StatusBarButton( QIcon(":icons/switchgui.png"), "Switch to Lite Mode", self.go_lite ) )
if self.wallet.seed:
sb.addPermanentWidget( StatusBarButton( QIcon(":icons/lock.png"), "Password", lambda: self.change_password_dialog(self.wallet, self) ) )
sb.addPermanentWidget( StatusBarButton( QIcon(":icons/preferences.png"), "Preferences", self.settings_dialog ) )
@ -1143,6 +1147,15 @@ class ElectrumWindow(QMainWindow):
self.status_button = StatusBarButton( QIcon(":icons/status_disconnected.png"), "Network", lambda: self.network_dialog(self.wallet, self) )
sb.addPermanentWidget( self.status_button )
self.setStatusBar(sb)
def go_lite(self):
import gui_lite
self.hide()
if self.lite:
self.lite.mini.show()
else:
self.lite = gui_lite.ElectrumGui(self.wallet, self.config, self)
self.lite.main(None)
def new_contact_dialog(self):
text, ok = QInputDialog.getText(self, _('New Contact'), _('Address') + ':')

Loading…
Cancel
Save