[gnome-games/applygsoc2009: 8/76] Cleaner way of finding current focused box
- From: Pablo Castellano <pablog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games/applygsoc2009: 8/76] Cleaner way of finding current focused box
- Date: Mon, 6 Sep 2010 02:47:54 +0000 (UTC)
commit 00412aa349630ce159ccc19cc6a507c8b5800c4e
Author: Pablo Castellano <pablog src gnome org>
Date: Thu Aug 26 04:39:50 2010 +0200
Cleaner way of finding current focused box
gnome-sudoku/src/lib/gsudoku.py | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
---
diff --git a/gnome-sudoku/src/lib/gsudoku.py b/gnome-sudoku/src/lib/gsudoku.py
index d82c643..0e26db5 100644
--- a/gnome-sudoku/src/lib/gsudoku.py
+++ b/gnome-sudoku/src/lib/gsudoku.py
@@ -49,9 +49,6 @@ class SudokuNumberGrid (gtk.AspectFrame):
for entry in self.__entries__.values():
entry.set_timer(timer)
- def get_focused_entry (self):
- return self.table.focus_child
-
def set_bg_color (self, color):
if type(color) == str:
try:
@@ -81,6 +78,7 @@ class SudokuGameDisplay (SudokuNumberGrid, gobject.GObject):
def __init__ (self, grid = None, group_size = 9,
show_impossible_implications = False):
group_size = int(group_size)
+ self.focused = None
self.hints = 0
self.hint_square = None
self.always_show_hints = False
@@ -150,7 +148,7 @@ class SudokuGameDisplay (SudokuNumberGrid, gobject.GObject):
def toggle_highlight (self, val):
self.do_highlight_cells = val
self.unhighlight_cells()
- if hasattr(self, 'focused') and self.focused:
+ if self.focused:
self.highlight_cells()
def unhighlight_cells (self, *args):
@@ -161,7 +159,7 @@ class SudokuGameDisplay (SudokuNumberGrid, gobject.GObject):
if not self.do_highlight_cells:
return
self.unhighlight_cells()
- if not hasattr(self, 'box_color'):
+ if self.focused:
self.get_highlight_colors()
my_x, my_y = self.focused.x, self.focused.y
@@ -581,7 +579,7 @@ class SudokuGameDisplay (SudokuNumberGrid, gobject.GObject):
@simple_debug
def auto_fill_current_entry (self):
- e = self.get_focused_entry()
+ e = self.focused
if not e:
return
filled = self.grid.auto_fill_for_xy(e.x, e.y)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]