|
|
@ -2,10 +2,26 @@ import json
|
|
|
|
import subprocess
|
|
|
|
import subprocess
|
|
|
|
|
|
|
|
|
|
|
|
import code128
|
|
|
|
import code128
|
|
|
|
|
|
|
|
from lxml import etree
|
|
|
|
|
|
|
|
|
|
|
|
from bureau import Bureau, add_command, add_api
|
|
|
|
from bureau import Bureau, add_command, add_api
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def clean_svg(svg):
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
This is a little hack that removes the height and width attributes from
|
|
|
|
|
|
|
|
SVG strings as they confuse Firefox. Sigh... hopefully this can go away
|
|
|
|
|
|
|
|
some day.
|
|
|
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
utf8_parser = etree.XMLParser(encoding='utf-8')
|
|
|
|
|
|
|
|
svg = svg.encode("utf-8")
|
|
|
|
|
|
|
|
otree = etree.fromstring(svg, utf8_parser)
|
|
|
|
|
|
|
|
del otree.attrib["height"]
|
|
|
|
|
|
|
|
del otree.attrib["width"]
|
|
|
|
|
|
|
|
clean_svg = etree.tostring(otree)
|
|
|
|
|
|
|
|
return clean_svg.decode("utf-8")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class InhumanResources(Bureau):
|
|
|
|
class InhumanResources(Bureau):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
This is a core functional bureau of the Screenless office it keeps track
|
|
|
|
This is a core functional bureau of the Screenless office it keeps track
|
|
|
@ -52,7 +68,7 @@ class InhumanResources(Bureau):
|
|
|
|
cmd = data["cmd"]
|
|
|
|
cmd = data["cmd"]
|
|
|
|
cmdname = data["cmdname"]
|
|
|
|
cmdname = data["cmdname"]
|
|
|
|
desc = data["desc"]
|
|
|
|
desc = data["desc"]
|
|
|
|
barcode = code128.svg(prefix + cmd + ".")
|
|
|
|
barcode = clean_svg(code128.svg(prefix + cmd + "."))
|
|
|
|
except KeyError as e:
|
|
|
|
except KeyError as e:
|
|
|
|
print("cannot add invalid command:", str(e))
|
|
|
|
print("cannot add invalid command:", str(e))
|
|
|
|
return
|
|
|
|
return
|
|
|
|