Browse Source

add switch-gui button for qt

283
bkkcoins 12 years ago
parent
commit
30de518be9
  1. 1
      icons.qrc
  2. BIN
      icons/switchgui.png
  3. 8
      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_connected.png</file>
<file>icons/status_disconnected.png</file> <file>icons/status_disconnected.png</file>
<file>icons/status_waiting.png</file> <file>icons/status_waiting.png</file>
<file>icons/switchgui.png</file>
<file>icons/unconfirmed.png</file> <file>icons/unconfirmed.png</file>
<file>icons/network.png</file> <file>icons/network.png</file>
</qresource> </qresource>

BIN
icons/switchgui.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

8
lib/gui_lite.py

@ -88,15 +88,18 @@ def load_theme_paths():
class ElectrumGui(QObject): class ElectrumGui(QObject):
def __init__(self, wallet, config): def __init__(self, wallet, config, expert=None):
super(QObject, self).__init__() super(QObject, self).__init__()
self.wallet = wallet self.wallet = wallet
self.config = config self.config = config
self.check_qt_version() self.check_qt_version()
self.expert = expert
if self.expert != None:
self.app = self.expert.app
else:
self.app = QApplication(sys.argv) self.app = QApplication(sys.argv)
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): if not(int(qtVersion[0]) >= 4 and int(qtVersion[2]) >= 7):
@ -123,6 +126,7 @@ class ElectrumGui(QObject):
if url: if url:
self.set_url(url) self.set_url(url)
if self.expert == None:
timer = Timer() timer = Timer()
timer.start() timer.start()
self.expert = gui_qt.ElectrumWindow(self.wallet, self.config) self.expert = gui_qt.ElectrumWindow(self.wallet, self.config)

13
lib/gui_qt.py

@ -294,6 +294,7 @@ class ElectrumWindow(QMainWindow):
def __init__(self, wallet, config): def __init__(self, wallet, config):
QMainWindow.__init__(self) QMainWindow.__init__(self)
self.lite = None
self.wallet = wallet self.wallet = wallet
self.config = config self.config = config
self.wallet.interface.register_callback('updated', self.update_callback) self.wallet.interface.register_callback('updated', self.update_callback)
@ -1108,6 +1109,9 @@ class ElectrumWindow(QMainWindow):
def create_status_bar(self): def create_status_bar(self):
sb = QStatusBar() sb = QStatusBar()
sb.setFixedHeight(35) 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: 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/lock.png"), "Password", lambda: self.change_password_dialog(self.wallet, self) ) )
sb.addPermanentWidget( StatusBarButton( QIcon(":icons/preferences.png"), "Preferences", self.settings_dialog ) ) sb.addPermanentWidget( StatusBarButton( QIcon(":icons/preferences.png"), "Preferences", self.settings_dialog ) )
@ -1117,6 +1121,15 @@ class ElectrumWindow(QMainWindow):
sb.addPermanentWidget( self.status_button ) sb.addPermanentWidget( self.status_button )
self.setStatusBar(sb) 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): def new_contact_dialog(self):
text, ok = QInputDialog.getText(self, _('New Contact'), _('Address') + ':') text, ok = QInputDialog.getText(self, _('New Contact'), _('Address') + ':')
address = unicode(text) address = unicode(text)

Loading…
Cancel
Save