electrum

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

commit 34ddaaa419889cb62fd81b2dbdc56c58e6d5469b
parent caccae222cbb9bb7f4658a813274f1796c9a3601
Author: ThomasV <thomasv@electrum.org>
Date:   Thu, 18 Feb 2016 12:41:05 +0100

kivy: share with qr code on double tap

Diffstat:
Mgui/kivy/main.kv | 10+++++-----
Mgui/kivy/main_window.py | 7+++++++
Mgui/kivy/uix/dialogs/qr_dialog.py | 3+++
Mgui/kivy/uix/ui_screens/receive.kv | 6+++---
4 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv @@ -128,11 +128,11 @@ <RefLabel@TopLabel> font_size: '6pt' ref_text: '' - text: '[ref=x]%s[/ref]' % self.ref_text + text: self.ref_text padding: '10dp', '10dp' - on_ref_press: - app._clipboard.copy(self.ref_text) - app.show_info(_('Text copied to clipboard')) + on_touch_down: + touch = args[1] + if self.collide_point(*touch.pos): app.on_ref_label(self.ref_text, touch) canvas.before: Color: rgb: .3, .3, .3 @@ -143,7 +143,7 @@ <TxHashLabel@RefLabel> tx_hash: '' ref_text: self.tx_hash - text: '[ref=x]%s[/ref]' %' '.join(map(''.join, zip(*[iter(self.tx_hash)]*4))) if self.tx_hash else '' + text: ' '.join(map(''.join, zip(*[iter(self.tx_hash)]*4))) if self.tx_hash else '' <InfoBubble> size_hint: None, None diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py @@ -600,6 +600,13 @@ class ElectrumWindow(App): self._orientation = 'landscape' if width > height else 'portrait' self._ui_mode = 'tablet' if min(width, height) > inch(3.51) else 'phone' + def on_ref_label(self, text, touch): + if touch.is_double_tap: + self.qr_dialog(_('Share with QR Code'), text) + else: + self._clipboard.copy(text) + self.show_info(_('Text copied to clipboard')) + def set_send(self, address, amount, label, message): self.send_payment(address, amount=amount, label=label, message=message) diff --git a/gui/kivy/uix/dialogs/qr_dialog.py b/gui/kivy/uix/dialogs/qr_dialog.py @@ -5,6 +5,7 @@ Builder.load_string(''' <QRDialog@Popup> id: popup title: '' + data: '' shaded: False AnchorLayout: anchor_x: 'center' @@ -13,6 +14,8 @@ Builder.load_string(''' size_hint: 1, 1 QRCodeWidget: id: qr + TopLabel: + text: root.data Widget: size_hint: 1, 0.2 BoxLayout: diff --git a/gui/kivy/uix/ui_screens/receive.kv b/gui/kivy/uix/ui_screens/receive.kv @@ -35,9 +35,10 @@ ReceiveScreen: width: min(self.height, bl.width) pos_hint: {'center': (.5, .5)} shaded: False + foreground_color: (0, 0, 0, 0.5) if self.shaded else (0, 0, 0, 0) on_touch_down: - self.shaded = not self.shaded - self.foreground_color = (0, 0, 0, 0.5) if self.shaded else (0, 0, 0, 0) + touch = args[1] + if self.collide_point(*touch.pos): self.shaded = not self.shaded Label: text: root.status opacity: 1 if root.status else 0 @@ -52,7 +53,6 @@ ReceiveScreen: pos: self.pos size: self.size - SendReceiveBlueBottom: id: blue_bottom size_hint: 1, None