Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/ReflectionActivity.py
diff options
context:
space:
mode:
Diffstat (limited to 'ReflectionActivity.py')
-rw-r--r--ReflectionActivity.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/ReflectionActivity.py b/ReflectionActivity.py
index 43194c7..4a25ea7 100644
--- a/ReflectionActivity.py
+++ b/ReflectionActivity.py
@@ -128,6 +128,13 @@ class ReflectionActivity(activity.Activity):
self.status = label_factory(self.toolbar, '')
if _have_toolbox:
+ separator_factory(toolbox.toolbar, False, True)
+
+ self.robot_button = button_factory(
+ 'robot-off', self.toolbar, self._robot_cb,
+ tooltip= _('Play with the robot.'))
+
+ if _have_toolbox:
separator_factory(toolbox.toolbar, True, False)
if _have_toolbox:
@@ -140,6 +147,18 @@ class ReflectionActivity(activity.Activity):
''' Start a new game. '''
self._game.new_game(orientation)
+ def _robot_cb(self, button=None):
+ ''' Play with the computer (or not). '''
+ if not self._game.playing_with_robot:
+ self.set_robot_status(True, 'robot-on')
+ else:
+ self.set_robot_status(False, 'robot-off')
+
+ def set_robot_status(self, status, icon):
+ ''' Reset robot icon and status '''
+ self._game.playing_with_robot = status
+ self.robot_button.set_icon(icon)
+
def write_file(self, file_path):
""" Write the grid status to the Journal """
[dot_list, orientation] = self._game.save_game()