* Add fixtures
* Add test_printer_file.py
* Remove old broken printer tests
* Include a close_on_reopen test
* Add test_printer_network.py
* Add test_printer_serial.py
* Add test_printer_usb.py
* Add test_printer_lp.py
* Add test_printer_cups.py
* Add test_printer_win32raw.py
* Test the 'printers' property
* Fix conftest import formatting
* Fix failing LP tests
* Cancel close only if literal False|None _device
* Fix win32raw failing tests (maybe)
* Include win32raw close_on_reopen test
* Include test _raw methods to win32raw
* Replace general exceptions in win32raw
* Replace wrong exception in cups
* Include more tests to cups
* Extend cups tests
* Add self-open mechanism
* self-open mechanism through the 'device' property
* Separate open() and store connection in 'device'
* Restore device status to False on close()
* Add default value to all params + type annotations
* Add generic DeviceNotFoundError exception
* Update USBNotFoundError return code
* Enhance connectors consistency
* Fix LP printer stall
* Fix LP waste of paper due to auto-flush + flush on close
* Move platform dependent printers' guard to init
---------
Co-authored-by: Patrick Kanzler <4189642+patkan@users.noreply.github.com>
* add unit test for issue pointed out by @scott-r in #570
* swap order of encoder search
As described by @scott-r in
Magic encoder does not use
previously used code pages
when possible #570
Thank you!
* add type annotations
* Update setup.cfg
* improve mypy and test config
* get_profile_class returns a baseProfile
* mute mypy type issue
* add set_with_default
* docstring
* add test for empty call
* correct type annotations in set_with_default
* improve tests
* test for exception
* sort with isort
* add default value to get call
* empty string has the same effect: will not be found --> None
* add mypy test to workflow
* explicitely call mypy
* update spelling
* 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
* add inheritance diagrams to all printers and exceptions
* split off printer implementations into separate files
* add wrapper that thros RuntimeError if not importable
* add dependency check for lp
* add dependency check for pyserial
* added check for usability
* import Win32Raw
* include WIn32Raw in documentation
* enable all extras on tox
* update github workflow
Drops Py3.7, improves typing and adds a mypy config, improves the docstrings and isorts the imports.
* configure isort
* sort with isort
* add github action
* enable flake8-docstrings
* fix docstrings
* add mypy env
* no implicit optional
* add type for raw
* add some type hints
* migrate
* abstract base class test
* remove assert_equal in test_cli
* remove nose from test_cli
* remove nose dependencies
* use tempfile
* configure coverage
* flag python version in name
* enable comment
* drop EOL py37
* bug/doc: Fix invalid EAN-13 barcode in examples
In the various examples and python-escpos CLI there are a number of uses
of `13243546557687` as an EAN-13 example. This EAN barcode is invalid
as the checksum should be `0` and not `7`.
```
$ python test_print.py
Traceback (most recent call last):
File "test_print.py", line 5, in <module>
p.barcode('13243546557687', 'EAN13', 64, 2, '', '')
File "/home/pi/fatt-display/lib/python3.7/site-packages/escpos/escpos.py", line 433, in barcode
bc=bc,
escpos.exceptions.BarcodeCodeError: No Barcode code was supplied (Barcode '13243546557687' not in a valid format for type 'EAN13')
```
This patch set removes `13243546557687` and replaces it with the valid
number `40063813339310`.
In researching the list of [assigned prefixes issued by
G1][g1-prefixes] there seemed to be no "officially" defined test prefix, so
this change was made to be minimally invasive using the number from the
existing test cases.
Resolves#350
Affects #176
[g1-prefixes]: https://www.gs1.org/standards/id-keys/company-prefix
[test-code]: https://www.barcodelookup.com/4006381333931
---------
Co-authored-by: Brian 'Redbeard' Harrington <redbeard@dead-city.org>
* Add buzzer function
* Add `buzzer(time, duration)` function to control the buzzer on supported
printers.
* Add unit tests for buzzer function.
* Update test_function_buzzer.py to pass black
* Run black in tests files
---------
Co-authored-by: Patrick Kanzler <dev@pkanzler.de>
* break line
* remove unused imports
* remove unused os import
* make flake8 more strict
* configure flake for black
* fix action
* use importlib_resources
* rename deprecated methods
* Merge software and hardware barcodes to one method
* Fix wrong sw barcode heigh/width
* Add missing param to _sw_barcode call
* Make barcode() smarter, improvements and clean up
* Use param font_size in sw_barcode()
* Update docstrings
* Update barcode examples and docs
* Add --force_software option to CLI
* Attempt to match the sw and hw barcode sizes
* Better approximation to native font size
* Fix docs build
* Update tests at test_function_softbarcode
* Fix exception
* Move image dpi setting to writter_options
* Fix _sw_barcode() docstring param
* Fix wrong default param in docstring
* improve linkage in documentation
---------
Co-authored-by: Patrick Kanzler <4189642+patkan@users.noreply.github.com>
Co-authored-by: Patrick Kanzler <dev@pkanzler.de>
* update read the docs config
* add hints on black code style
* add link to black
* fix path to requirements
* include submodules in build
* add submodule capabilities-data
* format as list
* post on execution on RTD
* use sphinx rtd theme 1.2.0
* add apt dependencies
* Added example with Docker and Flask
* set flask debug flag to False
* new line at the end of file
* format with black
---------
Co-authored-by: Ricardo Sanchez Alba <r2sanchezalba@gmail.com>
* Add support for slip/cheque dot matrix printers
* format
* fix comments
---------
Co-authored-by: Patrick Kanzler <4189642+patkan@users.noreply.github.com>
Co-authored-by: Patrick Kanzler <dev@pkanzler.de>
* Add Chinese support
* Add author
* Add newline
* Revert "Add Chinese support"
This reverts commit 110200dde6.
* Add Chinese support
* Add Chinese support
* update mailmap file
* update formatting
---------
Co-authored-by: Patrick Kanzler <dev@pkanzler.de>
Co-authored-by: Patrick Kanzler <4189642+patkan@users.noreply.github.com>