Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/PathsActivity.py
diff options
context:
space:
mode:
authorWalter Bender <walter.bender@gmail.com>2011-03-06 23:25:12 (GMT)
committer Walter Bender <walter.bender@gmail.com>2011-03-06 23:25:12 (GMT)
commitdc3f5cff94cdb655e95db19d8daf600f97118d90 (patch)
tree0b7cf10029eefe36cccaa7b84e185da550547802 /PathsActivity.py
parent1ea8fbaba89c1045d5eba54d6f62baab0ad667af (diff)
first pass at robot player support
Diffstat (limited to 'PathsActivity.py')
-rw-r--r--PathsActivity.py29
1 files changed, 19 insertions, 10 deletions
diff --git a/PathsActivity.py b/PathsActivity.py
index ff52229..f3de73b 100644
--- a/PathsActivity.py
+++ b/PathsActivity.py
@@ -135,14 +135,15 @@ class PathsActivity(activity.Activity):
toolbox.set_current_toolbar(1)
toolbar = games_toolbar
- self.new_game = _button_factory('new-game', _('Start a new game.'),
- self.new_game_cb, toolbar)
+ self.new_game_button = _button_factory('new-game',
+ _('Start a new game.'),
+ self.new_game_cb, toolbar)
- '''
- self.robot = _button_factory('robot-off',
- _('Play with the computer.'),
- self.robot_cb, toolbar)
- '''
+ self.robot_button = _button_factory('robot-off',
+ _('Play with the computer.'),
+ self.robot_cb, toolbar)
+
+ self.status = _label_factory('play on', toolbar)
if _have_toolbox:
_separator_factory(toolbox.toolbar, False, True)
@@ -157,8 +158,17 @@ class PathsActivity(activity.Activity):
self.game.new_game()
def robot_cb(self, button=None):
- ''' Play with the computer. '''
- pass
+ ''' Play with the computer (or not). '''
+ if not self.game.playing_with_robot:
+ self.game.playing_with_robot = True
+ self.game.grid.set_robot_status(True)
+ self.robot_button.set_icon('robot-on')
+ self.game.new_game()
+ else:
+ self.game.playing_with_robot = False
+ self.game.grid.set_robot_status(False)
+ self.robot_button.set_icon('robot-off')
+ self.game.new_game()
def write_file(self, file_path):
""" Write the grid status to the Journal """
@@ -237,4 +247,3 @@ class PathsActivity(activity.Activity):
if self.game.deck.cards[k].number == j:
self.game.last_spr_moved = self.game.deck.cards[k].spr
return
-