commit f2b0b7945dfe5da2568ed7945f050922bda572f4
parent cc526a8734da350769aa41fc7e607161a33c539e
Author: ThomasV <thomasv@electrum.org>
Date: Fri, 12 Feb 2016 15:21:03 +0100
kivy: qr dialog
Diffstat:
5 files changed, 53 insertions(+), 8 deletions(-)
diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py
@@ -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
diff --git a/gui/kivy/uix/dialogs/qr_dialog.py b/gui/kivy/uix/dialogs/qr_dialog.py
@@ -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)
diff --git a/gui/kivy/uix/qrcodewidget.py b/gui/kivy/uix/qrcodewidget.py
@@ -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()
diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py
@@ -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):
@@ -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)
diff --git a/plugins/exchange_rate/exchange_rate.py b/plugins/exchange_rate/exchange_rate.py
@@ -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")