mirror of
https://github.com/python-escpos/python-escpos
synced 2025-06-25 08:38:43 +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:
parent
5cdff0b56e
commit
7d42f11716
@ -69,8 +69,8 @@ changes
|
|||||||
- change the project's license to MIT in accordance with the contributors (see python-escpos/python-escpos#171)
|
- change the project's license to MIT in accordance with the contributors (see python-escpos/python-escpos#171)
|
||||||
- feature: add "capabilities" which are shared with escpos-php, capabilities are stored in
|
- feature: add "capabilities" which are shared with escpos-php, capabilities are stored in
|
||||||
`escpos-printer-db <https://github.com/receipt-print-hq/escpos-printer-db>`_
|
`escpos-printer-db <https://github.com/receipt-print-hq/escpos-printer-db>`_
|
||||||
- feature: the driver tries now to guess the appropriate codepage and sets it automatically (called "magic encode")
|
- feature: the driver tries now to guess the appropriate code page and sets it automatically (called "magic encode")
|
||||||
- as an alternative you can force the codepage with the old API
|
- as an alternative you can force the code page with the old API
|
||||||
- fix the encoding search so that lower encodings are found first
|
- fix the encoding search so that lower encodings are found first
|
||||||
- automatically handle cases where full cut or partial cut is not available
|
- automatically handle cases where full cut or partial cut is not available
|
||||||
- refactor of the set-method
|
- refactor of the set-method
|
||||||
@ -335,14 +335,14 @@ changes
|
|||||||
- change the project's license to MIT in accordance with the contributors (see python-escpos/python-escpos#171)
|
- change the project's license to MIT in accordance with the contributors (see python-escpos/python-escpos#171)
|
||||||
- feature: add "capabilities" which are shared with escpos-php, capabilities are stored in
|
- feature: add "capabilities" which are shared with escpos-php, capabilities are stored in
|
||||||
`escpos-printer-db <https://github.com/receipt-print-hq/escpos-printer-db>`_
|
`escpos-printer-db <https://github.com/receipt-print-hq/escpos-printer-db>`_
|
||||||
- feature: the driver tries now to guess the appropriate codepage and sets it automatically (called "magic encode")
|
- feature: the driver tries now to guess the appropriate code page and sets it automatically (called "magic encode")
|
||||||
- as an alternative you can force the codepage with the old API
|
- as an alternative you can force the code page with the old API
|
||||||
- updated and improved documentation
|
- updated and improved documentation
|
||||||
- changed constructor of main class due to introduction of capabilities
|
- changed constructor of main class due to introduction of capabilities
|
||||||
- changed interface of method `blocktext`, changed behavior of multiple methods, for details refer to the documentation
|
- changed interface of method `blocktext`, changed behavior of multiple methods, for details refer to the documentation
|
||||||
on `python-escpos.readthedocs.io <https://python-escpos.readthedocs.io>`_
|
on `python-escpos.readthedocs.io <https://python-escpos.readthedocs.io>`_
|
||||||
- add support for custom cash drawer sequence
|
- add support for custom cash drawer sequence
|
||||||
- enforce flake8 on the src-files, test py36 and py37 on travis
|
- enforce flake8 on the src-files, test py36 and py37 on Travis
|
||||||
|
|
||||||
contributors
|
contributors
|
||||||
^^^^^^^^^^^^
|
^^^^^^^^^^^^
|
||||||
@ -375,7 +375,7 @@ contributors
|
|||||||
|
|
||||||
changes
|
changes
|
||||||
^^^^^^^
|
^^^^^^^
|
||||||
- configure readthedocs and travis
|
- configure readthedocs and Travis
|
||||||
- update doc with hint on image preprocessing
|
- update doc with hint on image preprocessing
|
||||||
- add fix for printing large images (by splitting them into multiple images)
|
- add fix for printing large images (by splitting them into multiple images)
|
||||||
|
|
||||||
@ -440,8 +440,8 @@ changes
|
|||||||
- improve the documentation
|
- improve the documentation
|
||||||
- extend support of barcode-codes to type B
|
- extend support of barcode-codes to type B
|
||||||
- add function to disable panel-buttons
|
- add function to disable panel-buttons
|
||||||
- the text-functions are now intended for unicode, the driver will automatically encode the string based on the selected
|
- the text-functions are now intended for Unicode, the driver will automatically encode the string based on the selected
|
||||||
codepage
|
code page
|
||||||
- the image-functions are now much more flexible
|
- the image-functions are now much more flexible
|
||||||
- added a CLI
|
- added a CLI
|
||||||
- restructured the constants
|
- restructured the constants
|
||||||
@ -479,7 +479,7 @@ contributors
|
|||||||
--------------------------
|
--------------------------
|
||||||
|
|
||||||
- Merge pull request #53 from ldos/master
|
- Merge pull request #53 from ldos/master
|
||||||
- Extended params for serial printers
|
- Extended parameters for serial printers
|
||||||
- Sent by ldos <cafeteria.ldosalzira@gmail.com>
|
- Sent by ldos <cafeteria.ldosalzira@gmail.com>
|
||||||
|
|
||||||
2015-04-21 - Version 1.0.5
|
2015-04-21 - Version 1.0.5
|
||||||
|
@ -73,7 +73,7 @@ master_doc = "index"
|
|||||||
|
|
||||||
# General information about the project.
|
# General information about the project.
|
||||||
project = "python-escpos"
|
project = "python-escpos"
|
||||||
copyright = "2023, python-escpos developers"
|
copyright = "2024, python-escpos developers"
|
||||||
|
|
||||||
# The version info for the project you're documenting, acts as replacement for
|
# The version info for the project you're documenting, acts as replacement for
|
||||||
# |version| and |release|, also used in various other places throughout the
|
# |version| and |release|, also used in various other places throughout the
|
||||||
@ -134,7 +134,6 @@ else:
|
|||||||
import sphinx_rtd_theme
|
import sphinx_rtd_theme
|
||||||
|
|
||||||
html_theme = "sphinx_rtd_theme"
|
html_theme = "sphinx_rtd_theme"
|
||||||
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
print("no sphinx_rtd_theme found, switching to nature")
|
print("no sphinx_rtd_theme found, switching to nature")
|
||||||
html_theme = "default"
|
html_theme = "default"
|
||||||
@ -313,7 +312,7 @@ texinfo_documents = [
|
|||||||
# texinfo_no_detailmenu = False
|
# texinfo_no_detailmenu = False
|
||||||
|
|
||||||
# spellchecker
|
# spellchecker
|
||||||
spelling_ignore_pypi_package_names = True
|
spelling_ignore_pypi_package_names = False
|
||||||
spelling_ignore_wiki_words = True
|
spelling_ignore_wiki_words = True
|
||||||
spelling_ignore_python_builtins = True
|
spelling_ignore_python_builtins = True
|
||||||
spelling_ignore_importable_modules = True
|
spelling_ignore_importable_modules = True
|
||||||
|
@ -5,7 +5,7 @@ Release process
|
|||||||
|
|
||||||
* Update authors file
|
* Update authors file
|
||||||
* Update changelog
|
* Update changelog
|
||||||
* Set annotated tag for release and push to public github
|
* Set annotated tag for release and push to public GitHub
|
||||||
* Build wheel
|
* Build wheel
|
||||||
* Load wheel to PyPi
|
* Load wheel to PyPi
|
||||||
* Prepare project for next release with an empty changelog entry
|
* Prepare project for next release with an empty changelog entry
|
||||||
|
@ -2,11 +2,11 @@ pyusb
|
|||||||
Pillow>=2.0
|
Pillow>=2.0
|
||||||
qrcode>=4.0
|
qrcode>=4.0
|
||||||
pyserial
|
pyserial
|
||||||
sphinx-rtd-theme==2.0.0
|
sphinx-rtd-theme==3.0.1
|
||||||
setuptools
|
setuptools
|
||||||
setuptools-scm
|
setuptools-scm
|
||||||
docutils>=0.12
|
docutils>=0.12
|
||||||
sphinxcontrib-spelling>=7.2.0
|
sphinxcontrib-spelling>=8.0.0
|
||||||
python-barcode>=0.15.0,<1
|
python-barcode>=0.15.0,<1
|
||||||
importlib-metadata
|
importlib-metadata
|
||||||
importlib_resources
|
importlib_resources
|
||||||
|
@ -87,14 +87,18 @@ config
|
|||||||
del
|
del
|
||||||
dev
|
dev
|
||||||
dialout
|
dialout
|
||||||
|
docstring
|
||||||
docstrings
|
docstrings
|
||||||
ean
|
ean
|
||||||
Ean
|
Ean
|
||||||
encodable
|
encodable
|
||||||
Errno
|
Errno
|
||||||
fff
|
fff
|
||||||
|
formatter
|
||||||
fullimage
|
fullimage
|
||||||
|
hw
|
||||||
io
|
io
|
||||||
|
img
|
||||||
json
|
json
|
||||||
latin
|
latin
|
||||||
libusb
|
libusb
|
||||||
@ -104,16 +108,23 @@ natively
|
|||||||
php
|
php
|
||||||
pre
|
pre
|
||||||
prefilled
|
prefilled
|
||||||
|
preprocess
|
||||||
|
preprocessing
|
||||||
printcap
|
printcap
|
||||||
programmatically
|
programmatically
|
||||||
py
|
py
|
||||||
pypy
|
pypy
|
||||||
|
pyserial
|
||||||
|
pyusb
|
||||||
pyyaml
|
pyyaml
|
||||||
|
pywin
|
||||||
px
|
px
|
||||||
qrcode
|
qrcode
|
||||||
Raspbian
|
Raspbian
|
||||||
|
readthedocs
|
||||||
rebase
|
rebase
|
||||||
rebased
|
rebased
|
||||||
|
renderer
|
||||||
resetted
|
resetted
|
||||||
rst
|
rst
|
||||||
submodule
|
submodule
|
||||||
@ -122,11 +133,13 @@ src
|
|||||||
testcases
|
testcases
|
||||||
th
|
th
|
||||||
Todo
|
Todo
|
||||||
|
tox
|
||||||
traceback
|
traceback
|
||||||
udev
|
udev
|
||||||
usb
|
usb
|
||||||
USBTimeoutError
|
USBTimeoutError
|
||||||
usec
|
usec
|
||||||
virtualenvs
|
virtualenvs
|
||||||
|
viivakoodi
|
||||||
whitespaces
|
whitespaces
|
||||||
xml
|
xml
|
||||||
|
@ -142,7 +142,7 @@ format. For windows it is probably at::
|
|||||||
|
|
||||||
%appdata%/python-escpos/config.yaml
|
%appdata%/python-escpos/config.yaml
|
||||||
|
|
||||||
And for linux::
|
And for Linux::
|
||||||
|
|
||||||
$HOME/.config/python-escpos/config.yaml
|
$HOME/.config/python-escpos/config.yaml
|
||||||
|
|
||||||
@ -200,17 +200,17 @@ An USB-printer could be defined by::
|
|||||||
Printing text right
|
Printing text right
|
||||||
-------------------
|
-------------------
|
||||||
|
|
||||||
Python-escpos is designed to accept unicode.
|
Python-escpos is designed to accept Unicode.
|
||||||
|
|
||||||
For normal usage you can simply pass your text to the printers ``text()``-function. It will automatically guess
|
For normal usage you can simply pass your text to the printers ``text()``-function. It will automatically guess
|
||||||
the right codepage and then send the encoded data to the printer. If this feature does not work, please try to
|
the right code page and then send the encoded data to the printer. If this feature does not work, please try to
|
||||||
isolate the error and then create an issue on the GitHub project page.
|
isolate the error and then create an issue on the GitHub project page.
|
||||||
|
|
||||||
If you want or need to you can manually set the codepage.
|
If you want or need to you can manually set the code page.
|
||||||
For this please use the ``charcode()``-function.
|
For this please use the ``charcode()``-function.
|
||||||
You can set any key-value that is in ``CHARCODE``.
|
You can set any key-value that is in ``CHARCODE``.
|
||||||
If something is wrong, an ``CharCodeError`` will be raised.
|
If something is wrong, an ``CharCodeError`` will be raised.
|
||||||
After you have manually set the codepage the printer won't change it anymore.
|
After you have manually set the code page the printer won't change it anymore.
|
||||||
You can revert to normal behavior by setting charcode to ``AUTO``.
|
You can revert to normal behavior by setting charcode to ``AUTO``.
|
||||||
|
|
||||||
Resolving bus timeout issues during printing images
|
Resolving bus timeout issues during printing images
|
||||||
@ -241,7 +241,7 @@ advantage of the fact that `_raw()` accepts binary strings.)
|
|||||||
p._raw(data)
|
p._raw(data)
|
||||||
|
|
||||||
That's all, the printer should then print your data. You can also use this technique to let others reproduce an issue
|
That's all, the printer should then print your data. You can also use this technique to let others reproduce an issue
|
||||||
that you have found. (Just "print" your commands to a File-printer on your local filesystem.)
|
that you have found. (Just "print" your commands to a File-printer on your local file system.)
|
||||||
However, please keep in mind, that often it is easier and better to just supply the code that you are using.
|
However, please keep in mind, that often it is easier and better to just supply the code that you are using.
|
||||||
|
|
||||||
Here you can download an example, that will print a set of common barcodes:
|
Here you can download an example, that will print a set of common barcodes:
|
||||||
|
@ -33,7 +33,7 @@ def main():
|
|||||||
|
|
||||||
|
|
||||||
def print_codepage(printer, codepage):
|
def print_codepage(printer, codepage):
|
||||||
"""Print a codepage."""
|
"""Print a code page."""
|
||||||
if codepage.isdigit():
|
if codepage.isdigit():
|
||||||
codepage = int(codepage)
|
codepage = int(codepage)
|
||||||
printer._raw(CODEPAGE_CHANGE + bytes((codepage,)))
|
printer._raw(CODEPAGE_CHANGE + bytes((codepage,)))
|
||||||
|
@ -69,7 +69,7 @@ def forecast(idx):
|
|||||||
printer.text(" high " + str(hi))
|
printer.text(" high " + str(hi))
|
||||||
printer.text(deg)
|
printer.text(deg)
|
||||||
printer.text("\n")
|
printer.text("\n")
|
||||||
# take care of pesky unicode dash
|
# take care of pesky Unicode dash
|
||||||
printer.text(cond.replace("\u2013", "-").encode("utf-8"))
|
printer.text(cond.replace("\u2013", "-").encode("utf-8"))
|
||||||
printer.text("\n \n")
|
printer.text("\n \n")
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ def generate_parser() -> argparse.ArgumentParser:
|
|||||||
"""Generate an argparse parser."""
|
"""Generate an argparse parser."""
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description="CLI for python-escpos",
|
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.",
|
"file. See documentation for details.",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
"""Helper module for codepage handling."""
|
"""Helper module for code page handling."""
|
||||||
from .capabilities import CAPABILITIES
|
from .capabilities import CAPABILITIES
|
||||||
|
|
||||||
|
|
||||||
@ -9,7 +9,7 @@ class CodePageManager:
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
"""Initialize codepage manager."""
|
"""Initialize code page manager."""
|
||||||
self.data = data
|
self.data = data
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -188,8 +188,8 @@ LINESPACING_FUNCS: Dict[int, bytes] = {
|
|||||||
180: ESC + b"3", # line_spacing/180 of an inch, 0 <= line_spacing <= 255
|
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
|
#: Prefix to change the code page. You need to attach a byte to indicate
|
||||||
#: the codepage to use. We use escpos-printer-db as the data source.
|
#: the code page to use. We use escpos-printer-db as the data source.
|
||||||
CODEPAGE_CHANGE: bytes = ESC + b"\x74"
|
CODEPAGE_CHANGE: bytes = ESC + b"\x74"
|
||||||
|
|
||||||
# Barcode format
|
# Barcode format
|
||||||
|
@ -460,7 +460,7 @@ class Escpos(object, metaclass=ABCMeta):
|
|||||||
Sets the control sequence from ``CHARCODE`` in :py:mod:`escpos.constants` as active.
|
Sets the control sequence from ``CHARCODE`` in :py:mod:`escpos.constants` as active.
|
||||||
It will be sent with the next text sequence.
|
It will be sent with the next text sequence.
|
||||||
If you set the variable code to ``AUTO`` it will try to automatically guess the
|
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.)
|
(This is the standard behavior.)
|
||||||
|
|
||||||
:param code: Name of CharCode
|
:param code: Name of CharCode
|
||||||
@ -876,8 +876,8 @@ class Escpos(object, metaclass=ABCMeta):
|
|||||||
def text(self, txt: str) -> None:
|
def text(self, txt: str) -> None:
|
||||||
"""Print alpha-numeric text.
|
"""Print alpha-numeric text.
|
||||||
|
|
||||||
The text has to be encoded in the currently selected codepage.
|
The text has to be encoded in the currently selected code page.
|
||||||
The input text has to be encoded in unicode.
|
The input text has to be encoded in Unicode.
|
||||||
|
|
||||||
:param txt: text to be printed
|
:param txt: text to be printed
|
||||||
:raises: :py:exc:`~escpos.exceptions.TextError`
|
:raises: :py:exc:`~escpos.exceptions.TextError`
|
||||||
@ -887,8 +887,8 @@ class Escpos(object, metaclass=ABCMeta):
|
|||||||
def textln(self, txt: str = "") -> None:
|
def textln(self, txt: str = "") -> None:
|
||||||
"""Print alpha-numeric text with a newline.
|
"""Print alpha-numeric text with a newline.
|
||||||
|
|
||||||
The text has to be encoded in the currently selected codepage.
|
The text has to be encoded in the currently selected code page.
|
||||||
The input text has to be encoded in unicode.
|
The input text has to be encoded in Unicode.
|
||||||
|
|
||||||
:param txt: text to be printed with a newline
|
:param txt: text to be printed with a newline
|
||||||
:raises: :py:exc:`~escpos.exceptions.TextError`
|
: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:
|
def block_text(self, txt, font="0", columns=None) -> None:
|
||||||
"""Print text wrapped to specific columns.
|
"""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 txt: text to be printed
|
||||||
:param font: font to be used, can be :code:`a` or :code:`b`
|
:param font: font to be used, can be :code:`a` or :code:`b`
|
||||||
@ -1555,7 +1555,7 @@ class EscposIO:
|
|||||||
f"{text}",
|
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)
|
# TODO flush? or on print? (this should prob rather be handled by the _raw-method)
|
||||||
for line in lines:
|
for line in lines:
|
||||||
self.printer.set(**params)
|
self.printer.set(**params)
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
"""Magic Encode.
|
"""Magic Encode.
|
||||||
|
|
||||||
This module tries to convert an UTF-8 string to an encoded string for the printer.
|
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.
|
The code is based on the encoding-code in py-xml-escpos by @fvdsn.
|
||||||
|
|
||||||
:author: `Patrick Kanzler <dev@pkanzler.de>`_
|
:author: `Patrick Kanzler <dev@pkanzler.de>`_
|
||||||
@ -65,11 +65,11 @@ class Encoder:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _get_codepage_char_list(encoding):
|
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.
|
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)
|
codepage = CodePages.get_encoding(encoding)
|
||||||
if "data" in codepage:
|
if "data" in codepage:
|
||||||
@ -91,7 +91,7 @@ class Encoder:
|
|||||||
raise LookupError(f"Can't find a known encoding for {encoding}")
|
raise LookupError(f"Can't find a known encoding for {encoding}")
|
||||||
|
|
||||||
def _get_codepage_char_map(self, 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
|
Process an encoding and return a map of UTF-characters to code points
|
||||||
in this encoding.
|
in this encoding.
|
||||||
@ -166,7 +166,7 @@ class Encoder:
|
|||||||
1. code pages that we already tried before; there is a good
|
1. code pages that we already tried before; there is a good
|
||||||
chance they might work again, reducing the search space,
|
chance they might work again, reducing the search space,
|
||||||
and by re-using already used encodings we might also
|
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
|
to send. Still, any performance gains will presumably be
|
||||||
fairly minor.
|
fairly minor.
|
||||||
|
|
||||||
@ -225,7 +225,7 @@ class MagicEncode:
|
|||||||
:param encoding: If you know the current encoding of the printer
|
:param encoding: If you know the current encoding of the printer
|
||||||
when initializing this class, set it here. If the current
|
when initializing this class, set it here. If the current
|
||||||
encoding is unknown, the first character emitted will be a
|
encoding is unknown, the first character emitted will be a
|
||||||
codepage switch.
|
code page switch.
|
||||||
:param disabled:
|
:param disabled:
|
||||||
:param defaultsymbol:
|
:param defaultsymbol:
|
||||||
:param encoder:
|
:param encoder:
|
||||||
@ -284,20 +284,20 @@ class MagicEncode:
|
|||||||
def _handle_character_failed(self, char):
|
def _handle_character_failed(self, char):
|
||||||
"""Write a default symbol.
|
"""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
|
# Writing the default symbol via write() allows us to avoid
|
||||||
# unnecesary codepage switches.
|
# unnecesary code page switches.
|
||||||
self.write(self.defaultsymbol)
|
self.write(self.defaultsymbol)
|
||||||
|
|
||||||
def write_with_encoding(self, encoding, text):
|
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:
|
if text is not None and type(text) is not str:
|
||||||
raise Error(
|
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.
|
# is different, emit a change command.
|
||||||
if encoding != self.encoding:
|
if encoding != self.encoding:
|
||||||
self.encoding = encoding
|
self.encoding = encoding
|
||||||
|
@ -23,7 +23,7 @@ def is_usable() -> bool:
|
|||||||
class File(Escpos):
|
class File(Escpos):
|
||||||
"""Generic file printer.
|
"""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
|
Note that you should stay away from using USB-to-Parallel-Adapter since they are unreliable
|
||||||
and produce arbitrary errors.
|
and produce arbitrary errors.
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ class File(Escpos):
|
|||||||
def __init__(self, devfile: str = "", auto_flush: bool = True, *args, **kwargs):
|
def __init__(self, devfile: str = "", auto_flush: bool = True, *args, **kwargs):
|
||||||
"""Initialize file printer with device file.
|
"""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()
|
:param auto_flush: automatically call flush after every call of _raw()
|
||||||
"""
|
"""
|
||||||
Escpos.__init__(self, *args, **kwargs)
|
Escpos.__init__(self, *args, **kwargs)
|
||||||
|
@ -89,7 +89,7 @@ class Serial(Escpos):
|
|||||||
):
|
):
|
||||||
"""Initialize serial printer.
|
"""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 baudrate: Baud rate for serial transmission
|
||||||
:param bytesize: Serial buffer size
|
:param bytesize: Serial buffer size
|
||||||
:param timeout: Read/Write timeout
|
:param timeout: Read/Write timeout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user