Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/LegoJAM.py
diff options
context:
space:
mode:
Diffstat (limited to 'LegoJAM.py')
-rw-r--r--LegoJAM.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/LegoJAM.py b/LegoJAM.py
index f5e940d..8c4b994 100644
--- a/LegoJAM.py
+++ b/LegoJAM.py
@@ -45,12 +45,9 @@ class LegoJAM(Window):
self.canvas.pack_start(treeview, True, True, 0)
for num, robot in enumerate(robots):
- try:
- robot_str = '%s %s' % (robot.type, robot.host)
-
- except AttributeError:
- robot_str = '%s %s' % (robot.type, num+1)
- liststore.append([num+1, robot_str])
+ robot_id = robot.host if robot.type == 'bluetooth' else num+1
+ robot_str = '%s %s' % (robot.type, robot_id)
+ liststore.append([num, robot_str])
treeview.connect('row-activated', self.select_robot, robots)
@@ -58,7 +55,7 @@ class LegoJAM(Window):
def select_robot(self, treeview, treepath, column, robots):
treeview.destroy()
- self.set_layout(robots[treepath[0] - 1])
+ self.set_layout(robots[treepath[0]])
def set_layout(self, robot):
self.robot = Robot(robot)