40 |
|
|
41 |
def __getstate__(self): |
def __getstate__(self): |
42 |
print "GET STATE ON BLOCKTYPE %s" % self.type.getName() |
print "GET STATE ON BLOCKTYPE %s" % self.type.getName() |
43 |
return (str(self.type.getName()),) |
return (str(self.type.getName()),len(self.inputs), len(self.outputs)) |
44 |
|
|
45 |
def __setstate__(self, state): |
def __setstate__(self, state): |
46 |
print "SET STATE ON BLOCKTYPE" |
print "SET STATE ON BLOCKTYPE" |
47 |
(typename,) = state |
(typename,ninputs,noutputs) = state |
48 |
print "Recreating type '%s'" % typename |
print "Recreating type '%s' with %d inputs, %d outputs" % (typename,ninputs,noutputs) |
49 |
self.type = None |
self.type = None |
50 |
self.notesdb = None |
self.notesdb = None |
51 |
self._typename = typename |
self._typename = typename |
52 |
|
self.inputs = range(ninputs) |
53 |
|
self.outputs = range(noutputs) |
54 |
|
print "outputs =", self.outputs |
55 |
|
|
56 |
def reattach_ascend(self,library): |
def reattach_ascend(self,library, notesdb): |
57 |
self.type = library.findType(self._typename) |
self.type = library.findType(self._typename) |
58 |
|
|
59 |
|
nn = notesdb.getTypeRefinedNotesLang(self.type,ascpy.SymChar("inline")) |
60 |
|
|
61 |
|
self.inputs = [] |
62 |
|
self.outputs = [] |
63 |
|
for n in nn: |
64 |
|
t = n.getText() |
65 |
|
if t[0:min(len(t),3)]=="in:": |
66 |
|
self.inputs += [n] |
67 |
|
elif t[0:min(len(t),4)]=="out:": |
68 |
|
self.outputs += [n] |
69 |
|
|
70 |
|
print "Reattached type '%s', with %d inputs, %d outputs" % (self.type.getName(), len(self.inputs), len(self.outputs)) |
71 |
|
|