update mailroom to use kode256 for barcodes

workspace
Brendan Howell 5 years ago
parent 15e61b384e
commit 53f19e544c

@ -3,13 +3,13 @@ import email.mime.application
import email.mime.multipart import email.mime.multipart
import email.mime.text import email.mime.text
from email.header import decode_header, make_header from email.header import decode_header, make_header
#import imaplib
import os.path import os.path
import random import random
import smtplib import smtplib
import string import string
import imapclient import imapclient
import kode256
from bureau import Bureau, add_command, add_api from bureau import Bureau, add_command, add_api
@ -172,23 +172,17 @@ class MailRoom(Bureau):
# TODO: switch this to inline svgs # TODO: switch this to inline svgs
# make action barcodes # make action barcodes
msg.un_bc = os.path.join("/tmp", "POun." + shortcode + ".png") msg.un_bc = os.path.join("/tmp", "POun." + shortcode + ".png")
barcode.generate("code128", "POun." + shortcode, kode256.image("POun." + shortcode).save(msg.un_bc)
writer=barcode.writer.ImageWriter(), output=msg.un_bc)
msg.d_bc = os.path.join("/tmp", "POd." + shortcode + ".png") msg.d_bc = os.path.join("/tmp", "POd." + shortcode + ".png")
barcode.generate("code128", "POd." + shortcode, kode256.image("POd." + shortcode).save(msg.d_bc)
writer=barcode.writer.ImageWriter(), output=msg.d_bc)
msg.sp_bc = os.path.join("/tmp", "POsp." + shortcode + ".png") msg.sp_bc = os.path.join("/tmp", "POsp." + shortcode + ".png")
barcode.generate("code128", "POsp." + shortcode, kode256.image("POsp." + shortcode).save(msg.sp_bc)
writer=barcode.writer.ImageWriter(), output=msg.sp_bc)
msg.re_bc = os.path.join("/tmp", "POre." + shortcode + ".png") msg.re_bc = os.path.join("/tmp", "POre." + shortcode + ".png")
barcode.generate("code128", "POre." + shortcode, kode256.image("POre." + shortcode).save(msg.re_bc)
writer=barcode.writer.ImageWriter(), output=msg.re_bc)
msg.rea_bc = os.path.join("/tmp", "POrea." + shortcode + ".png") msg.rea_bc = os.path.join("/tmp", "POrea." + shortcode + ".png")
barcode.generate("code128", "POrea." + shortcode, kode256.image("POrea." + shortcode).save(msg.rea_bc)
writer=barcode.writer.ImageWriter(), output=msg.rea_bc)
msg.r_bc = os.path.join("/tmp", "POr." + shortcode + ".png") msg.r_bc = os.path.join("/tmp", "POr." + shortcode + ".png")
barcode.generate("code128", "POr." + shortcode, kode256.image("POr." + shortcode).save(msg.r_bc)
writer=barcode.writer.ImageWriter(), output=msg.r_bc)
self.print_full("email.html", msg=msg, shortcode=shortcode) self.print_full("email.html", msg=msg, shortcode=shortcode)
@ -315,9 +309,9 @@ class MailRoom(Bureau):
msg.subject = clean_header(envelope.subject.decode("utf-8")) msg.subject = clean_header(envelope.subject.decode("utf-8"))
# make action barcodes # make action barcodes
msg.d_bc = self.bc_svg("POd." + shortcode) msg.d_bc = kode256.svg("POd." + shortcode)
msg.sp_bc = self.bc_svg("POsp." + shortcode) msg.sp_bc = kode256.svg("POsp." + shortcode)
msg.r_bc = self.bc_svg("POr." + shortcode) msg.r_bc = kode256.svg("POr." + shortcode)
msgs.append(msg.__dict__) msgs.append(msg.__dict__)

Loading…
Cancel
Save