[gnome-games/sudoku-tube] Use NumberBoxModel again, instead of a list
- From: Zhang Sen <zhangsen src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/sudoku-tube] Use NumberBoxModel again, instead of a list
- Date: Wed, 22 Jul 2009 12:07:06 +0000 (UTC)
commit f260c15304d33fe2d9fb73dce5659a95e09c5480
Author: Zhang Sen <zh jesse gmail com>
Date: Wed Jul 22 19:04:14 2009 +0800
Use NumberBoxModel again, instead of a list
gnome-sudoku/src/lib/model.py | 9 ++++-----
gnome-sudoku/src/lib/networking.py | 2 +-
gnome-sudoku/src/lib/view.py | 6 +++---
3 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/model.py b/gnome-sudoku/src/lib/model.py
index 598e2b0..3d49f7c 100644
--- a/gnome-sudoku/src/lib/model.py
+++ b/gnome-sudoku/src/lib/model.py
@@ -218,7 +218,6 @@ class SudokuModel:
self.set_value(col, row, values[index])
def set_value(self, x, y, value):
- result = []
old_conflicts = self._remove_old_conficts(x, y)
new_conflicts = []
@@ -234,7 +233,7 @@ class SudokuModel:
new_conflicts = self._find_new_conflicts(x, y, value)
flag = True if new_conflicts else False
- result.append((x, y, value, flag))
+ result = [NumberBoxModel(x, y, value=value, conflict=flag)]
result.extend(old_conflicts)
result.extend(new_conflicts)
@@ -251,7 +250,7 @@ class SudokuModel:
result = []
old_conflicts = self._remove_related_conflicts(x, y)
for entry in old_conflicts:
- change = (entry[0], entry[1], None, False)
+ change = NumberBoxModel(entry[0], entry[1], conflict=False)
result.append(change)
return result
@@ -261,7 +260,7 @@ class SudokuModel:
if new_conflicts:
self.__error_pairs__[(x, y)] = new_conflicts
for entry in new_conflicts:
- change = (entry[0], entry[1], None, True)
+ change = NumberBoxModel(entry[0], entry[1], conflict=True)
result.append(change)
return result
@@ -293,7 +292,7 @@ class SudokuModel:
changed = set(self.grid.auto_fill()) # there are duplicate?
for coords, val in changed:
x, y = coords
- result.append((x, y, val, None))
+ result.append(NumberBoxModel(x, y, value=val))
self._signal_observers(result)
self._check_for_completeness()
diff --git a/gnome-sudoku/src/lib/networking.py b/gnome-sudoku/src/lib/networking.py
index 91a195c..a6fb882 100644
--- a/gnome-sudoku/src/lib/networking.py
+++ b/gnome-sudoku/src/lib/networking.py
@@ -40,7 +40,7 @@ class LocalViewProxy:
def update(self, changes):
for box in changes:
- x, y, value, conflict = box
+ x, y, value, conflict = box.x, box.y, box.value, box.conflict
if value is None:
pass
elif value == 0:
diff --git a/gnome-sudoku/src/lib/view.py b/gnome-sudoku/src/lib/view.py
index 5b10373..2b799ca 100644
--- a/gnome-sudoku/src/lib/view.py
+++ b/gnome-sudoku/src/lib/view.py
@@ -150,7 +150,7 @@ class SudokuView(SudokuNumberGrid, gobject.GObject):
values should be a list of NumberBoxModel"""
for box in values:
- x, y, value, conflict = box
+ x, y, value, conflict = box.x, box.y, box.value, box.conflict
if value is not None:
self.set_value(x, y, value)
self.emit("view-updated", x, y, value)
@@ -160,8 +160,8 @@ class SudokuView(SudokuNumberGrid, gobject.GObject):
def puzzle_finished_cb(self):
self.emit("puzzle-finished")
- def _show_conflict(self, x, y, conflict):
- self.__entries__[(x, y)].set_error_highlight(conflict)
+ def _show_conflict(self, x, y, flag):
+ self.__entries__[(x, y)].set_error_highlight(flag)
def update_notes(self, notes_list):
for notes in notes_list:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]