From ca45d2567035d7469a8d80cfcdb67f6aa2a4c858 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 9 Mar 2020 23:18:36 +1100 Subject: [PATCH 1/9] Update README.rst Added example on serial. --- README.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.rst b/README.rst index 3eebf6d..6e8901d 100644 --- a/README.rst +++ b/README.rst @@ -76,6 +76,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 Network 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 `_. From 2ee3ff7f87016e97d74894f249bbb36796c813d2 Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 9 Mar 2020 23:19:11 +1100 Subject: [PATCH 2/9] Update README.rst --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 6e8901d..bd36cbe 100644 --- a/README.rst +++ b/README.rst @@ -77,7 +77,7 @@ Another example based on the Network printer class: kitchen.barcode('1324354657687', 'EAN13', 64, 2, '', '') kitchen.cut() -Another example based on the Network printer class: +Another example based on the Serial printer class: .. code:: python From cc67cb1c1ed2f97b349d0ca5a7639caf0ef6c841 Mon Sep 17 00:00:00 2001 From: Maximilian Wagenbach Date: Wed, 11 Mar 2020 15:51:16 +0100 Subject: [PATCH 3/9] Added some documentation and error handling to the image center flag. --- src/escpos/escpos.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/escpos/escpos.py b/src/escpos/escpos.py index bfab265..3fa7eee 100644 --- a/src/escpos/escpos.py +++ b/src/escpos/escpos.py @@ -106,6 +106,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 +120,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: From f49c1dcb8963e9e7f0938dc44cebdd978444ed59 Mon Sep 17 00:00:00 2001 From: Maximilian Wagenbach Date: Wed, 11 Mar 2020 15:56:51 +0100 Subject: [PATCH 4/9] Updating AUTHORS. --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 2b5edc7..64eab60 100644 --- a/AUTHORS +++ b/AUTHORS @@ -19,6 +19,7 @@ Kristi ldos Lucy Linder Manuel F Martinez +Maximilian Wagenbach Michael Billington Michael Elsdörfer mrwunderbar666 From ae0a049efadc8047bca89c04dec76af05190e860 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Fri, 8 May 2020 22:43:47 +0200 Subject: [PATCH 5/9] fix authors file --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 2b5edc7..6f28dd8 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,5 +1,6 @@ Ahmed Tahri akeonly +Alexander Bougakov Alex Debiasio Asuki Kono belono From a3660a636687041cdf5799ba813b6efb1e0b60c8 Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Fri, 8 May 2020 23:14:05 +0200 Subject: [PATCH 6/9] fix authors file --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index 6f28dd8..92a374d 100644 --- a/AUTHORS +++ b/AUTHORS @@ -4,6 +4,7 @@ Alexander Bougakov Alex Debiasio Asuki Kono belono +Brian Christoph Heuel Cody (Quantified Code Bot) csoft2k From a2db415559700f9ff71ff96debb7728127dc879c Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Fri, 8 May 2020 23:19:31 +0200 Subject: [PATCH 7/9] remove authors --- AUTHORS | 42 ------------------------------------------ 1 file changed, 42 deletions(-) delete mode 100644 AUTHORS diff --git a/AUTHORS b/AUTHORS deleted file mode 100644 index 01113f4..0000000 --- a/AUTHORS +++ /dev/null @@ -1,42 +0,0 @@ -Ahmed Tahri -akeonly -Alexander Bougakov -Alex Debiasio -Asuki Kono -belono -Christoph Heuel -Cody (Quantified Code Bot) -csoft2k -Curtis // mashedkeyboard -Davis Goglin -Dean Rispin -Dmytro Katyukha -Gerard Marull-Paretas -Hark -Joel Lehtonen -Justin Vieira -kennedy -Kristi -ldos -Lucy Linder -Manuel F Martinez -Maximilian Wagenbach -Michael Billington -Michael Elsdörfer -mrwunderbar666 -Nathan Bookham -Omer Akram -Patrick Kanzler -primax79 -Qian Linfeng -Ramon Poca -reck31 -Renato Lorenzi -Romain Porte -Sam Cheng -Sergio Pulgarin -Stephan Sokolow -Thijs Triemstra -Thomas van den Berg -Yaisel Hurtado -ysuolmai From 34cd1ebde1d452c7143c77df93518835167fd1fd Mon Sep 17 00:00:00 2001 From: Patrick Kanzler Date: Fri, 8 May 2020 23:19:47 +0200 Subject: [PATCH 8/9] readd authors --- AUTHORS | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 AUTHORS diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..01113f4 --- /dev/null +++ b/AUTHORS @@ -0,0 +1,42 @@ +Ahmed Tahri +akeonly +Alexander Bougakov +Alex Debiasio +Asuki Kono +belono +Christoph Heuel +Cody (Quantified Code Bot) +csoft2k +Curtis // mashedkeyboard +Davis Goglin +Dean Rispin +Dmytro Katyukha +Gerard Marull-Paretas +Hark +Joel Lehtonen +Justin Vieira +kennedy +Kristi +ldos +Lucy Linder +Manuel F Martinez +Maximilian Wagenbach +Michael Billington +Michael Elsdörfer +mrwunderbar666 +Nathan Bookham +Omer Akram +Patrick Kanzler +primax79 +Qian Linfeng +Ramon Poca +reck31 +Renato Lorenzi +Romain Porte +Sam Cheng +Sergio Pulgarin +Stephan Sokolow +Thijs Triemstra +Thomas van den Berg +Yaisel Hurtado +ysuolmai From 4d106e8659a134336fe45e84e5ff507bf638e45c Mon Sep 17 00:00:00 2001 From: Patrick Kanzler <4189642+patkan@users.noreply.github.com> Date: Fri, 8 May 2020 23:34:24 +0200 Subject: [PATCH 9/9] Create pythonpackage.yml --- .github/workflows/pythonpackage.yml | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/pythonpackage.yml diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage.yml new file mode 100644 index 0000000..407d0eb --- /dev/null +++ b/.github/workflows/pythonpackage.yml @@ -0,0 +1,39 @@ +# 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 + - 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 + 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 pytest + run: | + tox