Commit Graph

67 Commits

Author SHA1 Message Date
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
Michael Elsdörfer b37f4fc8cc Merge branch 'capabilities' into text-encoding 2016-08-30 13:36:53 +02:00
Michael Elsdörfer b92eeed50b Add tests for the profile. 2016-08-30 13:27:48 +02:00
Michael Elsdörfer 3681c5c7bf Fix tests for Python 3. 2016-08-30 13:21:07 +02:00
Michael Elsdörfer 3d8626d17e Update text() test to use dummy printer. 2016-08-30 13:08:23 +02:00
Michael Elsdörfer ea7769f8b2 Merge remote-tracking branch 'origin/development' into capabilities 2016-08-30 13:04:17 +02:00
Michael Elsdörfer 5fa89ff685 Automatically choose correct barcode function.
Tests for barcode function.
2016-08-30 13:02:58 +02:00
Michael Elsdörfer c7864fd785 Largely rewrite the magic text encoding feature. 2016-08-27 11:28:52 +02:00
Michael Elsdörfer f6ce7e45da Merge branch 'capabilities' into text-encoding 2016-08-26 15:29:31 +02:00
Michael Elsdörfer ae9b3785c2 Fix broken tests. 2016-08-26 11:48:58 +02:00
Michael Elsdörfer 8b5bc9cf8a Make the Escpos class accept a profile.
This is now used for the block_text function.
2016-08-26 10:41:01 +02:00
Michael Elsdörfer 07d47765aa Allow linespacing reset. Make this the default. 2016-08-26 10:38:36 +02:00
Michael Elsdörfer 854b75be30 Support changing the line spacing. 2016-08-26 10:34:52 +02:00
Patrick Kanzler e8d91a6735
test add type-check for the qr-printing 2016-08-15 23:23:07 +02:00
Patrick Kanzler 59dccd79da
test add test for image-splitting-method 2016-08-07 14:39:58 +02:00
Patrick Kanzler 603b34cadb
test add test for the fragment-splitting 2016-08-07 13:49:46 +02:00
Patrick Kanzler 87a6647053 fix force-encoding REBASE (contains todos)
* fixed the code of forced-encoding in order to make it work
* extended unittest for forced-encoding
* fixed the constant for Katakana-encoding
2016-08-02 04:42:21 +02:00
Patrick Kanzler 046a08896c Ideen für unittest REBASE 2016-08-02 04:42:21 +02:00
Patrick Kanzler 0cfedb5706 add automatic codepage-changing
This code is adapted from the works by Frédéric Van der Essen in
pyxmlescpos.
I had to adapt the code completely in order to make it compatible with
modern unicode-handling

Further changes:
* improve text unittests in CLI and MagicEncode with hypothesis
* add feature force_encoding in order to enable old behaviour
* disable cli_text_test (for now)
* fix charcode(): it does now cooperate with the new structure
* remove redundant variable codepage from class Escpos
2016-08-02 04:42:21 +02:00
Patrick Kanzler 3546e0c4bb improve the exceptions
also adds a stump for the tests for MagicEncode
2016-08-02 04:42:21 +02:00
Patrick Kanzler 3d98eb8b9c fix file-printer did not flush
The file-printer did not automatically flush and thus behaved
differently to the other printer-classes.
Now the default behaviour is to flush after every call of _raw(). This
can be disabled by calling the file-printer with auto_flush=False.

fixes #106
2016-08-02 04:25:54 +02:00
Patrick Kanzler 9f5eed0020
add version-strings into the module
The version string is in the module as __version__ available.
In the doc the version will be automatically parsed. The version comes
from the installed module if on read the docs or directly from
setuptools_scm if you are working locally.
The CLI will issue the version string if you call it with the option
'version'. The CLI does not accept commands like '--version', since this
would not be conform with the rest of the interface (and argparse).

The configuration for loading the version-string is adapted from
pimutils/vdirsyncer. It autogenerates a version string setuptools_scm at
install-time and then adds it to the __version__ member in __init__.py

I adapted the GitHub-template with a fitting comment and bumped the
changelog.

closes #141
2016-07-17 19:39:42 +02:00
Patrick Kanzler e814396bd8 refactor: simplified expressions, remove unused import 2016-06-19 12:30:36 +02:00
Patrick Kanzler 910f2fbf2f add with-statement
* with imported from mosquito (adaption of the code in 86a3e8dfb257e3af0ec141ee5d97717501d6e945 by @mosquito)
* encoding of file to utf-8
* added rudimentary test for with
* implement close function for all printers
2016-06-17 23:34:51 +02:00
Patrick Kanzler 471222eda9 Merge pull request #127 from python-escpos/fix/abstractbaseclass-metaclass
FIX abstractbaseclass in Escpos not properly loaded
2016-04-14 00:02:28 +02:00
Michael Billington a0d8689141 apply fixes, mainly to whitespace ( patch by @patkan in #128 ) 2016-04-13 21:27:51 +10:00
Michael Billington 4584e3138a switch default image format to bitImageRaster
Printers which don't have native QR rendering are less likely to support the newer GS ( L graphics command.
2016-04-06 21:39:46 +10:00
Michael Billington b45afbb297 add implementation of GS v 0, GS ( L and GS *.
- ported test cases for EscposImage class, copied over 1px and 2px test images from escpos-php
- added test cases over image print function
- updated QR tests to also include image output check
- updated CLI to match new image function options
2016-04-06 07:34:19 +10:00