[gcompris] minor: mining: add return value: event processing



commit 2796daba0bff47dcba322db8bc77d74898e71835
Author: Peter Albrecht <pa-dev gmx de>
Date:   Fri Sep 21 15:50:16 2012 +0200

    minor: mining: add return value: event processing
    
    Event processing functions now return True or False, depending on
    whether they processed the event or not.
    I recognized no problems based on that, but I guess it's better this
    way.

 src/mining-activity/mining.py |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/src/mining-activity/mining.py b/src/mining-activity/mining.py
index 3be63dc..ed5333c 100644
--- a/src/mining-activity/mining.py
+++ b/src/mining-activity/mining.py
@@ -215,11 +215,11 @@ class Gcompris_mining:
 
     # ignore input while game paused
     if self.is_game_paused():
-      return
+      return True
 
     # don't react on double clicks
     if event.type != gtk.gdk.BUTTON_PRESS:
-      return
+      return False
 
     # coordinate space fix
     # Event-coordinates are in the coordinate space of that item, which lies direct under the cursor.
@@ -234,6 +234,9 @@ class Gcompris_mining:
       if self.nugget.is_hit(x, y):
         self.collect_nugget()
 
+    # we processed this event
+    return True
+
 
   def collect_nugget(self):
     """ The nugget was clicked, so collect it """
@@ -599,7 +602,7 @@ class Viewport:
 
     # ignore input while game paused
     if self.is_game_paused():
-      return
+      return True
 
     assert(event.type == gtk.gdk.SCROLL)
 
@@ -694,6 +697,8 @@ class Viewport:
       # call the callback function of main class
       self.cb_zoom_change(state)
 
+    return True
+
 
   def __update_transformation(self):
     """ Update the viewport's transformation matrix """



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]