electrum

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

commit 8a720b1629144ef43a0b5c27682668f55c3afe98
parent 268d7ba3b5e6e221c1161d766ef10f7bcc29c269
Author: ecdsa <ecdsa@github>
Date:   Sun, 17 Mar 2013 10:54:21 +0100

do the banner request in interface, not in wallet

Diffstat:
Mgui/gui_classic.py | 4++--
Mgui/gui_gtk.py | 2+-
Mgui/gui_text.py | 2+-
Mlib/interface.py | 8+++++++-
Mlib/wallet.py | 5-----
5 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/gui/gui_classic.py b/gui/gui_classic.py @@ -324,7 +324,7 @@ class ElectrumWindow(QMainWindow): self.connect(self, QtCore.SIGNAL('update_wallet'), self.update_wallet) self.connect(self, QtCore.SIGNAL('update_status'), self.update_status) - self.connect(self, QtCore.SIGNAL('banner_signal'), lambda: self.console.showMessage(self.wallet.banner) ) + self.connect(self, QtCore.SIGNAL('banner_signal'), lambda: self.console.showMessage(self.wallet.interface.banner) ) self.history_list.setFocus(True) self.exchanger = exchange_rate.Exchanger(self) @@ -337,7 +337,7 @@ class ElectrumWindow(QMainWindow): tabs.setCurrentIndex (0) # set initial message - self.console.showMessage(self.wallet.banner) + self.console.showMessage(self.wallet.interface.banner) # plugins that need to change the GUI do it here self.run_hook('init_gui') diff --git a/gui/gui_gtk.py b/gui/gui_gtk.py @@ -1129,7 +1129,7 @@ class ElectrumWindow: self.update_history_tab() self.update_receiving_tab() # addressbook too... - self.info.set_text( self.wallet.banner ) + self.info.set_text( self.wallet.interface.banner ) self.wallet_updated = False def update_receiving_tab(self): diff --git a/gui/gui_text.py b/gui/gui_text.py @@ -124,7 +124,7 @@ class ElectrumGui: self.stdscr.addstr( 12, 25, _("[Clear]"), curses.A_REVERSE if self.pos%6==5 else curses.color_pair(2)) def print_banner(self): - self.stdscr.addstr( 1, 1, self.wallet.banner ) + self.stdscr.addstr( 1, 1, self.wallet.interface.banner ) def print_list(self, list, firstline): self.maxpos = len(list) diff --git a/lib/interface.py b/lib/interface.py @@ -77,7 +77,8 @@ class Interface(threading.Thread): #json self.message_id = 0 self.unanswered_requests = {} - + #banner + self.banner = '' def queue_json_response(self, c): @@ -106,6 +107,10 @@ class Interface(threading.Thread): if method == 'server.version': self.server_version = result + elif method == 'server.banner': + self.banner = result + self.trigger_callback('banner') + elif method == 'server.peers.subscribe': servers = {} for item in result: @@ -429,6 +434,7 @@ class Interface(threading.Thread): self.connect_event.set() if self.is_connected: self.send([('server.version', [ELECTRUM_VERSION, PROTOCOL_VERSION])]) + self.send([('server.banner',[])]) self.trigger_callback('connected') else: self.trigger_callback('notconnected') diff --git a/lib/wallet.py b/lib/wallet.py @@ -104,7 +104,6 @@ class Wallet: self.prevout_values = {} # my own transaction outputs self.spent_outputs = [] self.receipt = None # next receipt - self.banner = '' # spv self.verifier = None @@ -951,7 +950,6 @@ class WalletSynchronizer(threading.Thread): self.interface = self.wallet.interface self.interface.register_channel('synchronizer') self.wallet.interface.register_callback('connected', lambda: self.wallet.set_up_to_date(False)) - self.wallet.interface.register_callback('connected', lambda: self.interface.send([('server.banner',[])],'synchronizer') ) self.was_updated = True self.running = False self.lock = threading.Lock() @@ -1091,9 +1089,6 @@ class WalletSynchronizer(threading.Thread): self.wallet.tx_result = result self.wallet.tx_event.set() - elif method == 'server.banner': - self.wallet.banner = result - self.interface.trigger_callback('banner') else: print_error("Error: Unknown message:" + method + ", " + repr(params) + ", " + repr(result) )