Restore device status to False on close()
This commit is contained in:
parent
21b329a955
commit
7103af083c
@ -181,4 +181,4 @@ class CupsPrinter(Escpos):
|
|||||||
if self.pending_job:
|
if self.pending_job:
|
||||||
self.send()
|
self.send()
|
||||||
print(f"Closing CUPS connection to printer {self.printer_name}")
|
print(f"Closing CUPS connection to printer {self.printer_name}")
|
||||||
self.device = None
|
self._device = False
|
||||||
|
@ -76,4 +76,4 @@ class File(Escpos):
|
|||||||
return
|
return
|
||||||
self.device.flush()
|
self.device.flush()
|
||||||
self.device.close()
|
self.device.close()
|
||||||
self.device = None
|
self._device = False
|
||||||
|
@ -87,7 +87,7 @@ class LP(Escpos):
|
|||||||
if not self._device:
|
if not self._device:
|
||||||
return
|
return
|
||||||
self.device.terminate()
|
self.device.terminate()
|
||||||
self.device = None
|
self._device = False
|
||||||
|
|
||||||
def flush(self):
|
def flush(self):
|
||||||
"""End line and wait for new commands."""
|
"""End line and wait for new commands."""
|
||||||
|
@ -92,4 +92,4 @@ class Network(Escpos):
|
|||||||
except socket.error:
|
except socket.error:
|
||||||
pass
|
pass
|
||||||
self.device.close()
|
self.device.close()
|
||||||
self.device = None
|
self._device = False
|
||||||
|
@ -151,4 +151,4 @@ class Serial(Escpos):
|
|||||||
if self.device.is_open:
|
if self.device.is_open:
|
||||||
self.device.flush()
|
self.device.flush()
|
||||||
self.device.close()
|
self.device.close()
|
||||||
self.device = None
|
self._device = False
|
||||||
|
@ -156,4 +156,4 @@ class Usb(Escpos):
|
|||||||
if not self._device:
|
if not self._device:
|
||||||
return
|
return
|
||||||
usb.util.dispose_resources(self.device)
|
usb.util.dispose_resources(self.device)
|
||||||
self.device = None
|
self._device = False
|
||||||
|
@ -97,7 +97,7 @@ class Win32Raw(Escpos):
|
|||||||
win32print.EndPagePrinter(self.device)
|
win32print.EndPagePrinter(self.device)
|
||||||
win32print.EndDocPrinter(self.device)
|
win32print.EndDocPrinter(self.device)
|
||||||
win32print.ClosePrinter(self.device)
|
win32print.ClosePrinter(self.device)
|
||||||
self.device = None
|
self._device = False
|
||||||
|
|
||||||
@dependency_win32print
|
@dependency_win32print
|
||||||
def _raw(self, msg):
|
def _raw(self, msg):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user