diff --git a/screenless/bureau/ihr/ihr.py b/screenless/bureau/ihr/ihr.py index 8a5d4d2..9c28c5c 100644 --- a/screenless/bureau/ihr/ihr.py +++ b/screenless/bureau/ihr/ihr.py @@ -1,5 +1,7 @@ import json +import code128 + from bureau import Bureau, add_command, add_api @@ -25,7 +27,7 @@ class InhumanResources(Bureau): Register Bureau with Inhuman Resources data = { prefix: "IR", - bureauname: "Inhuman Resources", + name: "Inhuman Resources", desc: "Keep track of public resources provided by bureaus" } """ @@ -35,7 +37,7 @@ class InhumanResources(Bureau): desc = data["desc"] except KeyError as e: print("cannot add invalid bureau:", str(e)) - return + return str(e) print("added menu") self.menu[prefix] = {"name": name, "desc": desc, @@ -49,6 +51,7 @@ class InhumanResources(Bureau): cmd = data["cmd"] cmdname = data["cmdname"] desc = data["desc"] + barcode = code128.svg(prefix + cmd + ".") except KeyError as e: print("cannot add invalid command:", str(e)) return @@ -58,7 +61,8 @@ class InhumanResources(Bureau): prefix) else: self.menu[prefix]["commands"][cmd] = {"name": cmdname, - "desc": desc} + "desc": desc, + "barcode": barcode} @add_api("addapi", "Register API Method") def add_api_method(self, data): @@ -83,6 +87,7 @@ class InhumanResources(Bureau): """ Prints the menu of commands for all operational bureaus. """ + self.print_full("menu.html", menu=self.menu) print(self.menu) diff --git a/screenless/bureau/ihr/menu.html b/screenless/bureau/ihr/menu.html new file mode 100644 index 0000000..7990e84 --- /dev/null +++ b/screenless/bureau/ihr/menu.html @@ -0,0 +1,48 @@ + + + The Screenless Office - Main Menu + + + +
+ %for prefix, buro in menu.items(): +
+

${buro["name"]}

+
Prefix: ${prefix}
+

${buro["desc"]}

+
+ %for cmdtxt, cmd in buro["commands"].items(): + % if cmdtxt != "test": +
+

${cmd["name"]}

+
${cmdtxt}
+
${cmd["barcode"]}
+

${cmd["desc"]}

+
+ % endif + %endfor +
+
+ %endfor +
+ +