Commit Graph

161 Commits

Author SHA1 Message Date
Patrick Kanzler 09a598883c
351 ean example fix (#537)
* 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>
2023-07-28 18:23:18 +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
Benito López 9ff327d967
Remove sleep when quering status. Fixes #407 (#534)
* Remove sleep when quering status
* Remove unused import time
2023-07-23 23:22:27 +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
Florent de Labarre cb3f4e856b
[FIX] doesn't work in multi user env (#532)
1/ launch code with user A, a temp dir is create with user A
2/ launch code with user B --> permission denied
2023-07-21 22:10:29 +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
Mathieu Poussin 7bf8d4e4b8
Add support for slip/cheque dot matrix printers (#485)
* 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>
2023-05-09 01:25:48 +02:00
白月秋见心 6849dd3979
Add Chinese support (#356)
* 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>
2023-05-09 01:18:00 +02:00
B. Howell 8bbbf7ceac
soft_barcode to render directly (#469)
Rendering to /dev/null by a call to .write causes an error. Calling .render directly is simpler and fixes the error.

Co-authored-by: Patrick Kanzler <4189642+patkan@users.noreply.github.com>
2023-05-09 01:07:56 +02:00
Patrick Kanzler 1626af5def
Merge branch 'master' into development 2023-04-19 22:27:56 +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
belono b1a1204bb8 Add _read() method to the CupsPrinter() connector 2023-04-14 12:36:15 +02:00
Benito López 361afe3555
Merge branch 'master' into development 2023-02-17 00:17:20 +01:00
belono ea61f287cb Add/Improve documentation of the new connectors 2022-12-11 16:29:33 +01:00
belono 69e9dca761 Fix black linter checks - Remove u"" strings 2022-11-24 20:23:21 +01:00
belono 9a3057c8a8 Add LP Connector - UNIX printing via lp command 2022-11-24 00:11:01 +01:00
Benito López 0b695eff79
Merge branch 'master' into development 2022-08-28 21:45:21 +02:00
belono f0760ddbc0 Add support for remote CUPS server 2022-08-28 21:39:01 +02:00
vendryan 7f9878282d
Fix typo 2022-05-13 08:52:27 +07:00
Patrick Kanzler 435f2bba24 reformat codebase 2021-10-30 18:15:22 +02:00
Patrick Kanzler a4e15c6ac2
Merge branch 'master' into patch-1 2021-10-30 17:58:24 +02:00
Alejandro Hernández 15c18f225e
Update printer.py
without the call to open function, the printer isn't initialize to print, i tested on a generic and epson physical printers.
2021-10-27 17:35:53 -05:00
B. Howell 69e9b9103e
Update escpos.py
Set block_text to use the default font. This means calls will wrap to full paper width.
2020-11-28 00:41:11 +01:00
Patrick Kanzler 1ad53eb642 drop support for python 3.5 2020-11-08 23:51:57 +01:00
Patrick Kanzler ed8ec0788a start with type annotation 2020-11-08 23:45:25 +01:00
Patrick Kanzler 36bbb6690f handle socket error when closing 2020-11-08 22:34:57 +01:00
Patrick Kanzler 596787554b add disclaimer to beep sound
fixes #365
2020-09-28 20:44:22 +02:00
Maximilian Wagenbach c57b9c35dc Use https links. 2020-05-31 16:21:42 +02:00
Maximilian Wagenbach ee6eef6db3 I verified that this works. Both modes cut the paper 95% of the way through. 2020-05-26 01:38:57 +02:00
Patrick Kanzler ff39908674
Merge branch 'master' into 390-add-spellcheck-to-sphinx 2020-05-11 23:45:34 +02:00
Patrick Kanzler f4e214ad17 add spellchecker with first conf, fix some errors 2020-05-11 23:39:56 +02:00
Patrick Kanzler b9e3827867 use pkg_resources
This change uses if no path for e capabilities-file is supplied a
temporary file created by pkg_resources, which should be more robust
than directly accessing the file. (This failed sometimes, for example
in zipped distributions or uncommon structures)
2020-05-11 22:54:22 +02:00
Romain Porte 8ca682e3ac soft_barcode: add new center=True option 2020-05-10 14:08:50 +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 c9953c2f56
Merge branch 'master' into development 2020-05-09 01:56:22 +02:00
Maximilian Wagenbach cc67cb1c1e Added some documentation and error handling to the image center flag. 2020-03-11 15:51:16 +01:00
belono f07d5e0610 Force send job unfiltered (raw) 2019-11-10 16:35:52 +01:00
Benito López a30c28baa5
Merge branch 'development' into development 2019-07-02 18:06:20 +02:00
Yaisel Hurtado 7c7d401f31 Adding except NotImplementedError for 'detach_kernel_driver' in order to avoid the exception NotImplementedError: Operation not supported or unimplemented on this platform. 2019-06-27 19:28:49 -04:00
belono 2110431d4f Fix whitespace 2019-06-27 00:26:49 +02:00
belono c86826101d Add CUPS printer connector 2019-06-24 23:09:43 +02:00
Patrick Kanzler 5ff73595b6 fix links and impl (in qr-method) in docstrings
fixes #308
2019-06-16 01:54:47 +02:00
Alex Debiasio 8bf0e08659 Implemented _read method of Network printer class 2019-06-13 21:28:46 +02:00
Patrick Kanzler b4c32b5a4a
Merge branch 'development' into development 2019-06-04 23:04:25 +02:00
Patrick Kanzler 40b30225d3
Merge pull request #330 from om26er/windows-support
Enable Windows Support
2019-06-04 23:04:09 +02:00
Justin Vieira 91ff83e506 Update to use pyyaml safe_load(), as load() is unsafe and disabled on some systems 2019-05-29 16:43:19 -04:00
Omer Akram 29ef88f591 Better comment 2019-05-22 17:25:33 +05:00
Omer Akram 7c01a30d6c fix a typo 2019-05-22 17:20:15 +05:00
Omer Akram d20646b2a9 Make windows enablement code more intelligent 2019-05-22 17:01:13 +05:00