Update code to better handle the raspberry pi mode
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user