[gnome-games/applygsoc2009: 46/76] XXX: Read more attributes from saved file. What happened to hints?



commit 12553569c6c4c7db7ed32d6c4511cd6a705b199a
Author: Pablo Castellano <pablog src gnome org>
Date:   Thu Aug 26 16:26:38 2010 +0200

    XXX: Read more attributes from saved file. What happened to hints?

 gnome-sudoku/src/lib/gsudoku.py |    9 ++++++++-
 gnome-sudoku/src/lib/main.py    |    9 +++++++++
 2 files changed, 17 insertions(+), 1 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/gsudoku.py b/gnome-sudoku/src/lib/gsudoku.py
index 11686fd..26f432e 100644
--- a/gnome-sudoku/src/lib/gsudoku.py
+++ b/gnome-sudoku/src/lib/gsudoku.py
@@ -329,7 +329,7 @@ class SudokuModel:
 
 	def __init__ (self, virgin_grid, group_size, initial_grid=None):
         self.hints = 0
-        self.auto_fills = 0
+        self.autofill_count = 0
         self.show_impossible_implications = False
         self.impossible_hints = 0
         self.impossibilities = []
@@ -534,7 +534,14 @@ class SudokuModel:
         if self.grid.check_for_completeness():
             self._signal_completeness()
 
+    def set_autofill_count(self, count):
+        self.autofill_count = count
+
+    def get_autofill_count(self):
+        return self.autofill_count
+
     def auto_fill (self):
+		self.autofill_count += 1
         changed = set(self.grid.auto_fill()) # there are duplicate?
         for coords, val in changed:
 		    self.set_value(coords[0], coords[1], val)
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index d93270e..a83322b 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -128,7 +128,16 @@ class UI (gconf_wrapper.GConfWrapper):
     def _open_saved_game(self, jar):
         virgin, in_prog = jar["game"].split('\n')
         self._main_model = gsudoku.SudokuModel(virgin, 9, in_prog)
+        self._main_model.set_autofill_count(jar["gsd.auto_fills"])
+        
         self._notes_model = gsudoku.NotesModel(self._main_model, group_size=9)
+        self._notes_model.set_hints_count(jar["gsd.hints"])
+        for (x, y, top, bottom) in jar["notes"]:
+             self._notes_model.set_notes(x, y, top, bottom)
+
+        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



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]