update menu print-out and bundle fonts

workspace
Brendan Howell 4 years ago
parent 54be0537d5
commit 30761fbecc

@ -66,9 +66,11 @@ class InhumanResources(Bureau):
cmdname = data["cmdname"]
desc = data["desc"]
cmd_code = prefix + cmd + "."
barcode_png = os.path.join(self.datadir, cmd_code + "png")
#bc = barcode.generate("code128", prefix + cmd + ".", writer=barcode.writer.ImageWriter(), output=barcode_png)
bc = kode256.image(cmd_code).save(barcode_png)
bc = kode256.svg(cmd_code)
encoded_svg = b64encode(bc.encode()).decode()
encoded_data = "data:image/svg+xml;charset=utf-8;base64," + encoded_svg
bc = '<img src="%s" />' % encoded_data
except KeyError as e:
print("cannot add invalid command:", str(e))
return
@ -79,8 +81,7 @@ class InhumanResources(Bureau):
else:
self.menu[prefix]["commands"][cmd] = {"name": cmdname,
"desc": desc,
"barcode": bc,
"barcode_png": barcode_png}
"barcode": bc }
@add_api("addapi", "Register API Method")
def add_api_method(self, data):

@ -90,7 +90,7 @@
<div class="cmdcol">
<p class="cmddesc">${cmd["desc"]}</p>
</div>
<div class="cmdcol"><img src="${cmd["barcode_png"]}" /></div>
<div class="cmdcol">${cmd["barcode"]}</div>
</div>
% endif
%endfor

Loading…
Cancel
Save