equal
deleted
inserted
replaced
206 def GetProjectPouVariables(self, pou_name=None): |
206 def GetProjectPouVariables(self, pou_name=None): |
207 variables = [] |
207 variables = [] |
208 for pou in self.Project.getPous(): |
208 for pou in self.Project.getPous(): |
209 if not pou_name or pou_name == pou.getName(): |
209 if not pou_name or pou_name == pou.getName(): |
210 variables.extend([var["Name"] for var in self.GetPouInterfaceVars(pou)]) |
210 variables.extend([var["Name"] for var in self.GetPouInterfaceVars(pou)]) |
211 if pou.getBodyType() == "SFC": |
211 for transition in pou.getTransitionList(): |
212 for transition in pou.getTransitionList(): |
212 variables.append(transition.getName()) |
213 variables.append(transition.getName()) |
213 for action in pou.getActionList(): |
214 for action in pou.getActionList(): |
214 variables.append(action.getName()) |
215 variables.append(action.getName()) |
|
216 return variables |
215 return variables |
217 |
216 |
218 # Return if project is saved |
217 # Return if project is saved |
219 def ProjectIsSaved(self): |
218 def ProjectIsSaved(self): |
220 return self.ProjectBuffer.IsCurrentSaved() |
219 return self.ProjectBuffer.IsCurrentSaved() |
1155 if pou.getBodyType() == "SFC": |
1154 if pou.getBodyType() == "SFC": |
1156 actions = [] |
1155 actions = [] |
1157 for action in pou.getActionList(): |
1156 for action in pou.getActionList(): |
1158 actions.append(action.getName()) |
1157 actions.append(action.getName()) |
1159 return actions |
1158 return actions |
|
1159 return [] |
|
1160 |
|
1161 # Return the names of the pou elements |
|
1162 def GetCurrentElementEditingVariables(self): |
|
1163 if self.CurrentElementEditing != None: |
|
1164 current_name = self.ElementsOpened[self.CurrentElementEditing] |
|
1165 words = current_name.split("::") |
|
1166 if len(words) == 1: |
|
1167 return self.GetProjectPouVariables(current_name) |
|
1168 else: |
|
1169 return self.GetProjectPouVariables(words[1]) |
1160 return [] |
1170 return [] |
1161 |
1171 |
1162 # Return the current pou editing informations |
1172 # Return the current pou editing informations |
1163 def GetCurrentElementEditingInstanceInfos(self, id = None, exclude = []): |
1173 def GetCurrentElementEditingInstanceInfos(self, id = None, exclude = []): |
1164 infos = {} |
1174 infos = {} |
1337 infos["connectors"]["output"]["position"] = instance.connectionPointOut.getRelPosition() |
1347 infos["connectors"]["output"]["position"] = instance.connectionPointOut.getRelPosition() |
1338 if infos["condition_type"] == "connection": |
1348 if infos["condition_type"] == "connection": |
1339 infos["connectors"]["connection"] = {} |
1349 infos["connectors"]["connection"] = {} |
1340 infos["connectors"]["connection"]["links"] = [] |
1350 infos["connectors"]["connection"]["links"] = [] |
1341 connections = instance.getConnections() |
1351 connections = instance.getConnections() |
1342 print connections |
|
1343 if connections: |
1352 if connections: |
1344 for link in connections: |
1353 for link in connections: |
1345 dic = {"refLocalId":link.getRefLocalId(),"points":link.getPoints(),"formalParameter":link.getFormalParameter()} |
1354 dic = {"refLocalId":link.getRefLocalId(),"points":link.getPoints(),"formalParameter":link.getFormalParameter()} |
1346 infos["connectors"]["connection"]["links"].append(dic) |
1355 infos["connectors"]["connection"]["links"].append(dic) |
1347 infos["condition"] = None |
1356 infos["condition"] = None |
1792 self.GetCurrentElementEditing().addInstance("transition", transition) |
1801 self.GetCurrentElementEditing().addInstance("transition", transition) |
1793 |
1802 |
1794 def SetCurrentElementEditingTransitionInfos(self, id, infos): |
1803 def SetCurrentElementEditingTransitionInfos(self, id, infos): |
1795 transition = self.GetCurrentElementEditing().getInstance(id) |
1804 transition = self.GetCurrentElementEditing().getInstance(id) |
1796 for param, value in infos.items(): |
1805 for param, value in infos.items(): |
1797 if param == "type" and infos.get("condition", None): |
1806 if param == "type" and value != "connection": |
1798 transition.setConditionContent(value, infos["condition"]) |
1807 transition.setConditionContent(value, infos["condition"]) |
1799 elif param == "height": |
1808 elif param == "height": |
1800 transition.setHeight(value) |
1809 transition.setHeight(value) |
1801 elif param == "width": |
1810 elif param == "width": |
1802 transition.setWidth(value) |
1811 transition.setWidth(value) |
1813 output_connector = value["output"] |
1822 output_connector = value["output"] |
1814 position = output_connector.GetRelPosition() |
1823 position = output_connector.GetRelPosition() |
1815 transition.addConnectionPointOut() |
1824 transition.addConnectionPointOut() |
1816 transition.connectionPointOut.setRelPosition(position.x, position.y) |
1825 transition.connectionPointOut.setRelPosition(position.x, position.y) |
1817 if infos.get("type", None) == "connection": |
1826 if infos.get("type", None) == "connection": |
|
1827 transition.setConditionContent("connection", None) |
1818 connection_connector = value["connection"] |
1828 connection_connector = value["connection"] |
1819 self.SetConnectionWires(transition, connection_connector) |
1829 self.SetConnectionWires(transition, connection_connector) |
1820 |
1830 |
1821 def AddCurrentElementEditingDivergence(self, id, type): |
1831 def AddCurrentElementEditingDivergence(self, id, type): |
1822 if type == SELECTION_DIVERGENCE: |
1832 if type == SELECTION_DIVERGENCE: |