diff options
author | Philip Withnall <philip@tecnocode.co.uk> | 2013-08-19 00:39:14 (GMT) |
---|---|---|
committer | Philip Withnall <philip@tecnocode.co.uk> | 2013-08-19 00:39:14 (GMT) |
commit | eeb46e54fd96248be07a85c28ea4a10035ac78d6 (patch) | |
tree | eba015ed55707f8d9cd42f83f9461c8beac5873a /PascalTriangle.activity/pascaltriangle.py | |
parent | 9dad3344b2e2f8912a78a1a89828a7f44767c082 (diff) |
Improve hint mode to highlight all edge cells equally
This means that a hint is given when the user selects the top-most
edge cell, which would previously not have had a hint due to having
no cells above it.
Diffstat (limited to 'PascalTriangle.activity/pascaltriangle.py')
-rwxr-xr-x | PascalTriangle.activity/pascaltriangle.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/PascalTriangle.activity/pascaltriangle.py b/PascalTriangle.activity/pascaltriangle.py index 6042031..f087ec1 100755 --- a/PascalTriangle.activity/pascaltriangle.py +++ b/PascalTriangle.activity/pascaltriangle.py @@ -281,11 +281,17 @@ class PascalTriangleActivity(activity.Activity): def _get_cell_background(self, row_index, column_index): if (row_index, column_index) == self._current_cell: return cairo.SolidPattern(0.0, 0.7, 0.0) # green + elif self._show_hints and self._current_cell != (-1, -1) and \ + (self._current_cell[1] == 0 or \ + self._current_cell[1] == self._current_cell[0]) and \ + (column_index == 0 or column_index == row_index): + return cairo.SolidPattern(0.0, 0.0, 0.5) # blue elif self._show_hints and row_index == self._current_cell[0] - 1 and \ (column_index == self._current_cell[1] - 1 or \ column_index == self._current_cell[1]): return cairo.SolidPattern(0.5, 0.5, 0.0) # yellow - return cairo.SolidPattern(1.0, 1.0, 1.0) # white + else: + return cairo.SolidPattern(1.0, 1.0, 1.0) # white def _draw_cell(self, ctx, row_index, column_index, cell_width, cell_height): |