|
|
|
@ -111,7 +111,7 @@ class Bureau(object):
|
|
|
|
|
# TODO: retry this a few times with a proper sleep/timeout
|
|
|
|
|
time.sleep(0.5)
|
|
|
|
|
try:
|
|
|
|
|
ret = json.loads(sender.recv(flags=zmq.NOBLOCK))
|
|
|
|
|
ret = json.loads(sender.recv_string(flags=zmq.NOBLOCK))
|
|
|
|
|
# TODO: deal with non-json replies
|
|
|
|
|
except zmq.ZMQError:
|
|
|
|
|
print("message sent but got no reply...")
|
|
|
|
@ -173,13 +173,15 @@ class Bureau(object):
|
|
|
|
|
|
|
|
|
|
subprocess.call("lpr -P " + lpname + " " + pdffile)
|
|
|
|
|
|
|
|
|
|
def print_small(self, text, printer="/dev/usb/lp1"):
|
|
|
|
|
# TODO: make this asynchronous
|
|
|
|
|
def print_small(self, text, printer="/dev/usb/lp0"):
|
|
|
|
|
"""
|
|
|
|
|
print on Thermal Line printer.
|
|
|
|
|
"""
|
|
|
|
|
# TODO: look this up in config
|
|
|
|
|
lp = open(printer, "w")
|
|
|
|
|
text += "\r\n" * 10
|
|
|
|
|
text += ".d0"
|
|
|
|
|
text += "\r\n" * 5
|
|
|
|
|
# text += ".d0"
|
|
|
|
|
lp.write(text)
|
|
|
|
|
lp.close()
|
|
|
|
|
|
|
|
|
|