[gcompris] guessnumber: fixed a potential crash at exit time. Give focus on the entry box.
- From: Bruno Coudoin <bcoudoin src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gcompris] guessnumber: fixed a potential crash at exit time. Give focus on the entry box.
- Date: Fri, 30 Dec 2011 17:14:52 +0000 (UTC)
commit d2fcb71ff9ed6e722a5ba978e5c843e3e8da6d73
Author: Bruno Coudoin <bruno coudoin free fr>
Date: Fri Dec 30 18:14:00 2011 +0100
guessnumber: fixed a potential crash at exit time. Give focus on the entry box.
src/guessnumber-activity/guessnumber.py | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
---
diff --git a/src/guessnumber-activity/guessnumber.py b/src/guessnumber-activity/guessnumber.py
index 0d201bc..1c41000 100644
--- a/src/guessnumber-activity/guessnumber.py
+++ b/src/guessnumber-activity/guessnumber.py
@@ -54,6 +54,7 @@ class Gcompris_guessnumber:
# When the bonus is displayed, it call us first with pause(1) and then with pause(0)
self.board_paused = 0
self.gamewon = 0
+ self.stopped = True
# Manage the helico move
self.move_stepnum = 0
@@ -91,11 +92,14 @@ class Gcompris_guessnumber:
gcompris.set_background(self.gcomprisBoard.canvas.get_root_item(),
"guessnumber/cave.png")
+ self.stopped = False
+
self.display_game()
def end(self):
+ self.stopped = True
# Remove the root item removes all the others inside it
self.cleanup_game()
@@ -279,7 +283,7 @@ class Gcompris_guessnumber:
self.widget.raise_(None)
#self.widget.grab_focus()
- #self.entry.grab_focus()
+ self.entry.grab_focus()
return self.entry
@@ -323,6 +327,9 @@ class Gcompris_guessnumber:
def move_step(self):
+ if self.stopped:
+ return
+
if self.move_stepnum < self.num_moveticks-1:
self.move_stepnum += 1
x = self.anim.get_property("x") + self.velocity[0]/self.num_moveticks
@@ -377,4 +384,6 @@ class Gcompris_guessnumber:
self.movestep_timer = gobject.timeout_add(self.move_tick, self.move_step)
def ok_event(self, widget, target, event, data):
+ if self.stopped:
+ return
self.enter_callback(data)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]