Put arguments into groups and use them to display them in the web interface
This commit is contained in:
parent
9095c3934f
commit
5a721df82b
|
@ -191,32 +191,37 @@ class Boxes:
|
|||
def __init__(self):
|
||||
self.formats = formats.Formats()
|
||||
self.argparser = ArgumentParser(description=self.__doc__)
|
||||
self.argparser.add_argument(
|
||||
self.argparser._action_groups[1].title = "Generator Settings"
|
||||
fingergroup = self.argparser.add_argument_group(
|
||||
"Finger Joint Settings")
|
||||
fingergroup.add_argument(
|
||||
"--fingerjointfinger", action="store", type=float, default=1.0,
|
||||
help="width of the fingers in multiples of thickness")
|
||||
self.argparser.add_argument(
|
||||
fingergroup.add_argument(
|
||||
"--fingerjointspace", action="store", type=float, default=1.0,
|
||||
help="width of the space between fingers in multiples of thickness")
|
||||
self.argparser.add_argument(
|
||||
fingergroup.add_argument(
|
||||
"--fingerjointsurrounding", action="store", type=float, default=1.0,
|
||||
help="amount of space needed at the end in multiples of normal spaces")
|
||||
self.argparser.add_argument(
|
||||
defaultgroup = self.argparser.add_argument_group(
|
||||
"Default Settings")
|
||||
defaultgroup.add_argument(
|
||||
"--thickness", action="store", type=float, default=4.0,
|
||||
help="thickness of the material")
|
||||
self.argparser.add_argument(
|
||||
defaultgroup.add_argument(
|
||||
"--output", action="store", type=str, default="box.svg",
|
||||
help="name of resulting file")
|
||||
self.argparser.add_argument(
|
||||
defaultgroup.add_argument(
|
||||
"--format", action="store", type=str, default="svg",
|
||||
choices=self.formats.getFormats(),
|
||||
help="format of resulting file")
|
||||
self.argparser.add_argument(
|
||||
defaultgroup.add_argument(
|
||||
"--debug", action="store", type=bool, default=False,
|
||||
help="print surrounding boxes for some structures")
|
||||
self.argparser.add_argument(
|
||||
defaultgroup.add_argument(
|
||||
"--reference", action="store", type=float, default=100,
|
||||
help="print reference rectangle with given length")
|
||||
self.argparser.add_argument(
|
||||
defaultgroup.add_argument(
|
||||
"--burn", action="store", type=float, default=0.05,
|
||||
help="burn correction in mm (bigger values for tighter fit)")
|
||||
|
||||
|
|
|
@ -142,15 +142,17 @@ flex cuts, holes and slots for screws and more high level functions.
|
|||
<h2 style="font-size: 1em; margin: 0px; "> <a href="/">generators</a></h2><h2 style="margin: 0px 0px 0px 20px;" > <span style="margin-right: 10px;"> >> <span>""", name, """</h2>
|
||||
<p>""", box.__doc__ or "", """</p>
|
||||
<form action="%s" method="GET" target="_blank">
|
||||
<table>
|
||||
""" % (action)]
|
||||
for a in box.argparser._actions:
|
||||
if a.dest in ("input", "output"):
|
||||
for group in box.argparser._action_groups[2:] + box.argparser._action_groups[:2]:
|
||||
if not group._group_actions:
|
||||
continue
|
||||
result.append(self.arg2html(a))
|
||||
if a.dest == "burn":
|
||||
result.append("</table>\n<hr>\n<table>\n")
|
||||
result.append("""</table>
|
||||
result.append("<h3>%s</h3>\n<table>\n" % group.title)
|
||||
for a in group._group_actions:
|
||||
if a.dest in ("input", "output"):
|
||||
continue
|
||||
result.append(self.arg2html(a))
|
||||
result.append("</table>")
|
||||
result.append("""
|
||||
<p><button name="render" value="1">Generate</button></p>
|
||||
</form>
|
||||
|
||||
|
|
Loading…
Reference in New Issue