From cb8ebefeb106fbc61faa019e12b6829aedfbc0d8 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Sat, 25 Feb 2017 19:59:16 +0100 Subject: [PATCH] Fix Servo.choices() and use it in robotarm --- boxes/generators/robotarm.py | 4 ++-- boxes/servos.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/boxes/generators/robotarm.py b/boxes/generators/robotarm.py index cba3dfb..2c633c6 100644 --- a/boxes/generators/robotarm.py +++ b/boxes/generators/robotarm.py @@ -35,10 +35,10 @@ class RobotArm(Boxes): # change class name here and below help="type of arm segment") self.argparser.add_argument( "--servo%ia" % i, action="store", type=sa, default="Servo9g", - help="type of servo to use") + choices=sa.choices(), help="type of servo to use") self.argparser.add_argument( "--servo%ib" % i, action="store", type=sa, default="Servo9g", - help="type of servo to use on second side (if different is supported)") + choices=sa.choices(), help="type of servo to use on second side (if different is supported)") self.argparser.add_argument( "--length%i" % i, action="store", type=float, default=50., help="length of segment axle to axle") diff --git a/boxes/servos.py b/boxes/servos.py index 4a716da..ad1d9a4 100644 --- a/boxes/servos.py +++ b/boxes/servos.py @@ -50,13 +50,13 @@ class ServoArg: def __init__(self, includenone=False): self.servos = ["Servo9g"] if includenone: - self.robotarms[0:0] = ["none"] + self.servos[0:0] = ["none"] def __call__(self, arg): return str(arg) def choices(self): - return [name for name, descr in self.robotarms] + return [name for name in self.servos] def html(self, name, default): options = "\n".join(