|
|
|
@ -1,4 +1,5 @@
|
|
|
|
|
import json
|
|
|
|
|
import os.path
|
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
import code128
|
|
|
|
@ -68,7 +69,11 @@ class InhumanResources(Bureau):
|
|
|
|
|
cmd = data["cmd"]
|
|
|
|
|
cmdname = data["cmdname"]
|
|
|
|
|
desc = data["desc"]
|
|
|
|
|
cmd_code = prefix + cmd + "."
|
|
|
|
|
barcode = clean_svg(code128.svg(prefix + cmd + "."))
|
|
|
|
|
barcode_png = os.path.join(self.datadir, cmd_code + "png")
|
|
|
|
|
code128.image(cmd_code).save(barcode_png)
|
|
|
|
|
barcode_png = str(barcode_png)
|
|
|
|
|
except KeyError as e:
|
|
|
|
|
print("cannot add invalid command:", str(e))
|
|
|
|
|
return
|
|
|
|
@ -79,7 +84,8 @@ class InhumanResources(Bureau):
|
|
|
|
|
else:
|
|
|
|
|
self.menu[prefix]["commands"][cmd] = {"name": cmdname,
|
|
|
|
|
"desc": desc,
|
|
|
|
|
"barcode": barcode}
|
|
|
|
|
"barcode": barcode,
|
|
|
|
|
"barcode_png": barcode_png}
|
|
|
|
|
|
|
|
|
|
@add_api("addapi", "Register API Method")
|
|
|
|
|
def add_api_method(self, data):
|
|
|
|
|