+ # callback for menu item reveal word activated event
+ def on_revealword_activate (self, menuitem):
+ if self.puzzle:
+ # reveal across/down word if any the position
+ if self.puzzle.data[self.selected_row][self.selected_col].occupied_across is True:
+ dlg = gtk.MessageDialog (self.window, gtk.DIALOG_MODAL,
+ gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO,
+ "Are you sure you wish to reveal across word at current cell?")
+ # confirm that the user wants to reveal
+ if dlg.run () == gtk.RESPONSE_YES:
+ self.puzzle.reveal_word_across (self.selected_row, self.selected_col)
+ # redraw the grid to reveal the word
+ puzgrid = self.ui.get_object ("puzzlegrid")
+ puzgrid.queue_draw ()
+ dlg.destroy ()
+ if self.puzzle.data[self.selected_row][self.selected_col].occupied_down is True:
+ dlg = gtk.MessageDialog (self.window, gtk.DIALOG_MODAL,
+ gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO,
+ "Are you sure wish to reveal down word at current cell?")
+ if dlg.run () == gtk.RESPONSE_YES:
+ self.puzzle.reveal_word_down (self.selected_row, self.selected_col)
+ # redraw the grid to reveal the word
+ puzgrid = self.ui.get_object ("puzzlegrid")
+ puzgrid.queue_draw ()
+ dlg.destroy ()
+
+