epson-tm-t20iii #1

Merged
n07070 merged 34 commits from epson-tm-t20iii into master 2022-05-04 11:57:09 +02:00
Showing only changes of commit c9a42a7b8b - Show all commits

View File

@ -31,13 +31,16 @@ class Printer(object):
self.printer = None
def init_printer(self, device_id,vendor_id):
try:
p = Usb(vendor_id, device_id)
p = Usb(0x04b8, 0x0e28, 0)
except USBNotFoundError as e:
self.app.logger.error("The USB device is not plugged in, aborting...")
exit(-1)
self.app.logger.error("The USB device is not plugged in, aborting..." + str(e))
return False
waiting_elapsed = 10
# p.open()
# Is the printer online ? Is the communication with the printer successfull ?
while not p.is_online():
self.app.logger.debug('Waiting for printer to get online...')
@ -59,12 +62,12 @@ class Printer(object):
self.app.logger.debug('Printer has paper, good to go')
# We're going to print a little text to let know that we're good, as a final check.
p.textln("Hello world ! \nStarting up at " + strftime("%Y-%m-%d %H:%M:%S", gmtime()))
p.set(align='center', font='a', bold=False, underline=0, width=1, height=1, density=9, invert=False, smooth=False, flip=False, double_width=False, double_height=False, custom_size=False)
p.textln("------------------")
p.qr("Hello World ! :)")
p.image("../configuration/hello_world.png",center=True)
p.cut()
# p.textln("Hello world ! \nStarting up at " + strftime("%Y-%m-%d %H:%M:%S", gmtime()))
# p.set(align='center', font='a', bold=False, underline=0, width=1, height=1, density=9, invert=False, smooth=False, flip=False, double_width=False, double_height=False, custom_size=False)
# p.textln("------------------")
# p.qr("Hello World ! :)",size=1)
p.image("configuration/hello_world.png",center=True,impl='bitImageColumn')
# p.cut()
self.printer = p;
self.ready = True;