gnome-games r7643 - in trunk/glchess: . src/lib src/lib/gtkui
- From: rancell svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r7643 - in trunk/glchess: . src/lib src/lib/gtkui
- Date: Sat, 10 May 2008 07:21:25 +0100 (BST)
Author: rancell
Date: Sat May 10 06:21:25 2008
New Revision: 7643
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7643&view=rev
Log:
Show dialog if unable to claim draw (Bug #515542)
Modified:
trunk/glchess/ChangeLog
trunk/glchess/src/lib/display.py
trunk/glchess/src/lib/gtkui/gtkui.py
Modified: trunk/glchess/src/lib/display.py
==============================================================================
--- trunk/glchess/src/lib/display.py (original)
+++ trunk/glchess/src/lib/display.py Sat May 10 06:21:25 2008
@@ -551,10 +551,11 @@
p = self.game.getHumanPlayer()
if p is not None:
p.resign()
-
+
def claimDraw(self):
"""Called by ui.ViewFeedback"""
# TODO: Have the UI ask if the player wants to make a move first or claim now (or abort)
p = self.game.getHumanPlayer()
- if p is not None:
- p.claimDraw()
+ if p is None:
+ return False
+ return p.claimDraw()
Modified: trunk/glchess/src/lib/gtkui/gtkui.py
==============================================================================
--- trunk/glchess/src/lib/gtkui/gtkui.py (original)
+++ trunk/glchess/src/lib/gtkui/gtkui.py Sat May 10 06:21:25 2008
@@ -813,7 +813,16 @@
def _on_claim_draw_clicked(self, widget):
"""Gtk+ callback"""
- self.view.feedback.claimDraw()
+ if not self.view.feedback.claimDraw():
+ dialog = gtk.MessageDialog(flags = gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+ type = gtk.MESSAGE_WARNING,
+ message_format = _("Unable to claim draw"))
+ dialog.format_secondary_text(_("""You may claim a draw when:
+a) The board has been in the same state three times (Three fold repitition)
+b) Fifty moves have occured where no pawn has moved and no piece has been captured (50 move rule)"""))
+ dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_ACCEPT)
+ dialog.run()
+ dialog.destroy()
def _on_preferences_clicked(self, widget):
"""Gtk+ callback"""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]