add inheritance diagrams

This commit is contained in:
Patrick Kanzler 2023-08-16 23:06:11 +02:00
parent 2f8ec0bbb9
commit 894f770f01
2 changed files with 109 additions and 1 deletions

View File

@ -27,7 +27,14 @@ Result/Exit codes:
class Error(Exception): class Error(Exception):
"""Base class for ESC/POS errors.""" """Base class for ESC/POS errors.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
"""
def __init__(self, msg, status=None): def __init__(self, msg, status=None):
"""Initialize Error object.""" """Initialize Error object."""
@ -48,6 +55,12 @@ class BarcodeTypeError(Error):
This exception indicates that no known barcode-type has been entered. The barcode-type has to be This exception indicates that no known barcode-type has been entered. The barcode-type has to be
one of those specified in :py:meth:`escpos.escpos.Escpos.barcode`. one of those specified in :py:meth:`escpos.escpos.Escpos.barcode`.
The returned error code is `10`. The returned error code is `10`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -67,6 +80,12 @@ class BarcodeSizeError(Error):
This exception indicates that the values for the barcode size are out of range. This exception indicates that the values for the barcode size are out of range.
The size of the barcode has to be in the range that is specified in :py:meth:`escpos.escpos.Escpos.barcode`. The size of the barcode has to be in the range that is specified in :py:meth:`escpos.escpos.Escpos.barcode`.
The resulting returncode is `20`. The resulting returncode is `20`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -86,6 +105,12 @@ class BarcodeCodeError(Error):
No data for the barcode has been supplied in :py:meth:`escpos.escpos.Escpos.barcode` or the the `check` parameter No data for the barcode has been supplied in :py:meth:`escpos.escpos.Escpos.barcode` or the the `check` parameter
was True and the check failed. was True and the check failed.
The returncode for this exception is `30`. The returncode for this exception is `30`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -103,6 +128,12 @@ class ImageSizeError(Error):
"""Image height is longer than 255px and can't be printed. """Image height is longer than 255px and can't be printed.
The returncode for this exception is `40`. The returncode for this exception is `40`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -122,6 +153,12 @@ class ImageWidthError(Error):
"""Image width is too large. """Image width is too large.
The return code for this exception is `41`. The return code for this exception is `41`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -140,6 +177,12 @@ class TextError(Error):
This exception is raised when an empty string is passed to :py:meth:`escpos.escpos.Escpos.text`. This exception is raised when an empty string is passed to :py:meth:`escpos.escpos.Escpos.text`.
The returncode for this exception is `50`. The returncode for this exception is `50`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -160,6 +203,12 @@ class CashDrawerError(Error):
A valid pin number has to be passed onto the method :py:meth:`escpos.escpos.Escpos.cashdraw`. A valid pin number has to be passed onto the method :py:meth:`escpos.escpos.Escpos.cashdraw`.
The returncode for this exception is `60`. The returncode for this exception is `60`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -181,6 +230,12 @@ class TabPosError(Error):
This exception is raised by :py:meth:`escpos.escpos.Escpos.control`. This exception is raised by :py:meth:`escpos.escpos.Escpos.control`.
The returncode for this exception is `70`. The returncode for this exception is `70`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -201,6 +256,12 @@ class CharCodeError(Error):
The supplied charcode-name in :py:meth:`escpos.escpos.Escpos.charcode` is unknown. The supplied charcode-name in :py:meth:`escpos.escpos.Escpos.charcode` is unknown.
Ths returncode for this exception is `80`. Ths returncode for this exception is `80`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -219,6 +280,12 @@ class USBNotFoundError(Error):
The USB device seems to be not plugged in. The USB device seems to be not plugged in.
Ths returncode for this exception is `90`. Ths returncode for this exception is `90`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -237,6 +304,12 @@ class SetVariableError(Error):
Check set variables against minimum and maximum values Check set variables against minimum and maximum values
Ths returncode for this exception is `100`. Ths returncode for this exception is `100`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -258,6 +331,12 @@ class ConfigNotFoundError(Error):
The default or passed configuration file could not be read The default or passed configuration file could not be read
Ths returncode for this exception is `200`. Ths returncode for this exception is `200`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -276,6 +355,12 @@ class ConfigSyntaxError(Error):
The syntax is incorrect The syntax is incorrect
Ths returncode for this exception is `210`. Ths returncode for this exception is `210`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):
@ -294,6 +379,12 @@ class ConfigSectionMissingError(Error):
The part of the config asked for doesn't exist in the loaded configuration The part of the config asked for doesn't exist in the loaded configuration
Ths returncode for this exception is `220`. Ths returncode for this exception is `220`.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, msg=""): def __init__(self, msg=""):

View File

@ -400,6 +400,12 @@ if _WIN32PRINT:
"""Printer binding for win32 API. """Printer binding for win32 API.
Uses the module pywin32 for printing. Uses the module pywin32 for printing.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, printer_name=None, *args, **kwargs): def __init__(self, printer_name=None, *args, **kwargs):
@ -455,6 +461,11 @@ if _CUPSPRINT:
- Ubuntu/Debian: ``libcups2-dev`` - Ubuntu/Debian: ``libcups2-dev``
- OpenSuse/Fedora: ``cups-devel`` - OpenSuse/Fedora: ``cups-devel``
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, printer_name=None, *args, **kwargs): def __init__(self, printer_name=None, *args, **kwargs):
@ -564,6 +575,12 @@ if not sys.platform.startswith("win"):
"""Simple UNIX lp command raw printing. """Simple UNIX lp command raw printing.
Thanks to `Oyami-Srk comment <https://github.com/python-escpos/python-escpos/pull/348#issuecomment-549558316>`_. Thanks to `Oyami-Srk comment <https://github.com/python-escpos/python-escpos/pull/348#issuecomment-549558316>`_.
inheritance:
.. inheritance-diagram:: escpos.printer.Dummy
:parts: 1
""" """
def __init__(self, printer_name: str, *args, **kwargs): def __init__(self, printer_name: str, *args, **kwargs):