URI: 
       tAdded notifications when receiving a new transaction - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 468c76b66ed39b389bdd7268c4cbdce677e8b3b0
   DIR parent 887557865ec6385b6793edffb1bf53b38c1fb093
  HTML Author: Maran <maran.hidskes@gmail.com>
       Date:   Fri, 31 May 2013 18:23:51 +0200
       
       Added notifications when receiving a new transaction
       
       Diffstat:
         M gui/gui_classic.py                  |      19 ++++++++++++++++---
         M lib/interface.py                    |       1 +
         M lib/wallet.py                       |       6 ++++--
       
       3 files changed, 21 insertions(+), 5 deletions(-)
       ---
   DIR diff --git a/gui/gui_classic.py b/gui/gui_classic.py
       t@@ -244,6 +244,11 @@ class ElectrumWindow(QMainWindow):
                self.config = config
                self.current_account = self.config.get("current_account", None)
        
       +        self.icon = QIcon(os.getcwd() + '/icons/electrum.png')
       +        self.notifier = QSystemTrayIcon(self.icon, self)
       +        self.notifier.setToolTip('Electrum')
       +        self.notifier.show()
       +
                self.init_plugins()
                self.create_status_bar()
        
       t@@ -252,6 +257,7 @@ class ElectrumWindow(QMainWindow):
                self.wallet.interface.register_callback('banner', lambda: self.emit(QtCore.SIGNAL('banner_signal')))
                self.wallet.interface.register_callback('disconnected', lambda: self.emit(QtCore.SIGNAL('update_status')))
                self.wallet.interface.register_callback('disconnecting', lambda: self.emit(QtCore.SIGNAL('update_status')))
       +        self.wallet.interface.register_callback('new_transaction', self.notify_transactions)
        
                self.expert_mode = config.get('classic_expert_mode', False)
                self.decimal_point = config.get('decimal_point', 8)
       t@@ -288,6 +294,7 @@ class ElectrumWindow(QMainWindow):
                
                self.connect(self, QtCore.SIGNAL('update_status'), self.update_status)
                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)
       t@@ -390,8 +397,6 @@ class ElectrumWindow(QMainWindow):
        
                self.setMenuBar(menubar)
        
       -
       -
            def load_wallet(self, filename):
                import electrum
        
       t@@ -415,7 +420,15 @@ class ElectrumWindow(QMainWindow):
        
                self.update_wallet()
        
       -        
       +    def notify_transactions(self):
       +        for tx in self.wallet.interface.pending_transactions:
       +            if tx:
       +                self.wallet.interface.pending_transactions.remove(tx)
       +                is_relevant, is_mine, v, fee = self.wallet.get_tx_value(tx)
       +                self.notify("New transaction received. %s BTC" % (self.format_amount(v)))
       +
       +    def notify(self, message):
       +        self.notifier.showMessage("Electrum", message, QSystemTrayIcon.Information, 20000)
        
            # plugins
            def init_plugins(self):
   DIR diff --git a/lib/interface.py b/lib/interface.py
       t@@ -90,6 +90,7 @@ class Interface(threading.Thread):
                self.unanswered_requests = {}
                #banner
                self.banner = ''
       +        self.pending_transactions = []
        
        
            def queue_json_response(self, c):
   DIR diff --git a/lib/wallet.py b/lib/wallet.py
       t@@ -674,7 +674,6 @@ class Wallet:
        
        
            def receive_tx_callback(self, tx_hash, tx, tx_height):
       -
                if not self.check_new_tx(tx_hash, tx):
                    # may happen due to pruning
                    print_error("received transaction that is no longer referenced in history", tx_hash)
       t@@ -682,6 +681,10 @@ class Wallet:
        
                with self.transaction_lock:
                    self.transactions[tx_hash] = tx
       +
       +            self.interface.pending_transactions.append(tx)
       +            self.interface.trigger_callback("new_transaction")
       +
                    self.save_transactions()
                    if self.verifier and tx_height>0: 
                        self.verifier.add(tx_hash, tx_height)
       t@@ -694,7 +697,6 @@ class Wallet:
                    tx[k] = str(v)
                self.config.set_key('transactions', tx, True)
        
       -
            def receive_history_callback(self, addr, hist):
        
                if not self.check_new_history(addr, hist):