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:
</child>
</object>
</child>
+ <child>
+ <object class="GtkMenuItem" id="puzzle">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Puzzle</property>
+ <property name="use_underline">True</property>
+ <child type="submenu">
+ <object class="GtkMenu" id="menu4">
+ <property name="visible">True</property>
+ <property name="ubuntu_local">True</property>
+ <child>
+ <object class="GtkMenuItem" id="verify">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Verify your board...</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkMenuItem" id="cleargrid">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Clear all...</property>
+ <property name="use_underline">True</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
<child>
<object class="GtkMenuItem" id="view">
<property name="visible">True</property>
</object>
</child>
<child>
- <object class="GtkMenuItem" id="revealsolution">
+ <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
<property name="visible">True</property>
- <property name="label" translatable="yes">Reveal _solution...</property>
- <property name="use_underline">True</property>
</object>
</child>
<child>
- <object class="GtkMenuItem" id="hidesolution">
+ <object class="GtkMenuItem" id="revealsolution">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Hide solution</property>
+ <property name="label" translatable="yes">Reveal _solution...</property>
<property name="use_underline">True</property>
+ <signal name="activate" handler="on_revealsolution_activate"/>
</object>
</child>
<child>
- <object class="GtkSeparatorMenuItem" id="sep2">
- <property name="visible">True</property>
- </object>
- </child>
- <child>
- <object class="GtkMenuItem" id="verify">
+ <object class="GtkMenuItem" id="hidesolution">
<property name="visible">True</property>
- <property name="label" translatable="yes">_Verify your board...</property>
+ <property name="label" translatable="yes">_Hide solution</property>
<property name="use_underline">True</property>
+ <signal name="activate" handler="on_hidesolution_activate"/>
</object>
</child>
</object>