[gcompris] play_piano, avoid double clicks.
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris] play_piano, avoid double clicks.
- Date: Sun, 14 Oct 2012 21:30:45 +0000 (UTC)
commit c63460ef25ad959969093294f3cd9f87a209d885
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Sun Oct 14 23:25:53 2012 +0200
play_piano, avoid double clicks.
In this activity, double clicks events was making the activity
impossible to play.
src/play_piano-activity/play_piano.py | 13 +++++++++++++
1 files changed, 13 insertions(+), 0 deletions(-)
---
diff --git a/src/play_piano-activity/play_piano.py b/src/play_piano-activity/play_piano.py
index 349eec3..a7ca957 100644
--- a/src/play_piano-activity/play_piano.py
+++ b/src/play_piano-activity/play_piano.py
@@ -48,6 +48,9 @@ class Gcompris_play_piano:
self.afterBonus = None
+ # Used to skip double clicks
+ self.record_click_time = 0
+
def start(self):
self.recordedHits = []
self.saved_policy = gcompris.sound.policy_get()
@@ -195,6 +198,16 @@ dialogue to\nenable the sound."), None)
gobject.timeout_add(500, self.display_bonus)
def keyboard_click(self, widget=None, target=None, event=None, numID=None):
+
+ # 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 not numID:
numID = target.numID
if self.gcomprisBoard.level <= 6:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]