Update code to better handle the raspberry pi mode

This commit is contained in:
nono
2025-10-17 17:33:53 +02:00
committed by n07070
parent 67b7de11e9
commit cdba783f45
3 changed files with 191 additions and 60 deletions

View File

@@ -17,6 +17,7 @@ class Web(object):
self.app.logger.debug("Printing : " + str(texte) + " from " + str(sign))
try:
self.printer.print_sms(texte, sign)
self.printer.cut()
except Exception as e:
self.app.logger.error(e)
flash("Error while printing the SMS : "+ str(e))
@@ -24,13 +25,14 @@ class Web(object):
flash("You message " + str( texte ) + " has been printed :)")
def print_image(self, image, sign: str):
def print_image(self, image, sign):
self.app.logger.debug("Uploading file")
try:
self.app.logger.debug("Uploading file from " + str(sign))
if self.upload_file(image):
self.app.logger.debug("File has been uploaded, printing...")
self.printer.print_img(os.path.join(self.app.config['UPLOAD_FOLDER'], secure_filename(image.filename)), sign)
self.printer.print_img(os.path.join(self.app.config['UPLOAD_FOLDER'], secure_filename(image.filename)), sign=sign,process=True)
self.printer.cut()
except Exception as e:
self.app.logger.error(e)
flash("Could not upload file." + str(e))