kivy: dim qr code on touch
This commit is contained in:
parent
aa83f5fdca
commit
3b49b5adca
|
@ -18,7 +18,6 @@ from kivy.clock import Clock
|
||||||
|
|
||||||
Builder.load_string('''
|
Builder.load_string('''
|
||||||
<QRCodeWidget>
|
<QRCodeWidget>
|
||||||
#on_parent: if args[1]: qrimage.source = self.loading_image
|
|
||||||
canvas.before:
|
canvas.before:
|
||||||
# Draw white Rectangle
|
# Draw white Rectangle
|
||||||
Color:
|
Color:
|
||||||
|
@ -28,15 +27,10 @@ Builder.load_string('''
|
||||||
pos: self.pos
|
pos: self.pos
|
||||||
canvas.after:
|
canvas.after:
|
||||||
Color:
|
Color:
|
||||||
rgba: .5, .5, .5, 0
|
rgba: root.foreground_color
|
||||||
Line:
|
Rectangle:
|
||||||
width: dp(1.333)
|
size: self.size
|
||||||
points:
|
pos: self.pos
|
||||||
self.x + dp(2), self.y + dp(2),\
|
|
||||||
self.right - dp(2), self.y + dp(2),\
|
|
||||||
self.right - dp(2), self.top - dp(2),\
|
|
||||||
self.x + dp(2), self.top - dp(2),\
|
|
||||||
self.x + dp(2), self.y + dp(2)
|
|
||||||
Image
|
Image
|
||||||
id: qrimage
|
id: qrimage
|
||||||
pos_hint: {'center_x': .5, 'center_y': .5}
|
pos_hint: {'center_x': .5, 'center_y': .5}
|
||||||
|
@ -48,18 +42,11 @@ Builder.load_string('''
|
||||||
class QRCodeWidget(FloatLayout):
|
class QRCodeWidget(FloatLayout):
|
||||||
|
|
||||||
data = StringProperty(None, allow_none=True)
|
data = StringProperty(None, allow_none=True)
|
||||||
''' Data using which the qrcode is generated.
|
|
||||||
|
|
||||||
:data:`data` is a :class:`~kivy.properties.StringProperty`, defaulting to
|
|
||||||
`None`.
|
|
||||||
'''
|
|
||||||
|
|
||||||
background_color = ListProperty((1, 1, 1, 1))
|
background_color = ListProperty((1, 1, 1, 1))
|
||||||
''' Background color of the background of the widget.
|
|
||||||
|
|
||||||
:data:`background_color` is a :class:`~kivy.properties.ListProperty`,
|
foreground_color = ListProperty((0, 0, 0, 0))
|
||||||
defaulting to `(1, 1, 1, 1)`.
|
|
||||||
'''
|
|
||||||
|
|
||||||
#loading_image = StringProperty('gui/kivy/theming/loading.gif')
|
#loading_image = StringProperty('gui/kivy/theming/loading.gif')
|
||||||
|
|
||||||
|
|
|
@ -28,9 +28,10 @@ ReceiveScreen:
|
||||||
size_hint: None, 1
|
size_hint: None, 1
|
||||||
width: min(self.height, bl.width)
|
width: min(self.height, bl.width)
|
||||||
pos_hint: {'center': (.5, .5)}
|
pos_hint: {'center': (.5, .5)}
|
||||||
|
shaded: False
|
||||||
on_touch_down:
|
on_touch_down:
|
||||||
if self.collide_point(*args[1].pos):\
|
self.shaded = not self.shaded
|
||||||
app.show_info_bubble(icon=self.ids.qrimage.texture, text='texture')
|
self.foreground_color = (0, 0, 0, 0.5) if self.shaded else (0, 0, 0, 0)
|
||||||
|
|
||||||
SendReceiveBlueBottom:
|
SendReceiveBlueBottom:
|
||||||
id: blue_bottom
|
id: blue_bottom
|
||||||
|
|
Loading…
Reference in New Issue