From 2eeac7a4b68dc54ded667158f1f4166110a528e6 Mon Sep 17 00:00:00 2001 From: Philipp Klaus Date: Sun, 13 Jan 2019 11:19:04 +0100 Subject: [PATCH] improve docstring documentation of brother_ql.raster --- brother_ql/raster.py | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/brother_ql/raster.py b/brother_ql/raster.py index eac214e..e037e2b 100644 --- a/brother_ql/raster.py +++ b/brother_ql/raster.py @@ -1,3 +1,11 @@ +""" +This module contains the implementation of the raster language +of the Brother QL-series label printers according to their +documentation and to reverse engineering efforts. + +The central piece of code in this module is the class +:py:class:`BrotherQLRaster`. +""" from builtins import bytes @@ -29,6 +37,21 @@ logger = logging.getLogger(__name__) class BrotherQLRaster(object): + """ + This class facilitates the creation of a complete set + of raster instructions by adding them one after the other + using the methods of the class. Each method call is adding + instructions to the member variable :py:attr:`data`. + + Instatiate the class by providing the printer + model as argument. + + :param str model: Choose from the list of available models. + + :ivar bytes data: The resulting bytecode with all instructions. + :ivar bool exception_on_warning: If set to True, an exception is raised if trying to add instruction which are not supported on the selected model. If set to False, the instruction is simply ignored and a warning sent to logging/stderr. + """ + def __init__(self, model='QL-500'): if model not in models: raise BrotherQLUnknownModel() @@ -169,6 +192,14 @@ class BrotherQLRaster(object): self.data += struct.pack('