URI: 
       tgui: display lightning balance in status bar - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit b7d93e2e11b8f21d9b4005dbf24b5673869c9bcc
   DIR parent 18bd93446189757143953af09c5982f3123c7872
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Wed, 30 Jan 2019 19:16:04 +0100
       
       gui: display lightning balance in status bar
       
       Diffstat:
         M electrum/commands.py                |       3 +++
         M electrum/gui/qt/main_window.py      |       4 ++++
         M electrum/lnworker.py                |       4 ++++
       
       3 files changed, 11 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/electrum/commands.py b/electrum/commands.py
       t@@ -348,11 +348,14 @@ class Commands:
            def getbalance(self):
                """Return the balance of your wallet. """
                c, u, x = self.wallet.get_balance()
       +        l = self.lnworker.get_balance()
                out = {"confirmed": str(Decimal(c)/COIN)}
                if u:
                    out["unconfirmed"] = str(Decimal(u)/COIN)
                if x:
                    out["unmatured"] = str(Decimal(x)/COIN)
       +        if l:
       +            out["lightning"] = str(Decimal(l)/COIN)
                return out
        
            @command('n')
   DIR diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
       t@@ -371,6 +371,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
                    self.channels_list.update_rows.emit(*args)
                elif event == 'channel':
                    self.channels_list.update_single_row.emit(*args)
       +            self.update_status()
                elif event == 'ln_status':
                    self.need_update_ln.set()
                else:
       t@@ -850,6 +851,9 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
                            text +=  " [%s unconfirmed]"%(self.format_amount(u, is_diff=True).strip())
                        if x:
                            text +=  " [%s unmatured]"%(self.format_amount(x, is_diff=True).strip())
       +                l = self.wallet.lnworker.get_balance()
       +                if l:
       +                    text += u'    \U0001f5f2 %s'%(self.format_amount_and_units(l).strip())
        
                        # append fiat balance and price
                        if self.fx.is_enabled():
   DIR diff --git a/electrum/lnworker.py b/electrum/lnworker.py
       t@@ -572,6 +572,10 @@ class LNWorker(PrintError):
                self.wallet.storage.put('lightning_invoices', self.invoices)
                self.wallet.storage.write()
        
       +    def get_balance(self):
       +        with self.lock:
       +            return Decimal(sum(chan.balance(LOCAL) for chan in self.channels.values()))/1000
       +
            def list_channels(self):
                with self.lock:
                    # we output the funding_outpoint instead of the channel_id because lnd uses channel_point (funding outpoint) to identify channels