Core¶
Base¶
- class pdpy_lib.core.base.Base(patchname=None, pdtype=None, cls=None, json=None, xml=None, default=None)[source]¶
Bases:
XmlBuilder,XmlTagConvertThe base class for all pdpy objects
- Parameters
patchname (
strorNone) – Name of the Pd patch file (default:None)pdtype (
strorNone) – Type of the Pd object:X,N, orA(default:X)cls (
strorNone) – Class of the Pd object, eg.:msg,text, … (default:obj)json (
dictorNone) – A json dictionary of key/value pairs to populate the object.xml (
xml.etree.ElementTree.ElementorNone) – An Xml Element with the appropriate element structure.default (
pdpy_lib.utilities.default.DefaultorNone) – A class containing a template for default values.
- __pd__(args=None)[source]¶
Returns a the pd line for this object
Called by all derived classes to return a Pd line for this object. If
argsis present the pd line will end with;\r\n, and:If
argsis a list of strings, each element is appended to the pd line:#N canvas >>> 0 22 340 520 12 >>> ; <<<If
argsis a string, it is appended to the pd line:#X obj >>> 10 30 print >>> ; <<<If
argsisNone, the pd line is returned without arguments:#X connect >>> <<<
- Parameters
args (
listofstrorstrorNone) – The arguments to the pd line.- Returns
the pd line for this object built with
__type__and__cls__- Return type
str
- __xml_load__(xml_tree)[source]¶
Parse an XML tree into a PdPy object
Called if loading a PdPy object from an XML file.
Note
This method assumes it belongs to a PdPy class, because:
pdpy_lib.patching.pdpy.PdPybasespdpy_lib.core.base.Base
- addpos(x, y)[source]¶
Adds or updates the position
pdpy_lib.primitives.point.Point
Canvas Base¶
- class pdpy_lib.core.canvasbase.CanvasBase(obj_idx=0, isroot=False)[source]¶
Bases:
XmlBuilderBase class for a canvas
This class is based by
pdpy_lib.patching.pdpy.PdPyandpdpy_lib.patching.canvas.Canvas- add(node)[source]¶
Add (append) a Node to this canvas
nodesThis method creates and/or appends a node to an internal array
nodes. Each node is a Pure Data object that is neither a comment nor a connection- Returns
The position (index) of the most recently added node
- Return type
int
- comment(comment)[source]¶
Append a pure data comment
This method creates and/or appends a pure data comment.
- Return type
None
Object Class Definitions
- class pdpy_lib.core.object.Object(id=None, x=None, y=None, **kwargs)[source]¶
Bases:
BaseA Object base class
A Object holds the id, and the x and y coordinates of the pd object, as well as the arguments array.
- - `addargs(argv)`: Adds arguments to the pd object.
Message¶
- class pdpy_lib.core.message.Message(address=None, json=None, xml=None)[source]¶
Bases:
BaseRepresentation of a Pd Message (non patchable, used by
pdpy_lib.objects.msg.Msg)This class represents a Pd message. It stores a list of messages, together with a
address. If no address is given, the default is the outlet. Otherwise, messages are sent to that address.- Parameters
address (
strorNone) – (optional) The target address of the message (default:"outlet")json (
dictorNone) – (optional) A json dictionary with the scope of a Messagexml (
xml.etree.ElementTree.ElementorNone) – (optional) An xml Element with the scope of a Message