2019-02-08 22:56:19 +01:00
|
|
|
|
|
|
|
Generators
|
|
|
|
==========
|
|
|
|
|
2023-01-02 00:32:42 +01:00
|
|
|
Generators are subclasses of
|
2019-02-08 22:56:19 +01:00
|
|
|
|
|
|
|
.. autoclass:: boxes.Boxes
|
|
|
|
|
2023-01-02 00:32:42 +01:00
|
|
|
Most code is directly in this class. Subclass are supposed to over
|
2019-02-08 22:56:19 +01:00
|
|
|
write the ``.__init__()`` and ``.render()`` method.
|
|
|
|
|
2020-05-18 22:18:39 +02:00
|
|
|
The Boxes class keeps a canvas object (self.ctx) that all
|
2019-02-08 22:56:19 +01:00
|
|
|
drawing is made on. In addition it keeps a couple of global settings
|
|
|
|
used for various drawing operations. See the ``.__init__()`` method
|
|
|
|
for the details.
|
|
|
|
|
|
|
|
For implementing a new generator forking an existing one or using the
|
|
|
|
``boxes/generators/_template.py`` is probably easier than starting
|
|
|
|
from scratch.
|
|
|
|
|
2023-01-02 00:32:42 +01:00
|
|
|
Many methods and attributes are for use of the subclasses. These
|
2019-02-08 22:56:19 +01:00
|
|
|
methods are the interface for the user interfaces to interact with the
|
|
|
|
generators:
|
|
|
|
|
|
|
|
.. automethod:: boxes.Boxes.__init__
|
|
|
|
|
|
|
|
.. automethod:: boxes.Boxes.parseArgs
|
|
|
|
.. automethod:: boxes.Boxes.render
|
|
|
|
|
|
|
|
.. automethod:: boxes.Boxes.open
|
|
|
|
.. automethod:: boxes.Boxes.close
|
|
|
|
|
|
|
|
Handling Generators
|
|
|
|
-------------------
|
|
|
|
|
|
|
|
To handle the generators there is code in the ``boxes.generators``
|
|
|
|
package.
|
|
|
|
|
|
|
|
.. automodule:: boxes.generators
|
|
|
|
:members:
|
|
|
|
:undoc-members:
|
|
|
|
|
|
|
|
This adds generators to the user interfaces automatically. For this to
|
|
|
|
work it is important that the class names are unique. So whenever you
|
|
|
|
start a new generator please change the class name right away.
|