normalize whitespace
This commit is contained in:
parent
ca880dd8ec
commit
ce94a1fc18
|
@ -126,7 +126,7 @@ class Escpos(object):
|
||||||
def _image_send_graphics_data(self, m, fn, data):
|
def _image_send_graphics_data(self, m, fn, data):
|
||||||
"""
|
"""
|
||||||
Wrapper for GS ( L, to calculate and send correct data length.
|
Wrapper for GS ( L, to calculate and send correct data length.
|
||||||
|
|
||||||
:param m: Modifier//variant for function. Usually '0'
|
:param m: Modifier//variant for function. Usually '0'
|
||||||
:param fn: Function number to use, as byte
|
:param fn: Function number to use, as byte
|
||||||
:param data: Data to send
|
:param data: Data to send
|
||||||
|
@ -203,7 +203,7 @@ class Escpos(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _int_low_high(inp_number, out_bytes):
|
def _int_low_high(inp_number, out_bytes):
|
||||||
""" Generate multiple bytes for a number: In lower and higher parts, or more parts as needed.
|
""" Generate multiple bytes for a number: In lower and higher parts, or more parts as needed.
|
||||||
|
|
||||||
:param inp_number: Input number
|
:param inp_number: Input number
|
||||||
:param out_bytes: The number of bytes to output (1 - 4).
|
:param out_bytes: The number of bytes to output (1 - 4).
|
||||||
"""
|
"""
|
||||||
|
@ -259,7 +259,7 @@ class Escpos(object):
|
||||||
|
|
||||||
.. todo:: If further barcode-types are needed they could be rendered transparently as an image. (This could also
|
.. todo:: If further barcode-types are needed they could be rendered transparently as an image. (This could also
|
||||||
be of help if the printer does not support types that others do.)
|
be of help if the printer does not support types that others do.)
|
||||||
|
|
||||||
:param code: alphanumeric data to be printed as bar code
|
:param code: alphanumeric data to be printed as bar code
|
||||||
:param bc: barcode format, possible values are for type A are:
|
:param bc: barcode format, possible values are for type A are:
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ class Escpos(object):
|
||||||
Without any arguments the paper will be cut completely. With 'mode=PART' a partial cut will
|
Without any arguments the paper will be cut completely. With 'mode=PART' a partial cut will
|
||||||
be attempted. Note however, that not all models can do a partial cut. See the documentation of
|
be attempted. Note however, that not all models can do a partial cut. See the documentation of
|
||||||
your printer for details.
|
your printer for details.
|
||||||
|
|
||||||
.. todo:: Check this function on TM-T88II.
|
.. todo:: Check this function on TM-T88II.
|
||||||
|
|
||||||
:param mode: set to 'PART' for a partial cut
|
:param mode: set to 'PART' for a partial cut
|
||||||
|
|
|
@ -28,7 +28,7 @@ class EscposImage(object):
|
||||||
def __init__(self, img_source):
|
def __init__(self, img_source):
|
||||||
"""
|
"""
|
||||||
Load in an image
|
Load in an image
|
||||||
|
|
||||||
:param img_source: PIL.Image, or filename to load one from.
|
:param img_source: PIL.Image, or filename to load one from.
|
||||||
"""
|
"""
|
||||||
if isinstance(img_source, Image.Image):
|
if isinstance(img_source, Image.Image):
|
||||||
|
@ -45,12 +45,12 @@ class EscposImage(object):
|
||||||
im = Image.new("RGB", img_original.size, (255, 255, 255))
|
im = Image.new("RGB", img_original.size, (255, 255, 255))
|
||||||
im.paste(img_original, mask=img_original.split()[3])
|
im.paste(img_original, mask=img_original.split()[3])
|
||||||
# Convert down to greyscale
|
# Convert down to greyscale
|
||||||
im = im.convert("L")
|
im = im.convert("L")
|
||||||
# Invert: Only works on 'L' images
|
# Invert: Only works on 'L' images
|
||||||
im = ImageOps.invert(im)
|
im = ImageOps.invert(im)
|
||||||
# Pure black and white
|
# Pure black and white
|
||||||
self._im = im.convert("1")
|
self._im = im.convert("1")
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def width(self):
|
def width(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -70,9 +70,9 @@ class Encoder(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_codepage_char_list(encoding):
|
def _get_codepage_char_list(encoding):
|
||||||
"""Get codepage character list
|
"""Get codepage character list
|
||||||
|
|
||||||
Gets characters 128-255 for a given code page, as an array.
|
Gets characters 128-255 for a given code page, as an array.
|
||||||
|
|
||||||
:param encoding: The name of the encoding. This must appear in the CodePage list
|
:param encoding: The name of the encoding. This must appear in the CodePage list
|
||||||
"""
|
"""
|
||||||
codepage = CodePages.get_encoding(encoding)
|
codepage = CodePages.get_encoding(encoding)
|
||||||
|
@ -94,12 +94,12 @@ class Encoder(object):
|
||||||
|
|
||||||
def _get_codepage_char_map(self, encoding):
|
def _get_codepage_char_map(self, encoding):
|
||||||
""" Get codepage character map
|
""" Get codepage character map
|
||||||
|
|
||||||
Process an encoding and return a map of UTF-characters to code points
|
Process an encoding and return a map of UTF-characters to code points
|
||||||
in this encoding.
|
in this encoding.
|
||||||
|
|
||||||
This is generated once only, and returned from a cache.
|
This is generated once only, and returned from a cache.
|
||||||
|
|
||||||
:param encoding: The name of the encoding.
|
:param encoding: The name of the encoding.
|
||||||
"""
|
"""
|
||||||
# Skip things that were loaded previously
|
# Skip things that were loaded previously
|
||||||
|
@ -112,7 +112,7 @@ class Encoder(object):
|
||||||
|
|
||||||
def can_encode(self, encoding, char):
|
def can_encode(self, encoding, char):
|
||||||
"""Determine if a character is encodeable in the given code page.
|
"""Determine if a character is encodeable in the given code page.
|
||||||
|
|
||||||
:param encoding: The name of the encoding.
|
:param encoding: The name of the encoding.
|
||||||
:param char: The character to attempt to encode.
|
:param char: The character to attempt to encode.
|
||||||
"""
|
"""
|
||||||
|
@ -130,7 +130,7 @@ class Encoder(object):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _encode_char(char, charmap, defaultchar):
|
def _encode_char(char, charmap, defaultchar):
|
||||||
""" Encode a single character with the given encoding map
|
""" Encode a single character with the given encoding map
|
||||||
|
|
||||||
:param char: char to encode
|
:param char: char to encode
|
||||||
:param charmap: dictionary for mapping characters in this code page
|
:param charmap: dictionary for mapping characters in this code page
|
||||||
"""
|
"""
|
||||||
|
@ -142,7 +142,7 @@ class Encoder(object):
|
||||||
|
|
||||||
def encode(self, text, encoding, defaultchar='?'):
|
def encode(self, text, encoding, defaultchar='?'):
|
||||||
""" Encode text under the given encoding
|
""" Encode text under the given encoding
|
||||||
|
|
||||||
:param text: Text to encode
|
:param text: Text to encode
|
||||||
:param encoding: Encoding name to use (must be defined in capabilities)
|
:param encoding: Encoding name to use (must be defined in capabilities)
|
||||||
:param defaultchar: Fallback for non-encodable characters
|
:param defaultchar: Fallback for non-encodable characters
|
||||||
|
|
|
@ -34,7 +34,7 @@ class Usb(Escpos):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, idVendor, idProduct, timeout=0, in_ep=0x82, out_ep=0x01, *args, **kwargs):
|
def __init__(self, idVendor, idProduct, timeout=0, in_ep=0x82, out_ep=0x01, *args, **kwargs): # noqa: N803
|
||||||
"""
|
"""
|
||||||
:param idVendor: Vendor ID
|
:param idVendor: Vendor ID
|
||||||
:param idProduct: Product ID
|
:param idProduct: Product ID
|
||||||
|
|
Loading…
Reference in New Issue