This change replaces the simple lists and dictionaries
defined in brother_ql/devicedependent.py with data class
definitions based on attrs. They are split into two
new modules:
* brother_ql/models.py and
* brother_ql/labels.py.
To keep the compatibility with other software relying on
this package, the old brother_ql/devicedependent.py module
can still be imported. Its content is recreated with the
help of the new modules in some _populate_legacy_structures()
functions.
There is a big problem with this commit - it only works with:
* Python 3.5 and later due to
type hints being introduced with
PEP-484 https://www.python.org/dev/peps/pep-0484/
lead to syntax errors on earlier versions.
* (even worse) only with Python 3.6+ due to
PEP 526 variable annotations (introduced in 3.6)
needed by dataclasses too.
We aim, however, at Python 2.7 compatibility with this project.
So after all, I reverse the commit and will implement the changes
in a different way.
This change replaces the simple lists and dictionaries
defined in brother_ql/devicedependent.py with data class
based definitions split into two new modules:
* brother_ql/models.py and
* brother_ql/labels.py.
To keep the compatibility with other software relying on
this package, the old brother_ql/devicedependent.py module
can still be imported. Its content is recreated with the
help of the new modules in some _populate_legacy_structures()
functions.
with pillow < 3.3.0, the call of Image.new()
in brother_ql/brother_ql_create.py line 113
would fail with the following error:
[...]
File "/usr/lib/python3.4/site-packages/brother_ql/brother_ql_create.py", line 113, in create_label
new_im = Image.new(im.mode, (device_pixel_width, im.size[1]), (255,)*len(im.mode))
File "/usr/lib64/python3.4/site-packages/PIL/Image.py", line 2050, in new
return Image()._new(core.fill(mode, size, color))
TypeError: an integer is required (got type tuple)
The brother_ql.backends package provides backends for
* network (via raw TCP/IP sockets)
* linux_kernel (via device handles like /dev/usb/lp0 etc.)
* pyusb (via PyUSB)
The new backends are in use by the additional scripts
* brother_ql_debug
* brother_ql_print