- if col < self.puzzle.cols and row < self.puzzle.rows:
- if (self.puzzle.data[row][col].occupied_across is True or
- self.puzzle.data[row][col].occupied_down is True):
- self.selected_col = col
- self.selected_row = row
- drawarea.queue_draw ()
+
+ # function to set the selected row/col based on the number clicked
+ # on the clues list and also set the typing mode
+ def set_selection_of_num (self, num, across = True):
+ # get the row, col of the word
+ row, col = self.puzzle.get_position_of_num (num)
+
+ # set the selected row and column
+ self.selected_row = row
+ self.selected_col = col
+ # set typing mode to across
+ if across is True:
+ self.typing_mode = self.ACROSS
+ else:
+ self.typing_mode = self.DOWN
+
+ # update the puzzle grid
+ puzgrid = self.ui.get_object ("puzzlegrid")
+
+ # set focus to the puzzle grid
+ self.window.set_focus (puzgrid)
+
+ puzgrid.queue_draw ()
+
+ # callback for tree view "across" being activated
+ # activated - when double clicked or enter pressed
+ def on_tree_clues_across_row_activated (self, view, path, column):
+ # get the across list object
+ across_list = self.ui.get_object ("clues_across")
+ # get the number of the across word
+ anum = int (across_list.get_value (across_list.get_iter (path), 0))
+
+ self.set_selection_of_num (anum)