remove old code128 deps

workspace
Brendan Howell 6 years ago
parent 73d056561f
commit def8c6c16b

@ -1,6 +1,5 @@
appdirs==1.4.0
argcomplete==1.6.0
git+git://gitlab.com/bhowell/bc128.git#egg=bc128
backports.ssl==0.0.9
cffi==1.9.1
chardet==2.3.0

@ -4,7 +4,7 @@ import signal
import socket
import subprocess
import code128
import barcode
from lxml import etree
from bureau import Bureau, add_command, add_api
@ -72,10 +72,9 @@ class InhumanResources(Bureau):
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)
# barcode = clean_svg(code128.svg(prefix + cmd + "."))
barcode_png = os.path.join(self.datadir, cmd_code)
bc = barcode.generate("code128", prefix + cmd + ".", writer=barcode.writer.ImageWriter, output=barcode_png)
except KeyError as e:
print("cannot add invalid command:", str(e))
return
@ -86,7 +85,7 @@ class InhumanResources(Bureau):
else:
self.menu[prefix]["commands"][cmd] = {"name": cmdname,
"desc": desc,
"barcode": barcode,
"barcode": bc,
"barcode_png": barcode_png}
@add_api("addapi", "Register API Method")

@ -9,7 +9,7 @@ import random
import smtplib
import string
import code128
import barcode
import imapclient
from bureau import Bureau, add_command, add_api
@ -169,24 +169,24 @@ class MailRoom(Bureau):
# TODO: switch this to inline svgs
# make action barcodes
barcode_png = os.path.join("/tmp", "POun." + shortcode + ".png")
code128.image("POun." + shortcode).save(barcode_png)
msg.un_bc = str(barcode_png)
barcode_png = os.path.join("/tmp", "POd." + shortcode + ".png")
code128.image("POd." + shortcode).save(barcode_png)
msg.d_bc = str(barcode_png)
barcode_png = os.path.join("/tmp", "POsp." + shortcode + ".png")
code128.image("POsp." + shortcode).save(barcode_png)
msg.sp_bc = str(barcode_png)
barcode_png = os.path.join("/tmp", "POre." + shortcode + ".png")
code128.image("POre." + shortcode).save(barcode_png)
msg.re_bc = str(barcode_png)
barcode_png = os.path.join("/tmp", "POrea." + shortcode + ".png")
code128.image("POrea." + shortcode).save(barcode_png)
msg.rea_bc = str(barcode_png)
barcode_png = os.path.join("/tmp", "POr." + shortcode + ".png")
code128.image("POr." + shortcode).save(barcode_png)
msg.r_bc = str(barcode_png)
msg.un_bc = os.path.join("/tmp", "POun." + shortcode + ".png")
barcode.generate("code128", "POun." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.un_bc)
msg.d_bc = os.path.join("/tmp", "POd." + shortcode + ".png")
barcode.generate("code128", "POd." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.d_bc)
msg.sp_bc = os.path.join("/tmp", "POsp." + shortcode + ".png")
barcode.generate("code128", "POsp." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.sp_bc)
msg.re_bc = os.path.join("/tmp", "POre." + shortcode + ".png")
barcode.generate("code128", "POre." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.re_bc)
msg.rea_bc = os.path.join("/tmp", "POrea." + shortcode + ".png")
barcode.generate("code128", "POrea." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.rea_bc)
msg.r_bc = os.path.join("/tmp", "POr." + shortcode + ".png")
barcode.generate("code128", "POr." + shortcode,
writer=barcode.writer.ImageWriter, output=msg.r_bc)
self.print_full("email.html", msg=msg, shortcode=shortcode)
@ -313,9 +313,9 @@ class MailRoom(Bureau):
msg.subject = clean_header(envelope.subject.decode("utf-8"))
# make action barcodes
msg.d_bc = code128.svg("POd." + shortcode)
msg.sp_bc = code128.svg("POsp." + shortcode)
msg.r_bc = code128.svg("POr." + shortcode)
msg.d_bc = str(barcode.get("code128", "POd." + shortcode).raw)
msg.sp_bc = str(barcode.get("code128", "POsp." + shortcode).raw)
msg.r_bc = str(barcode.get("code128", "POr." + shortcode).raw)
msgs.append(msg.__dict__)

@ -9,8 +9,8 @@ import string
import threading
import urllib.request, urllib.parse, urllib.error
import barcode
import bleach
import code128
import feedparser
import lxml.html
import PIL
@ -165,7 +165,7 @@ class Publications(Bureau):
continue # skip bogus links
tmpcode = self._make_shorturl(link.attrib["href"])
svg = code128.svg("PBr." + tmpcode)
svg = barcode.get("CODE128", "PBr." + tmpcode).raw
footnote = html.makeelement("div")
footnote.attrib["class"] = "footnote"
@ -173,7 +173,7 @@ class Publications(Bureau):
notetext.text = str(notecount) + ". " + link.attrib["href"]
footnote.append(notetext)
#TODO: make this barcode inline thing a util method
encoded_svg = b64encode(bytes(svg, 'utf-8')).decode()
encoded_svg = b64encode(svg).decode()
encoded_data = "data:image/svg+xml;charset=utf-8;base64," + encoded_svg
svg = '<img class="endnotebc" src="%s"/>' % encoded_data
footnote.append(lxml.html.fromstring(svg))
@ -276,8 +276,8 @@ class Publications(Bureau):
entry.source = feed.feed.title
entry.dbhash = self._make_shorturl(entry.link)
entry.svg = code128.svg("PBr." + entry.dbhash)
encoded_svg = b64encode(bytes(entry.svg, 'utf-8')).decode()
entry.svg = barcode.get("CODE128", "PBr." + tmpcode).raw
encoded_svg = b64encode(entry.svg).decode()
encoded_data = "data:image/svg+xml;charset=utf-8;base64," + encoded_svg
entry.svg = '<img src="%s"/>' % encoded_data

@ -1,11 +1,11 @@
import random
import string
import code128
import barcode
chars = string.ascii_letters + string.digits
for code in range(30):
code = ''.join(random.choice(chars) for _ in range(5))
code = "SAp." + code
with open("/tmp/" + code + ".svg", "w") as f:
f.write(code128.svg(code, caption=True))
out_file = "/tmp/" + code + ".svg"
barcode.generate("code128", code, output=out_file)

Loading…
Cancel
Save