[gnome-games/applygsoc2009: 10/76] Properly do post-open setup
- From: Pablo Castellano <pablog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/applygsoc2009: 10/76] Properly do post-open setup
- Date: Mon, 6 Sep 2010 02:48:04 +0000 (UTC)
commit c6802aa5e264f1eeb049078e24c4b2be4d891c04
Author: Pablo Castellano <pablog src gnome org>
Date: Thu Aug 26 04:43:44 2010 +0200
Properly do post-open setup
gnome-sudoku/src/lib/main.py | 18 ++++++++++++++----
1 files changed, 14 insertions(+), 4 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index ec74e5e..8249a34 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -132,6 +132,10 @@ class UI (gconf_wrapper.GConfWrapper):
self._auto_load_saved()
if not self._game: # no game loaded
self._auto_load_new()
+ if self._game:
+ self._post_open_setup()
+ else:
+ print 'No game opened, should die'
self.show()
# generate puzzles while our use is working...
@@ -146,7 +150,6 @@ class UI (gconf_wrapper.GConfWrapper):
if saved_games:
self._game = saved_games[0]
saver.open_game(self, self._game)
- self.update_statusbar()
def _auto_load_new(self):
"""Automatically open a new game"""
@@ -156,6 +159,15 @@ class UI (gconf_wrapper.GConfWrapper):
# process self._game==None
self.gsd.change_grid(self._game, 9)
+ def _post_open_setup(self):
+ """Properly do the setup after entering game
+
+ Like show highlight, update hints, start timer, etc."""
+ self.timer.start_timing()
+ self.update_statusbar()
+ if self.gconf['always_show_hints']:
+ self.gsd.update_all_hints()
+
def _run_background_generator (self):
"""Generate puzzles in background"""
if self.gconf['generate_puzzles_in_background']:
@@ -172,13 +184,11 @@ class UI (gconf_wrapper.GConfWrapper):
selector.dialog.destroy()
if not choice:
return True
- self.timer.start_timing()
if choice[0] == game_selector.NewOrSavedGameSelector.NEW_GAME:
self.gsd.change_grid(choice[1], 9)
if choice[0] == game_selector.NewOrSavedGameSelector.SAVED_GAME:
saver.open_game(self, choice[1])
- if self.gconf['always_show_hints']:
- self.gsd.update_all_hints()
+ self._post_open_setup()
def _activate_in_game_actions (self, sensitive):
"""Inactivate some actions if we are in game-selector
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]