[gcompris] fixes timers not cleared on land_safe activity end.
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris] fixes timers not cleared on land_safe activity end.
- Date: Thu, 28 Feb 2013 22:36:25 +0000 (UTC)
commit 3c094015d86503dc2f896ec8f2d919864dca64f0
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Thu Feb 28 23:35:35 2013 +0100
fixes timers not cleared on land_safe activity end.
I have been reported that this activity creates instability
of GCompris. I found out that its timers are run even when
the activity is ended.
src/land_safe-activity/land_safe.py | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/src/land_safe-activity/land_safe.py b/src/land_safe-activity/land_safe.py
index 6dc62a5..ef6a67c 100644
--- a/src/land_safe-activity/land_safe.py
+++ b/src/land_safe-activity/land_safe.py
@@ -114,6 +114,7 @@ class Gcompris_land_safe:
def end(self):
# Remove the root item removes all the others inside it
self.rootitem.remove()
+ self.space_ship.set_done()
def ok(self):
gcompris.utils.dialog_close()
@@ -261,6 +262,13 @@ class Spaceship:
# Load fuel, altitude and landing area
self.info = Display(self, rootitem)
+ # Set to true to stop the timeout
+ self.done = False
+
+ def set_done(self):
+ self.done = True
+ self.info.done = True
+
def initiate(self):
# incase of landing return false
gobject.timeout_add(30, self.spaceship_movement)
@@ -291,12 +299,18 @@ class Spaceship:
self.key_vertical += 1
def remove_flame(self,side):
+ if self.done:
+ return False
+
if side == 1:
self.flame_left.props.visibility = goocanvas.ITEM_INVISIBLE
else:
self.flame_right.props.visibility = goocanvas.ITEM_INVISIBLE
def spaceship_movement(self):
+ if self.done:
+ return False
+
if self.game.board_paused:
return True
@@ -443,6 +457,9 @@ class Display:
def __init__(self, ship_instance, rootitem):
+ # Set to true to stop the timeout
+ self.done = False
+
# text for altitude
self.rootitem = rootitem
text = goocanvas.Text(
@@ -526,6 +543,9 @@ class Display:
self.vel = self.ship_instance.y
def set_fuel_time(self):
+ if self.done:
+ return False
+
if self.stop_consumtion == True:
return False
@@ -542,6 +562,9 @@ class Display:
gobject.timeout_add(30, self.set_fuel_time)
def fuel(self):
+ if self.done:
+ return False
+
if self.ship_instance.level == 1:
self.fuel_amt -= 1 * 0.5
else:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]