some hacks for barcode layout wierdness

workspace
Brendan Howell 8 years ago
parent e1f1e3ae0f
commit 240b6c5e63

@ -2,10 +2,26 @@ import json
import subprocess
import code128
from lxml import etree
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):
"""
This is a core functional bureau of the Screenless office it keeps track
@ -52,7 +68,7 @@ class InhumanResources(Bureau):
cmd = data["cmd"]
cmdname = data["cmdname"]
desc = data["desc"]
barcode = code128.svg(prefix + cmd + ".")
barcode = clean_svg(code128.svg(prefix + cmd + "."))
except KeyError as e:
print("cannot add invalid command:", str(e))
return

@ -17,6 +17,9 @@
.bureau h3 {
border-bottom: 1px solid black;
}
.bureau .description {
line-height: 1.2;
}
.cmd {
clear: both;
width: 100%;
@ -29,13 +32,19 @@
}
.cmdcol svg {
width: 100%;
height: 41px;
}
.cmddesc {
margin-top: 0;
line-height: 1.1;
}
.cmdname {
font-weight: bold;
font-family: "TeX Gyre Adventor";
line-height: 1.1;
}
.cmdtxt {
margin-top: 1em;
}
</style>
</head>

Loading…
Cancel
Save