More win32raw fixes
This commit is contained in:
parent
99777526a3
commit
da0cd8f863
@ -20,7 +20,6 @@ _DEP_WIN32PRINT = False
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import _win32typing
|
|
||||||
import pywintypes
|
import pywintypes
|
||||||
import win32print
|
import win32print
|
||||||
|
|
||||||
@ -67,7 +66,7 @@ class Win32Raw(Escpos):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
_device: Union[
|
_device: Union[
|
||||||
Literal[False], Literal[None], "_win32typing.PyPrinterHANDLE"
|
Literal[False], Literal[None], "_win32typing.PyPrinterHANDLE" # noqa: F821
|
||||||
] = False
|
] = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -120,11 +119,11 @@ class Win32Raw(Escpos):
|
|||||||
assert self.printer_name in self.printers, "Incorrect printer name"
|
assert self.printer_name in self.printers, "Incorrect printer name"
|
||||||
# Open device
|
# Open device
|
||||||
self.device: Optional[
|
self.device: Optional[
|
||||||
"_win32typing.PyPrinterHANDLE"
|
"_win32typing.PyPrinterHANDLE" # noqa: F821
|
||||||
] = win32print.OpenPrinter(self.printer_name)
|
] = win32print.OpenPrinter(self.printer_name)
|
||||||
if self.device:
|
if self.device:
|
||||||
self.current_job = win32print.StartDocPrinter(
|
self.current_job = win32print.StartDocPrinter(
|
||||||
hprinter=self.device, level=1, _tuple=(job_name, None, "RAW")
|
self.device, 1, (job_name, None, "RAW")
|
||||||
)
|
)
|
||||||
win32print.StartPagePrinter(self.device)
|
win32print.StartPagePrinter(self.device)
|
||||||
except (AssertionError, pywintypes.error) as e:
|
except (AssertionError, pywintypes.error) as e:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user