Fix Servo.choices() and use it in robotarm

This commit is contained in:
Florian Festi 2017-02-25 19:59:16 +01:00
parent 5ef277fc21
commit cb8ebefeb1
2 changed files with 4 additions and 4 deletions

View File

@ -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")

View File

@ -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(