diff --git a/TODO.txt b/TODO.txt index 3705309..789d06c 100644 --- a/TODO.txt +++ b/TODO.txt @@ -7,4 +7,3 @@ * offer a collection of different settings * Make bolts configurable (e.g. box2.py) * setup.py - * Fix error message on parsing error in web interface diff --git a/bserver.py b/bserver.py index c37486f..2feb341 100755 --- a/bserver.py +++ b/bserver.py @@ -6,13 +6,14 @@ import argparse import cgi import tempfile import os +import urllib from wsgiref.util import setup_testing_defaults from wsgiref.simple_server import make_server import wsgiref.util import box, box2, box3, drillbox, flexbox, flexbox2, flexbox3, flextest, folder -import magazinefile, trayinsert, typetray, silverwarebox +import magazinefile, trayinsert, traylayout, typetray, silverwarebox class ArgumentParserError(Exception): pass @@ -39,8 +40,9 @@ class BServer: "TrayInsert" : trayinsert.TrayInsert(), "TypeTray" : typetray.TypeTray(), "SilverwareBox" : silverwarebox.Silverware(), + "TrayLayout" : traylayout.LayoutGenerator(), + "TrayLayout2" : traylayout.Layout(webargs=True), } - def arg2html(self, a): name = a.option_strings[0].replace("-", "") if isinstance(a, argparse._HelpAction): @@ -48,20 +50,24 @@ class BServer: if isinstance(a, argparse._StoreTrueAction): return """%s%s\n""" % \ (name, name, a.default, a.help) - + if a.dest == "layout": + val = a.default.split("\n") + return """%s%s\n""" % \ + (name, name, max((len(l) for l in val))+10, len(val)+1, + a.default, a.help or "") return """%s%s\n""" % \ (name, name, a.default, a.help) - def args2html(self, name, box): + def args2html(self, name, box, action=""): result = ["""Boxes - """, name, """

""", name, """

""", box.__doc__, """

-
+ -"""] + """ % (action)] for a in box.argparser._actions: - if a.dest == "output": + if a.dest in ("input", "output"): continue result.append(self.arg2html(a)) if a.dest == "burn": @@ -90,6 +96,8 @@ flex cuts, holes and slots for screws and more high level functions.