URI: 
       tkivy: qr dialog - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit f2b0b7945dfe5da2568ed7945f050922bda572f4
   DIR parent cc526a8734da350769aa41fc7e607161a33c539e
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Fri, 12 Feb 2016 15:21:03 +0100
       
       kivy: qr dialog
       
       Diffstat:
         M gui/kivy/main_window.py             |       5 +++++
         A gui/kivy/uix/dialogs/qr_dialog.py   |      36 +++++++++++++++++++++++++++++++
         M gui/kivy/uix/qrcodewidget.py        |       2 +-
         M gui/kivy/uix/screens.py             |      17 ++++++++++-------
         M plugins/exchange_rate/exchange_rat… |       1 +
       
       5 files changed, 53 insertions(+), 8 deletions(-)
       ---
   DIR diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py
       t@@ -267,6 +267,11 @@ class ElectrumWindow(App):
                self.switch_to('receive')
                self.receive_screen.screen.address = addr
        
       +    def qr_dialog(self, title, data):
       +        from uix.dialogs.qr_dialog import QRDialog
       +        popup = QRDialog(title, data)
       +        popup.open()
       +
            def scan_qr(self, on_complete):
                if platform != 'android':
                    return
   DIR diff --git a/gui/kivy/uix/dialogs/qr_dialog.py b/gui/kivy/uix/dialogs/qr_dialog.py
       t@@ -0,0 +1,36 @@
       +from kivy.factory import Factory
       +from kivy.lang import Builder
       +
       +Builder.load_string('''
       +<QRDialog@Popup>
       +    id: popup
       +    title: ''
       +    shaded: False
       +    AnchorLayout:
       +        anchor_x: 'center'
       +        BoxLayout:
       +            orientation: 'vertical'
       +            size_hint: 1, 1
       +            QRCodeWidget:
       +                id: qr
       +            Widget:
       +                size_hint: 1, 0.2
       +            BoxLayout:
       +                size_hint: 1, None
       +                height: '48dp'
       +                Widget:
       +                    size_hint: 1, None
       +                    height: '48dp'
       +                Button:
       +                    size_hint: 1, None
       +                    height: '48dp'
       +                    text: _('Close')
       +                    on_release:
       +                        popup.dismiss()
       +''')
       +
       +class QRDialog(Factory.Popup):
       +    def __init__(self, title, data):
       +        Factory.Popup.__init__(self)
       +        self.title = title
       +        self.ids.qr.set_data(data)
   DIR diff --git a/gui/kivy/uix/qrcodewidget.py b/gui/kivy/uix/qrcodewidget.py
       t@@ -111,7 +111,7 @@ class QRCodeWidget(FloatLayout):
            def _upd_texture(self, buff):
                texture = self._qrtexture
                texture.blit_buffer(buff, colorfmt='rgb', bufferfmt='ubyte')
       -        img =self.ids.qrimage
       +        img = self.ids.qrimage
                img.anim_delay = -1
                img.texture = texture
                img.canvas.ask_update()
   DIR diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py
       t@@ -133,12 +133,12 @@ class HistoryScreen(CScreen):
        
                    label = self.app.wallet.get_label(tx_hash) if tx_hash else _('Pruned transaction outputs')
                    date = timestamp_to_datetime(timestamp)
       -            rate = run_hook('history_rate', date)
       -            if self.app.fiat_unit:
       -                s = run_hook('historical_value_str', value, date)
       -                quote_text = "..." if s is None else s + ' ' + self.app.fiat_unit
       -            else:
       -                quote_text = ''
       +            quote_text = ''
       +            if self.app.fiat_unit and date:
       +                rate = run_hook('history_rate', date)
       +                if rate:
       +                    s = run_hook('value_str', value, rate)
       +                    quote_text = '' if s is None else s + ' ' + self.app.fiat_unit
                    yield (conf, icon, time_str, label, value, tx_hash, quote_text)
        
            def update(self, see_all=False):
       t@@ -273,7 +273,10 @@ class SendScreen(CScreen):
                    self.app.show_error(str(e))
                    return
                if not tx.is_complete():
       -            self.app.show_info("Transaction is not complete")
       +            from electrum.bitcoin import base_encode
       +            text = str(tx).decode('hex')
       +            text = base_encode(text, base=43)
       +            self.app.qr_dialog(_("Unsigned Transaction"), text)
                    return
                # broadcast
                ok, txid = self.app.wallet.sendtx(tx)
   DIR diff --git a/plugins/exchange_rate/exchange_rate.py b/plugins/exchange_rate/exchange_rate.py
       t@@ -388,6 +388,7 @@ class FxPlugin(BasePlugin, ThreadJob):
            def requires_settings(self):
                return True
        
       +    @hook
            def value_str(self, satoshis, rate):
                if satoshis is None:  # Can happen with incomplete history
                    return _("Unknown")