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