Ajout d'un try/except
This commit is contained in:
parent
be3770956c
commit
4fea7c1e86
@ -120,13 +120,17 @@ class Printer(object):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
if not os.getenv('LIPY_DEBUG') == True:
|
if not os.getenv('LIPY_DEBUG') == True:
|
||||||
self.printer.open(self.usb_args);
|
try:
|
||||||
self.printer.set(align='left', font='a', bold=False, underline=0, width=1, height=1, density=8, invert=False, smooth=True, flip=False, double_width=False, double_height=False, custom_size=False)
|
self.printer.open(self.usb_args);
|
||||||
self.printer.textln(clean_msg)
|
self.printer.set(align='left', font='a', bold=False, underline=0, width=1, height=1, density=8, invert=False, smooth=True, flip=False, double_width=False, double_height=False, custom_size=False)
|
||||||
self.printer.set(align='left', font='b', bold=False, underline=1, width=1, height=1, density=9, invert=False, smooth=True, flip=False, double_width=False, double_height=False, custom_size=False)
|
self.printer.textln(clean_msg)
|
||||||
self.printer.textln("> " + clean_signature + " @ " + strftime("%Y-%m-%d %H:%M:%S", gmtime()))
|
self.printer.set(align='left', font='b', bold=False, underline=1, width=1, height=1, density=9, invert=False, smooth=True, flip=False, double_width=False, double_height=False, custom_size=False)
|
||||||
self.printer.cut()
|
self.printer.textln("> " + clean_signature + " @ " + strftime("%Y-%m-%d %H:%M:%S", gmtime()))
|
||||||
self.printer.close()
|
self.printer.cut()
|
||||||
|
self.printer.close
|
||||||
|
except Exception as e:
|
||||||
|
flash("Unable to print because : " + e)
|
||||||
|
|
||||||
flash("Message printed : " + clean_msg ,category='info')
|
flash("Message printed : " + clean_msg ,category='info')
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user