1 |
|
from gaphas.item import Line |
|
# This class is not yet used, but should be. |
|
2 |
|
|
3 |
class LineInstance: |
class LineInstance: |
4 |
""" |
""" |
5 |
Class representation of the ASCEND 'ARE_THE_SAME' relationship |
Class representation of the ASCEND 'ARE_THE_SAME' relationship |
6 |
signified by a ConnectorLine on the BlockCanvas. |
signified by a ConnectorLine on the BlockCanvas. |
7 |
|
|
8 |
|
There will be a reference to a LineInstance stored within a |
9 |
|
LineItem object. |
10 |
|
|
11 |
|
The intention is that it should be possible to encapsulate all the |
12 |
|
non-graphical information about a canvas model using a number of |
13 |
|
BlockInstance and LineInstance objects, and no Gaphas objects. It |
14 |
|
should be possible to pickle this collection of objects and have everything |
15 |
|
that is necessary for passing the model to ASCEND -- this provides the |
16 |
|
clean separation of ASCEND-related and Gaphas-releated code, hopefully. |
17 |
""" |
""" |
18 |
|
|
19 |
def __init__(self): |
def __init__(self): |
20 |
self.fromblock = None |
self.connectedblocks = [] |
|
self.toblock = None |
|
21 |
|
|
22 |
def __str__(self): |
def __str__(self): |
23 |
s += ("\t%s, %s ARE_THE_SAME;\n" % (li.fromblock.name, li.toblock.name)) |
""" |
24 |
|
Representation of this line requires the name object from the |
25 |
|
BlockInstance as well as name associated with the connected Port |
26 |
|
(still a problem). |
27 |
|
""" |
28 |
|
try: |
29 |
|
return ("\t%s, %s ARE_THE_SAME;\n" % (li.fromblock.name, li.toblock.name)) |
30 |
|
except: |
31 |
|
return "" |
32 |
|
|