[gcompris] piano_composition, skip double clicks.



commit 0c56d73b9d17527fba38c8fd4363d57760c43aca
Author: Bruno Coudoin <bruno coudoin free fr>
Date:   Tue Oct 23 01:02:19 2012 +0200

    piano_composition, skip double clicks.

 .../piano_composition.py                           |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/piano_composition-activity/piano_composition.py b/src/piano_composition-activity/piano_composition.py
index ce7f675..ac93013 100644
--- a/src/piano_composition-activity/piano_composition.py
+++ b/src/piano_composition-activity/piano_composition.py
@@ -56,6 +56,10 @@ class Gcompris_piano_composition:
         self.noClefDescription = False
 
         self.melodyPageToDisplay = 0
+
+        # Used to skip double clicks
+        self.record_click_time = 0
+
     def start(self):
         # write the navigation bar to bottom left corner
         gcompris.bar_set(gcompris.BAR_LEVEL)
@@ -673,6 +677,17 @@ dialogue to\nenable the sound."), None)
         with a note name, text is output to canvas, the note sound is generated,
         and the note is drawn on the staff
         '''
+        # Skip Double clicks
+        if event:
+            if event.type == gtk.gdk._2BUTTON_PRESS:
+                return True
+            if event.time - self.record_click_time <= 200:
+                self.record_click_time = event.time
+                return True
+            self.record_click_time = event.time
+
+
+
         if hasattr(self.staff, 'locked') and self.staff.locked:
             return
         if not numID:



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