graphics/FBD_Objects.py
changeset 1739 ec153828ded2
parent 1736 7e61baa047f0
child 1740 b789b695b5c6
equal deleted inserted replaced
1738:d2e979738700 1739:ec153828ded2
   218                     resulttype = outputtype
   218                     resulttype = outputtype
   219         return resulttype
   219         return resulttype
   220 
   220 
   221     # Returns all the block connectors
   221     # Returns all the block connectors
   222     def GetConnectors(self):
   222     def GetConnectors(self):
   223         return {"inputs" : self.Inputs, "outputs" : self.Outputs}
   223         return {"inputs": self.Inputs, "outputs": self.Outputs}
   224 
   224 
   225     # Test if point given is on one of the block connectors
   225     # Test if point given is on one of the block connectors
   226     def TestConnector(self, pt, direction = None, exclude = True):
   226     def TestConnector(self, pt, direction = None, exclude = True):
   227         # Test each input connector
   227         # Test each input connector
   228         for input in self.Inputs:
   228         for input in self.Inputs:
   418 
   418 
   419     def GetToolTipValue(self):
   419     def GetToolTipValue(self):
   420         return self.Description
   420         return self.Description
   421 
   421 
   422     # Adds an highlight to the block
   422     # Adds an highlight to the block
   423     def AddHighlight(self, infos, start, end ,highlight_type):
   423     def AddHighlight(self, infos, start, end, highlight_type):
   424         if infos[0] in ["type", "name"] and start[0] == 0 and end[0] == 0:
   424         if infos[0] in ["type", "name"] and start[0] == 0 and end[0] == 0:
   425             highlights = self.Highlights.setdefault(infos[0], [])
   425             highlights = self.Highlights.setdefault(infos[0], [])
   426             AddHighlight(highlights, (start, end, highlight_type))
   426             AddHighlight(highlights, (start, end, highlight_type))
   427         elif infos[0] == "input" and infos[1] < len(self.Inputs):
   427         elif infos[0] == "input" and infos[1] < len(self.Inputs):
   428             self.Inputs[infos[1]].AddHighlight(infos[2:], start, end, highlight_type)
   428             self.Inputs[infos[1]].AddHighlight(infos[2:], start, end, highlight_type)
   841             connection.SetPosition(self.Pos.x, self.Pos.y)
   841             connection.SetPosition(self.Pos.x, self.Pos.y)
   842         connection.Connector = self.Connector.Clone(connection)
   842         connection.Connector = self.Connector.Clone(connection)
   843         return connection
   843         return connection
   844 
   844 
   845     def GetConnectorTranslation(self, element):
   845     def GetConnectorTranslation(self, element):
   846         return {self.Connector : element.Connector}
   846         return {self.Connector: element.Connector}
   847 
   847 
   848     # Unconnect connector
   848     # Unconnect connector
   849     def Clean(self):
   849     def Clean(self):
   850         if self.Connector:
   850         if self.Connector:
   851             self.Connector.UnConnect(delete = True)
   851             self.Connector.UnConnect(delete = True)