From 3b49b5adca4bd7901148c343d9af290b3a0fc370 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Fri, 16 Oct 2015 11:51:28 +0200 Subject: [PATCH] kivy: dim qr code on touch --- gui/kivy/uix/qrcodewidget.py | 25 ++++++------------------- gui/kivy/uix/ui_screens/receive.kv | 5 +++-- 2 files changed, 9 insertions(+), 21 deletions(-) diff --git a/gui/kivy/uix/qrcodewidget.py b/gui/kivy/uix/qrcodewidget.py index fadd2b6e..a4c8a2b2 100644 --- a/gui/kivy/uix/qrcodewidget.py +++ b/gui/kivy/uix/qrcodewidget.py @@ -18,7 +18,6 @@ from kivy.clock import Clock Builder.load_string(''' - #on_parent: if args[1]: qrimage.source = self.loading_image canvas.before: # Draw white Rectangle Color: @@ -28,15 +27,10 @@ Builder.load_string(''' pos: self.pos canvas.after: Color: - rgba: .5, .5, .5, 0 - Line: - width: dp(1.333) - points: - 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) + rgba: root.foreground_color + Rectangle: + size: self.size + pos: self.pos Image id: qrimage pos_hint: {'center_x': .5, 'center_y': .5} @@ -48,18 +42,11 @@ Builder.load_string(''' class QRCodeWidget(FloatLayout): 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 of the background of the widget. - :data:`background_color` is a :class:`~kivy.properties.ListProperty`, - defaulting to `(1, 1, 1, 1)`. - ''' + foreground_color = ListProperty((0, 0, 0, 0)) + #loading_image = StringProperty('gui/kivy/theming/loading.gif') diff --git a/gui/kivy/uix/ui_screens/receive.kv b/gui/kivy/uix/ui_screens/receive.kv index 00402bd8..159a1d03 100644 --- a/gui/kivy/uix/ui_screens/receive.kv +++ b/gui/kivy/uix/ui_screens/receive.kv @@ -28,9 +28,10 @@ ReceiveScreen: size_hint: None, 1 width: min(self.height, bl.width) pos_hint: {'center': (.5, .5)} + shaded: False on_touch_down: - if self.collide_point(*args[1].pos):\ - app.show_info_bubble(icon=self.ids.qrimage.texture, text='texture') + self.shaded = not self.shaded + self.foreground_color = (0, 0, 0, 0.5) if self.shaded else (0, 0, 0, 0) SendReceiveBlueBottom: id: blue_bottom