92 for output in self.Outputs: |
92 for output in self.Outputs: |
93 output.UnConnect(delete = True) |
93 output.UnConnect(delete = True) |
94 |
94 |
95 # Refresh the size of text for name |
95 # Refresh the size of text for name |
96 def RefreshNameSize(self): |
96 def RefreshNameSize(self): |
97 dc = wx.ClientDC(self.Parent) |
97 self.NameSize = self.Parent.GetTextExtent(self.Name) |
98 self.NameSize = dc.GetTextExtent(self.Name) |
|
99 |
98 |
100 # Refresh the size of text for execution order |
99 # Refresh the size of text for execution order |
101 def RefreshExecutionOrderSize(self): |
100 def RefreshExecutionOrderSize(self): |
102 dc = wx.ClientDC(self.Parent) |
101 self.ExecutionOrderSize = self.Parent.GetTextExtent(str(self.ExecutionOrder)) |
103 self.ExecutionOrderSize = dc.GetTextExtent(str(self.ExecutionOrder)) |
|
104 |
102 |
105 # Refresh the block bounding box |
103 # Refresh the block bounding box |
106 def RefreshBoundingBox(self): |
104 def RefreshBoundingBox(self): |
107 # Calculate the size of the name outside the block |
105 # Calculate the size of the name outside the block |
108 text_width, text_height = self.NameSize |
106 text_width, text_height = self.NameSize |
214 # Changes the block type |
212 # Changes the block type |
215 def SetType(self, type, extension, inputs = None, connectors = {}): |
213 def SetType(self, type, extension, inputs = None, connectors = {}): |
216 if type != self.Type or self.Extension != extension: |
214 if type != self.Type or self.Extension != extension: |
217 if type != self.Type: |
215 if type != self.Type: |
218 self.Type = type |
216 self.Type = type |
219 dc = wx.ClientDC(self.Parent) |
217 self.TypeSize = self.Parent.GetTextExtent(self.Type) |
220 self.TypeSize = dc.GetTextExtent(self.Type) |
|
221 self.Extension = extension |
218 self.Extension = extension |
222 # Find the block definition from type given and create the corresponding |
219 # Find the block definition from type given and create the corresponding |
223 # inputs and outputs |
220 # inputs and outputs |
224 blocktype = GetBlockType(type, inputs) |
221 blocktype = GetBlockType(type, inputs) |
225 if blocktype: |
222 if blocktype: |
438 def Delete(self): |
435 def Delete(self): |
439 self.Parent.DeleteVariable(self) |
436 self.Parent.DeleteVariable(self) |
440 |
437 |
441 # Refresh the size of text for name |
438 # Refresh the size of text for name |
442 def RefreshNameSize(self): |
439 def RefreshNameSize(self): |
443 dc = wx.ClientDC(self.Parent) |
440 self.NameSize = self.Parent.GetTextExtent(self.Name) |
444 self.NameSize = dc.GetTextExtent(self.Name) |
|
445 |
441 |
446 # Refresh the size of text for execution order |
442 # Refresh the size of text for execution order |
447 def RefreshExecutionOrderSize(self): |
443 def RefreshExecutionOrderSize(self): |
448 dc = wx.ClientDC(self.Parent) |
444 self.ExecutionOrderSize = self.Parent.GetTextExtent(str(self.ExecutionOrder)) |
449 self.ExecutionOrderSize = dc.GetTextExtent(str(self.ExecutionOrder)) |
|
450 |
445 |
451 # Refresh the variable bounding box |
446 # Refresh the variable bounding box |
452 def RefreshBoundingBox(self): |
447 def RefreshBoundingBox(self): |
453 if self.Type in (OUTPUT, INOUT): |
448 if self.Type in (OUTPUT, INOUT): |
454 bbx_x = self.Pos.x - CONNECTOR_SIZE |
449 bbx_x = self.Pos.x - CONNECTOR_SIZE |
666 def Delete(self): |
661 def Delete(self): |
667 self.Parent.DeleteConnection(self) |
662 self.Parent.DeleteConnection(self) |
668 |
663 |
669 # Refresh the size of text for name |
664 # Refresh the size of text for name |
670 def RefreshNameSize(self): |
665 def RefreshNameSize(self): |
671 dc = wx.ClientDC(self.Parent) |
666 self.NameSize = self.Parent.GetTextExtent(self.Name) |
672 self.NameSize = dc.GetTextExtent(self.Name) |
|
673 |
667 |
674 # Refresh the connection bounding box |
668 # Refresh the connection bounding box |
675 def RefreshBoundingBox(self): |
669 def RefreshBoundingBox(self): |
676 if self.Type == CONNECTOR: |
670 if self.Type == CONNECTOR: |
677 bbx_x = self.Pos.x - CONNECTOR_SIZE |
671 bbx_x = self.Pos.x - CONNECTOR_SIZE |