[gnome-games/sudoku-tube] Make hints-count work
- From: Zhang Sen <zhangsen src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/sudoku-tube] Make hints-count work
- Date: Wed, 15 Jul 2009 02:40:58 +0000 (UTC)
commit d1203e238ce4a2bff87000394d0300c33a61f562
Author: Zhang Sen <zh jesse gmail com>
Date: Wed Jul 15 10:04:39 2009 +0800
Make hints-count work
gnome-sudoku/src/lib/gsudoku.py | 8 +++++++-
gnome-sudoku/src/lib/main.py | 3 ++-
2 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/gsudoku.py b/gnome-sudoku/src/lib/gsudoku.py
index fca0d41..ffcd05b 100644
--- a/gnome-sudoku/src/lib/gsudoku.py
+++ b/gnome-sudoku/src/lib/gsudoku.py
@@ -328,6 +328,7 @@ class NotesModel:
self._model.add_observer(self)
self._always_show_hints = False
+ self._hints_count = 0
def toggle_auto_hint(self, flag):
if flag:
@@ -386,6 +387,7 @@ class NotesModel:
if vals:
txt = ''.join([str(v) for v in vals])
self.set_notes(x, y, bottom_note=txt)
+ self._increase_hints_count()
else:
self.set_notes(x, y, bottom_note="X")
@@ -394,11 +396,15 @@ class NotesModel:
for y in range(self._group_size):
self.set_notes(x, y, bottom_note="")
+ def _increase_hints_count(self):
+ self._hints_count += 1
+
+ def get_hints_count(self):
+ return self._hints_count
class SudokuModel:
def __init__ (self, grid, group_size):
- self.hints = 0
self.auto_fills = 0
self.show_impossible_implications = False
self.impossible_hints = 0
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index 8670b52..994e7e3 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -322,7 +322,8 @@ class UI (gconf_wrapper.GConfWrapper):
}
sublabel += "\n"
sublabel += ngettext("You got %(n)s hint", "You got %(n)s hints",
- self._main_model.hints) % {'n': self._main_model.hints}
+ self._notes_model.get_hints_count()) % {
+ 'n': self._notes_model.get_hints_count()}
sublabel += "\n"
if self._main_model.impossible_hints:
sublabel += ngettext("You had %(n)s impossibility pointed out.",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]