/[ascend]/trunk/pygtk/canvas/blocktype.py
ViewVC logotype

Diff of /trunk/pygtk/canvas/blocktype.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1959 by jpye, Mon Nov 17 11:51:01 2008 UTC revision 1961 by jpye, Tue Nov 18 03:48:21 2008 UTC
# Line 40  class BlockType: Line 40  class BlockType:
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    

Legend:
Removed from v.1959  
changed lines
  Added in v.1961

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22