Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/GNUChessActivity.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2012-07-25 09:56:24 (GMT)
committer Walter Bender <walter.bender@gmail.com>2012-07-25 09:56:24 (GMT)
commit526847bc2c4b939ecbc825fbdc63aa7ea00f1984 (patch)
tree9ef06c294949bc50de9bb2a504f1e270fc050e1a /GNUChessActivity.py
parentb9ed2a744835c961b25a86efbcb2a12e86603371 (diff)
add thinking cursor when computer is thinking
Diffstat (limited to 'GNUChessActivity.py')
-rw-r--r--GNUChessActivity.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/GNUChessActivity.py b/GNUChessActivity.py
index 17e87fe..f0f56f5 100644
--- a/GNUChessActivity.py
+++ b/GNUChessActivity.py
@@ -81,6 +81,11 @@ class GNUChessActivity(activity.Activity):
canvas.show()
self.show_all()
+ if hasattr(self.get_window(), 'get_cursor'):
+ self.old_cursor = self.get_window().get_cursor()
+ else:
+ self.old_cursor = None
+
self._gnuchess = Gnuchess(canvas,
parent=self,
path=activity.get_bundle_path(),
@@ -93,6 +98,19 @@ class GNUChessActivity(activity.Activity):
self._gnuchess.new_game()
self._restoring = False
+ def restore_cursor(self):
+ ''' No longer thinking, so restore standard cursor. '''
+ if hasattr(self.get_window(), 'get_cursor'):
+ self.get_window().set_cursor(self.old_cursor)
+ else:
+ self.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.LEFT_PTR))
+
+ def set_thinking_cursor(self):
+ ''' Thinking, so set watch cursor. '''
+ if hasattr(self.get_window(), 'get_cursor'):
+ self.old_cursor = self.get_window().get_cursor()
+ self.get_window().set_cursor(gtk.gdk.Cursor(gtk.gdk.WATCH))
+
def _setup_toolbars(self):
''' Setup the toolbars. '''