[gnome-games/sudoku-tube] Use a simple list for updating the grid
- From: Zhang Sen <zhangsen src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/sudoku-tube] Use a simple list for updating the grid
- Date: Fri, 17 Jul 2009 11:04:51 +0000 (UTC)
commit f48fbcbeb481927c17ddcf3c5aa6b1bfdfe80e67
Author: Zhang Sen <zh jesse gmail com>
Date: Fri Jul 17 07:13:33 2009 +0800
Use a simple list for updating the grid
So eliminate NumberBoxModel
gnome-sudoku/src/lib/gsudoku.py | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/gsudoku.py b/gnome-sudoku/src/lib/gsudoku.py
index 0b21778..48f4a2c 100644
--- a/gnome-sudoku/src/lib/gsudoku.py
+++ b/gnome-sudoku/src/lib/gsudoku.py
@@ -192,12 +192,12 @@ class SudokuView(SudokuNumberGrid, gobject.GObject):
values should be a list of NumberBoxModel"""
for box in values:
- x, y = box.x, box.y,
- if box.value is not None:
- self.set_value(x, y, box.value)
- self.emit("view-updated", x, y, box.value)
- if box.conflict is not None:
- self._show_conflict(x, y, box.conflict)
+ x, y, value, conflict = box
+ if value is not None:
+ self.set_value(x, y, value)
+ self.emit("view-updated", x, y, value)
+ if conflict is not None:
+ self._show_conflict(x, y, conflict)
def puzzle_finished_cb(self):
self.emit("puzzle-finished")
@@ -499,7 +499,7 @@ class SudokuModel:
new_conflicts = self._find_new_conflicts(x, y, value)
flag = True if new_conflicts else False
- result.append(NumberBoxModel(x, y, value, conflict=flag))
+ result.append((x, y, value, flag))
result.extend(old_conflicts)
result.extend(new_conflicts)
@@ -513,7 +513,7 @@ class SudokuModel:
result = []
old_conflicts = self._remove_related_conflicts(x, y)
for entry in old_conflicts:
- change = NumberBoxModel(x=entry[0], y=entry[1], conflict=False)
+ change = (entry[0], entry[1], None, False)
result.append(change)
return result
@@ -523,7 +523,7 @@ class SudokuModel:
if new_conflicts:
self.__error_pairs__[(x, y)] = new_conflicts
for entry in new_conflicts:
- change = NumberBoxModel(x=entry[0], y=entry[1], conflict=True)
+ change = (entry[0], entry[1], None, True)
result.append(change)
return result
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]