graphics/FBD_Objects.py
changeset 1847 6198190bc121
parent 1782 5b6ad7a7fd9d
child 1852 70c1cc354a8f
equal deleted inserted replaced
1846:14b40afccd69 1847:6198190bc121
   250                 self.Colour = wx.BLACK
   250                 self.Colour = wx.BLACK
   251                 inputs = [input for input in blocktype["inputs"]]
   251                 inputs = [input for input in blocktype["inputs"]]
   252                 outputs = [output for output in blocktype["outputs"]]
   252                 outputs = [output for output in blocktype["outputs"]]
   253                 if blocktype["extensible"]:
   253                 if blocktype["extensible"]:
   254                     start = int(inputs[-1][0].replace("IN", ""))
   254                     start = int(inputs[-1][0].replace("IN", ""))
   255                     for i in xrange(self.Extension - len(blocktype["inputs"])):
   255                     for dummy in xrange(self.Extension - len(blocktype["inputs"])):
   256                         start += 1
   256                         start += 1
   257                         inputs.append(("IN%d" % start, inputs[-1][1], inputs[-1][2]))
   257                         inputs.append(("IN%d" % start, inputs[-1][1], inputs[-1][2]))
   258                 comment = blocktype["comment"]
   258                 comment = blocktype["comment"]
   259                 self.Description = _(comment) + blocktype.get("usage", "")
   259                 self.Description = _(comment) + blocktype.get("usage", "")
   260             else:
   260             else:
   350     # Refresh the block minimum size
   350     # Refresh the block minimum size
   351     def RefreshMinSize(self):
   351     def RefreshMinSize(self):
   352         # Calculate the inputs maximum width
   352         # Calculate the inputs maximum width
   353         max_input = 0
   353         max_input = 0
   354         for input in self.Inputs:
   354         for input in self.Inputs:
   355             w, h = input.GetNameSize()
   355             w, _h = input.GetNameSize()
   356             max_input = max(max_input, w)
   356             max_input = max(max_input, w)
   357         # Calculate the outputs maximum width
   357         # Calculate the outputs maximum width
   358         max_output = 0
   358         max_output = 0
   359         for output in self.Outputs:
   359         for output in self.Outputs:
   360             w, h = output.GetNameSize()
   360             w, _h = output.GetNameSize()
   361             max_output = max(max_output, w)
   361             max_output = max(max_output, w)
   362         width = max(self.TypeSize[0] + 10, max_input + max_output + 15)
   362         width = max(self.TypeSize[0] + 10, max_input + max_output + 15)
   363         height = (max(len(self.Inputs), len(self.Outputs)) + 1) * BLOCK_LINE_SIZE
   363         height = (max(len(self.Inputs), len(self.Outputs)) + 1) * BLOCK_LINE_SIZE
   364         self.MinSize = width, height
   364         self.MinSize = width, height
   365 
   365