electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit b9b5f1e58c954b5e195b00c109a52086101c2c88
parent 13e757036b02966989e15be7954871654c4dd6d1
Author: ThomasV <thomasv@gitorious>
Date:   Sat, 11 Feb 2012 22:19:22 +0100

signal timer

Diffstat:
Mclient/gui_qt.py | 42+++++++++++++++++++++++++++++++++++++-----
1 file changed, 37 insertions(+), 5 deletions(-)

diff --git a/client/gui_qt.py b/client/gui_qt.py @@ -1,4 +1,4 @@ -import sys +import sys, time # todo: see PySide @@ -7,22 +7,31 @@ from PyQt4.QtCore import * import PyQt4.QtCore as QtCore import PyQt4.QtGui as QtGui +from wallet import format_satoshis + def restore_create_dialog(wallet): pass +class Sender(QtCore.QThread): + def run(self): + while True: + self.emit(QtCore.SIGNAL('testsignal')) + time.sleep(0.5) + class BitcoinWidget(QMainWindow): def __init__(self, wallet): QMainWindow.__init__(self) self.wallet = wallet + tabs = QTabWidget(self) tabs.addTab(self.create_history_tab(), 'History') tabs.addTab(self.create_send_tab(), 'Send') tabs.addTab(self.create_receive_tab(), 'Receive') tabs.addTab(self.create_contacts_tab(),'Contacts') tabs.addTab(self.create_wall_tab(), 'Wall') - tabs.resize(600, 400) + tabs.setMinimumSize(600, 400) tabs.show() self.create_status_bar() @@ -31,6 +40,26 @@ class BitcoinWidget(QMainWindow): self.setWindowTitle( 'Electrum ' + self.wallet.electrum_version ) self.show() + def connect_slots(self, sender): + self.connect(sender, QtCore.SIGNAL('testsignal'), self.update_wallet) + + def update_wallet(self): + if self.wallet.interface.is_connected: + if self.wallet.interface.blocks == 0: + text = "Server not ready" + elif not self.wallet.interface.was_polled: + text = "Synchronizing..." + else: + c, u = self.wallet.get_balance() + text = "Balance: %s "%( format_satoshis(c) ) + if u: text += "[%s unconfirmed]"%( format_satoshis(u,True) ) + else: + text = "Not connected" + self.statusBar().showMessage(text) + + if self.wallet.interface.was_updated: + self.textbox.setText( self.wallet.interface.message ) + self.wallet.interface.was_updated = False def create_history_tab(self): h = [ 'ff', 'bar' ] @@ -50,13 +79,14 @@ class BitcoinWidget(QMainWindow): return QLabel('heh') def create_wall_tab(self): - return QLabel(self.wallet.interface.message) + self.textbox = textbox = QTextEdit(self) + textbox.setReadOnly(True) + return textbox def create_status_bar(self): sb = QStatusBar() sb.setFixedHeight(18) self.setStatusBar(sb) - self.statusBar().showMessage(self.tr("test")) class BitcoinGUI(): @@ -65,9 +95,11 @@ class BitcoinGUI(): self.wallet = wallet def main(self): - + s = Sender() + s.start() app = QApplication(sys.argv) w = BitcoinWidget(self.wallet) + w.connect_slots(s) app.exec_()