mirror of
				https://github.com/python-escpos/python-escpos
				synced 2025-10-23 09:30:00 +00:00 
			
		
		
		
	Bump sphinx-rtd-theme from 2.0.0 to 3.0.1 (#661)
* Bump sphinx-rtd-theme from 2.0.0 to 3.0.1 Bumps [sphinx-rtd-theme](https://github.com/readthedocs/sphinx_rtd_theme) from 2.0.0 to 3.0.1. - [Changelog](https://github.com/readthedocs/sphinx_rtd_theme/blob/master/docs/changelog.rst) - [Commits](https://github.com/readthedocs/sphinx_rtd_theme/compare/2.0.0...3.0.1) --- updated-dependencies: - dependency-name: sphinx-rtd-theme dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * remove call to get_html_theme_path according to deprection warning of sphinx-rtd-theme>=3 * disable broken spelling integration (pypi) and fix spelling * fix spelling --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Patrick Kanzler <dev@pkanzler.de>
This commit is contained in:
		@@ -522,7 +522,7 @@ def generate_parser() -> argparse.ArgumentParser:
 | 
			
		||||
    """Generate an argparse parser."""
 | 
			
		||||
    parser = argparse.ArgumentParser(
 | 
			
		||||
        description="CLI for python-escpos",
 | 
			
		||||
        epilog="Printer configuration is defined in the python-escpos config"
 | 
			
		||||
        epilog="Printer configuration is defined in the python-escpos configuration "
 | 
			
		||||
        "file. See documentation for details.",
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,4 +1,4 @@
 | 
			
		||||
"""Helper module for codepage handling."""
 | 
			
		||||
"""Helper module for code page handling."""
 | 
			
		||||
from .capabilities import CAPABILITIES
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -9,7 +9,7 @@ class CodePageManager:
 | 
			
		||||
    """
 | 
			
		||||
 | 
			
		||||
    def __init__(self, data):
 | 
			
		||||
        """Initialize codepage manager."""
 | 
			
		||||
        """Initialize code page manager."""
 | 
			
		||||
        self.data = data
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
 
 | 
			
		||||
@@ -188,8 +188,8 @@ LINESPACING_FUNCS: Dict[int, bytes] = {
 | 
			
		||||
    180: ESC + b"3",  # line_spacing/180 of an inch, 0 <= line_spacing <= 255
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#: Prefix to change the codepage. You need to attach a byte to indicate
 | 
			
		||||
#: the codepage to use. We use escpos-printer-db as the data source.
 | 
			
		||||
#: Prefix to change the code page. You need to attach a byte to indicate
 | 
			
		||||
#: the code page to use. We use escpos-printer-db as the data source.
 | 
			
		||||
CODEPAGE_CHANGE: bytes = ESC + b"\x74"
 | 
			
		||||
 | 
			
		||||
# Barcode format
 | 
			
		||||
 
 | 
			
		||||
@@ -460,7 +460,7 @@ class Escpos(object, metaclass=ABCMeta):
 | 
			
		||||
        Sets the control sequence from ``CHARCODE`` in :py:mod:`escpos.constants` as active.
 | 
			
		||||
        It will be sent with the next text sequence.
 | 
			
		||||
        If you set the variable code to ``AUTO`` it will try to automatically guess the
 | 
			
		||||
        right codepage.
 | 
			
		||||
        right code page.
 | 
			
		||||
        (This is the standard behavior.)
 | 
			
		||||
 | 
			
		||||
        :param code: Name of CharCode
 | 
			
		||||
@@ -876,8 +876,8 @@ class Escpos(object, metaclass=ABCMeta):
 | 
			
		||||
    def text(self, txt: str) -> None:
 | 
			
		||||
        """Print alpha-numeric text.
 | 
			
		||||
 | 
			
		||||
        The text has to be encoded in the currently selected codepage.
 | 
			
		||||
        The input text has to be encoded in unicode.
 | 
			
		||||
        The text has to be encoded in the currently selected code page.
 | 
			
		||||
        The input text has to be encoded in Unicode.
 | 
			
		||||
 | 
			
		||||
        :param txt: text to be printed
 | 
			
		||||
        :raises: :py:exc:`~escpos.exceptions.TextError`
 | 
			
		||||
@@ -887,8 +887,8 @@ class Escpos(object, metaclass=ABCMeta):
 | 
			
		||||
    def textln(self, txt: str = "") -> None:
 | 
			
		||||
        """Print alpha-numeric text with a newline.
 | 
			
		||||
 | 
			
		||||
        The text has to be encoded in the currently selected codepage.
 | 
			
		||||
        The input text has to be encoded in unicode.
 | 
			
		||||
        The text has to be encoded in the currently selected code page.
 | 
			
		||||
        The input text has to be encoded in Unicode.
 | 
			
		||||
 | 
			
		||||
        :param txt: text to be printed with a newline
 | 
			
		||||
        :raises: :py:exc:`~escpos.exceptions.TextError`
 | 
			
		||||
@@ -909,7 +909,7 @@ class Escpos(object, metaclass=ABCMeta):
 | 
			
		||||
    def block_text(self, txt, font="0", columns=None) -> None:
 | 
			
		||||
        """Print text wrapped to specific columns.
 | 
			
		||||
 | 
			
		||||
        Text has to be encoded in unicode.
 | 
			
		||||
        Text has to be encoded in Unicode.
 | 
			
		||||
 | 
			
		||||
        :param txt: text to be printed
 | 
			
		||||
        :param font: font to be used, can be :code:`a` or :code:`b`
 | 
			
		||||
@@ -1555,7 +1555,7 @@ class EscposIO:
 | 
			
		||||
                f"{text}",
 | 
			
		||||
            ]
 | 
			
		||||
 | 
			
		||||
        # TODO check unicode handling
 | 
			
		||||
        # TODO check Unicode handling
 | 
			
		||||
        # TODO flush? or on print? (this should prob rather be handled by the _raw-method)
 | 
			
		||||
        for line in lines:
 | 
			
		||||
            self.printer.set(**params)
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@
 | 
			
		||||
"""Magic Encode.
 | 
			
		||||
 | 
			
		||||
This module tries to convert an UTF-8 string to an encoded string for the printer.
 | 
			
		||||
It uses trial and error in order to guess the right codepage.
 | 
			
		||||
It uses trial and error in order to guess the right code page.
 | 
			
		||||
The code is based on the encoding-code in py-xml-escpos by @fvdsn.
 | 
			
		||||
 | 
			
		||||
:author: `Patrick Kanzler <dev@pkanzler.de>`_
 | 
			
		||||
@@ -65,11 +65,11 @@ class Encoder:
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def _get_codepage_char_list(encoding):
 | 
			
		||||
        """Get codepage character list.
 | 
			
		||||
        """Get code page character list.
 | 
			
		||||
 | 
			
		||||
        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 code page list
 | 
			
		||||
        """
 | 
			
		||||
        codepage = CodePages.get_encoding(encoding)
 | 
			
		||||
        if "data" in codepage:
 | 
			
		||||
@@ -91,7 +91,7 @@ class Encoder:
 | 
			
		||||
        raise LookupError(f"Can't find a known encoding for {encoding}")
 | 
			
		||||
 | 
			
		||||
    def _get_codepage_char_map(self, encoding):
 | 
			
		||||
        """Get codepage character map.
 | 
			
		||||
        """Get code page character map.
 | 
			
		||||
 | 
			
		||||
        Process an encoding and return a map of UTF-characters to code points
 | 
			
		||||
        in this encoding.
 | 
			
		||||
@@ -166,7 +166,7 @@ class Encoder:
 | 
			
		||||
        1. code pages that we already tried before; there is a good
 | 
			
		||||
           chance they might work again, reducing the search space,
 | 
			
		||||
           and by re-using already used encodings we might also
 | 
			
		||||
           reduce the number of codepage change instruction we have
 | 
			
		||||
           reduce the number of code page change instruction we have
 | 
			
		||||
           to send. Still, any performance gains will presumably be
 | 
			
		||||
           fairly minor.
 | 
			
		||||
 | 
			
		||||
@@ -225,7 +225,7 @@ class MagicEncode:
 | 
			
		||||
        :param encoding: If you know the current encoding of the printer
 | 
			
		||||
        when initializing this class, set it here. If the current
 | 
			
		||||
        encoding is unknown, the first character emitted will be a
 | 
			
		||||
        codepage switch.
 | 
			
		||||
        code page switch.
 | 
			
		||||
        :param disabled:
 | 
			
		||||
        :param defaultsymbol:
 | 
			
		||||
        :param encoder:
 | 
			
		||||
@@ -284,20 +284,20 @@ class MagicEncode:
 | 
			
		||||
    def _handle_character_failed(self, char):
 | 
			
		||||
        """Write a default symbol.
 | 
			
		||||
 | 
			
		||||
        Called when no codepage was found to render a character.
 | 
			
		||||
        Called when no code page was found to render a character.
 | 
			
		||||
        """
 | 
			
		||||
        # Writing the default symbol via write() allows us to avoid
 | 
			
		||||
        # unnecesary codepage switches.
 | 
			
		||||
        # unnecesary code page switches.
 | 
			
		||||
        self.write(self.defaultsymbol)
 | 
			
		||||
 | 
			
		||||
    def write_with_encoding(self, encoding, text):
 | 
			
		||||
        """Write the text and inject necessary codepage switches."""
 | 
			
		||||
        """Write the text and inject necessary code page switches."""
 | 
			
		||||
        if text is not None and type(text) is not str:
 | 
			
		||||
            raise Error(
 | 
			
		||||
                f"The supplied text has to be unicode, but is of type {type(text)}."
 | 
			
		||||
                f"The supplied text has to be Unicode, but is of type {type(text)}."
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
        # We always know the current code page; if the new codepage
 | 
			
		||||
        # We always know the current code page; if the new code page
 | 
			
		||||
        # is different, emit a change command.
 | 
			
		||||
        if encoding != self.encoding:
 | 
			
		||||
            self.encoding = encoding
 | 
			
		||||
 
 | 
			
		||||
@@ -23,7 +23,7 @@ def is_usable() -> bool:
 | 
			
		||||
class File(Escpos):
 | 
			
		||||
    """Generic file printer.
 | 
			
		||||
 | 
			
		||||
    This class is used for parallel port printer or other printers that are directly attached to the filesystem.
 | 
			
		||||
    This class is used for parallel port printer or other printers that are directly attached to the file system.
 | 
			
		||||
    Note that you should stay away from using USB-to-Parallel-Adapter since they are unreliable
 | 
			
		||||
    and produce arbitrary errors.
 | 
			
		||||
 | 
			
		||||
@@ -46,7 +46,7 @@ class File(Escpos):
 | 
			
		||||
    def __init__(self, devfile: str = "", auto_flush: bool = True, *args, **kwargs):
 | 
			
		||||
        """Initialize file printer with device file.
 | 
			
		||||
 | 
			
		||||
        :param devfile: Device file under dev filesystem
 | 
			
		||||
        :param devfile: Device file under dev file system
 | 
			
		||||
        :param auto_flush: automatically call flush after every call of _raw()
 | 
			
		||||
        """
 | 
			
		||||
        Escpos.__init__(self, *args, **kwargs)
 | 
			
		||||
 
 | 
			
		||||
@@ -89,7 +89,7 @@ class Serial(Escpos):
 | 
			
		||||
    ):
 | 
			
		||||
        """Initialize serial printer.
 | 
			
		||||
 | 
			
		||||
        :param devfile:  Device file under dev filesystem
 | 
			
		||||
        :param devfile:  Device file under dev file system
 | 
			
		||||
        :param baudrate: Baud rate for serial transmission
 | 
			
		||||
        :param bytesize: Serial buffer size
 | 
			
		||||
        :param timeout:  Read/Write timeout
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user