X-Git-Url: https://harishankar.org/repos/?p=getaclue.git;a=blobdiff_plain;f=player_mainwindow.py;fp=player_mainwindow.py;h=b384b542cd1aa51a01c4f39fc1b3bc9cc49b12bf;hp=89459ae4114f35cb7afa20c235d9269cc3ec7bbd;hb=d7084b7094c99003960b33d4bd4fb655248c6ab3;hpb=1f9de52c4798a22293aaf2c32611090a099d0ce4 diff --git a/player_mainwindow.py b/player_mainwindow.py index 89459ae..b384b54 100644 --- a/player_mainwindow.py +++ b/player_mainwindow.py @@ -33,6 +33,30 @@ class MainWindow: self.gtk_main_quit () + # callback for menu item hide solution activated event + def on_hidesolution_activate (self, menuitem): + if self.puzzle: + # hide the solution + self.puzzle.reveal_solution (False) + puzgrid = self.ui.get_object ("puzzlegrid") + # redraw the grid + puzgrid.queue_draw () + + # callback for menu item reveal solution activated event + def on_revealsolution_activate (self, menuitem): + if self.puzzle: + # confirm first + dlg = gtk.MessageDialog (self.window, gtk.DIALOG_MODAL, + gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO, + "This will reveal all words in the puzzle! Are you sure?") + if dlg.run () == gtk.RESPONSE_YES: + # reveal the solution + self.puzzle.reveal_solution () + # redraw the grid + puzgrid = self.ui.get_object ("puzzlegrid") + puzgrid.queue_draw () + dlg.destroy () + # callback for menu item reveal word activated event def on_revealword_activate (self, menuitem): if self.puzzle: