Links connect Node objects to each other.
More...
Links connect Node objects to each other.
They have a LinkType. Detail objects can be attached to them.
| def psynth.psynth.Link.__init__ |
( |
|
self, |
|
|
|
origin_uid, |
|
|
|
terminus_uid, |
|
|
|
type, |
|
|
|
name = "Link", |
|
|
|
value = 1, |
|
|
|
uid = None |
|
) |
| |
Constructs a Link object.
- Parameters
-
| origin_uid | str :: The uid of the origin Node. |
| terminus_uid | str :: The uid of the terminus Node. |
| type | str :: The name of the LinkType that describes this Link. |
| name | str :: The displayed name of this Link. |
| value | int :: The value of this Link. |
| uid | str :: The global unique identifier of this Link. |
1 my_link = Link(origin_node.uid, terminus_node.uid,
'Money', value=60)
| def psynth.psynth.Link.add_detail |
( |
|
self, |
|
|
|
detail, |
|
|
|
update = True, |
|
|
|
callback = None |
|
) |
| |
Attaches a Detail to this Link.
- Parameters
-
| detail | Detail :: The Detail to attach to this Link. |
| 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.Link.center |
( |
|
self | ) |
|
Returns the center point of this Link.
- Returns
- point: dict :: A dictionary {x,y} identifying the center of this Link.
1 if link.center()[
'x'] > 42:
2 print link.center()[
'y']
| def psynth.psynth.Link.detail_list |
( |
|
self | ) |
|
Returns a list of Detail objects which are attached to this Link.
- Returns
- details: list :: A list of Detail objects which are attached to this Link.
1 for d
in n.detail_list():
| def psynth.psynth.Link.details |
( |
|
self | ) |
|
Returns a uid-keyed dictionary of Detail objects which are attached to this Link.
- Returns
- details: dict :: A uid-keyed dictionary of Detail objects which are attached to this Link.
2 print n.details()[d].anchor() == n
| def psynth.psynth.Link.dictionary |
( |
|
self | ) |
|
Returns a dictionary of this Link's properties, as required by the API.
Generally used internally to build queries.
- Returns
- dict: dict :: A dictionary of this Link's properties.
| def psynth.psynth.Link.link_type |
( |
|
self | ) |
|
Returns the LinkType object that this Link is a member of.
- Returns
- link_type: LinkType ::
1 print link.link_type().color
| def psynth.psynth.Link.origin |
( |
|
self | ) |
|
Returns the origin Node.
- Returns
- origin: Node ::
1 print link.origin().name
| def psynth.psynth.Link.parallel |
( |
|
self | ) |
|
Returns a list of Links which are parallel to this Link, meaning that they share two nodes, regardless of direction.
- Returns
- links: list :: A list of Links which are parallel to this Link.
2 for l2
in l.parallel():
| def psynth.psynth.Link.terminus |
( |
|
self | ) |
|
Returns the terminus Node.
- Returns
- terminus: Node ::
1 print link.terminus().name
| def psynth.psynth.Link.update |
( |
|
self, |
|
|
|
callback = None |
|
) |
| |
Updates the server's registry of this Link.
- Parameters
-
| callback | function :: An optional function to handle the server's response to the query. |
2 l.name =
"New Link Name"
| psynth.psynth.Link.created |
bool :: Whether or not this Link has been created on the server.
| psynth.psynth.Link.graph = None |
|
static |
| psynth.psynth.Link.origin_uid |
str :: The global unique id of the origin node.
| psynth.psynth.Link.terminus_uid |
str :: The global unique id of the terminus node.
The documentation for this class was generated from the following file:
- /Users/psymac0/GitHub/python_psynth/psynth/psynth.py