From a12380ea8dc5e2b55f66a56319ce4a0f37b5e2fa Mon Sep 17 00:00:00 2001 From: samerbam Date: Tue, 22 Aug 2023 22:32:59 -0400 Subject: [PATCH] update python-escpos version --- application/main.py | 2 +- application/thermal_print.py | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/application/main.py b/application/main.py index 32d53d7..62d6369 100644 --- a/application/main.py +++ b/application/main.py @@ -17,7 +17,7 @@ from .thermal_print import ThermalPrinter app = FastAPI() auth = VerifyToken() data = TodoDatabase() -printer = ThermalPrinter() +printer = ThermalPrinter(data) diff --git a/application/thermal_print.py b/application/thermal_print.py index 7357922..e7b60e8 100644 --- a/application/thermal_print.py +++ b/application/thermal_print.py @@ -36,9 +36,9 @@ import wonderwords from datetime import datetime -from .sudoku_generator import * -from .wordsearch_generator import WordSearch -from .database import TodoDatabase +# from .sudoku_generator import * +# from .wordsearch_generator import WordSearch +from database import TodoDatabase @@ -47,7 +47,8 @@ class ThermalPrinter(): # self.p = printer.Usb(0x0416, 0x5011, 4, 0x81, 0x02) #initalize printer on raspberry pi self.database = database try: - self.p = Usb(0x0416, 0x5011, 4, 0x81, 0x02) #initalize printer on raspberry pi + # self.p = Usb(0x0416, 0x5011, 4, 0x81, 0x02) #initalize printer on raspberry pi + self.p = Usb(idVendor=0x0416, idProduct=0x5011, usb_args=None, timeout=4 , in_ep=0x81, out_ep=0x02) # pass except usb.core.NoBackendError as e: print(e) @@ -73,7 +74,8 @@ class ThermalPrinter(): def print_sudoku(self): self.p.close() - self.p = Usb(0x0416, 0x5011, 4, 0x81, 0x02) + # self.p = Usb(0x0416, 0x5011, None, 4, 0x81, 0x02) + self.p = Usb(idVendor=0x0416, idProduct=0x5011, usb_args=None, timeout=4 , in_ep=0x81, out_ep=0x02) convert_to_image(generate_sudoku()) self.p.image("sudoku.png")