[gnome-games/sudoku-tube] Add new_with_contact to GUI
- From: Zhang Sen <zhangsen src gnome org>
- To: svn-commits-list gnome org
- Subject: [gnome-games/sudoku-tube] Add new_with_contact to GUI
- Date: Tue, 26 May 2009 21:18:40 -0400 (EDT)
commit 24c3ad452b6c0d14d56d5ac18b17082bf0e08e36
Author: Zhang Sen <zh jesse gmail com>
Date: Wed May 27 09:15:51 2009 +0800
Add new_with_contact to GUI
Add 'NewWithContact' action and menuitem. For now it's identical to the 'New'
action (open local game).
---
gnome-sudoku/src/lib/main.py | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/gnome-sudoku/src/lib/main.py b/gnome-sudoku/src/lib/main.py
index 9ae99cc..6687677 100644
--- a/gnome-sudoku/src/lib/main.py
+++ b/gnome-sudoku/src/lib/main.py
@@ -49,6 +49,7 @@ def inactivate_new_game_etc (fun):
def inactivate_new_game_etc_ (ui, *args, **kwargs):
paths = [
'/MenuBar/Game/New',
+ '/MenuBar/Game/NewWithContact',
'/MenuBar/Game/Print',
# undo/redo is handled elsewhere as it can't simply be turned on/off.
'/MenuBar/Edit/Clear',
@@ -87,6 +88,7 @@ class UI (gconf_wrapper.GConfWrapper):
<menubar name="MenuBar">
<menu name="Game" action="Game">
<menuitem action="New"/>
+ <menuitem action="NewWithContact"/>
<separator/>
<menuitem action="PuzzleInfo"/>
<separator/>
@@ -247,6 +249,8 @@ class UI (gconf_wrapper.GConfWrapper):
('Game', None, _('_Game')),
('New', gtk.STOCK_NEW, None,
'<Control>n', _('New game'), self.new_cb),
+ ('NewWithContact', gtk.STOCK_NEW, _('New with contact'),
+ None, _('New with contact'), self.new_with_contact),
('Print', gtk.STOCK_PRINT, None,
None, _('Print current game'), self.print_game),
('PrintMany', gtk.STOCK_PRINT, _('Print _Multiple Sudokus'),
@@ -475,6 +479,23 @@ class UI (gconf_wrapper.GConfWrapper):
self.do_stop()
self.select_game()
+ @inactivate_new_game_etc
+ def new_with_contact (self, *args):
+ if (self.gsd.grid and self.gsd.grid.is_changed() and not self.won):
+ try:
+ if dialog_extras.getBoolean(
+ label = _("Save this game before starting new one?"),
+ custom_yes = _("_Save game for later"),
+ custom_no = _("_Abandon game"),
+ ):
+ self.save_game()
+ else:
+ self.sudoku_tracker.abandon_game(self)
+ except dialog_extras.UserCancelledError:
+ # User cancelled new game
+ return
+ self.do_stop()
+ self.select_game()
@simple_debug
def stop_game (self):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]