Common
Global Variables
Version numbers are used as default values in Header and to select a matching json schema file if no version is set.
pyfdl.FDL_SCHEMA_MAJOR = 1
module-attribute
pyfdl.FDL_SCHEMA_MINOR = 0
module-attribute
pyfdl.FDL_SCHEMA_VERSION = {'major': FDL_SCHEMA_MAJOR, 'minor': FDL_SCHEMA_MINOR}
module-attribute
Different workflows have different requirements for precision, so we are flexible in how to apply rounding of values
pyfdl.DEFAULT_ROUNDING_STRATEGY = NO_ROUNDING
module-attribute
This is the default behavior for rounding the values of dimensions. The rules are the same as for
CanvasTemplate.round.
pyfdl.NO_ROUNDING = {}
module-attribute
This will disable rounding of values in dimensions. Exception being Canvas.dimensions when
created by a canvas templates
pyfdl.set_rounding_strategy(rules)
pyfdl.rounding_strategy()
Base Classes
Below is a collection of the common classes that are used by other classes.
pyfdl.Base()
Base class not to be instanced directly.
| Attributes: |
|
|---|
apply_defaults()
Applies default values defined in the defaults attribute to attributes that are None
check_required()
Check that required attributes contain values. Checks linked attributes like: "effective_dimensions.effective_anchor_point" where "effective_anchor_point" is required if "effective_dimensions" is set
| Returns: |
|
|---|
from_dict(raw)
classmethod
Create instances of classes from a provided dict.
| Parameters: |
|
|---|
| Returns: |
|
|---|
to_dict()
Produce a dictionary representation of the current object along with all sub objects.
| Raises: |
|
|---|
| Returns: |
|
|---|
pyfdl.TypedCollection(cls)
Collection only accepting items of a given class. In addition, a strict control of unique id's is enforced.
| Parameters: |
|
|---|
add(item)
Add an item to the collection. All items added to a collection get associated to the collection by passing itself as parent
| Parameters: |
|
|---|
| Raises: |
|
|---|
get(item_id)
Get an item in the collection
| Parameters: |
|
|---|
| Returns: |
|
|---|
remove(item_id)
Remove an item in the collection if found
| Parameters: |
|
|---|
pyfdl.Dimensions(width=None, height=None, dtype=float)
Bases: Base
Dimensions may be either ints or floats. You may pass the desired data type at instantiation.
However, the objects using the dimensions will set the required type for you when they are passed
to them
| Parameters: |
|
|---|
copy()
Create a copy of these dimensions
| Returns: |
|
|---|
scale_by(factor)
Scale the dimensions by the provider factor
| Parameters: |
|
|---|
pyfdl.Point(x=None, y=None)
Bases: Base
Point properly formatted
| Parameters: |
|
|---|
pyfdl.RoundStrategy(even=None, mode=None)
Bases: Base
Describes how to handle rounding canvas dimensions when applying a CanvasTemplate.
| Parameters: |
|
|---|
| Raises: |
|
|---|
round_dimensions(dimensions)
Round the provided dimensions based on the rules defined in this object
| Parameters: |
|
|---|
| Returns: |
|
|---|