Skip to content

Commit

Permalink
Merge release branch release-1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
heuer committed Aug 18, 2020
2 parents 808144f + 20eb026 commit 48aa1cb
Show file tree
Hide file tree
Showing 75 changed files with 1,658 additions and 417 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 4
insert_final_newline = true
end_of_line = lf
charset = utf-8
11 changes: 5 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
*.pyc
.coverage
.tox
.idea
.[nt]ox/
.idea/
*.egg-info
htmlcov/*
dist/*
build/*
venv/*
dist/
build/
venv/
sandbox/out/*.svg
sandbox/out/*.png
39 changes: 26 additions & 13 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,17 @@
Changes
=======

Versions follow `Semantic Versioning <https://semver.org/>`_.
1.2.0 -- 2020-08-18
-------------------
* Added ``QRCode.svg_inline`` method which returns a string which
can be used to embed the SVG directly in HTML pages.
* Improved documentation <https://segno.readthedocs.org/>
* Improved code quality
* Switched from `tox <https://pypi.org/project/tox/>`_ to
`nox <https://pypi.org/project/nox/>`_
* Utilize `flake8 <https://pypi.org/project/flake8/>`_
* Moved metadata from setup.py to setup.cfg


1.1.0 -- 2020-08-05
-------------------
Expand All @@ -17,7 +27,7 @@ Versions follow `Semantic Versioning <https://semver.org/>`_.
1.0.2 -- 2020-07-30
-------------------
* Fixed error in Kanji encoding: Data was incomplete.
Again, discovered by `Shi Yan <https://github.com/neycyanshi>`_)
Again, discovered by `Shi Yan <https://github.com/neycyanshi>`_
* Better test coverage for Kanji encoding


Expand All @@ -30,7 +40,7 @@ Versions follow `Semantic Versioning <https://semver.org/>`_.
by a numeric constant.
* Added support for `Netpbm PPM <http://netpbm.sourceforge.net/doc/ppm.html>`_ images.
* Documentation improvements (also thanks to `James Addison <https://github.com/jayaddison>`_
for pr`#73 <https://github.com/heuer/segno/pull/73>`_)
for pr `#73 <https://github.com/heuer/segno/pull/73>`_)
* Removed "version" parameter from ``encoder.prepare_data`` (does not belong to
the public API anyway)

Expand All @@ -56,9 +66,9 @@ Versions follow `Semantic Versioning <https://semver.org/>`_.
-------------------
* Removed deprecated functions, modules etc. See `#56 <https://github.com/heuer/segno/issues/56>`_,
`#57 <https://github.com/heuer/segno/issues/57>`_, `#59 <https://github.com/heuer/segno/issues/59>`_,
`#61 <https://github.com/heuer/segno/issues/61>`_:, `#67 <https://github.com/heuer/segno/issues/67>`_:.
`#61 <https://github.com/heuer/segno/issues/61>`_, `#67 <https://github.com/heuer/segno/issues/67>`_.
* Deprecated usage of keywords "color" and "background". Replacements: "dark"
and "light". See `#60 <https://github.com/heuer/segno/issues/60>`_:. The deprecated keywords will be removed in 1.0.0.
and "light". See `#60 <https://github.com/heuer/segno/issues/60>`_. The deprecated keywords will be removed in 1.0.0.
* Minor performance improvements for writing SVG (at least for Py 3.7, YMMV).
* Documentation improvements

Expand Down Expand Up @@ -215,7 +225,8 @@ Versions follow `Semantic Versioning <https://semver.org/>`_.
-------------------
* Fixed typos
* PDF serializer: Added support for stroke and background color,
initial code contributed by Serge Morel (pr #52).
initial code contributed by `Serge Morel <https://github.com/Vluf>`_
(pr `#52 <https://github.com/heuer/segno/pull/52>`_).


0.2.8 -- 2018-10-17
Expand All @@ -228,7 +239,8 @@ Versions follow `Semantic Versioning <https://semver.org/>`_.
finder pattern etc.)
* Minor performance improvements
* Removed Python 2.6 from test environment
* Added support for vCard TITLE attribute, contributed by Stefano Borini
* Added support for vCard TITLE attribute, contributed by `Stefano Borini <https://github.com/stefanoborini>`_
(pr `#48 <https://github.com/heuer/segno/pull/48>`_)
* Added support for vCard PHOTO URI attribute, suggested by Arthur Reinhart


Expand Down Expand Up @@ -260,7 +272,8 @@ Versions follow `Semantic Versioning <https://semver.org/>`_.
Some Micro QR Codes may be unreadable due to wrong
format information. Further, M1 and M3 codes may be wrong due to wrong
encoding of final data symbol character (8 bits instead of (correct) 4 bits).
Thanks to Nicolas Boullis for the bug report, initial fix, tests and patience.
Thanks to `Nicolas Boullis <https://github.com/nboullis>`_ for the bug report,
initial fix, tests and patience.
* Fixed `#34 <https://github.com/heuer/segno/issues/34>`_:
Change default error level from "M" to "L" to avoid surprises that
the content does not fit into the provided version. This change is somewhat
Expand Down Expand Up @@ -309,7 +322,7 @@ Versions follow `Semantic Versioning <https://semver.org/>`_.
0.2.2 -- 2016-09-21
-------------------
* Command line script reports Segno's version (``--ver``) and the version
is also mentioned in the help message (``-h``) (#24)
is also mentioned in the help message (``-h``) (`#24 <https://github.com/heuer/segno/issues/24>`_)
* Support for creating email addresses or complete messages (``segno.helpers``)
* Internal optimizations and more correct minimal version finding
(`#26 <https://github.com/heuer/segno/issues/26>`_)
Expand Down Expand Up @@ -369,19 +382,19 @@ Versions follow `Semantic Versioning <https://semver.org/>`_.
* Added QRCode.matrix_iter(border) which returns an iterator over the matrix and
includes the border (as light modules).
* Invalid (empty) SVG identifiers / class names are ignored and do not result
into an invalid SVG document (issue #8).
into an invalid SVG document (issue `#8 <https://github.com/heuer/segno/issues/8>`_).
* SVG serializer: If ``unit`` was set to ``None``, an invalid SVG document was
generated (issue #14).
generated (issue `#14 <https://github.com/heuer/segno/issues/14>`_).
* Better command line support:

- The command line script recognizes all SVG options (`#9 <https://github.com/heuer/segno/issues/9>`_)
- Added ``--mode``/``-m``, renamed ``--mask``/``-m`` to ``--pattern``/``-p``
(issue #10)
(issue `#10 <https://github.com/heuer/segno/issues/10>`_)
- The script used an empty string as default value for the data to encode.
The data to encode has no default value anymore
(issue `#11 <https://github.com/heuer/segno/issues/11>`_)
- Added ``--no-ad`` to omit the comment ``Software`` in PNG images
(issue #12)
(issue `#12 <https://github.com/heuer/segno/issues/12>`_)


0.1.4 -- 2016-08-21
Expand Down
64 changes: 34 additions & 30 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
Segno -- Python QR Code and Micro QR Code encoder
=================================================

Segno (Italian for "sign" / "symbol") is a QR Code and Micro QR Code encoder
which has no further dependencies.
Pure Python QR Code generator with no dependencies.

This package implements ISO/IEC 18004:2015(E) "QR Code bar code symbology
specification" and produces Micro QR Codes and QR Codes with nearly no effort.
It supports the Structured Append mode which splits a message across several
QR Codes.
QR codes.

Segno provides several serialization formats like Scalable Vector Graphics (SVG),
Encapsulated PostScript (EPS), Portable Network Graphics (PNG),
Portable Document Format (PDF), Netpbm (PAM, PBM, PPM), LaTeX (PGF/TikZ),
X PixMap (XBM), and X Bitmap (XPM) etc.
Segno (Italian for "sign" / "symbol") provides several serialization formats
like Scalable Vector Graphics (SVG), Encapsulated PostScript (EPS),
Portable Network Graphics (PNG), Portable Document Format (PDF), Netpbm (PAM, PBM, PPM),
LaTeX (PGF/TikZ), X PixMap (XBM), and X Bitmap (XPM) etc.
None of these serializers require an external lib.
Further, it provides several high level functions to create QR Codes which encode
`contact data (vCard, MeCard) <https://segno.readthedocs.io/en/stable/contact-information.html>`_,
Expand All @@ -25,34 +24,39 @@ standard conform QR Code and Micro QR Code generation acc. to ISO/IEC 18004:2015

Unique features
---------------
* Pure Python (supports 2.7, 3.7+, PyPy2 and PyPy3)
* Pure Python QR Code generator (supports 2.7, 3.7+, PyPy2 and PyPy3)
* No dependencies
* A lot of `serialization formats <https://segno.readthedocs.io/en/stable/serializers.html#available-serializers>`_ (SVG, PNG, EPS, PDF, ...)
* `Fastest (pure Python) QR Code encoder <https://segno.readthedocs.io/en/stable/comparison-qrcode-libs.html#performance>`_
* Micro QR Codes
* `Colorful QR Codes <https://segno.readthedocs.io/en/stable/colorful-qrcodes.html>`_

.. image:: https://github.com/heuer/segno/raw/develop/docs/_static/yellow-submarine.png
:alt: Colorful 3-H QR Code encoding "Yellow Submarine"

... works also with Micro QR Codes

.. image:: https://github.com/heuer/segno/raw/develop/docs/_static/colorful/rain.png
:alt: Colorful M4-Q Micro QR Code encoding "Rain"
* Animated QR codes (requires the `segno-pil <https://github.com/heuer/segno-pil/>`_
plug-in)

.. image:: https://raw.githubusercontent.com/heuer/segno-pil/develop/images/beatles-animated.gif
:alt: Animated 4-H QR code encoding "The Beatles -- Abbey Road"

* `Structured Append mode <https://segno.readthedocs.io/en/stable/structured-append.html>`_
* `Hanzi mode <https://segno.readthedocs.io/en/stable/qrcode-modes.html#hanzi-mode>`_
* `Simple, user-friendly API <https://segno.readthedocs.io/en/stable/api.html>`_
::

import segno
qr = segno.make('Yellow Submarine')
qr.save('yellow-submarine.png')

* `Colorful QR codes <https://segno.readthedocs.io/en/stable/colorful-qrcodes.html>`_

.. image:: https://github.com/heuer/segno/raw/develop/docs/_static/yellow-submarine.png
:alt: Colorful 3-H QR code encoding "Yellow Submarine"

... works also with Micro QR codes

.. image:: https://github.com/heuer/segno/raw/develop/docs/_static/colorful/rain.png
:alt: Colorful M4-Q Micro QR code encoding "Rain"
* `Artistic QR Codes <https://segno.readthedocs.io/en/latest/artistic-qrcodes.html>`_
(requires the `qrcode-artistic <https://github.com/heuer/qrcode-artistic>`_ plug-in)

.. image:: https://github.com/heuer/segno/raw/develop/docs/_static/artistic/letitbe.jpg
:alt: Animated 3-H QR code encoding "The Beatles -- Let It Be"

... animated QR codes are supported as well

.. image:: https://github.com/heuer/segno/raw/develop/docs/_static/artistic/abbey-road.webp
:alt: Animated 4-H QR code encoding "The Beatles -- Abbey Road"


Installation
Expand All @@ -69,12 +73,12 @@ Usage
Command line
^^^^^^^^^^^^

The command line script prints the QR Code to the terminal::
The command line script prints a QR code to the terminal::

$ segno "Comfortably Numb"


To serialize the QR Code, use the "output" argument::
To serialize a QR code, use the "output" argument::

$ segno -o=raincoat.svg "Famous Blue Raincoat"
$ segno --scale 10 --dark darkblue --border 0 --output=fire.svg "Who by Fire"
Expand All @@ -91,7 +95,7 @@ Library
>>> # Let Segno choose the minimal version and an optimal (maximal) error
>>> # level without changing the minimal version
>>> qr = segno.make('Up Jumped the Devil')
>>> qr.designator # Returns the QR Code version and the error correction level
>>> qr.designator # Returns the QR code version and the error correction level
'2-Q'
>>> qr.save('up-jumped-the-devil.png') # Save as PNG
>>> qr.save('up-jumped-the-devil-2.png', scale=10) # Scaling factor 10
Expand All @@ -101,7 +105,7 @@ Library
>>> qr.save('up-jumped-the-devil.svg', scale=10, dark='darkblue')
If the content to encode is small enough, a Micro QR Code is generated:
If the content to encode is small enough, a Micro QR code is generated:

.. code-block:: python
Expand All @@ -125,9 +129,9 @@ If this behaviour is not desired, the user may set ``micro`` to ``False``
'1-H'
Or use the factory functions ``segno.make_qr()`` which generates always QR Codes
(never Micro QR Codes) or ``segno.make_micro()`` which returns always
Micro QR Codes (or raises an error if the content is too large for a Micro QR Code).
Or use the factory functions ``segno.make_qr()`` which generates always QR codes
(never Micro QR codes) or ``segno.make_micro()`` which returns always
Micro QR codes (or raises an error if the content is too large for a Micro QR code).

.. code-block:: python
Expand Down
Binary file added docs/_static/artistic/abbey-road.webp
Binary file not shown.
Binary file added docs/_static/artistic/albums.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/artistic/letitbe.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/_static/artistic/yellow-submarine.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/_static/chart_create_1m.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/_static/chart_create_30h.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/_static/chart_create_7q.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/_static/chart_png.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/_static/chart_svg.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions docs/_static/js/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ document.addEventListener('DOMContentLoaded', function(){
var cells = feature_table.getElementsByTagName("td");
for (var i = 0; i < cells.length; i++) {
var content = cells[i].innerHTML;
console.log(content);
if (content === "Yes") {
if (content.includes("Yes")) {
cells[i].classList.add('feature_yes')
}
else if (content == "No") {
else if (content.includes("No")) {
cells[i].classList.add('feature_no')
}
}
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
83 changes: 83 additions & 0 deletions docs/artistic-qrcodes.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
Artistic QR Codes
=================

Segno focuses on creating (Micro) QR codes and offers many
:ref:`output formats <serializers>` without additional dependencies on other
libraries.

Advanced graphic operations require the `qrcode-artistic <https://pypi.org/project/qrcode-artistic/>`_
plug-in, which in turn depends on the `Pillow <https://pypi.org/project/Pillow/>`_ library.

The plugin can be used to create animated QR codes or static QR codes with a
background image.

To install the plugin, use::

pip install qrcode-artistic

After that, every QR code created with :py:func:`segno.make` has two additional
methods "to_pil" and "to_artistic".

The former returns a Pillow `Image <https://pillow.readthedocs.io/en/stable/reference/Image.html>`_
instance, which can be used for further manipulations (e.g. rotating the QR code).

.. code-block:: python
>>> import segno
>>> qr = segno.make('Yellow Submarine', error='h')
>>> img = qr.to_pil(scale=3).rotate(45, expand=True)
>>> img.save('yellow-submarine-rotated.png')
.. image:: _static/artistic/yellow-submarine-rotated.png
:alt: Colorful 3-H QR code encoding "Yellow Submarine" rotated by 45°

The "to_pil" method provides all options of :doc:`colorful-qrcodes`.

.. code-block:: python
>>> import segno
>>> qr = segno.make('Yellow Submarine', error='h')
>>> img = qr.to_pil(scale=4, dark='darkred', data_dark='darkorange',
data_light='yellow')
>>> img.save('yellow-submarine.png')
.. image:: _static/artistic/yellow-submarine.png
:alt: Colorful 3-H QR code encoding "Yellow Submarine"


The "to_artistic" method can create animated or static QR codes.

.. code-block:: python
>>> import segno
>>> qr = segno.make('The Beatles -- Albums', error='h')
>>> qr.to_artistic(background='src/albums.gif'), target='albums.gif' scale=8)
.. image:: _static/artistic/albums.gif
:alt: 3-H QR code encoding "The Beatles -- Albums" (animated)


If the Pillow installation supports animated WebP images the plugin can
save animated WebP images as well.

.. code-block:: python
>>> import segno
>>> qr = segno.make('The Beatles -- Abbey Road', error='h')
>>> qr.to_artistic(background='src/abbey-road-walking.gif', target='abbey-road.webp' scale=4)
.. image:: _static/artistic/abbey-road.webp
:alt: 4-H QR code encoding "The Beatles -- Abbey Road" (animated)


The plugin also supports static backgrounds

.. code-block:: python
>>> import segno
>>> qr = segno.make('The Beatles -- Let It Be', error='h')
>>> qr.to_artistic(background='src/letitbe.jpg', target='letitbe.jpg' scale=5)
.. image:: _static/artistic/letitbe.jpg
:alt: 3-H QR code encoding "The Beatles -- Let It Be" with a background image

2 changes: 1 addition & 1 deletion docs/boost-error-correction-level.rst
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Boost Error Correction Level
Boost error correction level
============================

If the user does not provide any :option:`--version <segno --version>` or
Expand Down

0 comments on commit 48aa1cb

Please sign in to comment.