[gnome-games] refine the parameters of complain_conficts
- From: Thomas Hindoe Paaboel Andersen <thomashpa src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games] refine the parameters of complain_conficts
- Date: Mon, 4 May 2009 16:22:09 -0400 (EDT)
commit 8a4002bbdcef0de7f53242dbf737bcd3a3b3a254
Author: Zhang Sen <zh jesse gmail com>
Date: Tue Apr 28 16:29:23 2009 +0800
refine the parameters of complain_conficts
use coordinates, not widget object, as parameters.
also add docstring
GNOME Bug #578903
---
gnome-sudoku/src/lib/gsudoku.py | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/gnome-sudoku/src/lib/gsudoku.py b/gnome-sudoku/src/lib/gsudoku.py
index 3b7e474..b1b4f25 100644
--- a/gnome-sudoku/src/lib/gsudoku.py
+++ b/gnome-sudoku/src/lib/gsudoku.py
@@ -410,12 +410,16 @@ class SudokuGameDisplay (SudokuNumberGrid, gobject.GObject):
if self.grid.check_for_completeness():
self.emit('puzzle-finished')
- def complain_conflicts (self, origin):
- self.__entries__[origin.x, origin.y].set_error_highlight(True)
- conflicts = self.grid.find_conflicts(origin.x, origin.y, origin.value)
+ def complain_conflicts (self, x, y, value):
+ '''set error highlights on [x, y] and all related box.
+
+ We think the error is caused by `value`. But the box at [x, y] could
+ have a different value.'''
+ self.__entries__[x, y].set_error_highlight(True)
+ conflicts = self.grid.find_conflicts(x, y, value)
for conflict in conflicts:
self.__entries__[conflict].set_error_highlight(True)
- self.__error_pairs__[(origin.x, origin.y)] = conflicts
+ self.__error_pairs__[(x, y)] = conflicts
@simple_debug
def add_value (self, x, y, val, trackers = []):
@@ -453,7 +457,7 @@ class SudokuGameDisplay (SudokuNumberGrid, gobject.GObject):
try:
self.grid.add(x, y, val, True)
except sudoku.ConflictError, err:
- self.complain_conflicts(err)
+ self.complain_conflicts(err.x, err.y, err.value)
# Draw our entry
self.__entries__[(x, y)].queue_draw()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]