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 self.printer = None
def init_printer(self, device_id,vendor_id): def init_printer(self, device_id,vendor_id):
try: try:
p = Usb(vendor_id, device_id) p = Usb(0x04b8, 0x0e28, 0)
except USBNotFoundError as e: except USBNotFoundError as e:
self.app.logger.error("The USB device is not plugged in, aborting...") self.app.logger.error("The USB device is not plugged in, aborting..." + str(e))
exit(-1) return False
waiting_elapsed = 10 waiting_elapsed = 10
# p.open()
# Is the printer online ? Is the communication with the printer successfull ? # Is the printer online ? Is the communication with the printer successfull ?
while not p.is_online(): while not p.is_online():
self.app.logger.debug('Waiting for printer to get 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') 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. # 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.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.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.textln("------------------")
p.qr("Hello World ! :)") # p.qr("Hello World ! :)",size=1)
p.image("../configuration/hello_world.png",center=True) p.image("configuration/hello_world.png",center=True,impl='bitImageColumn')
p.cut() # p.cut()
self.printer = p; self.printer = p;
self.ready = True; self.ready = True;