1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-09-13 09:09:58 +00:00

17 Commits

Author SHA1 Message Date
Patrick Kanzler
a68347ee1c update mailmap-file 2019-06-30 17:43:20 +02:00
Brian 'Redbeard' Harrington
c40f2abe07 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
2019-06-29 19:19:16 -07:00
Brian 'Redbeard' Harrington
fb82e5dc4a AUTHORS: Adding Brian Redbeard to AUTHORS
As per `CONTRIBUTING.rst` including a commit for Brian 'redbeard'
Harrington to AUTHORS
2019-06-29 19:19:16 -07:00
Patrick Kanzler
fa140c2df5 cleanup todo page 2019-06-19 15:50:19 +02:00
Patrick Kanzler
8b3076871f Merge pull request #346 from python-escpos/development
release v3.0a6
2019-06-19 15:28:46 +02:00
Patrick Kanzler
46429b1092 update changelog 2019-06-19 14:39:52 +02:00
Patrick Kanzler
99ca096f82 Merge pull request #345 from python-escpos/setup-fix-capabilities-path
improve package structure with capabilities file
2019-06-19 14:30:00 +02:00
Patrick Kanzler
2d97c0bbbd improve package structure with capabilities file 2019-06-19 14:14:59 +02:00
Patrick Kanzler
6c6fe9bccf Merge pull request #342 from python-escpos/108-test-on-windows-travis
Add Windows and macOS configuration for Travis CI
2019-06-16 12:13:30 +02:00
Patrick Kanzler
c5e46a888d fix allowed failures 2019-06-16 03:08:19 +02:00
Patrick Kanzler
46942820a5 update env variables 2019-06-16 03:05:42 +02:00
Patrick Kanzler
e50e295acc add osx 2019-06-16 03:01:36 +02:00
Patrick Kanzler
2d7458fa49 activate fast_finish 2019-06-16 02:47:46 +02:00
Patrick Kanzler
a6f635c0d5 fix capabilities file 2019-06-16 02:45:40 +02:00
Patrick Kanzler
2d0f045457 add first draft of Windows conf for #108 2019-06-16 02:45:40 +02:00
Patrick Kanzler
293b8632ff Merge pull request #341 from python-escpos/308-update-docstring-qr
fix links and impl (in qr-method) in docstrings
2019-06-16 02:17:27 +02:00
Patrick Kanzler
5ff73595b6 fix links and impl (in qr-method) in docstrings
fixes #308
2019-06-16 01:54:47 +02:00
11 changed files with 51 additions and 43 deletions

View File

@@ -13,3 +13,4 @@ csoft2k <csoft2k@hotmail.com>
Sergio Pulgarin <sergio.pulgarin@gmail.com> Sergio Pulgarin <sergio.pulgarin@gmail.com>
reck31 <rakesh.gunduka@gmail.com> reck31 <rakesh.gunduka@gmail.com>
Alex Debiasio <alex.debiasio@thinkin.io> <alex.debiasio@studenti.unitn.it> Alex Debiasio <alex.debiasio@thinkin.io> <alex.debiasio@studenti.unitn.it>
Brian 'Redbeard' Harrington <redbeard@dead-city.org>

View File

@@ -12,7 +12,23 @@ env:
global: global:
- ESCPOS_CAPABILITIES_FILE=/home/travis/build/python-escpos/python-escpos/capabilities-data/dist/capabilities.json - ESCPOS_CAPABILITIES_FILE=/home/travis/build/python-escpos/python-escpos/capabilities-data/dist/capabilities.json
matrix: matrix:
fast_finish: true
include: include:
- name: "Python 3.7 on Windows"
os: windows
language: shell
before_install:
- choco install python
- pip install tox codecov 'sphinx>=1.5.1'
env:
- TOXENV=py37
- PATH=/c/Python37:/c/Python37/Scripts:$PATH
- ESCPOS_CAPABILITIES_FILE=C:/Users/travis/build/python-escpos/python-escpos/capabilities-data/dist/capabilities.json
- name: "Python 3.7 on macOS"
os: osx
osx_image: xcode10.2
language: shell
env: TOXENV=py37 ESCPOS_CAPABILITIES_FILE=/Users/travis/build/python-escpos/python-escpos/capabilities-data/dist/capabilities.json
- python: 2.7 - python: 2.7
env: TOXENV=py27 env: TOXENV=py27
- python: 3.4 - python: 3.4
@@ -40,11 +56,14 @@ matrix:
- python: 3.7 - python: 3.7
env: TOXENV=flake8 env: TOXENV=flake8
allow_failures: allow_failures:
- python: 2.7
- python: 3.6-dev - python: 3.6-dev
- python: 3.7-dev - python: 3.7-dev
- python: 3.8-dev - python: 3.8-dev
- python: nightly - python: nightly
- python: pypy3 - python: pypy3
- os: windows
- os: osx
before_install: before_install:
- pip install tox codecov 'sphinx>=1.5.1' - pip install tox codecov 'sphinx>=1.5.1'
- ./doc/generate_authors.sh --check - ./doc/generate_authors.sh --check

View File

@@ -3,6 +3,7 @@ akeonly
Alex Debiasio Alex Debiasio
Asuki Kono Asuki Kono
belono belono
Brian 'Redbeard' Harrington
Christoph Heuel Christoph Heuel
Cody (Quantified Code Bot) Cody (Quantified Code Bot)
csoft2k csoft2k

View File

@@ -1,6 +1,22 @@
********* *********
Changelog Changelog
********* *********
2019-06-19 - Version 3.0a6 - "Mistake not..."
---------------------------------------------
This release is the seventh alpha release of the new version 3.0.
Please be aware the the API is subject to change until v3.0 is
released.
changes
^^^^^^^
- fix inclusion of the capabilities-file
- execute CI jobs also on Windows and macOS-targets
- improve documentation
contributors
^^^^^^^^^^^^
- Patrick Kanzler
2019-06-16 - Version 3.0a5 - "Lightly Seared On The Reality Grill" 2019-06-16 - Version 3.0a5 - "Lightly Seared On The Reality Grill"
------------------------------------------------------------------ ------------------------------------------------------------------
This release is the sixth alpha release of the new version 3.0. Please This release is the sixth alpha release of the new version 3.0. Please

View File

@@ -1,6 +1,5 @@
include *.rst include *.rst
include *.txt include *.txt
include COPYING
include LICENSE include LICENSE
include INSTALL include INSTALL
include tox.ini include tox.ini

View File

@@ -62,7 +62,7 @@ The basic usage is:
p = Usb(0x04b8, 0x0202, 0, profile="TM-T88III") p = Usb(0x04b8, 0x0202, 0, profile="TM-T88III")
p.text("Hello World\n") p.text("Hello World\n")
p.image("logo.gif") p.image("logo.gif")
p.barcode('1324354657687', 'EAN13', 64, 2, '', '') p.barcode('4006381333931', 'EAN13', 64, 2, '', '')
p.cut() p.cut()
@@ -74,7 +74,7 @@ Another example based on the Network printer class:
kitchen = Network("192.168.1.100") #Printer IP Address kitchen = Network("192.168.1.100") #Printer IP Address
kitchen.text("Hello World\n") kitchen.text("Hello World\n")
kitchen.barcode('1324354657687', 'EAN13', 64, 2, '', '') kitchen.barcode('4006381333931', 'EAN13', 64, 2, '', '')
kitchen.cut() kitchen.cut()

View File

@@ -2,38 +2,9 @@
TODO TODO
**** ****
Introduction Open points and issues of the project are tracked in the GitHub issues.
------------ Some annotations still remain in the code and should be moved over time
into the issue tracker.
python-escpos is the initial idea, from here we can start to build a
robust library to get most of the ESC/POS printers working with this
library.
Eventually, this library must be able to cover almost all the defined
models detailed in the ESC/POS Command Specification Manual.
Details
-------
What things are planned to work on?
Testing
~~~~~~~
* Test on many printers as possible (USB, Serial, Network)
* automate testing
Design
~~~~~~
* Add all those sequences which are not common, but part of the ESC/POS
Command Specifications.
* Port to Python 3
* Windows compatibility (hidapi instead libusb?)
* PDF417 support
* use something similar to the `capabilities` in escpos-php
Todos in the codebase Todos in the codebase
~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~

View File

@@ -119,7 +119,7 @@ on a USB interface.
# Print QR Code # Print QR Code
p.qr("You can readme from your smartphone") p.qr("You can readme from your smartphone")
# Print barcode # Print barcode
p.barcode('1324354657687','EAN13',64,2,'','') p.barcode('4006381333931','EAN13',64,2,'','')
# Cut paper # Cut paper
p.cut() p.cut()

View File

@@ -56,7 +56,7 @@ setup(
platforms='any', platforms='any',
package_dir={"": "src"}, package_dir={"": "src"},
packages=find_packages(where="src", exclude=["tests", "tests.*"]), packages=find_packages(where="src", exclude=["tests", "tests.*"]),
package_data={'': ['COPYING', 'src/escpos/capabilities.json']}, package_data={'escpos': ['capabilities.json']},
include_package_data=True, include_package_data=True,
classifiers=[ classifiers=[
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',

View File

@@ -53,7 +53,7 @@ DEMO_FUNCTIONS = {
'barcodes_a': [ 'barcodes_a': [
{'bc': 'UPC-A', 'code': '13243546576'}, {'bc': 'UPC-A', 'code': '13243546576'},
{'bc': 'UPC-E', 'code': '132435'}, {'bc': 'UPC-E', 'code': '132435'},
{'bc': 'EAN13', 'code': '1324354657687'}, {'bc': 'EAN13', 'code': '4006381333931'},
{'bc': 'EAN8', 'code': '1324354'}, {'bc': 'EAN8', 'code': '1324354'},
{'bc': 'CODE39', 'code': 'TEST'}, {'bc': 'CODE39', 'code': 'TEST'},
{'bc': 'ITF', 'code': '55867492279103'}, {'bc': 'ITF', 'code': '55867492279103'},
@@ -62,13 +62,13 @@ DEMO_FUNCTIONS = {
'barcodes_b': [ 'barcodes_b': [
{'bc': 'UPC-A', 'code': '13243546576', 'function_type': 'B'}, {'bc': 'UPC-A', 'code': '13243546576', 'function_type': 'B'},
{'bc': 'UPC-E', 'code': '132435', 'function_type': 'B'}, {'bc': 'UPC-E', 'code': '132435', 'function_type': 'B'},
{'bc': 'EAN13', 'code': '1324354657687', 'function_type': 'B'}, {'bc': 'EAN13', 'code': '4006381333931', 'function_type': 'B'},
{'bc': 'EAN8', 'code': '1324354', 'function_type': 'B'}, {'bc': 'EAN8', 'code': '1324354', 'function_type': 'B'},
{'bc': 'CODE39', 'code': 'TEST', 'function_type': 'B'}, {'bc': 'CODE39', 'code': 'TEST', 'function_type': 'B'},
{'bc': 'ITF', 'code': '55867492279103', 'function_type': 'B'}, {'bc': 'ITF', 'code': '55867492279103', 'function_type': 'B'},
{'bc': 'NW7', 'code': 'A00000000A', 'function_type': 'B'}, {'bc': 'NW7', 'code': 'A00000000A', 'function_type': 'B'},
{'bc': 'CODE93', 'code': 'A00000000A', 'function_type': 'B'}, {'bc': 'CODE93', 'code': 'A00000000A', 'function_type': 'B'},
{'bc': 'CODE93', 'code': '1324354657687', 'function_type': 'B'}, {'bc': 'CODE93', 'code': '4006381333931', 'function_type': 'B'},
{'bc': 'CODE128A', 'code': 'TEST', 'function_type': 'B'}, {'bc': 'CODE128A', 'code': 'TEST', 'function_type': 'B'},
{'bc': 'CODE128B', 'code': 'TEST', 'function_type': 'B'}, {'bc': 'CODE128B', 'code': 'TEST', 'function_type': 'B'},
{'bc': 'CODE128C', 'code': 'TEST', 'function_type': 'B'}, {'bc': 'CODE128C', 'code': 'TEST', 'function_type': 'B'},

View File

@@ -195,6 +195,7 @@ class Escpos(object):
:param native: True to render the code on the printer, False to render the code as an image and send it to the :param native: True to render the code on the printer, False to render the code as an image and send it to the
printer (Default) printer (Default)
:param center: Centers the code *default:* False :param center: Centers the code *default:* False
:param impl: Image-printing-implementation, refer to :meth:`.image()` for details
""" """
# Basic validation # Basic validation
if ec not in [QR_ECLEVEL_L, QR_ECLEVEL_M, QR_ECLEVEL_H, QR_ECLEVEL_Q]: if ec not in [QR_ECLEVEL_L, QR_ECLEVEL_M, QR_ECLEVEL_H, QR_ECLEVEL_Q]:
@@ -306,8 +307,8 @@ class Escpos(object):
.. todo:: For fixed-length standards with mandatory checksum (EAN, UPC), .. todo:: For fixed-length standards with mandatory checksum (EAN, UPC),
compute and add the checksum automatically if missing. compute and add the checksum automatically if missing.
:param bc: barcode format, see :py:func`~escpos.Escpos.barcode` :param bc: barcode format, see :py:meth:`.barcode()`
:param code: alphanumeric data to be printed as bar code, see :py:func`~escpos.Escpos.barcode` :param code: alphanumeric data to be printed as bar code, see :py:meth:`.barcode()`
:return: bool :return: bool
""" """
if bc not in BARCODE_FORMATS: if bc not in BARCODE_FORMATS:
@@ -394,7 +395,7 @@ class Escpos(object):
*default*: A *default*: A
:param check: If this parameter is True, the barcode format will be checked to ensure it meets the bc :param check: If this parameter is True, the barcode format will be checked to ensure it meets the bc
requirements as defigned in the esc/pos documentation. See py:func:`~escpos.Escpos.check_barcode` requirements as defigned in the esc/pos documentation. See :py:meth:`.check_barcode()`
for more information. *default*: True. for more information. *default*: True.
:raises: :py:exc:`~escpos.exceptions.BarcodeSizeError`, :raises: :py:exc:`~escpos.exceptions.BarcodeSizeError`,