Nodes are the basic unit in Psynth.
More...
Nodes are the basic unit in Psynth.
They can be connected by Link objects, and Detail objects can be attached to them.
| def psynth.psynth.Node.__init__ |
( |
|
self, |
|
|
|
uid = None, |
|
|
|
name = "New Node", |
|
|
|
x = 1.0, |
|
|
|
y = 1.0, |
|
|
|
shape = 6, |
|
|
|
image = "na", |
|
|
|
radius = 24.0, |
|
|
|
color = "dynamic" |
|
) |
| |
Constructs a Node object.
- Parameters
-
| uid | str :: A global unique identifier for the Node. |
| name | str :: The displayed name of the Node. |
| x | float :: The x-coordinate of the Node. Assumes a web-standard grid with (0,0) at (top,left) |
| y | float :: The y-coordinate of the Node. Assumes a web-standard grid with (0,0) at (top,left) |
| shape | int :: The number of sides the Node should have. 0 for circle, 1 for image. |
| image | str :: The url of an image to display on this node. Requires a shape of 1. |
| radius | float :: The radius of the Node shape. |
| color | str :: A color string, e.g. '#FF0000'. 'dynamic' will make the Node responsive to user-selected palette. 'static' will leave a node image's color unaffected. Labeled as a Photo mode in the gui. |
1 n = Node(name=
'My Node', shape=8, radius=33.5)
| def psynth.psynth.Node.add_detail |
( |
|
self, |
|
|
|
detail, |
|
|
|
update = True, |
|
|
|
callback = None |
|
) |
| |
Attaches a Detail to this Node.
Allows for fewer explicit property declarations on Detail creation.
- Parameters
-
| detail | Detail :: The Detail to attach to this Node. |
| update | bool :: Whether or not to immediately enqueue the query. |
| callback | function :: An optional function to handle the server's response to the query. |
1 d = Detail(content=
"http://psymphonic.com", type=
"link")
| def psynth.psynth.Node.all_links |
( |
|
self | ) |
|
Returns a list of Link objects which connect to this Node.
- Returns
- links: list :: A list of Link objects which connect to this Node.
1 for link
in n.all_links():
| def psynth.psynth.Node.all_neighbors |
( |
|
self | ) |
|
Returns a list of Node objects which neighbor this Node.
- Returns
- nodes: list :: A list of Node objects which neighbor this Node.
1 for n2
in n.all_neighbors():
| def psynth.psynth.Node.detail_list |
( |
|
self | ) |
|
Returns a list of Detail objects which are attached to this Node.
- Returns
- dets: list :: A list of Detail objects which are attached to this Node.
1 for d
in n.detail_list():
| def psynth.psynth.Node.details |
( |
|
self | ) |
|
Returns a uid-keyed dictionary of Detail objects which are attached to this Node.
- Returns
- dets: dict :: A uid-keyed dictionary of Detail objects which are attached to this Node.
2 print n.details()[d].anchor() == n
| def psynth.psynth.Node.dictionary |
( |
|
self | ) |
|
Returns a dictionary with this Node's properties, as required by the API.
Generally used to build queries.
- Returns
- dict: dict :: A dictionary of this Node's properties.
| def psynth.psynth.Node.in_links |
( |
|
self | ) |
|
Returns a list of Link objects which terminate at this Node.
- Returns
- links: list :: A list of Link objects which terminate at this Node.
1 for link
in n.in_links():
| def psynth.psynth.Node.in_neighbors |
( |
|
self | ) |
|
Returns a list of Node objects which neighbor this Node by incoming Link.
- Returns
- nodes: list :: A list of Node objects which neighbor this Node by incoming Link.
1 for n2
in n.in_neighbors():
| def psynth.psynth.Node.out_links |
( |
|
self | ) |
|
Returns a list of Link objects which originate at this Node.
- Returns
- links: list :: A list of Link objects which originate at this Node.
1 for link
in n.out_links():
| def psynth.psynth.Node.out_neighbors |
( |
|
self | ) |
|
Returns a list of Node objects which neighbor this Node by outgoing Link.
- Returns
- nodes: list :: A list of Node objects which neighbor this Node by outgoing Link.
1 for n2
in n.out_neighbors():
| def psynth.psynth.Node.update |
( |
|
self, |
|
|
|
callback = None |
|
) |
| |
Updates the register of this Node on the server.
- Parameters
-
| callback | function :: An optional function to handle the server's response to the query. |
1 n.name =
"Different Node Name"
str :: The color of the Node.
e.g. '#FF0000'
| psynth.psynth.Node.created |
bool :: Whether or not this Node has been created on the Server.
| psynth.psynth.Node.graph = None |
|
static |
str :: The URL for an image to display on this Node.
str :: The display name of the Node.
int :: The number of sides of the Node shape.
0 for circle, 1 for image, otherwise n-gon.
str :: The global unique id of the Node.
float :: The x-coordinate of the Node.
Assumes a web-standard grid with (0,0) at (top,left)
float :: The y-coordinate of the Node.
Assumes a web-standard grid with (0,0) at (top,left)
The documentation for this class was generated from the following file:
- /Users/psymac0/GitHub/python_psynth/psynth/psynth.py