kivy: share with qr code on double tap

This commit is contained in:
ThomasV 2016-02-18 12:41:05 +01:00
parent caccae222c
commit 34ddaaa419
4 changed files with 18 additions and 8 deletions

View File

@ -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

View File

@ -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)

View File

@ -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:

View File

@ -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