[gnome-games/sudoku-tube] Can restore notes
- From: Zhang Sen <zhangsen src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/sudoku-tube] Can restore notes
- Date: Tue, 21 Jul 2009 10:44:02 +0000 (UTC)
commit 27e62a1d58cd3d64bce2834119d74a592f0823d0
Author: Zhang Sen <zh jesse gmail com>
Date: Tue Jul 21 16:57:41 2009 +0800
Can restore notes
gnome-sudoku/src/lib/gsudoku.py | 7 ++++++-
gnome-sudoku/src/lib/main.py | 2 ++
2 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/gsudoku.py b/gnome-sudoku/src/lib/gsudoku.py
index ec6a53b..b090cee 100644
--- a/gnome-sudoku/src/lib/gsudoku.py
+++ b/gnome-sudoku/src/lib/gsudoku.py
@@ -341,6 +341,11 @@ class NotesModel:
def add_observer(self, observer):
self._observers.append(observer)
+ init_change = []
+ for (x, y) in self._notes:
+ top, bottom = self._notes[(x, y)]
+ init_change.append((x, y, top, bottom))
+ self._signal_observers(init_change)
def _signal_observers(self, changes):
for observer in self._observers:
@@ -353,7 +358,7 @@ class NotesModel:
if top_note is not None:
self._notes[(x, y)][0] = top_note
if bottom_note is not None:
- self._notes[(x, y)][0] = bottom_note
+ self._notes[(x, y)][1] = bottom_note
change = (x, y, top_note, bottom_note)
self._signal_observers([change])
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index 7e985a4..049462f 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -133,6 +133,8 @@ class UI (gconf_wrapper.GConfWrapper):
virgin, in_prog = jar["game"].split('\n')
self._main_model = gsudoku.SudokuModel(virgin, 9, in_prog)
self._notes_model = gsudoku.NotesModel(self._main_model, group_size=9)
+ for (x, y, top, bottom) in jar["notes"]:
+ self._notes_model.set_notes(x, y, top, bottom)
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]