From 831d27d71e4657eaa43a94e5a69aded677081c51 Mon Sep 17 00:00:00 2001 From: Brendan Howell Date: Wed, 25 Jan 2017 22:52:22 +0100 Subject: [PATCH] barcodes and template tweaks for email --- screenless/bureau/mailroom/email.html | 31 +++++++++++++++++++------- screenless/bureau/mailroom/mailroom.py | 22 ++++++++++++++++++ 2 files changed, 45 insertions(+), 8 deletions(-) diff --git a/screenless/bureau/mailroom/email.html b/screenless/bureau/mailroom/email.html index cf5d828..8071ce9 100644 --- a/screenless/bureau/mailroom/email.html +++ b/screenless/bureau/mailroom/email.html @@ -16,12 +16,12 @@ } #content { float: left; - width: 63%; + width: 70%; padding-right: 3%; line-height: 0.9em; } #menu { - width: 30%; + width: 24%; float: left; padding-right: 3%; } @@ -29,6 +29,9 @@ clear: both; width: 100%; } + .cmd img { + width: 12em; + }
@@ -44,12 +47,24 @@ ${msg.content}
diff --git a/screenless/bureau/mailroom/mailroom.py b/screenless/bureau/mailroom/mailroom.py index 5842d19..d5af694 100644 --- a/screenless/bureau/mailroom/mailroom.py +++ b/screenless/bureau/mailroom/mailroom.py @@ -1,7 +1,9 @@ import email from email.header import decode_header, make_header import imaplib +import os.path +import code128 import imapclient from bureau import Bureau, add_command, add_api @@ -129,6 +131,26 @@ class MailRoom(Bureau): msg.content = msg.content.replace(">", ">") msg.content = msg.content.replace("\n", "
") + # make action barcodes + barcode_png = os.path.join("/tmp", "POun." + msg.shortcode + ".png") + code128.image("POun." + shortcode).save(barcode_png) + msg.un_bc = str(barcode_png) + barcode_png = os.path.join("/tmp", "POd." + msg.shortcode + ".png") + code128.image("POd." + shortcode).save(barcode_png) + msg.d_bc = str(barcode_png) + barcode_png = os.path.join("/tmp", "POsp." + msg.shortcode + ".png") + code128.image("POsp." + shortcode).save(barcode_png) + msg.sp_bc = str(barcode_png) + barcode_png = os.path.join("/tmp", "POre." + msg.shortcode + ".png") + code128.image("POre." + shortcode).save(barcode_png) + msg.re_bc = str(barcode_png) + barcode_png = os.path.join("/tmp", "POrea." + msg.shortcode + ".png") + code128.image("POrea." + shortcode).save(barcode_png) + msg.rea_bc = str(barcode_png) + barcode_png = os.path.join("/tmp", "POr." + msg.shortcode + ".png") + code128.image("POr." + shortcode).save(barcode_png) + msg.r_bc = str(barcode_png) + self.print_full("email.html", msg=msg, shortcode=shortcode) @add_command("d", "Delete email")