diff --git a/boxes/__init__.py b/boxes/__init__.py index 16ba5ae02..91be3a643 100755 --- a/boxes/__init__.py +++ b/boxes/__init__.py @@ -198,7 +198,7 @@ def html(self, name, default, translate): ("""""" % (e, ' selected="selected"' if e == default else "", translate("%s %s" % (e, self.names.get(e, "")))) for e in self.edges)) - return """\n""" % (name, options) + return """\n""" % (name, name, name+"_id", name+"_description", options) def inx(self, name, viewname, arg): return (' \n' % @@ -218,8 +218,8 @@ def html(self, name, default, _): if isinstance(default, (str)): default = self(default) return """ -""" % \ - (name, name, ' checked="checked"' if default else "") +""" % \ + (name, name, name, name+"_id", name+"_description",' checked="checked"' if default else "") boolarg = BoolArg() diff --git a/scripts/boxesserver b/scripts/boxesserver index 624f6b984..6dabd8209 100755 --- a/scripts/boxesserver +++ b/scripts/boxesserver @@ -45,7 +45,6 @@ class FileChecker(threading.Thread): super(FileChecker, self).__init__() self.checkmodules = checkmodules self.timestamps = {} - self._stopped = False for path in files: self.timestamps[path] = os.stat(path).st_mtime if checkmodules: @@ -71,14 +70,11 @@ class FileChecker(threading.Thread): return True def run(self): - while not self._stopped: + while True: if not self.filesOK(): os.execv(__file__, sys.argv) time.sleep(1) - def stop(self): - self._stopped = True - class ArgumentParserError(Exception): pass class ThrowingArgumentParser(argparse.ArgumentParser): @@ -160,25 +156,24 @@ class BServer: viewname = name[len(prefix)+1:] default = defaults.get(name, None) - - row = """%s%%s%s\n""" % \ - (_(viewname), "" if not a.help else markdown.markdown(_(a.help))) + row = """%%s%s\n""" % \ + (name+"_id", name, _(viewname), name+"_description","" if not a.help else markdown.markdown(_(a.help))) if (isinstance(a, argparse._StoreAction) and hasattr(a.type, "html")): input = a.type.html(name, default or a.default, _) elif a.dest == "layout": val = (default or a.default).split("\n") - input = """""" % \ - (name, max((len(l) for l in val))+10, len(val)+1, default or a.default) + input = """""" % \ + (name, name, name+"_id", name+"_description", max((len(l) for l in val))+10, len(val)+1, default or a.default) elif a.choices: options = "\n".join( ("""""" % (e, ' selected="selected"' if (e == (default or a.default)) or (str(e) == str(default or a.default)) else "", _(e)) for e in a.choices)) - input = """\n""" % (name, options) + input = """\n""" % (name, name, name+"_id", name+"_description", options) else: - input = """""" % \ - (name, default or a.default) + input = """""" % \ + (name, name, name+"_id", name+"_description", default or a.default) return row % input @@ -190,9 +185,11 @@ class BServer: if(e.style.display == null || e.style.display == "none") { e.style.display = "block"; h.classList.add("open"); + h.setAttribute("aria-expanded","true"); } else { e.style.display = "none"; h.classList.remove("open"); + h.setAttribute("aria-expanded","false"); } } function hideargs() { @@ -246,10 +243,11 @@ class BServer: if len(group._group_actions) == 1 and isinstance(group._group_actions[0], argparse._HelpAction): continue prefix = getattr(group, "prefix", None) - result.append('''

%s

\n\n''' % (groupid, groupid, groupid, _(group.title), groupid)) + result.append('''

%s

\n\n''' % (groupid, groupid, groupid, _(group.title), groupid)) for a in group._group_actions: if a.dest in ("input", "output"): + continue result.append(self.arg2html(a, prefix, defaults, _)) result.append("") @@ -345,7 +343,7 @@ class BServer: """ ] for nr, group in enumerate(self.groups): result.append(f''' - @@ -559,12 +557,7 @@ if __name__=="__main__": boxserver = BServer() httpd = make_server(host, port, boxserver.serve) print("BoxesServer serving on host:port %s:%s..." % (host, port) ) - try: - httpd.serve_forever() - except KeyboardInterrupt: - fc.stop() - httpd.server_close() - print("BoxesServer stops.") + httpd.serve_forever() else: application = BServer().serve