From e6c109dd36515baa193966bc9cabb2cb460f4105 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Thu, 22 Oct 2020 01:22:51 +0200 Subject: [PATCH] trying out web view for internet radio station management --- screenless/bureau/ihr/ihrweb.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/screenless/bureau/ihr/ihrweb.py b/screenless/bureau/ihr/ihrweb.py index 85ace68..00cd785 100644 --- a/screenless/bureau/ihr/ihrweb.py +++ b/screenless/bureau/ihr/ihrweb.py @@ -17,6 +17,7 @@ class IhrApp(Bottle): self.route("/log/", callback=self.bureau_log) self.route('/static/', callback=self.static) self.bureaus = [] + self.views = {} mpath = inspect.getfile(self.__class__) self.tdir = os.path.dirname(mpath) @@ -29,10 +30,16 @@ class IhrApp(Bottle):

Web Manager

    """ + + print("webviews", self.views) for bureau in self.bureaus: out += '
  • {0}:
      \n'.format(bureau) out += '
    • {0} config
    • \n'.format(bureau) out += '
    • {0} logs
    • \n'.format(bureau) + if bureau in self.views: + for view in self.views[bureau]: + out += '
    • {1}
    • \n'.format(bureau, view) + out += '
  • ' out += '
  • Printers
  • \n' @@ -91,6 +98,11 @@ class IhrApp(Bottle): self.bureaus.append(bureau) def register_webview(self, prefix, view, callback): + #TODO: add description + if prefix in self.views: + self.views[prefix].append(view) + else: + self.views[prefix] = [view] def wrapped_cb(): callback(request.forms) self.route("/" + prefix + "/" + view, callback=wrapped_cb)