tkivy: dim qr code on touch - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 3b49b5adca4bd7901148c343d9af290b3a0fc370 DIR parent aa83f5fdcad96c684e42033525b49ab288d16e78 HTML Author: ThomasV <thomasv@electrum.org> Date: Fri, 16 Oct 2015 11:51:28 +0200 kivy: dim qr code on touch Diffstat: M gui/kivy/uix/qrcodewidget.py | 25 ++++++------------------- M gui/kivy/uix/ui_screens/receive.kv | 5 +++-- 2 files changed, 9 insertions(+), 21 deletions(-) --- DIR diff --git a/gui/kivy/uix/qrcodewidget.py b/gui/kivy/uix/qrcodewidget.py t@@ -18,7 +18,6 @@ from kivy.clock import Clock Builder.load_string(''' <QRCodeWidget> - #on_parent: if args[1]: qrimage.source = self.loading_image canvas.before: # Draw white Rectangle Color: t@@ -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} t@@ -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') DIR diff --git a/gui/kivy/uix/ui_screens/receive.kv b/gui/kivy/uix/ui_screens/receive.kv t@@ -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