mirror of
https://github.com/python-escpos/python-escpos
synced 2025-08-24 09:03:34 +00:00
Enable spell checking (#563)
* add spellchecking * improve spelling * improve spelling config * extend word list * improve spelling * improve spelling * escalate warning in spell check to failure * fix spelling * fix spelling * add plural * Update doc/spelling_wordlist.txt * do not stop on warning * require newest sphinxcontrib spelling * remove old comment * add authors as single line entry to spelling list * reenable stop on warning
This commit is contained in:
@@ -26,7 +26,7 @@ from . import config, version
|
||||
|
||||
# Must be defined before it's used in DEMO_FUNCTIONS
|
||||
def str_to_bool(string):
|
||||
"""Convert string to Bool.
|
||||
"""Convert string to bool.
|
||||
|
||||
Used as a type in argparse so that we get back a proper
|
||||
bool instead of always True.
|
||||
|
@@ -13,7 +13,7 @@ from . import exceptions, printer
|
||||
class Config(object):
|
||||
"""Configuration handler class.
|
||||
|
||||
This class loads configuration from a default or specificed directory. It
|
||||
This class loads configuration from a default or specified directory. It
|
||||
can create your defined printer and return it to you.
|
||||
"""
|
||||
|
||||
@@ -95,7 +95,7 @@ class Config(object):
|
||||
|
||||
Throw an exception on error.
|
||||
|
||||
This method loads the default config if one hasn't beeen already loaded.
|
||||
This method loads the default config if one has not been already loaded.
|
||||
|
||||
"""
|
||||
if not self._has_loaded:
|
||||
|
@@ -1,8 +1,8 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
""" Set of ESC/POS Commands (Constants)
|
||||
|
||||
This module contains constants that are described in the esc/pos-documentation.
|
||||
Since there is no definitive and unified specification for all esc/pos-like printers the constants could later be
|
||||
This module contains constants that are described in the Esc/Pos-documentation.
|
||||
Since there is no definitive and unified specification for all Esc/Pos-like printers the constants could later be
|
||||
moved to `capabilities` as in `escpos-php by @mike42 <https://github.com/mike42/escpos-php>`_.
|
||||
|
||||
:author: python-escpos developers
|
||||
|
@@ -110,7 +110,7 @@ SW_BARCODE_NAMES = {
|
||||
class Escpos(object):
|
||||
"""ESC/POS Printer object.
|
||||
|
||||
This class is the abstract base class for an esc/pos-printer. The printer implementations are children of this
|
||||
This class is the abstract base class for an Esc/Pos-printer. The printer implementations are children of this
|
||||
class.
|
||||
"""
|
||||
|
||||
@@ -391,9 +391,11 @@ class Escpos(object):
|
||||
def charcode(self, code: str = "AUTO") -> None:
|
||||
"""Set Character Code Table.
|
||||
|
||||
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. (This is the standard behaviour.)
|
||||
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.
|
||||
(This is the standard behavior.)
|
||||
|
||||
:param code: Name of CharCode
|
||||
:raises: :py:exc:`~escpos.exceptions.CharCodeError`
|
||||
@@ -848,7 +850,7 @@ class Escpos(object):
|
||||
self.text("\n" * count)
|
||||
|
||||
def block_text(self, txt, font="0", columns=None):
|
||||
"""Print text wrapped to specifiec columns.
|
||||
"""Print text wrapped to specific columns.
|
||||
|
||||
Text has to be encoded in unicode.
|
||||
|
||||
|
@@ -79,7 +79,7 @@ class BarcodeSizeError(Error):
|
||||
|
||||
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 resulting returncode is `20`.
|
||||
The resulting return code is `20`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -104,7 +104,7 @@ class BarcodeCodeError(Error):
|
||||
|
||||
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.
|
||||
The returncode for this exception is `30`.
|
||||
The return code for this exception is `30`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -127,7 +127,7 @@ class BarcodeCodeError(Error):
|
||||
class ImageSizeError(Error):
|
||||
"""Image height is longer than 255px and can't be printed.
|
||||
|
||||
The returncode for this exception is `40`.
|
||||
The return code for this exception is `40`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -176,7 +176,7 @@ class TextError(Error):
|
||||
"""Text string must be supplied to the `text()` method.
|
||||
|
||||
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 return code for this exception is `50`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -202,7 +202,7 @@ class CashDrawerError(Error):
|
||||
"""Valid pin must be set in order to send pulse.
|
||||
|
||||
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 return code for this exception is `60`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -229,7 +229,7 @@ class TabPosError(Error):
|
||||
Both values multiplied must not exceed 255, since it is the maximum tab value.
|
||||
|
||||
This exception is raised by :py:meth:`escpos.escpos.Escpos.control`.
|
||||
The returncode for this exception is `70`.
|
||||
The return code for this exception is `70`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -255,7 +255,7 @@ class CharCodeError(Error):
|
||||
"""Valid char code must be set.
|
||||
|
||||
The supplied charcode-name in :py:meth:`escpos.escpos.Escpos.charcode` is unknown.
|
||||
Ths returncode for this exception is `80`.
|
||||
The return code for this exception is `80`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -276,10 +276,10 @@ class CharCodeError(Error):
|
||||
|
||||
|
||||
class USBNotFoundError(Error):
|
||||
"""Device wasn't found (probably not plugged in).
|
||||
"""Device was not found (probably not plugged in).
|
||||
|
||||
The USB device seems to be not plugged in.
|
||||
Ths returncode for this exception is `90`.
|
||||
The return code for this exception is `90`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -303,7 +303,7 @@ class SetVariableError(Error):
|
||||
"""A set method variable was out of range.
|
||||
|
||||
Check set variables against minimum and maximum values
|
||||
Ths returncode for this exception is `100`.
|
||||
The return code for this exception is `100`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -330,7 +330,7 @@ class ConfigNotFoundError(Error):
|
||||
"""The configuration file was not found.
|
||||
|
||||
The default or passed configuration file could not be read
|
||||
Ths returncode for this exception is `200`.
|
||||
The return code for this exception is `200`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -354,7 +354,7 @@ class ConfigSyntaxError(Error):
|
||||
"""The configuration file is invalid.
|
||||
|
||||
The syntax is incorrect
|
||||
Ths returncode for this exception is `210`.
|
||||
The return code for this exception is `210`.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -377,8 +377,8 @@ class ConfigSyntaxError(Error):
|
||||
class ConfigSectionMissingError(Error):
|
||||
"""The configuration file is missing a section.
|
||||
|
||||
The part of the config asked for doesn't exist in the loaded configuration
|
||||
Ths returncode for this exception is `220`.
|
||||
The part of the config asked for does not exist in the loaded configuration
|
||||
The return code for this exception is `220`.
|
||||
|
||||
inheritance:
|
||||
|
||||
|
@@ -28,15 +28,9 @@ class Encoder(object):
|
||||
|
||||
Note: To determine the code page, it needs to do the conversion, and
|
||||
thus already knows what the final byte in the target encoding would
|
||||
be. Nevertheless, the API of this class doesn't return the byte.
|
||||
be. Nevertheless, the API of this class does not return the byte.
|
||||
|
||||
The caller use to do the character conversion itself.
|
||||
|
||||
$ python -m timeit -s "{u'ö':'a'}.get(u'ö')"
|
||||
100000000 loops, best of 3: 0.0133 usec per loop
|
||||
|
||||
$ python -m timeit -s "u'ö'.encode('latin1')"
|
||||
100000000 loops, best of 3: 0.0141 usec per loop
|
||||
"""
|
||||
|
||||
def __init__(self, codepage_map):
|
||||
@@ -117,7 +111,7 @@ class Encoder(object):
|
||||
return codepage_char_map
|
||||
|
||||
def can_encode(self, encoding, char):
|
||||
"""Determine if a character is encodeable in the given code page.
|
||||
"""Determine if a character is encodable in the given code page.
|
||||
|
||||
:param encoding: The name of the encoding.
|
||||
:param char: The character to attempt to encode.
|
||||
@@ -171,7 +165,7 @@ class Encoder(object):
|
||||
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 instructiosn we have
|
||||
reduce the number of codepage change instruction we have
|
||||
to send. Still, any performance gains will presumably be
|
||||
fairly minor.
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
"""This module contains the implementation of the CupsPrinter printer driver.
|
||||
"""This module contains the implementation of the Network printer driver.
|
||||
|
||||
:author: python-escpos developers
|
||||
:organization: `python-escpos <https://github.com/python-escpos>`_
|
||||
@@ -21,18 +21,22 @@ def is_usable() -> bool:
|
||||
class Network(Escpos):
|
||||
"""Network printer.
|
||||
|
||||
This class is used to attach to a networked printer. You can also use this in order to attach to a printer that
|
||||
This class is used to attach to a networked printer.
|
||||
You can also use this in order to attach to a printer that
|
||||
is forwarded with ``socat``.
|
||||
|
||||
If you have a local printer on parallel port ``/dev/usb/lp0`` then you could start ``socat`` with:
|
||||
If you have a local printer on parallel port ``/dev/usb/lp0``
|
||||
then you could start ``socat`` with:
|
||||
|
||||
.. code-block:: none
|
||||
|
||||
socat -u TCP4-LISTEN:4242,reuseaddr,fork OPEN:/dev/usb/lp0
|
||||
|
||||
Then you should be able to attach to port ``4242`` with this class.
|
||||
Otherwise the normal usecase would be to have a printer with ethernet interface. This type of printer should
|
||||
work the same with this class. For the address of the printer check its manuals.
|
||||
Otherwise the normal use case would be to have a printer with
|
||||
Ethernet interface.
|
||||
This type of printer should work the same with this class.
|
||||
For the address of the printer check its manuals.
|
||||
|
||||
inheritance:
|
||||
|
||||
@@ -53,7 +57,7 @@ class Network(Escpos):
|
||||
def __init__(self, host, port=9100, timeout=60, *args, **kwargs):
|
||||
"""Initialize network printer.
|
||||
|
||||
:param host: Printer's hostname or IP address
|
||||
:param host: Printer's host name or IP address
|
||||
:param port: Port to write to
|
||||
:param timeout: timeout in seconds for the socket-library
|
||||
"""
|
||||
|
Reference in New Issue
Block a user