[gnome-games/sudoku-tube] Extract two methods
- From: Zhang Sen <zhangsen src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/sudoku-tube] Extract two methods
- Date: Tue, 7 Jul 2009 10:49:13 +0000 (UTC)
commit 18531e5e7a6d6f1c74da1541db134d26df0536f5
Author: Zhang Sen <zh jesse gmail com>
Date: Tue Jul 7 18:18:29 2009 +0800
Extract two methods
SudokuNumberGrid shouldn't directly manipulate the number-boxes
gnome-sudoku/src/lib/gsudoku.py | 11 ++++++++---
1 files changed, 8 insertions(+), 3 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/gsudoku.py b/gnome-sudoku/src/lib/gsudoku.py
index bc4b850..9417768 100644
--- a/gnome-sudoku/src/lib/gsudoku.py
+++ b/gnome-sudoku/src/lib/gsudoku.py
@@ -95,6 +95,12 @@ class SudokuNumberGrid (gtk.AspectFrame):
for e in self.__entries__.values():
e.modify_bg(gtk.STATE_NORMAL, color)
+ def set_value(self, x, y, value):
+ self.__entries__[(x, y)].set_value(value)
+
+ def set_readonly_appearance(self, x, y, flag):
+ self.__entries__[(x, y)].set_read_only(flag)
+
class ParallelDict (dict):
"""A handy new sort of dictionary for tracking conflicts.
@@ -256,7 +262,6 @@ class SudokuGameDisplay (SudokuNumberGrid, gobject.GObject):
else:
e.set_background_color(self.box_color)
-
def show_hint (self):
if self.focused:
entry = self.focused
@@ -425,9 +430,9 @@ class SudokuGameDisplay (SudokuNumberGrid, gobject.GObject):
To specify NO trackers, use trackers = [-1]
"""
# Add the value to the UI to display
- self.__entries__[(x, y)].set_value(val)
+ self.set_value(x, y, val)
if self.doing_initial_setup:
- self.__entries__[(x, y)].set_read_only(True)
+ self.set_readonly_appearance(x, y, True)
# Handle any trackers.
if trackers:
# Explicitly specified tracker
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]