mirror of
https://github.com/python-escpos/python-escpos
synced 2025-09-13 09:09:58 +00:00
Compare commits
72 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
ef34cca463 | ||
![]() |
4680fb16b1 | ||
![]() |
544bb4f904 | ||
![]() |
d330dd80fd | ||
![]() |
570661b3c8 | ||
![]() |
aa7f2773eb | ||
![]() |
ff39908674 | ||
![]() |
d960eea4a8 | ||
![]() |
f7962576b4 | ||
![]() |
f4e214ad17 | ||
![]() |
9e406efc86 | ||
![]() |
b9e3827867 | ||
![]() |
cbe412cfdb | ||
![]() |
42554d836c | ||
![]() |
8ca682e3ac | ||
![]() |
ab30ef4a8c | ||
![]() |
725f1254aa | ||
![]() |
1e313cefc6 | ||
![]() |
b0ea9aec41 | ||
![]() |
ab210b5996 | ||
![]() |
f3e1db8da2 | ||
![]() |
1e7b43a92d | ||
![]() |
0e41709703 | ||
![]() |
cb30d7a881 | ||
![]() |
142fc4af71 | ||
![]() |
8f71372bb0 | ||
![]() |
6a60b6706e | ||
![]() |
c14a414924 | ||
![]() |
faa9414da5 | ||
![]() |
2c4552a528 | ||
![]() |
557991d80b | ||
![]() |
fe08fc1469 | ||
![]() |
6c27222aeb | ||
![]() |
6731057456 | ||
![]() |
f0b1a89c48 | ||
![]() |
fd7bd0710e | ||
![]() |
7ea58625e6 | ||
![]() |
baffd98a22 | ||
![]() |
ecbdd43dff | ||
![]() |
5b6b96d2a0 | ||
![]() |
7aa20a60e3 | ||
![]() |
95ec6d5c08 | ||
![]() |
18c3a5f298 | ||
![]() |
4836dcd486 | ||
![]() |
d9d400da6d | ||
![]() |
fe2e1a6d28 | ||
![]() |
c53575a155 | ||
![]() |
cadf448c38 | ||
![]() |
7c05404ac4 | ||
![]() |
e1e1ccb3f2 | ||
![]() |
32c56e78ea | ||
![]() |
4d106e8659 | ||
![]() |
ddab5318cf | ||
![]() |
9b60e2e3ab | ||
![]() |
34cd1ebde1 | ||
![]() |
a2db415559 | ||
![]() |
4e19b0ca51 | ||
![]() |
a3660a6366 | ||
![]() |
9fa551e6e8 | ||
![]() |
ae0a049efa | ||
![]() |
117d286371 | ||
![]() |
a555a651b4 | ||
![]() |
e350a49cad | ||
![]() |
f49c1dcb89 | ||
![]() |
cc67cb1c1e | ||
![]() |
2ee3ff7f87 | ||
![]() |
ca45d25670 | ||
![]() |
51d1299285 | ||
![]() |
0c0e6b9b4c | ||
![]() |
50437cc9d2 | ||
![]() |
7c7d401f31 | ||
![]() |
fa140c2df5 |
43
.github/workflows/pythonpackage.yml
vendored
Normal file
43
.github/workflows/pythonpackage.yml
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
|
||||
|
||||
name: Python package
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
python-version: [3.5, 3.6, 3.7, 3.8]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8 pytest tox tox-gh-actions
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
- name: Test with tox
|
||||
run: |
|
||||
tox
|
||||
env:
|
||||
ESCPOS_CAPABILITIES_FILE: /home/runner/work/python-escpos/python-escpos/capabilities-data/dist/capabilities.json
|
7
.gitignore
vendored
7
.gitignore
vendored
@@ -29,3 +29,10 @@ test/test-cli-output/
|
||||
*.swp
|
||||
*.swn
|
||||
*.swo
|
||||
|
||||
# vscode
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
|
28
.travis.yml
28
.travis.yml
@@ -1,16 +1,14 @@
|
||||
language: python
|
||||
sudo: false
|
||||
cache: pip
|
||||
dist: xenial
|
||||
dist: bionic
|
||||
git:
|
||||
depth: 100000
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- graphviz
|
||||
env:
|
||||
global:
|
||||
- ESCPOS_CAPABILITIES_FILE=/home/travis/build/python-escpos/python-escpos/capabilities-data/dist/capabilities.json
|
||||
- libenchant1c2a
|
||||
matrix:
|
||||
fast_finish: true
|
||||
include:
|
||||
@@ -19,7 +17,7 @@ matrix:
|
||||
language: shell
|
||||
before_install:
|
||||
- choco install python
|
||||
- pip install tox codecov 'sphinx>=1.5.1'
|
||||
- pip install tox codecov 'sphinx>=1.5.1' 'sphinxcontrib-spelling>=5'
|
||||
env:
|
||||
- TOXENV=py37
|
||||
- PATH=/c/Python37:/c/Python37/Scripts:$PATH
|
||||
@@ -29,35 +27,27 @@ matrix:
|
||||
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
|
||||
env: TOXENV=py27
|
||||
- python: 3.4
|
||||
env: TOXENV=py34
|
||||
- python: 3.5
|
||||
env: TOXENV=py35
|
||||
- python: 3.6
|
||||
env: TOXENV=py36
|
||||
- python: 3.6-dev
|
||||
env: TOXENV=py36
|
||||
- python: 3.7
|
||||
env: TOXENV=py37
|
||||
- python: 3.7-dev
|
||||
env: TOXENV=py37
|
||||
- python: 3.8
|
||||
env: TOXENV=py38
|
||||
- python: 3.8-dev
|
||||
env: TOXENV=py38
|
||||
- python: nightly
|
||||
env: TOXENV=py38
|
||||
- python: pypy
|
||||
env: TOXENV=pypy
|
||||
- python: pypy3
|
||||
env: TOXENV=pypy3
|
||||
- python: 3.7
|
||||
- python: 3.8
|
||||
env: TOXENV=docs
|
||||
- python: 3.7
|
||||
- python: 3.8
|
||||
env: TOXENV=flake8
|
||||
allow_failures:
|
||||
- python: 2.7
|
||||
- python: 3.6-dev
|
||||
- python: 3.7-dev
|
||||
- python: 3.8-dev
|
||||
- python: nightly
|
||||
@@ -65,7 +55,7 @@ matrix:
|
||||
- os: windows
|
||||
- os: osx
|
||||
before_install:
|
||||
- pip install tox codecov 'sphinx>=1.5.1'
|
||||
- pip install tox codecov 'sphinx>=1.5.1' 'sphinxcontrib-spelling>=5'
|
||||
- ./doc/generate_authors.sh --check
|
||||
script:
|
||||
- tox
|
||||
@@ -86,4 +76,4 @@ deploy:
|
||||
tags: true
|
||||
repo: python-escpos/python-escpos
|
||||
branch: master
|
||||
condition: $TRAVIS_PYTHON_VERSION = "3.7"
|
||||
condition: $TRAVIS_PYTHON_VERSION = "3.8"
|
||||
|
11
.vscode/settings.json
vendored
Normal file
11
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"restructuredtext.confPath": "${workspaceFolder}/doc",
|
||||
"files.watcherExclude": {
|
||||
"**/.git/objects/**": true,
|
||||
"**/.git/subtree-cache/**": true,
|
||||
"**/node_modules/*/**": true,
|
||||
"**/.eggs/**": true,
|
||||
"**/.hypothesis/**": true,
|
||||
"**/.tox/**": true,
|
||||
}
|
||||
}
|
16
.vscode/tasks.json
vendored
Normal file
16
.vscode/tasks.json
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "test with tox",
|
||||
"type": "shell",
|
||||
"command": "tox",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
4
AUTHORS
4
AUTHORS
@@ -1,8 +1,10 @@
|
||||
Ahmed Tahri
|
||||
akeonly
|
||||
Alexander Bougakov
|
||||
Alex Debiasio
|
||||
Asuki Kono
|
||||
belono
|
||||
Brian
|
||||
Christoph Heuel
|
||||
Cody (Quantified Code Bot)
|
||||
csoft2k
|
||||
@@ -19,6 +21,7 @@ Kristi
|
||||
ldos
|
||||
Lucy Linder
|
||||
Manuel F Martinez
|
||||
Maximilian Wagenbach
|
||||
Michael Billington
|
||||
Michael Elsdörfer
|
||||
mrwunderbar666
|
||||
@@ -36,4 +39,5 @@ Sergio Pulgarin
|
||||
Stephan Sokolow
|
||||
Thijs Triemstra
|
||||
Thomas van den Berg
|
||||
Yaisel Hurtado
|
||||
ysuolmai
|
||||
|
@@ -1,10 +1,57 @@
|
||||
*********
|
||||
Changelog
|
||||
*********
|
||||
2020-05-12 - Version 3.0a8 - "Only Slightly Bent"
|
||||
-------------------------------------------------
|
||||
This release is the ninth alpha release of the new version 3.0.
|
||||
Please be aware that the API is subject to change until v3.0 is
|
||||
released.
|
||||
|
||||
This release drops support for Python 2, requiring at least
|
||||
version 3.5 of Python.
|
||||
|
||||
changes
|
||||
^^^^^^^
|
||||
- Drop support for Python 2 and mark in setuptools as only supporting 3.5 and upwards
|
||||
- remove landscape.io badge
|
||||
- replace viivakoodi with python-barcode which is maintained
|
||||
- add configuration for Visual Studio Code
|
||||
- use pkg_resources for the retrieval of the capabilities.json
|
||||
|
||||
contributors
|
||||
^^^^^^^^^^^^
|
||||
- Romain Porte
|
||||
- Patrick Kanzler
|
||||
|
||||
2020-05-09 - Version 3.0a7 - "No Fixed Abode"
|
||||
---------------------------------------------
|
||||
This release is the eight alpha release of the new version 3.0.
|
||||
Please be aware that the API is subject to change until v3.0
|
||||
is released.
|
||||
|
||||
This release also marks the point at which the project transitioned
|
||||
to having only a master-branch (and not an additional development branch).
|
||||
|
||||
changes
|
||||
^^^^^^^
|
||||
- add Exception for NotImplementedError in detach_kernel_driver
|
||||
- update installation information
|
||||
- update and improve documentation
|
||||
- add error handling to image centering flag
|
||||
- update and fix tox and CI environment, preparing drop of support for Python 2
|
||||
|
||||
contributors
|
||||
^^^^^^^^^^^^
|
||||
- Alexander Bougakov
|
||||
- Brian
|
||||
- Yaisel Hurtado
|
||||
- Maximilan Wagenbach
|
||||
- Patrick Kanzler
|
||||
|
||||
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
|
||||
Please be aware that the API is subject to change until v3.0 is
|
||||
released.
|
||||
|
||||
changes
|
||||
|
@@ -27,25 +27,6 @@ Style-Guide
|
||||
|
||||
When writing code please try to stick to these rules.
|
||||
|
||||
Python 2 and 3
|
||||
^^^^^^^^^^^^^^
|
||||
We have rewritten the code in order to maintain compatibility with both Python 2 and Python 3.
|
||||
In order to ensure that we do not miss any accidental degradation, please add these imports to the top
|
||||
of every file of code:
|
||||
|
||||
.. code-block:: Python
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
Furthermore please be aware of the differences between Python 2 and 3. For
|
||||
example `this guide <https://docs.python.org/3/howto/pyporting.html>`_ is helpful.
|
||||
Special care has to be taken when dealing with strings and byte-strings. Please note
|
||||
that the :py:meth:`~escpos.escpos.Escpos._raw`-method only accepts byte-strings.
|
||||
Often you can achieve compatibility quite easily with a tool from the `six`-package.
|
||||
|
||||
PEP8
|
||||
^^^^
|
||||
The entire codebase adheres to the rules of PEP8.
|
||||
@@ -56,12 +37,9 @@ Apart from that the travis-log and the check by Landscape will provide you with
|
||||
|
||||
GIT
|
||||
^^^
|
||||
The master-branch contains code that has been released to PyPi. A release is marked with a tag
|
||||
corresponding to the version. Issues are closed when they have been resolved in the development-branch.
|
||||
|
||||
When you have a change to make, begin by creating a new branch from the HEAD of `python-escpos/development`.
|
||||
Name your branch to indicate what you are trying to achieve. Good branch names might
|
||||
be `improve/text-handling`, `feature/enable-color-printing`.
|
||||
The master-branch contains the main development of the project. A release to PyPi is marked with a tag
|
||||
corresponding to the version. Issues are closed when they have been resolved by merging into the master-branch.
|
||||
When you have a change to make, begin by creating a new branch from the HEAD of `python-escpos/master`.
|
||||
|
||||
Please try to group your commits into logical units. If you need to tidy up your branch, you can make use of a
|
||||
git feature called an 'interactive rebase' before making a pull request. A small, self-contained change-set is
|
||||
|
23
INSTALL
23
INSTALL
@@ -1,23 +1,10 @@
|
||||
python-escpos
|
||||
=============
|
||||
|
||||
Ensure the library is installed on ${lib_arch}/${python_ver}/site-packages/escpos
|
||||
This library is available over pypi. So for most of the use-cases it should be sufficient to run
|
||||
|
||||
On CLi you must run:
|
||||
# python setup.py build
|
||||
# sudo python setup.py install
|
||||
```
|
||||
pip install python-escpos --user # add --pre if you want to install pre-releases
|
||||
```
|
||||
|
||||
On Linux, ensure you belongs to the proper group so you can have access to the printer.
|
||||
This can be done, by adding yourself to 'dialout' group, this might require to re-login
|
||||
so the changes make effect.
|
||||
|
||||
Then, add the following rule to /etc/udev/rules.d/99-escpos.rules
|
||||
SUBSYSTEM=="usb", ATTRS{idVendor}=="04b8", ATTRS{idProduct}=="0202", MODE="0664", GROUP="dialout"
|
||||
|
||||
and restar udev rules.
|
||||
# sudo service udev restart
|
||||
|
||||
Enjoy !!!
|
||||
And please, don't forget to ALWAYS add Epson.cut() at the end of your printing :)
|
||||
|
||||
Manuel F Martinez <manpaz@bashlinux.com>
|
||||
For more information please read the documentation at https://python-escpos.readthedocs.io/en/latest/user/installation.html
|
||||
|
@@ -4,6 +4,7 @@ include LICENSE
|
||||
include INSTALL
|
||||
include tox.ini
|
||||
include capabilities-data/dist/capabilities.json
|
||||
include src/escpos/capabilities.json
|
||||
recursive-include doc *.bat
|
||||
recursive-include doc *.ico
|
||||
recursive-include doc *.py
|
||||
|
29
README.rst
29
README.rst
@@ -6,16 +6,12 @@ python-escpos - Python library to manipulate ESC/POS Printers
|
||||
:target: https://travis-ci.org/python-escpos/python-escpos
|
||||
:alt: Continous Integration
|
||||
|
||||
.. image:: https://landscape.io/github/python-escpos/python-escpos/master/landscape.svg?style=flat
|
||||
:target: https://landscape.io/github/python-escpos/python-escpos/master
|
||||
:alt: Code Health
|
||||
|
||||
.. image:: https://codecov.io/github/python-escpos/python-escpos/coverage.svg?branch=master
|
||||
:target: https://codecov.io/github/python-escpos/python-escpos?branch=master
|
||||
:alt: Code Coverage
|
||||
|
||||
.. image:: https://readthedocs.org/projects/python-escpos/badge/?version=stable
|
||||
:target: http://python-escpos.readthedocs.io/en/latest/?badge=stable
|
||||
.. image:: https://readthedocs.org/projects/python-escpos/badge/?version=latest
|
||||
:target: http://python-escpos.readthedocs.io/en/latest/?badge=latest
|
||||
:alt: Documentation Status
|
||||
|
||||
|
||||
@@ -47,7 +43,7 @@ This library makes use of:
|
||||
* `Pillow <https://github.com/python-pillow/Pillow>`_ for image printing
|
||||
* `qrcode <https://github.com/lincolnloop/python-qrcode>`_ for the generation of QR-codes
|
||||
* `pyserial <https://github.com/pyserial/pyserial>`_ for serial printers
|
||||
* `viivakoodi <https://github.com/kxepal/viivakoodi>`_ for the generation of barcodes
|
||||
* `python-barcode <https://github.com/WhyNotHugo/python-barcode>`_ for the generation of barcodes
|
||||
|
||||
Documentation and Usage
|
||||
-----------------------
|
||||
@@ -76,6 +72,25 @@ Another example based on the Network printer class:
|
||||
kitchen.text("Hello World\n")
|
||||
kitchen.barcode('1324354657687', 'EAN13', 64, 2, '', '')
|
||||
kitchen.cut()
|
||||
|
||||
Another example based on the Serial printer class:
|
||||
|
||||
.. code:: python
|
||||
|
||||
from escpos.printer import Serial
|
||||
|
||||
""" 9600 Baud, 8N1, Flow Control Enabled """
|
||||
p = Serial(devfile='/dev/tty.usbserial',
|
||||
baudrate=9600,
|
||||
bytesize=8,
|
||||
parity='N',
|
||||
stopbits=1,
|
||||
timeout=1.00,
|
||||
dsrdtr=True)
|
||||
|
||||
p.text("Hello World\n")
|
||||
p.qr("You can readme from your smartphone")
|
||||
p.cut()
|
||||
|
||||
|
||||
The full project-documentation is available on `Read the Docs <https://python-escpos.readthedocs.io>`_.
|
||||
|
Submodule capabilities-data updated: 8885283d71...3b5b35cfd3
@@ -3,10 +3,9 @@ codecov:
|
||||
|
||||
coverage:
|
||||
status:
|
||||
project:
|
||||
default: # status context
|
||||
target: auto
|
||||
threshold: "1%"
|
||||
project: off
|
||||
patch: off
|
||||
changes: off
|
||||
range: "60...100"
|
||||
|
||||
comment: off
|
||||
|
@@ -19,7 +19,7 @@ ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext spelling
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@@ -45,6 +45,7 @@ help:
|
||||
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
@echo " spelling to run the spellchecker"
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)/*
|
||||
@@ -175,3 +176,8 @@ pseudoxml:
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||
|
||||
spelling:
|
||||
$(SPHINXBUILD) -b spelling $(ALLSPHINXOPTS) $(BUILDDIR)/spelling
|
||||
@echo
|
||||
@echo "Spellchecker finished."
|
||||
|
@@ -43,6 +43,7 @@ extensions = [
|
||||
'sphinx.ext.todo',
|
||||
'sphinx.ext.graphviz',
|
||||
'sphinx.ext.inheritance_diagram',
|
||||
'sphinxcontrib.spelling',
|
||||
]
|
||||
|
||||
# supress warnings for external images
|
||||
@@ -292,3 +293,9 @@ texinfo_documents = [
|
||||
|
||||
# If true, do not generate a @detailmenu in the "Top" node's menu.
|
||||
#texinfo_no_detailmenu = False
|
||||
|
||||
# spellchecker
|
||||
spelling_ignore_pypi_package_names = True
|
||||
spelling_ignore_wiki_words = True
|
||||
spelling_ignore_python_builtins = True
|
||||
spelling_ignore_importable_modules = True
|
||||
|
@@ -3,6 +3,8 @@ Pillow>=2.0
|
||||
qrcode>=4.0
|
||||
pyserial
|
||||
sphinx-rtd-theme
|
||||
setuptools
|
||||
setuptools-scm
|
||||
docutils>=0.12
|
||||
viivakoodi
|
||||
sphinxcontrib-spelling>=5
|
||||
python-barcode>=0.11.0,<1
|
||||
|
7
doc/spelling_wordlist.txt
Normal file
7
doc/spelling_wordlist.txt
Normal file
@@ -0,0 +1,7 @@
|
||||
Raspbian
|
||||
ESC
|
||||
POS
|
||||
Escpos
|
||||
Escpos
|
||||
baudrate
|
||||
lsusb
|
@@ -2,38 +2,9 @@
|
||||
TODO
|
||||
****
|
||||
|
||||
Introduction
|
||||
------------
|
||||
|
||||
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
|
||||
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.
|
||||
|
||||
Todos in the codebase
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
@@ -48,14 +48,16 @@ to have and the second yields the "Output Endpoint" address.
|
||||
|
||||
By default the "Interface" number is "0" and the "Output Endpoint"
|
||||
address is "0x01". If you have other values then you can define them on
|
||||
your instance. So, assuming that we have another printer where in\_ep is
|
||||
on 0x81 and out\_ep=0x02, then the printer definition should look like:
|
||||
your instance. So, assuming that we have another printer, CT-S2000,
|
||||
manufactured by Citizen (with "Vendor ID" of 2730 and "Product ID" of 0fff)
|
||||
where in\_ep is on 0x81 and out\_ep=0x02, then the printer definition should
|
||||
look like:
|
||||
|
||||
**Generic USB Printer initialization**
|
||||
|
||||
::
|
||||
|
||||
p = printer.Usb(0x1a2b,0x1a2b,0,0x81,0x02)
|
||||
p = printer.Usb(0x2730, 0x0fff, 0, 0x81, 0x02)
|
||||
|
||||
Network printer
|
||||
^^^^^^^^^^^^^^^
|
||||
@@ -82,7 +84,7 @@ to.
|
||||
::
|
||||
|
||||
p = printer.Serial("/dev/tty0")
|
||||
|
||||
|
||||
# on a Windows OS serial devices are typically accessible as COM
|
||||
p = printer.Serial("COM1")
|
||||
|
||||
@@ -161,7 +163,7 @@ The printer section
|
||||
|
||||
The ``printer`` configuration section defines a default printer to create.
|
||||
|
||||
The only required paramter is ``type``. The value of this has to be one of the
|
||||
The only required parameter is ``type``. The value of this has to be one of the
|
||||
printers defined in :doc:`/user/printers`.
|
||||
|
||||
The rest of the given parameters will be passed on to the initialization of the printer class.
|
||||
@@ -192,12 +194,12 @@ An USB-printer could be defined by::
|
||||
|
||||
Printing text right
|
||||
-------------------
|
||||
Python-escpos is designed to accept unicode. So make sure that you use ``u'strings'`` or import ``unicode_literals``
|
||||
from ``__future__`` if you are on Python 2. On Python 3 you should be fine.
|
||||
|
||||
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
|
||||
the right codepage 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. For this please use the ``charcode()``-function. You can set
|
||||
any key-value that is in ``CHARCODE``. If something is wrong, an ``CharCodeError`` will be raised.
|
||||
|
@@ -1,7 +1,6 @@
|
||||
"""Prints code page tables.
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
|
||||
import six
|
||||
import sys
|
||||
|
@@ -6,4 +6,4 @@ p = Usb(0x0416, 0x5011, profile="POS-5890")
|
||||
|
||||
# Some software barcodes
|
||||
p.soft_barcode('code128', 'Hello')
|
||||
p.soft_barcode('code39', '123456')
|
||||
p.soft_barcode('code39', '1234')
|
||||
|
@@ -13,7 +13,6 @@
|
||||
# Check out his github: https://github.com/AdamWhitcroft/climacons
|
||||
|
||||
|
||||
from __future__ import print_function
|
||||
from datetime import datetime
|
||||
import calendar
|
||||
import urllib
|
||||
|
@@ -3,5 +3,5 @@ formats:
|
||||
- epub
|
||||
requirements_file: doc/requirements.txt
|
||||
python:
|
||||
version: 2
|
||||
version: 3
|
||||
setup_py_install: true
|
68
setup.cfg
68
setup.cfg
@@ -1,11 +1,71 @@
|
||||
[metadata]
|
||||
name = python-escpos
|
||||
url = https://github.com/python-escpos/python-escpos
|
||||
description = Python library to manipulate ESC/POS Printers
|
||||
long_description = file: README.rst
|
||||
license = MIT
|
||||
license_file = LICENSE
|
||||
author = Manuel F Martinez and others
|
||||
author_email = dev@pkanzler.de
|
||||
maintainer = Patrick Kanzler
|
||||
maintainer_email = dev@pkanzler.de
|
||||
keywords = ESC/POS, thermoprinter, voucher printer, printing, receipt
|
||||
classifiers =
|
||||
Development Status :: 4 - Beta
|
||||
Environment :: Console
|
||||
Intended Audience :: Developers
|
||||
License :: OSI Approved :: MIT License
|
||||
Operating System :: OS Independent
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.5
|
||||
Programming Language :: Python :: 3.6
|
||||
Programming Language :: Python :: 3.7
|
||||
Programming Language :: Python :: 3.8
|
||||
Programming Language :: Python :: Implementation :: CPython
|
||||
Topic :: Software Development :: Libraries :: Python Modules
|
||||
Topic :: Office/Business :: Financial :: Point-Of-Sale
|
||||
project_urls =
|
||||
Bug Tracker = https://github.com/python-escpos/python-escpos/issues
|
||||
Documentation = https://python-escpos.readthedocs.io/en/latest/
|
||||
Release Notes = https://github.com/python-escpos/python-escpos/releases
|
||||
|
||||
[options]
|
||||
python_requires = >=3.5
|
||||
zip_safe = false
|
||||
include_package_data = true
|
||||
install_requires =
|
||||
pyusb>=1.0.0
|
||||
Pillow>=2.0
|
||||
qrcode>=4.0
|
||||
pyserial
|
||||
python-barcode>=0.9.1,<1
|
||||
setuptools
|
||||
six
|
||||
appdirs
|
||||
PyYAML
|
||||
argparse
|
||||
argcomplete
|
||||
future
|
||||
viivakoodi>=0.8
|
||||
setup_requires = setuptools_scm
|
||||
tests_require =
|
||||
jaconv
|
||||
tox
|
||||
pytest!=3.2.0,!=3.3.0
|
||||
pytest-cov
|
||||
pytest-mock
|
||||
nose
|
||||
scripttest
|
||||
mock
|
||||
hypothesis>4
|
||||
flake8
|
||||
sphinxcontrib-spelling>=5
|
||||
|
||||
[nosetests]
|
||||
verbosity=3
|
||||
with-doctest=1
|
||||
|
||||
[bdist_wheel]
|
||||
# This flag says that the code is written to work on both Python 2 and Python 3.
|
||||
universal=1
|
||||
|
||||
[flake8]
|
||||
exclude = .git,.tox,.github,.eggs,__pycache__,doc/conf.py,build,dist,capabilities-data,test,src/escpos/constants.py
|
||||
max-line-length = 120
|
||||
|
81
setup.py
81
setup.py
@@ -22,90 +22,19 @@ setuptools_scm_template = """\
|
||||
# coding: utf-8
|
||||
# file generated by setuptools_scm
|
||||
# don't change, don't track in version control
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
version = '{version}'
|
||||
"""
|
||||
|
||||
|
||||
setup(
|
||||
name='python-escpos',
|
||||
use_scm_version={
|
||||
'write_to': 'src/escpos/version.py',
|
||||
'write_to_template': setuptools_scm_template,
|
||||
"write_to": "src/escpos/version.py",
|
||||
"write_to_template": setuptools_scm_template,
|
||||
},
|
||||
url='https://github.com/python-escpos/python-escpos',
|
||||
download_url='https://github.com/python-escpos/python-escpos/archive/master.zip',
|
||||
description='Python library to manipulate ESC/POS Printers',
|
||||
license='MIT',
|
||||
long_description=read('README.rst'),
|
||||
author='Manuel F Martinez and others',
|
||||
author_email='manpaz@bashlinux.com',
|
||||
maintainer='Patrick Kanzler',
|
||||
maintainer_email='dev@pkanzler.de',
|
||||
keywords=[
|
||||
'ESC/POS',
|
||||
'thermoprinter',
|
||||
'voucher printer',
|
||||
'printing',
|
||||
'receipt,',
|
||||
],
|
||||
platforms='any',
|
||||
platforms="any",
|
||||
package_dir={"": "src"},
|
||||
packages=find_packages(where="src", exclude=["tests", "tests.*"]),
|
||||
package_data={'escpos': ['capabilities.json']},
|
||||
include_package_data=True,
|
||||
classifiers=[
|
||||
'Development Status :: 4 - Beta',
|
||||
'Environment :: Console',
|
||||
'Intended Audience :: Developers',
|
||||
'License :: OSI Approved :: MIT License',
|
||||
'Operating System :: OS Independent',
|
||||
'Programming Language :: Python',
|
||||
'Programming Language :: Python :: 3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: 3.6',
|
||||
'Programming Language :: Python :: 3.7',
|
||||
'Programming Language :: Python :: Implementation :: CPython',
|
||||
'Programming Language :: Python :: Implementation :: PyPy',
|
||||
'Topic :: Software Development :: Libraries :: Python Modules',
|
||||
'Topic :: Office/Business :: Financial :: Point-Of-Sale',
|
||||
],
|
||||
install_requires=[
|
||||
'pyusb>=1.0.0',
|
||||
'Pillow>=2.0',
|
||||
'qrcode>=4.0',
|
||||
'pyserial',
|
||||
'six',
|
||||
'appdirs',
|
||||
'PyYAML',
|
||||
'argparse',
|
||||
'argcomplete',
|
||||
'future',
|
||||
'viivakoodi>=0.8'
|
||||
],
|
||||
setup_requires=[
|
||||
'setuptools_scm',
|
||||
],
|
||||
tests_require=[
|
||||
'jaconv',
|
||||
'tox',
|
||||
'pytest!=3.2.0,!=3.3.0',
|
||||
'pytest-cov',
|
||||
'pytest-mock',
|
||||
'nose',
|
||||
'scripttest',
|
||||
'mock',
|
||||
'hypothesis!=3.56.9,<4',
|
||||
'flake8'
|
||||
],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'python-escpos = escpos.cli:main'
|
||||
]
|
||||
},
|
||||
package_data={"escpos": ["capabilities.json"]},
|
||||
entry_points={"console_scripts": ["python-escpos = escpos.cli:main"]},
|
||||
)
|
||||
|
@@ -2,10 +2,6 @@
|
||||
"""
|
||||
python-escpos enables you to manipulate escpos-printers
|
||||
"""
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
__all__ = ["constants", "escpos", "exceptions", "printer"]
|
||||
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import re
|
||||
from os import environ, path
|
||||
import pkg_resources
|
||||
import pickle
|
||||
import logging
|
||||
import time
|
||||
@@ -15,9 +16,9 @@ logger = logging.getLogger(__name__)
|
||||
|
||||
pickle_dir = environ.get('ESCPOS_CAPABILITIES_PICKLE_DIR', gettempdir())
|
||||
pickle_path = path.join(pickle_dir, '{v}.capabilities.pickle'.format(v=platform.python_version()))
|
||||
capabilities_path = environ.get(
|
||||
'ESCPOS_CAPABILITIES_FILE',
|
||||
path.join(path.dirname(__file__), 'capabilities.json'))
|
||||
# get a temporary file from pkg_resources if no file is specified in env
|
||||
capabilities_path = environ.get('ESCPOS_CAPABILITIES_FILE',
|
||||
pkg_resources.resource_filename(__name__, 'capabilities.json'))
|
||||
|
||||
# Load external printer database
|
||||
t0 = time.time()
|
||||
@@ -58,7 +59,7 @@ BARCODE_B = 'barcodeB'
|
||||
|
||||
|
||||
class BaseProfile(object):
|
||||
"""This respresents a printer profile.
|
||||
"""This represents a printer profile.
|
||||
|
||||
A printer profile knows about the number of columns, supported
|
||||
features, colors and more.
|
||||
|
@@ -3,16 +3,12 @@
|
||||
""" CLI
|
||||
|
||||
This module acts as a command line interface for python-escpos. It mirrors
|
||||
closely the available ESCPOS commands while adding a couple extra ones for convience.
|
||||
closely the available ESCPOS commands while adding a couple extra ones for convenience.
|
||||
|
||||
It requires you to have a configuration file. See documentation for details.
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import argparse
|
||||
try:
|
||||
@@ -558,7 +554,7 @@ def main():
|
||||
|
||||
def demo(printer, **kwargs):
|
||||
"""
|
||||
Prints specificed demos. Called when CLI is passed `demo`. This function
|
||||
Prints demos. Called when CLI is passed `demo`. This function
|
||||
uses the DEMO_FUNCTIONS dictionary.
|
||||
|
||||
:param printer: A printer from escpos.printer
|
||||
|
@@ -1,13 +1,9 @@
|
||||
""" ESC/POS configuration manager.
|
||||
|
||||
This module contains the implentations of abstract base class :py:class:`Config`.
|
||||
This module contains the implementations of abstract base class :py:class:`Config`.
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import appdirs
|
||||
|
@@ -11,10 +11,6 @@ moved to `capabilities` as in `escpos-php by @mike42 <https://github.com/mike42/
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import six
|
||||
|
||||
|
@@ -10,10 +10,6 @@ This module contains the abstract base class :py:class:`Escpos`.
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import qrcode
|
||||
import textwrap
|
||||
@@ -106,6 +102,9 @@ class Escpos(object):
|
||||
* `graphics`: prints with the `GS ( L`-command
|
||||
* `bitImageColumn`: prints with the `ESC *`-command
|
||||
|
||||
When trying to center an image make sure you have initialized the printer with a valid profile, that
|
||||
contains a media width pixel field. Otherwise the centering will have no effect.
|
||||
|
||||
:param img_source: PIL image or filename to load: `jpg`, `gif`, `png` or `bmp`
|
||||
:param high_density_vertical: print in high density in vertical direction *default:* True
|
||||
:param high_density_horizontal: print in high density in horizontal direction *default:* True
|
||||
@@ -117,6 +116,10 @@ class Escpos(object):
|
||||
im = EscposImage(img_source)
|
||||
|
||||
try:
|
||||
if self.profile.profile_data['media']['width']['pixels'] == "Unknown":
|
||||
print("The media.width.pixel field of the printer profile is not set. " +
|
||||
"The center flag will have no effect.")
|
||||
|
||||
max_width = int(self.profile.profile_data['media']['width']['pixels'])
|
||||
|
||||
if im.width > max_width:
|
||||
@@ -395,7 +398,7 @@ class Escpos(object):
|
||||
*default*: A
|
||||
|
||||
: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:meth:`.check_barcode()`
|
||||
requirements as definged in the ESC/POS documentation. See :py:meth:`.check_barcode()`
|
||||
for more information. *default*: True.
|
||||
|
||||
:raises: :py:exc:`~escpos.exceptions.BarcodeSizeError`,
|
||||
@@ -476,7 +479,8 @@ class Escpos(object):
|
||||
self._raw(NUL)
|
||||
|
||||
def soft_barcode(self, barcode_type, data, impl='bitImageColumn',
|
||||
module_height=5, module_width=0.2, text_distance=1):
|
||||
module_height=5, module_width=0.2, text_distance=1,
|
||||
center=True):
|
||||
|
||||
image_writer = ImageWriter()
|
||||
|
||||
@@ -499,7 +503,7 @@ class Escpos(object):
|
||||
|
||||
# Retrieve the Pillow image and print it
|
||||
image = my_code.writer._image
|
||||
self.image(image, impl=impl)
|
||||
self.image(image, impl=impl, center=center)
|
||||
|
||||
def text(self, txt):
|
||||
""" Print alpha-numeric text
|
||||
|
@@ -25,11 +25,6 @@ Result/Exit codes:
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
class Error(Exception):
|
||||
""" Base class for ESC/POS errors """
|
||||
|
@@ -8,10 +8,6 @@ This module contains the image format handler :py:class:`EscposImage`.
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import math
|
||||
from PIL import Image, ImageOps
|
||||
|
@@ -4,11 +4,6 @@
|
||||
I doubt that this currently works correctly.
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
|
||||
try:
|
||||
import jaconv
|
||||
|
@@ -12,10 +12,6 @@ The code is based on the encoding-code in py-xml-escpos by @fvdsn.
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from builtins import bytes
|
||||
from .constants import CODEPAGE_CHANGE
|
||||
|
@@ -8,15 +8,11 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import usb.core
|
||||
import usb.util
|
||||
import serial
|
||||
import socket
|
||||
import usb.core
|
||||
import usb.util
|
||||
|
||||
from .escpos import Escpos
|
||||
from .exceptions import USBNotFoundError
|
||||
@@ -83,6 +79,8 @@ class Usb(Escpos):
|
||||
if check_driver is None or check_driver:
|
||||
try:
|
||||
self.device.detach_kernel_driver(0)
|
||||
except NotImplementedError:
|
||||
pass
|
||||
except usb.core.USBError as e:
|
||||
if check_driver is not None:
|
||||
print("Could not detatch kernel driver: {0}".format(str(e)))
|
||||
@@ -349,6 +347,7 @@ class Dummy(Escpos):
|
||||
_WIN32PRINT = False
|
||||
try:
|
||||
import win32print
|
||||
|
||||
_WIN32PRINT = True
|
||||
except ImportError:
|
||||
pass
|
||||
|
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/python
|
||||
"""verifies that the metaclass abc is properly used by Escpos
|
||||
"""verifies that the metaclass abc is properly used by ESC/POS
|
||||
|
||||
:author: `Patrick Kanzler <patrick.kanzler@fablab.fau.de>`_
|
||||
:organization: `python-escpos <https://github.com/python-escpos>`_
|
||||
@@ -7,10 +7,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from nose.tools import raises
|
||||
|
||||
@@ -20,7 +16,7 @@ from abc import ABCMeta
|
||||
|
||||
@raises(TypeError)
|
||||
def test_abstract_base_class_raises():
|
||||
"""test whether the abstract base class raises an exception for Escpos"""
|
||||
"""test whether the abstract base class raises an exception for ESC/POS"""
|
||||
escpos.Escpos() # This call should raise TypeError because of abstractmethod _raw()
|
||||
|
||||
|
||||
|
@@ -2,10 +2,6 @@
|
||||
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
@@ -1,11 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import escpos.printer as printer
|
||||
from escpos.constants import BARCODE_TYPE_A, BARCODE_TYPE_B
|
||||
from escpos.capabilities import Profile, BARCODE_B
|
||||
from escpos.exceptions import BarcodeTypeError, BarcodeCodeError
|
||||
import pytest
|
||||
|
@@ -1,8 +1,4 @@
|
||||
#!/usr/bin/python
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import escpos.printer as printer
|
||||
from escpos.exceptions import CashDrawerError
|
||||
|
@@ -1,10 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import escpos.printer as printer
|
||||
import pytest
|
||||
|
@@ -1,7 +1,3 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import six
|
||||
|
||||
|
@@ -7,10 +7,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
|
||||
|
@@ -7,10 +7,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import escpos.printer as printer
|
||||
|
||||
|
@@ -7,10 +7,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import escpos.printer as printer
|
||||
|
||||
|
@@ -7,10 +7,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from nose.tools import raises
|
||||
import pytest
|
||||
|
@@ -8,10 +8,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
import mock
|
||||
|
@@ -1,7 +1,3 @@
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import six
|
||||
|
||||
|
@@ -1,16 +1,17 @@
|
||||
#!/usr/bin/python
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import escpos.printer as printer
|
||||
import pytest
|
||||
|
||||
|
||||
def test_soft_barcode():
|
||||
"""just execute soft_barcode
|
||||
"""
|
||||
instance = printer.Dummy()
|
||||
@pytest.fixture
|
||||
def instance():
|
||||
return printer.Dummy()
|
||||
|
||||
|
||||
def test_soft_barcode_ean8(instance):
|
||||
instance.soft_barcode("ean8", "1234")
|
||||
|
||||
|
||||
def test_soft_barcode_ean8_nocenter(instance):
|
||||
instance.soft_barcode("ean8", "1234", center=False)
|
||||
|
@@ -7,10 +7,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
import mock
|
||||
|
@@ -7,10 +7,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import escpos.printer as printer
|
||||
|
||||
|
@@ -8,10 +8,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
from nose.tools import raises, assert_raises
|
||||
|
@@ -8,10 +8,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import six
|
||||
|
||||
@@ -28,7 +24,6 @@ else:
|
||||
|
||||
|
||||
@pytest.mark.skip("this test is broken and has to be fixed or discarded")
|
||||
@settings(use_coverage=False)
|
||||
@given(path=text())
|
||||
def test_load_file_printer(mocker, path):
|
||||
"""test the loading of the file-printer"""
|
||||
@@ -40,7 +35,6 @@ def test_load_file_printer(mocker, path):
|
||||
|
||||
|
||||
@pytest.mark.skip("this test is broken and has to be fixed or discarded")
|
||||
@settings(deadline=None, use_coverage=False)
|
||||
@given(txt=text())
|
||||
def test_auto_flush(mocker, txt):
|
||||
"""test auto_flush in file-printer"""
|
||||
@@ -62,7 +56,6 @@ def test_auto_flush(mocker, txt):
|
||||
|
||||
|
||||
@pytest.mark.skip("this test is broken and has to be fixed or discarded")
|
||||
@settings(deadline=None, use_coverage=False)
|
||||
@given(txt=text())
|
||||
def test_flush_on_close(mocker, txt):
|
||||
"""test flush on close in file-printer"""
|
||||
|
@@ -7,10 +7,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import pytest
|
||||
import escpos
|
||||
|
@@ -7,10 +7,6 @@
|
||||
:license: MIT
|
||||
"""
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import escpos.printer as printer
|
||||
import escpos.escpos as escpos
|
||||
|
18
tox.ini
18
tox.ini
@@ -1,5 +1,12 @@
|
||||
[tox]
|
||||
envlist = py27, py34, py35, py36, py37, docs, flake8
|
||||
envlist = py35, py36, py37, py38, docs, flake8
|
||||
|
||||
[gh-actions]
|
||||
python =
|
||||
2.7: py27
|
||||
3.6: py36
|
||||
3.7: py37
|
||||
3.8: py38
|
||||
|
||||
[testenv]
|
||||
deps = nose
|
||||
@@ -10,9 +17,9 @@ deps = nose
|
||||
pytest!=3.2.0,!=3.3.0
|
||||
pytest-cov
|
||||
pytest-mock
|
||||
hypothesis!=3.56.9,<4
|
||||
viivakoodi
|
||||
commands = py.test --cov escpos
|
||||
hypothesis>4
|
||||
python-barcode
|
||||
commands = pytest --cov escpos
|
||||
passenv = ESCPOS_CAPABILITIES_PICKLE_DIR ESCPOS_CAPABILITIES_FILE CI TRAVIS TRAVIS_* APPVEYOR APPVEYOR_* CODECOV_*
|
||||
|
||||
[testenv:docs]
|
||||
@@ -20,7 +27,8 @@ basepython = python
|
||||
changedir = doc
|
||||
deps = sphinx>=1.5.1
|
||||
setuptools_scm
|
||||
viivakoodi
|
||||
python-barcode
|
||||
sphinxcontrib-spelling>=5
|
||||
commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
|
||||
|
||||
[testenv:flake8]
|
||||
|
Reference in New Issue
Block a user