diff --git a/screenless/bureau/bureau.py b/screenless/bureau/bureau.py index 24c0dad..ca52348 100644 --- a/screenless/bureau/bureau.py +++ b/screenless/bureau/bureau.py @@ -465,7 +465,7 @@ class Bureau(object): """ # start the hardware input handler - io_handler = threading.Thread(target=self._run_io) + io_handler = threading.Thread(target=self._run_io, daemon=True) io_handler.start() # register commands and api methods @@ -499,7 +499,6 @@ class Bureau(object): self.log.debug("got method: " + ref) if (ref in self.commands) or (ref in self.api): - # TODO: cope with data for calls with no params if ref in self.api: if data: data = json.loads(data) diff --git a/screenless/bureau/ihr/ihrweb.py b/screenless/bureau/ihr/ihrweb.py index c99c3c3..a40b52c 100644 --- a/screenless/bureau/ihr/ihrweb.py +++ b/screenless/bureau/ihr/ihrweb.py @@ -40,9 +40,13 @@ class IhrApp(Bottle): def bureau_config(self, bureau): # parse the config and make it into a form + # TODO: add a little html snippet with cfg file docs templfile = os.path.join(self.tdir, "web_config.html") template = mako.template.Template(filename=templfile) basedir = os.path.expanduser("~/.screenless") + + msg = "" + if bureau == "mgmt": cfgfile = "mgmt.ini" mode = "ini" @@ -54,15 +58,15 @@ class IhrApp(Bottle): mode = "yaml" cfgfile = os.path.join(basedir, cfgfile) if request.method == "POST": - #save all the request.forms stuff to the config - # tell the bureau to restart / reload - # set our message to be "updated config" - print("NOT saving updated ", cfgfile) - pass + with open(cfgfile, "w") as cfg: + cfg.write(request.forms.get("cfgdata")) + # TODO: tell the bureau to restart / reload + msg = "Modified config file saved!" + #parse and show the config as a form with open(cfgfile) as cfg: cfgdata = cfg.read() - return template.render_unicode(bureau=bureau, cfgfile=cfgfile, mode=mode, cfgdata=cfgdata) + return template.render_unicode(msg=msg, bureau=bureau, cfgfile=cfgfile, mode=mode, cfgdata=cfgdata) def register_bureau(self, bureau): self.bureaus.append(bureau) diff --git a/screenless/bureau/ihr/web_config.html b/screenless/bureau/ihr/web_config.html index 3ebefbb..fb9c538 100644 --- a/screenless/bureau/ihr/web_config.html +++ b/screenless/bureau/ihr/web_config.html @@ -4,17 +4,23 @@ Screenless Office - edit ${cfgfile}

The Screenless Office

edit config file ${cfgfile}

+
${msg}
+
← Main
${cfgdata}