other minor problems
This commit is contained in:
parent
87b33367c0
commit
4d479337d3
|
@ -421,8 +421,8 @@ class Escpos(object):
|
||||||
"Barcode '{bc}' not valid for barcode function type "
|
"Barcode '{bc}' not valid for barcode function type "
|
||||||
'{function_type}').format(
|
'{function_type}').format(
|
||||||
bc=bc,
|
bc=bc,
|
||||||
function_type=function_type,
|
function_type=function_type,)
|
||||||
))
|
)
|
||||||
|
|
||||||
if check and not self.check_barcode(bc, code):
|
if check and not self.check_barcode(bc, code):
|
||||||
raise BarcodeCodeError((
|
raise BarcodeCodeError((
|
||||||
|
@ -590,8 +590,7 @@ class Escpos(object):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if custom_size:
|
if custom_size:
|
||||||
if 1 <= width <= 8 and 1 <= height <= 8 and isinstance(width, int) and\
|
if 1 <= width <= 8 and 1 <= height <= 8 and isinstance(width, int) and isinstance(height, int):
|
||||||
isinstance(height, int):
|
|
||||||
size_byte = TXT_STYLE['width'][width] + TXT_STYLE['height'][height]
|
size_byte = TXT_STYLE['width'][width] + TXT_STYLE['height'][height]
|
||||||
self._raw(TXT_SIZE + six.int2byte(size_byte))
|
self._raw(TXT_SIZE + six.int2byte(size_byte))
|
||||||
else:
|
else:
|
||||||
|
@ -640,8 +639,7 @@ class Escpos(object):
|
||||||
|
|
||||||
if divisor not in LINESPACING_FUNCS:
|
if divisor not in LINESPACING_FUNCS:
|
||||||
raise ValueError('divisor must be either 360, 180 or 60')
|
raise ValueError('divisor must be either 360, 180 or 60')
|
||||||
if (divisor in [360, 180]
|
if (divisor in [360, 180] and (not(0 <= spacing <= 255))):
|
||||||
and (not(0 <= spacing <= 255))):
|
|
||||||
raise ValueError('spacing must be a int between 0 and 255 when divisor is 360 or 180')
|
raise ValueError('spacing must be a int between 0 and 255 when divisor is 360 or 180')
|
||||||
if divisor == 60 and (not(0 <= spacing <= 85)):
|
if divisor == 60 and (not(0 <= spacing <= 85)):
|
||||||
raise ValueError('spacing must be a int between 0 and 85 when divisor is 60')
|
raise ValueError('spacing must be a int between 0 and 85 when divisor is 60')
|
||||||
|
|
|
@ -107,7 +107,7 @@ class EscposImage(object):
|
||||||
:param fragment_height: height of fragment
|
:param fragment_height: height of fragment
|
||||||
:return: list of PIL objects
|
:return: list of PIL objects
|
||||||
"""
|
"""
|
||||||
passes = int(math.ceil(self.height/fragment_height))
|
passes = int(math.ceil(self.height // fragment_height))
|
||||||
fragments = []
|
fragments = []
|
||||||
for n in range(0, passes):
|
for n in range(0, passes):
|
||||||
left = 0
|
left = 0
|
||||||
|
|
Loading…
Reference in New Issue