Commit Graph

94 Commits

Author SHA1 Message Date
Patrick Kanzler fbabd8ed88
Drop Py37, improve typing and docstrings (#544)
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
2023-08-15 01:03:36 +02:00
Patrick Kanzler 4c2dcdfac6
Clean up tests and migrate (#540)
* 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
2023-08-10 00:18:02 +02:00
Alfredo orozco df9e8ff394
Feature(escpos) Add buzzer function (#535)
* 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>
2023-07-27 19:10:19 +02:00
Patrick Kanzler e9e8b10582
Fixes from ci (#533)
* 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
2023-07-21 23:03:46 +02:00
Benito López 3c11c1b9ab
New high level barcode method. Closes #245, #244. (#527)
* 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>
2023-07-12 20:45:41 +02:00
Patrick Kanzler 709d90809c fixed formatting with black 2023-04-19 22:23:23 +02:00
Patrick Kanzler 70d4da1364 format with black 2023-04-19 22:11:09 +02:00
Patrick Kanzler 435f2bba24 reformat codebase 2021-10-30 18:15:22 +02:00
Patrick Kanzler 0758a79e64 test for graceful closing of socket 2020-11-08 22:33:51 +01:00
Patrick Kanzler 3962bc991f improve test for soft barcode 2020-11-08 22:04:27 +01:00
Patrick Kanzler e898413464 change useage of assert_equal(s) 2020-11-08 21:29:18 +01:00
Patrick Kanzler f4e214ad17 add spellchecker with first conf, fix some errors 2020-05-11 23:39:56 +02:00
Romain Porte 8ca682e3ac soft_barcode: add new center=True option 2020-05-10 14:08:50 +02:00
Romain Porte ab30ef4a8c test_function_softbarcode: use pytest fixture 2020-05-10 14:05:33 +02:00
Romain Porte 1e313cefc6 test_function_barcode.py: remove unused imports 2020-05-10 14:03:43 +02:00
Romain Porte cb30d7a881 drop Python 2.7 support
Python 2.7 EOL is arriving on 2020-01-01: https://pythonclock.org/

This will allow us to use Python 3 only libraries, like python-barcode,
which can maintain a reduced, simpler codebase, due to only one version
to support.

Closes #371.

Signed-off-by: Romain Porte <microjoe@microjoe.org>
2020-05-10 10:55:44 +02:00
Patrick Kanzler 95ec6d5c08 update hypothesis 2020-05-09 00:39:41 +02:00
Patrick Kanzler 6c94f88c24
improve platform independence (#296)
* add os.devnull for platform independence

fixes #288

* add test for soft_barcode

* open devnull as binary

* add version identifier to pickle
2018-05-15 01:03:07 +02:00
Patrick Kanzler 0c9856c1f6
disable QR test for image 2018-05-13 18:26:48 +02:00
Patrick Kanzler b84e280efb
disable broken tests 2018-05-13 17:32:52 +02:00
Christoph Heuel 26d72a69f0 Feature/clear content in dummy printer (#271)
Add Function to Dummy Printer for Clearing Buffer

If you are using the dummy printer, you may want to use the printer
again after sending the output to a physical printer.
This method empties the list of the output buffer.
2017-12-04 00:13:28 +01:00
reck 3c3dab95f5 raise exception when TypeError occurs in cashdraw (#268) 2017-12-03 23:21:29 +01:00
Patrick Kanzler d6d12f99d4 improve test - tests raising of error #257 2017-10-08 21:53:36 +02:00
Patrick Kanzler 128221363f reproduce #257 2017-10-08 21:53:36 +02:00
Lucy Linder 456f5b7aa6 Feature/check barcodes (#255)
* add a method to check barcode code format

ensure that the code to print is compatible with the ESC/POS formats and
also automatically check this format before printing (barcode() method).

* rewrite test using pytest's parametrize functionality

* add test for the 'check' argument

* update authors list
2017-10-08 20:05:18 +02:00
Patrick Kanzler d78a6f1699
completely fix tests
The feature use_coverage of hypothesis caused the failing tests, because
the printer_file_test is sensitive to the coverage analysis of
hypothesis.

Fixed by disabling use_coverage for the crashing tests
2017-09-27 10:38:42 +02:00
Patrick Kanzler 5e784c060a
fix tests failing (for now)
hypothesis introduced a regression in 3.29.0 (or at least changed
behaviour). Until I have found the problem I will pin it to the last
working version.

Also two tests should be prevented from failing when they are slow.
2017-09-27 10:29:19 +02:00
Romain Porte b648cfd67f First attempt at centering images and QRs (#250)
This was tested on ZJ-5890 with success. By default centering is
deactivated for backward compatibility. Trying to center a QR code in
native mode will raise an exception as we do not know ATM if the native
rendering is centered by default or not.

* Added basic tests for center feature

* Check image size before centering
2017-08-31 09:25:35 +02:00
Romain Porte b64b534394 Add methods for simpler newlines (#246) 2017-08-01 17:09:24 +02:00
Romain Porte 9e47ff2505 Added test for cut without feed, fixed raw code for it 2017-07-26 09:09:32 +02:00
Romain Porte 5bd6dcf471 Ensure QR codes have a border large enough (#235)
*  Ensure QR codes have a border large enough
(The QR code spec requires a border at least 4*box_size thick but we can't
 just set border=16 because that results in a QR code more than 255px tall
 and I'm not yet ready to use fullimage() as a backend for it)
This fix was originally commited by Stephan Sokolow on 2014-05-22
* Let the user print stuff using qr example
* fix tests
2017-07-24 15:04:54 +02:00
Romain Porte c4dd4f2960 Added ImageWidthError and its implementation (#226)
* Added ImageWidthError and its implementation

* Added unit tests for ImageWidthError

* Parse max_width to int before compare
2017-05-23 15:13:28 +02:00
Patrick Kanzler 5bf2636753 rewrite to Dummy() 2017-05-22 00:57:48 +02:00
TAHRI Ahmed 1f427953a8 Preliminary support of pos 'line display' printing 2017-05-22 00:40:40 +02:00
Romain Porte a6e1d0df00 Using booleans for handling text size 2017-05-21 22:50:07 +02:00
Romain Porte a16d6bde06 Refactor of the set method, with tests 2017-05-21 22:50:07 +02:00
Patrick Kanzler 3ee787e8b1
change license to MIT 2017-01-31 03:55:50 +01:00
Patrick Kanzler c2fc464c55
reformat PEP8 and similar issues 2017-01-30 00:10:14 +01:00
Patrick Kanzler e4a21e94fc
improve doc, improve codepage_tables.py 2017-01-29 23:36:33 +01:00
Patrick Kanzler 1b2f509758
use jaconv instead of jcconv for japanese chars
jaconv is available for more Python-versions and seems to be more
professional. Apart from that I added jaconv to the test-requirements
but not the requirements. (If the katakana-stuff really works we can
later add it as a real dependency)
2016-09-27 20:31:39 +02:00
Patrick Kanzler b795c02dd4
DOC remove incode TODOs
I will add them as issues where applicable.
2016-09-27 20:05:24 +02:00
Patrick Kanzler 915adf8fd3
fix file-printer-tests by using pytest-mock 2016-09-27 20:05:16 +02:00
Michael Billington 7b68d97f5f test fixes - just case-changes to match code page names, seems to need 'future' pip module 2016-09-13 20:28:54 +10:00
Michael Billington 9a65945fcd re-work encoder to consult the capabilities database and use custom code pages or python encoder as necessary 2016-09-11 21:03:55 +10:00
Michael Elsdörfer a435b66006 jcconf not available on Python 3. 2016-08-30 18:10:32 +02:00
Michael Elsdörfer c3e3ec5808 Merge branch 'capabilities' into text-encoding 2016-08-30 18:02:40 +02:00
Michael Elsdörfer c850a726cb Fix docstring warnings from QuantifedCode. 2016-08-30 17:55:58 +02:00
Michael Elsdörfer d246e945a2 Merge branch 'capabilities' into text-encoding 2016-08-30 17:47:31 +02:00
Michael Elsdörfer 1bd53697b9 Fix the CLI test inside pytest runner. 2016-08-30 17:47:09 +02:00
Michael Elsdörfer 2f89f3fe3a Port to current version of escpos-printer-db. 2016-08-30 17:08:27 +02:00