From 732f239b54263652fd1a311936d50b5c9b4733ed Mon Sep 17 00:00:00 2001 From: Qua-non Date: Thu, 1 Mar 2012 01:58:57 +0530 Subject: [PATCH 1/2] propagate on_touch_down to kids in Button and Label --- kivy/uix/button.py | 2 ++ kivy/uix/label.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/kivy/uix/button.py b/kivy/uix/button.py index 1a527305e..cb782c748 100644 --- a/kivy/uix/button.py +++ b/kivy/uix/button.py @@ -111,6 +111,8 @@ class Button(Label): self.state = 'normal' def on_touch_down(self, touch): + if super(Button, self).on_touch_down(touch): + return True if not self.collide_point(touch.x, touch.y): return False if self in touch.ud: diff --git a/kivy/uix/label.py b/kivy/uix/label.py index 2d3b9a937..c752dd7ae 100644 --- a/kivy/uix/label.py +++ b/kivy/uix/label.py @@ -179,6 +179,8 @@ class Label(Widget): self.texture_size = list(self.texture.size) def on_touch_down(self, touch): + if super(Label, self).on_touch_down(touch): + return True if not len(self.refs): return False tx, ty = touch.pos From e2cf603ddd5b996e3eb03e182ed3e708467f4341 Mon Sep 17 00:00:00 2001 From: Qua-non Date: Thu, 1 Mar 2012 11:50:48 +0530 Subject: [PATCH 2/2] propagate touch_move and touch_up events to kids and two style guide fixes --- kivy/uix/button.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/kivy/uix/button.py b/kivy/uix/button.py index cb782c748..ce4f217e6 100644 --- a/kivy/uix/button.py +++ b/kivy/uix/button.py @@ -67,7 +67,8 @@ class Button(Label): default to [1, 1, 1, 1]. ''' - background_normal = StringProperty('atlas://data/images/defaulttheme/button') + background_normal = StringProperty( + 'atlas://data/images/defaulttheme/button') '''Background image of the button used for default graphical representation, when the button is not pressed. @@ -77,7 +78,8 @@ class Button(Label): default to 'atlas://data/images/defaulttheme/button' ''' - background_down = StringProperty('atlas://data/images/defaulttheme/button_pressed') + background_down = StringProperty( + 'atlas://data/images/defaulttheme/button_pressed') '''Background image of the button used for default graphical representation, when the button is pressed. @@ -124,9 +126,13 @@ class Button(Label): return True def on_touch_move(self, touch): + if super(Button, self).on_touch_move(touch): + return True return self in touch.ud def on_touch_up(self, touch): + if super(Button, self).on_touch_up(touch): + return True if touch.grab_current is not self: return assert(self in touch.ud)