prevent using --red (two color printing) if not supported by model
This commit is contained in:
@@ -71,6 +71,9 @@ def create_label(qlr, image, label_size, threshold=70, cut=True, dither=False, c
|
|||||||
threshold = 100.0 - threshold
|
threshold = 100.0 - threshold
|
||||||
threshold = min(255, max(0, int(threshold/100.0 * 255))) # from percent to pixel val
|
threshold = min(255, max(0, int(threshold/100.0 * 255))) # from percent to pixel val
|
||||||
|
|
||||||
|
if red and not qlr.two_color_support:
|
||||||
|
raise BrotherQLUnsupportedCmd('Printing in red is not supported with the selected model.')
|
||||||
|
|
||||||
if isinstance(image, Image.Image):
|
if isinstance(image, Image.Image):
|
||||||
im = image
|
im = image
|
||||||
elif isinstance(image, (unicode, str)):
|
elif isinstance(image, (unicode, str)):
|
||||||
|
|||||||
@@ -171,3 +171,9 @@ compressionsupport = [
|
|||||||
'QL-810W',
|
'QL-810W',
|
||||||
'QL-820NWB',
|
'QL-820NWB',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
two_color_support = [
|
||||||
|
'QL-800',
|
||||||
|
'QL-810W',
|
||||||
|
'QL-820NWB',
|
||||||
|
]
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ from .devicedependent import models, \
|
|||||||
compressionsupport, \
|
compressionsupport, \
|
||||||
cuttingsupport, \
|
cuttingsupport, \
|
||||||
expandedmode, \
|
expandedmode, \
|
||||||
|
two_color_support, \
|
||||||
modesetting
|
modesetting
|
||||||
|
|
||||||
from . import BrotherQLError, BrotherQLUnsupportedCmd, BrotherQLUnknownModel, BrotherQLRasterError
|
from . import BrotherQLError, BrotherQLUnsupportedCmd, BrotherQLUnknownModel, BrotherQLRasterError
|
||||||
@@ -66,6 +67,10 @@ class BrotherQLRaster(object):
|
|||||||
"""
|
"""
|
||||||
self._warn(problem, kind=BrotherQLUnsupportedCmd)
|
self._warn(problem, kind=BrotherQLUnsupportedCmd)
|
||||||
|
|
||||||
|
@property
|
||||||
|
def two_color_support(self):
|
||||||
|
return self.model in two_color_support
|
||||||
|
|
||||||
def add_initialize(self):
|
def add_initialize(self):
|
||||||
self.page_number = 0
|
self.page_number = 0
|
||||||
self.data += b'\x1B\x40' # ESC @
|
self.data += b'\x1B\x40' # ESC @
|
||||||
@@ -150,6 +155,9 @@ class BrotherQLRaster(object):
|
|||||||
if self.model not in expandedmode:
|
if self.model not in expandedmode:
|
||||||
self.unsupported("Trying to set expanded mode (dpi/cutting at end) on a printer that doesn't support it")
|
self.unsupported("Trying to set expanded mode (dpi/cutting at end) on a printer that doesn't support it")
|
||||||
return
|
return
|
||||||
|
if self.two_color_printing and not self.two_color_support:
|
||||||
|
self.unsupported("Trying to set two_color_printing in expanded mode on a printer that doesn't support it.")
|
||||||
|
return
|
||||||
self.data += b'\x1B\x69\x4B' # ESC i K
|
self.data += b'\x1B\x69\x4B' # ESC i K
|
||||||
flags = 0x00
|
flags = 0x00
|
||||||
flags |= self.cut_at_end << 3
|
flags |= self.cut_at_end << 3
|
||||||
|
|||||||
Reference in New Issue
Block a user