[gnome-games/sudoku-tube] On work: Can read saved trackers
- From: Zhang Sen <zhangsen src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/sudoku-tube] On work: Can read saved trackers
- Date: Fri, 24 Jul 2009 03:00:05 +0000 (UTC)
commit 5e9b94919badbdcc9337fdd6cd77a1170fdcc6bb
Author: Zhang Sen <zh jesse gmail com>
Date: Fri Jul 24 09:46:30 2009 +0800
On work: Can read saved trackers
gnome-sudoku/src/lib/main.py | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index 2a3101c..f24a6c1 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -121,12 +121,12 @@ class UI (gconf_wrapper.GConfWrapper):
if game_type == game_selector.NewOrSavedGameSelector.NEW_GAME:
self._main_model = model.SudokuModel(puzzle, 9)
self._notes_model = model.NotesModel(self._main_model, group_size=9)
+ self._main_grid_vew.connect_to_model(self._main_model)
elif game_type == game_selector.NewOrSavedGameSelector.SAVED_GAME:
self._open_saved_game(puzzle)
else:
logger.fatal("shouldn't be here")
- self._main_grid_vew.connect_to_model(self._main_model)
self._main_grid_vew.connect_to_notes_model(self._notes_model)
def _open_saved_game(self, jar):
@@ -134,6 +134,10 @@ class UI (gconf_wrapper.GConfWrapper):
self._main_model = model.SudokuModel(virgin, 9, in_prog)
self._main_model.set_autofill_count(jar["gsd.auto_fills"])
+ # Do the connection here; it will setup the readonly appearance.
+ # And it must be before the following tracker-setup
+ self._main_grid_vew.connect_to_model(self._main_model)
+
self._notes_model = model.NotesModel(self._main_model, group_size=9)
self._notes_model.set_hints_count(jar["gsd.hints"])
for (x, y, top, bottom) in jar["notes"]:
@@ -142,19 +146,18 @@ class UI (gconf_wrapper.GConfWrapper):
self.timer.__absolute_start_time__ = jar["timer.__absolute_start_time__"]
self.timer.active_time = jar["timer.active_time"]
self.timer.total_time = jar["timer.total_time"]
- return
# this is a bit easily breakable... we take advantage of the fact
# that we create tracker IDs sequentially and that {}.items()
# sorts by keys by default
for tracker, tracked in jar.get('trackers', {}).items():
# add 1 tracker per existing tracker...
- self.tracker_ui.add_tracker()
+ self._tracker_ui.add_tracker()
for x, y, val in tracked:
- self.gsd.add_tracker(x, y, tracker, val = val)
+ self._main_model.set_value(x, y, val)
for tracker, tracking in jar.get('tracking', {}).items():
if tracking:
- ui.tracker_ui.select_tracker(tracker)
+ self._tracker_ui.select_tracker(tracker)
def _post_open_setup(self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]