diff options
author | Gonzalo Odiard <godiard@gmail.com> | 2014-06-16 14:17:05 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@gmail.com> | 2014-06-16 15:26:39 (GMT) |
commit | a9a505e4c1a299c07a4d45ae9331ba2db0dffd09 (patch) | |
tree | 2930c68a5c11b8c0ea36758795ca2a56a54fe207 | |
parent | 11e735284e41a94cb31dbd00cfbc121628aca86f (diff) |
Be sure finishwindow is closed when the game finish
-rwxr-xr-x | activity.py | 4 | ||||
-rw-r--r-- | game.py | 9 |
2 files changed, 10 insertions, 3 deletions
diff --git a/activity.py b/activity.py index 1cf3040..6afdbd1 100755 --- a/activity.py +++ b/activity.py @@ -199,5 +199,9 @@ class MazeActivity(activity.Activity): logging.debug('Saving data: %s', data) self.metadata['state'] = json.dumps(data) + def can_close(self): + self.game.close_finish_window() + return True + def read_file(self, file_path): pass @@ -178,9 +178,7 @@ class MazeGame(Gtk.DrawingArea): self.mouse_in_use = 0 if self._ebook_mode_detector.get_ebook_mode(): self._start_accelerometer() - if self._finish_window is not None: - self._finish_window.destroy() - self._finish_window = None + self.close_finish_window() def __draw_cb(self, widget, ctx): # compute the size of the tiles given the screen size, etc. @@ -589,6 +587,11 @@ class MazeGame(Gtk.DrawingArea): parent_xid = self.get_toplevel().get_window() self._finish_window = FinishWindow(self, parent_xid) + def close_finish_window(self): + if self._finish_window is not None: + self._finish_window.destroy() + self._finish_window = None + class FinishWindow(Gtk.Window): |