graphics/FBD_Objects.py
changeset 102 85875dcb7754
parent 99 2b18a72dcaf0
child 103 26c10e28ee3a
equal deleted inserted replaced
101:3f06a178b960 102:85875dcb7754
   136         return None
   136         return None
   137     
   137     
   138     def GetInputTypes(self):
   138     def GetInputTypes(self):
   139         return tuple([input.GetType() for input in self.Inputs])
   139         return tuple([input.GetType() for input in self.Inputs])
   140     
   140     
   141     def GetConnectionResultType(self, connector):
   141     def SetOutputValues(self, values):
   142         resulttype = None
   142         for output in self.Outputs:
       
   143             output.SetValue(values.get(ouput.getName(), None))
       
   144     
       
   145     def GetConnectionResultType(self, connector, connectortype):
       
   146         resulttype = connectortype
   143         for input in self.Inputs:
   147         for input in self.Inputs:
   144             name = input.GetName()
   148             name = input.GetName()
   145             if input != connector and (name.startswith("IN") or name in ["MN", "MX"]):
   149             if input != connector and (name.startswith("IN") or name in ["MN", "MX"]):
   146                 inputtype = input.GetConnectedType()
   150                 inputtype = input.GetConnectedType()
   147                 if resulttype is None or inputtype is not None and IsOfType(inputtype, resulttype):
   151                 if resulttype is None or inputtype is not None and IsOfType(inputtype, resulttype):
   476         # Edit the variable properties
   480         # Edit the variable properties
   477         self.Parent.EditVariableContent(self)
   481         self.Parent.EditVariableContent(self)
   478     
   482     
   479     # Method called when a RightUp event have been generated
   483     # Method called when a RightUp event have been generated
   480     def OnRightUp(self, event, dc, scaling):
   484     def OnRightUp(self, event, dc, scaling):
   481         pos = GetScaledEventPosition(event, dc, scaling)
   485         self.Parent.PopupDefaultMenu()
   482         # Popup the menu with special items for a variable and a connector if it's handled
       
   483         connector = self.TestConnector(pos, False)
       
   484         if connector:
       
   485             self.Handle = (HANDLE_CONNECTOR, connector)
       
   486             self.Parent.PopupVariableMenu(connector)
       
   487         else:
       
   488             self.Parent.PopupVariableMenu()
       
   489     
   486     
   490     # Refreshes the variable model
   487     # Refreshes the variable model
   491     def RefreshModel(self, move=True):
   488     def RefreshModel(self, move=True):
   492         self.Parent.RefreshVariableModel(self)
   489         self.Parent.RefreshVariableModel(self)
   493         # If variable has moved and variable is not of type OUTPUT, refresh the model
   490         # If variable has moved and variable is not of type OUTPUT, refresh the model