Fix Servo.choices() and use it in robotarm
This commit is contained in:
parent
5ef277fc21
commit
cb8ebefeb1
|
@ -35,10 +35,10 @@ class RobotArm(Boxes): # change class name here and below
|
||||||
help="type of arm segment")
|
help="type of arm segment")
|
||||||
self.argparser.add_argument(
|
self.argparser.add_argument(
|
||||||
"--servo%ia" % i, action="store", type=sa, default="Servo9g",
|
"--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(
|
self.argparser.add_argument(
|
||||||
"--servo%ib" % i, action="store", type=sa, default="Servo9g",
|
"--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(
|
self.argparser.add_argument(
|
||||||
"--length%i" % i, action="store", type=float, default=50.,
|
"--length%i" % i, action="store", type=float, default=50.,
|
||||||
help="length of segment axle to axle")
|
help="length of segment axle to axle")
|
||||||
|
|
|
@ -50,13 +50,13 @@ class ServoArg:
|
||||||
def __init__(self, includenone=False):
|
def __init__(self, includenone=False):
|
||||||
self.servos = ["Servo9g"]
|
self.servos = ["Servo9g"]
|
||||||
if includenone:
|
if includenone:
|
||||||
self.robotarms[0:0] = ["none"]
|
self.servos[0:0] = ["none"]
|
||||||
|
|
||||||
def __call__(self, arg):
|
def __call__(self, arg):
|
||||||
return str(arg)
|
return str(arg)
|
||||||
|
|
||||||
def choices(self):
|
def choices(self):
|
||||||
return [name for name, descr in self.robotarms]
|
return [name for name in self.servos]
|
||||||
|
|
||||||
def html(self, name, default):
|
def html(self, name, default):
|
||||||
options = "\n".join(
|
options = "\n".join(
|
||||||
|
|
Loading…
Reference in New Issue