Adding support for avoiding name conflicts
authorlbessard
Mon, 13 Aug 2007 18:06:50 +0200
changeset 70 0e48629c1e6d
parent 69 8fbff50141f8
child 71 0578bc212c20
Adding support for avoiding name conflicts
Dialogs.py
PLCControler.py
PLCGenerator.py
PLCOpenEditor.py
Viewer.py
examples/example.xml
--- a/Dialogs.py	Mon Aug 13 18:04:19 2007 +0200
+++ b/Dialogs.py	Mon Aug 13 18:06:50 2007 +0200
@@ -152,6 +152,9 @@
         self.Inputs.Enable(False)
         self.Block = None
         self.MinBlockSize = None
+        
+        self.PouNames = []
+        self.PouElementNames = []
     
     def FindTreeItem(self, root, name, inputs = None):
         if root.IsOk():
@@ -174,14 +177,32 @@
     def OnOK(self, event):
         error = []
         selected = self.TypeTree.GetSelection()
+        block_name = self.Name.GetValue()
+        name_enabled = self.Name.IsEnabled()
         if not selected.IsOk() or self.TypeTree.GetItemParent(selected) == self.TypeTree.GetRootItem() or selected == self.TypeTree.GetRootItem():
             message = wx.MessageDialog(self, "Form isn't complete. Valid block type must be selected!", "Error", wx.OK|wx.ICON_ERROR)
             message.ShowModal()
             message.Destroy()
-        elif self.Name.IsEnabled() and self.Name.GetValue() == "":
+        elif name_enabled and block_name == "":
             message = wx.MessageDialog(self, "Form isn't complete. Name must be filled!", "Error", wx.OK|wx.ICON_ERROR)
             message.ShowModal()
             message.Destroy()
+        elif name_enabled and not TestIdentifier(block_name):
+            message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%block_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        elif name_enabled and block_name.upper() in IEC_KEYWORDS:
+            message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%block_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        elif name_enabled and block_name.upper() in self.PouNames:
+            message = wx.MessageDialog(self, "\"%s\" pou already exists!"%block_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        elif name_enabled and block_name.upper() in self.PouElementNames:
+            message = wx.MessageDialog(self, "\"%s\" element for this pou already exists!"%block_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
         else:
             self.EndModal(wx.ID_OK)
 
@@ -198,6 +219,12 @@
     def SetMinBlockSize(self, size):
         self.MinBlockSize = size
 
+    def SetPouNames(self, pou_names):
+        self.PouNames = [pou_name.upper() for pou_name in pou_names]
+        
+    def SetPouElementNames(self, element_names):
+        self.PouElementNames = [element_name.upper() for element_name in element_names]
+        
     def SetValues(self, values):
         for name, value in values.items():
             if name == "type":
--- a/PLCControler.py	Mon Aug 13 18:04:19 2007 +0200
+++ b/PLCControler.py	Mon Aug 13 18:06:50 2007 +0200
@@ -208,11 +208,10 @@
         for pou in self.Project.getPous():
             if not pou_name or pou_name == pou.getName():
                 variables.extend([var["Name"] for var in self.GetPouInterfaceVars(pou)])
-                if pou.getBodyType() == "SFC":
-                    for transition in pou.getTransitionList():
-                        variables.append(transition.getName())
-                    for action in pou.getActionList():
-                        variables.append(action.getName())
+                for transition in pou.getTransitionList():
+                    variables.append(transition.getName())
+                for action in pou.getActionList():
+                    variables.append(action.getName())
         return variables
     
     # Return if project is saved
@@ -1159,6 +1158,17 @@
                 return actions
         return []
 
+    # Return the names of the pou elements
+    def GetCurrentElementEditingVariables(self):
+        if self.CurrentElementEditing != None:
+            current_name = self.ElementsOpened[self.CurrentElementEditing]
+            words = current_name.split("::")
+            if len(words) == 1:
+                return self.GetProjectPouVariables(current_name)
+            else:
+                return self.GetProjectPouVariables(words[1])
+        return []
+
     # Return the current pou editing informations
     def GetCurrentElementEditingInstanceInfos(self, id = None, exclude = []):
         infos = {}
@@ -1339,7 +1349,6 @@
                     infos["connectors"]["connection"] = {}
                     infos["connectors"]["connection"]["links"] = []
                     connections = instance.getConnections()
-                    print connections
                     if connections:
                         for link in connections:
                             dic = {"refLocalId":link.getRefLocalId(),"points":link.getPoints(),"formalParameter":link.getFormalParameter()}
@@ -1794,7 +1803,7 @@
     def SetCurrentElementEditingTransitionInfos(self, id, infos):
         transition = self.GetCurrentElementEditing().getInstance(id)
         for param, value in infos.items():
-            if param == "type" and infos.get("condition", None):
+            if param == "type" and value != "connection":
                 transition.setConditionContent(value, infos["condition"])
             elif param == "height":
                 transition.setHeight(value)
@@ -1815,6 +1824,7 @@
                 transition.addConnectionPointOut()
                 transition.connectionPointOut.setRelPosition(position.x, position.y)
                 if infos.get("type", None) == "connection":
+                    transition.setConditionContent("connection", None)
                     connection_connector = value["connection"]
                     self.SetConnectionWires(transition, connection_connector)
     
--- a/PLCGenerator.py	Mon Aug 13 18:04:19 2007 +0200
+++ b/PLCGenerator.py	Mon Aug 13 18:06:50 2007 +0200
@@ -62,6 +62,7 @@
         self.Interface = []
         self.InitialSteps = []
         self.BlockComputed = {}
+        self.ComputedBlocks = ""
         self.SFCNetworks = {"Steps":{}, "Transitions":{}, "Actions":{}}
         self.ActionNumber = 0
         self.Program = ""
@@ -130,11 +131,11 @@
                     self.GenerateSFCTransition(instance, pou)
                 elif isinstance(instance, plcopen.jumpStep):
                     self.GenerateSFCJump(instance, pou)
-            if len(self.InitialSteps) > 0:
+            if len(self.InitialSteps) > 0 and self.ComputedBlocks != "":
                 action_name = "COMPUTE_FUNCTION_BLOCKS"
                 action_infos = {"qualifier" : "S", "content" : action_name}
                 self.SFCNetworks["Steps"][self.InitialSteps[0]]["actions"].append(action_infos)
-                self.SFCNetworks["Actions"][action_name] = ReIndentText(self.Program, 4)
+                self.SFCNetworks["Actions"][action_name] = ReIndentText(self.ComputedBlocks, 4)
                 self.Program = ""
             else:
                 raise Exception
@@ -205,7 +206,7 @@
             if isinstance(next, plcopen.leftPowerRail) or isinstance(next, plcopen.contact):
                 return "LD"
             elif isinstance(next, plcopen.block):
-                 for variable in instance.inputVariables.getVariable():
+                 for variable in next.inputVariables.getVariable():
                      result = self.GetNetworkType(variable.connectionPointIn.getConnections(), body)
                      if result != "FBD":
                          return result
@@ -326,16 +327,18 @@
                             connections = instance.connectionPointIn.getConnections()
                             if connections and len(connections) == 1:
                                 expression = self.ComputeFBDExpression(actionBody, connections[0])
-                                self.SFCNetworks["Actions"][action_name] = self.Program + "  %s := %s;\n"%(var, expression)
+                                action_content = self.Program + "  %s := %s;\n"%(var, expression)
                                 self.Program = ""
+                                self.SFCNetworks["Actions"][action_name] = ReIndentText(action_content, 4)
                 elif actionType == "LD":
                     for instance in actionbody.getContentInstances():
                         if isinstance(instance, plcopen.coil):
                             paths = self.GenerateLDPaths(instance.connectionPointIn.getConnections(), actionBody)
                             variable = self.ExtractModifier(instance, instance.getVariable())
                             expression = self.ComputeLDExpression(paths, True)
-                            self.SFCNetworks["Actions"][action_name] = self.Program + "  %s := %s;\n"%(variable, expression)
+                            action_content = self.Program + "  %s := %s;\n"%(variable, expression)
                             self.Program = ""
+                            self.SFCNetworks["Actions"][action_name] = ReIndentText(action_content, 4)
     
     def GenerateSFCTransition(self, transition, pou):
         if transition not in self.SFCNetworks["Transitions"].keys():
@@ -374,12 +377,16 @@
                             if connections and len(connections) == 1:
                                 expression = self.ComputeFBDExpression(transitionBody, connections[0])
                                 transition_infos["content"] = "\n    := %s;\n"%expression
+                                self.ComputedBlocks += self.Program
+                                self.Program = ""
                 elif transitionType == "LD":
                     for instance in transitionBody.getContentInstances():
                         if isinstance(instance, plcopen.coil):
                             paths = self.GenerateLDPaths(instance.connectionPointIn.getConnections(), transitionBody)
                             expression = self.ComputeLDExpression(paths, True)
                             transition_infos["content"] = "\n    := %s;\n"%expression
+                            self.ComputedBlocks += self.Program
+                            self.Program = ""
             elif transitionValues["type"] == "connection":
                 body = pou.getBody()
                 connections = transition.getConnections()
@@ -390,9 +397,13 @@
                     paths = self.GenerateLDPaths(connections, body)
                     expression = self.ComputeLDExpression(paths, True)
                     transition_infos["content"] = "\n    := %s;\n"%expression
+                    self.ComputedBlocks += self.Program
+                    self.Program = ""
                 else:
                     expression = self.ComputeFBDExpression(body, connections[0])
                     transition_infos["content"] = "\n    := %s;\n"%expression
+                    self.ComputedBlocks += self.Program
+                    self.Program = ""
             for step in steps:
                 self.GenerateSFCStep(step, pou)
                 step_name = step.getName()
--- a/PLCOpenEditor.py	Mon Aug 13 18:04:19 2007 +0200
+++ b/PLCOpenEditor.py	Mon Aug 13 18:06:50 2007 +0200
@@ -414,8 +414,8 @@
         
         self.CurrentToolBar = []
         self.CurrentLanguage = ""
-        self.DrawingMode = FREEDRAWING_MODE
-        #self.DrawingMode = DRIVENDRAWING_MODE
+        #self.DrawingMode = FREEDRAWING_MODE
+        self.DrawingMode = DRIVENDRAWING_MODE
         
         self.RefreshFileMenu()
         self.RefreshEditMenu()
@@ -829,10 +829,10 @@
                 if itemtype == ITEM_PROJECT:
                     self.Controler.SetProjectProperties(name = new_name)
                 elif itemtype == ITEM_POU:
-                    if new_name.upper() in self.Controler.GetProjectPouNames():
+                    if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
                         message = "\"%s\" pou already exists!"%new_name
                         abort = True
-                    elif new_name.upper() in self.Controler.GetProjectPouVariables():
+                    elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariables()]:
                         messageDialog = wx.MessageDialog(self, "A variable is defined with \"%s\" as name. It can generate a conflict. Do you wish to continue?"%new_name, "Error", wx.YES_NO|wx.ICON_QUESTION)
                         if messageDialog.ShowModal() == wx.ID_NO:
                             abort = True
@@ -845,9 +845,9 @@
                     category = self.ProjectTree.GetItemParent(item)
                     pou = self.ProjectTree.GetItemParent(category)
                     pou_name = self.ProjectTree.GetItemText(pou)
-                    if new_name.upper() in self.Controler.GetProjectPouNames():
+                    if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
                         message = "A pou with \"%s\" as name exists!"%new_name
-                    elif new_name.upper() in self.Controler.GetProjectPouVariables(pou_name):
+                    elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariables(pou_name)]:
                         message = "A variable with \"%s\" as name already exists in this pou!"%new_name
                     else:
                         old_name = self.ProjectTree.GetItemText(item)
@@ -857,28 +857,14 @@
                     category = self.ProjectTree.GetItemParent(item)
                     pou = self.ProjectTree.GetItemParent(category)
                     pou_name = self.ProjectTree.GetItemText(pou)
-                    if new_name.upper() in self.Controler.GetProjectPouNames():
+                    if new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouNames()]:
                         message = "A pou with \"%s\" as name exists!"%new_name
-                    elif new_name.upper() in self.Controler.GetProjectPouVariables(pou_name):
+                    elif new_name.upper() in [name.upper() for name in self.Controler.GetProjectPouVariables(pou_name)]:
                         message = "A variable with \"%s\" as name already exists in this pou!"%new_name
                     else:
                         old_name = self.ProjectTree.GetItemText(item)
                         self.Controler.ChangePouActionName(pou_name, old_name, new_name)
                         self.RefreshTabsOpenedTitles()
-                elif itemtype == ITEM_VARIABLE:
-                    category = self.ProjectTree.GetItemParent(item)
-                    if self.ProjectTree.GetItemText(category) != 'Global':
-                        category = self.ProjectTree.GetItemParent(category)
-                    pou = self.ProjectTree.GetItemParent(category)
-                    pou_name = self.ProjectTree.GetItemText(pou)
-                    if new_name.upper() in self.Controler.GetProjectPouNames():
-                        message = "A pou with \"%s\" as name exists!"%new_name
-                    elif new_name.upper() in self.Controler.GetProjectPouVariables(pou_name):
-                        message = "A variable with \"%s\" as name already exists in this pou!"%new_name
-                    else:
-                        old_name = self.ProjectTree.GetItemText(item)
-                        self.Controler.ChangePouVariableName(pou_name, old_name, new_name)
-                        self.RefreshTabsOpenedTitles()
             if message or abort:
                 if message:
                     messageDialog = wx.MessageDialog(self, message, "Error", wx.OK|wx.ICON_ERROR)
@@ -1122,6 +1108,7 @@
     def OnAddPouMenu(self, event):
         dialog = PouDialog(self)
         dialog.SetPouNames(self.Controler.GetProjectPouNames())
+        dialog.SetPouElementNames(self.Controler.GetProjectPouVariables())
         if dialog.ShowModal() == wx.ID_OK:
             values = dialog.GetValues()
             self.Controler.ProjectAddPou(values["pouName"], values["pouType"], values["language"])
@@ -1174,6 +1161,8 @@
             pouname = self.ProjectTree.GetItemText(selected)
             if self.Controler.GetPouBodyType(pouname) == "SFC":
                 dialog = PouTransitionDialog(self)
+                dialog.SetPouNames(self.Controler.GetProjectPouNames())
+                dialog.SetPouElementNames(self.Controler.GetProjectPouVariables(pouname))
                 if dialog.ShowModal() == wx.ID_OK: 
                     values = dialog.GetValues()
                     self.Controler.ProjectAddPouTransition(pouname, values["transitionName"], values["language"])
@@ -1201,6 +1190,8 @@
             pouname = self.ProjectTree.GetItemText(selected)
             if self.Controler.GetPouBodyType(pouname) == "SFC":
                 dialog = PouActionDialog(self)
+                dialog.SetPouNames(self.Controler.GetProjectPouNames())
+                dialog.SetPouElementNames(self.Controler.GetProjectPouVariables(pouname))
                 if dialog.ShowModal() == wx.ID_OK:
                     values = dialog.GetValues()
                     self.Controler.ProjectAddPouAction(pouname, values["actionName"], values["language"])
@@ -1531,6 +1522,7 @@
         self.RefreshLanguage()
 
         self.PouNames = []
+        self.PouElementNames = []
 
     def OnOK(self, event):
         error = []
@@ -1565,6 +1557,12 @@
             message = wx.MessageDialog(self, "\"%s\" pou already exists!"%pou_name, "Error", wx.OK|wx.ICON_ERROR)
             message.ShowModal()
             message.Destroy()
+        elif pou_name.upper() in self.PouElementNames:
+            message = wx.MessageDialog(self, "A pou has an element with \"%s\" for name. It can generate a conflict. Do you wish to continue?"%pou_name, "Warning", wx.YES_NO|wx.ICON_EXCLAMATION)
+            result = message.ShowModal()
+            message.Destroy()
+            if result == wx.ID_YES:
+                self.EndModal(wx.ID_OK)
         else:
             self.EndModal(wx.ID_OK)
 
@@ -1584,6 +1582,9 @@
     def SetPouNames(self, pou_names):
         self.PouNames = [pou_name.upper() for pou_name in pou_names]
 
+    def SetPouElementNames(self, element_names):
+        self.PouElementNames = [element_name.upper() for element_name in element_names]
+
     def SetValues(self, values):
         for item, value in values.items():
             if item == "pouName":
@@ -1672,9 +1673,13 @@
         
         for option in ["IL","ST","LD","FBD"]:
             self.Language.Append(option)
+            
+        self.PouNames = []
+        self.PouElementNames = []
         
     def OnOK(self, event):
         error = []
+        transition_name = self.TransitionName.GetValue()
         if self.TransitionName.GetValue() == "":
             error.append("Transition Name")
         if self.Language.GetStringSelection() == "":
@@ -1691,9 +1696,31 @@
             message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
             message.ShowModal()
             message.Destroy()
+        elif not TestIdentifier(transition_name):
+            message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%transition_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        elif transition_name.upper() in IEC_KEYWORDS:
+            message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%transition_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        elif transition_name.upper() in self.PouNames:
+            message = wx.MessageDialog(self, "A pou with \"%s\" for name exists!"%transition_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        elif transition_name.upper() in self.PouElementNames:
+            message = wx.MessageDialog(self, "\"%s\" element for this pou already exists!"%transition_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
         else:
             self.EndModal(wx.ID_OK)
-
+    
+    def SetPouNames(self, pou_names):
+        self.PouNames = [pou_name.upper() for pou_name in pou_names]
+    
+    def SetPouElementNames(self, pou_names):
+        self.PouElementNames = [pou_name.upper() for pou_name in pou_names]
+    
     def SetValues(self, values):
         for item, value in values.items():
             if item == "transitionName":
@@ -1779,9 +1806,13 @@
         for option in ["IL","ST","LD","FBD"]:
             self.Language.Append(option)
         
+        self.PouNames = []
+        self.PouElementNames = []
+    
     def OnOK(self, event):
         error = []
-        if self.ActionName.GetValue() == "":
+        action_name = self.ActionName.GetValue()
+        if action_name == "":
             error.append("Action Name")
         if self.Language.GetStringSelection() == "":
             error.append("Language")
@@ -1797,9 +1828,31 @@
             message = wx.MessageDialog(self, "Form isn't complete. %s must be filled!"%text, "Error", wx.OK|wx.ICON_ERROR)
             message.ShowModal()
             message.Destroy()
+        elif not TestIdentifier(action_name):
+            message = wx.MessageDialog(self, "\"%s\" is not a valid identifier!"%action_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        elif action_name.upper() in IEC_KEYWORDS:
+            message = wx.MessageDialog(self, "\"%s\" is a keyword. It can't be used!"%action_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        elif action_name.upper() in self.PouNames:
+            message = wx.MessageDialog(self, "A pou with \"%s\" for name exists!"%action_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
+        elif action_name.upper() in self.PouElementNames:
+            message = wx.MessageDialog(self, "\"%s\" element for this pou already exists!"%action_name, "Error", wx.OK|wx.ICON_ERROR)
+            message.ShowModal()
+            message.Destroy()
         else:
             self.EndModal(wx.ID_OK)
-
+    
+    def SetPouNames(self, pou_names):
+        self.PouNames = [pou_name.upper() for pou_name in pou_names]
+        
+    def SetPouElementNames(self, element_names):
+        self.PouElementNames = [element_name.upper() for element_name in element_names]
+        
     def SetValues(self, values):
         for item, value in values.items():
             if item == "actionName":
@@ -2204,18 +2257,18 @@
             self.DefaultTypes = {"All" : "Local", "Interface" : "Input", "Variables" : "Local"}
             self.DefaultValue = {"Name" : "", "Class" : "", "Type" : "INT", "Location" : "", "Initial Value" : "", "Retain" : "No", "Constant" : "No", "Edit" : "True"}
         if pou_type in ["config", "resource"] or pou_type == "program":
-            self.Table = VariableTable(self, [], ["#", "Name", "Class", "Type", "Location", "Initial Value", "Retain", "Constant", "Edit"])
+            self.Table = VariableTable(self, [], ["#", "Name", "Class", "Type", "Location", "Initial Value", "Retain", "Constant"])
             if pou_type not in ["config", "resource"]:
                 self.FilterChoices = ["All","Interface","   Input","   Output","   InOut","   External","Variables","   Local","   Temp","Global","Access"]
             else:
                 self.FilterChoices = ["All","Global","Access"]
-            self.ColSizes = [40, 80, 70, 80, 80, 80, 60, 70, 50]
-            self.ColAlignements = [wx.ALIGN_CENTER, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_CENTER, wx.ALIGN_LEFT]
-        else:
-            self.Table = VariableTable(self, [], ["#", "Name", "Class", "Type", "Initial Value", "Retain", "Constant", "Edit"])
+            self.ColSizes = [40, 80, 70, 80, 80, 80, 60, 70]
+            self.ColAlignements = [wx.ALIGN_CENTER, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_CENTER]
+        else:
+            self.Table = VariableTable(self, [], ["#", "Name", "Class", "Type", "Initial Value", "Retain", "Constant"])
             self.FilterChoices = ["All","Interface","   Input","   Output","   InOut","   External","Variables","   Local","   Temp"]
-            self.ColSizes = [40, 120, 70, 80, 120, 60, 70, 50]
-            self.ColAlignements = [wx.ALIGN_CENTER, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_CENTER, wx.ALIGN_LEFT]
+            self.ColSizes = [40, 120, 70, 80, 120, 60, 70]
+            self.ColAlignements = [wx.ALIGN_CENTER, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_LEFT, wx.ALIGN_CENTER, wx.ALIGN_CENTER]
         for choice in self.FilterChoices:
             self.ClassFilter.Append(choice)
         reverse_transfer = {}
--- a/Viewer.py	Mon Aug 13 18:04:19 2007 +0200
+++ b/Viewer.py	Mon Aug 13 18:06:50 2007 +0200
@@ -993,6 +993,8 @@
     def AddNewBlock(self, bbox):
         dialog = BlockPropertiesDialog(self.Parent)
         dialog.SetBlockList(self.Controler.GetBlockTypes())
+        dialog.SetPouNames(self.Controler.GetProjectPouNames())
+        dialog.SetPouElementNames(self.Controler.GetCurrentElementEditingVariables())
         dialog.SetMinBlockSize((bbox.width, bbox.height))
         if dialog.ShowModal() == wx.ID_OK:
             id = self.GetNewId()
@@ -1019,7 +1021,8 @@
         vars = self.Controler.GetCurrentElementEditingInterfaceVars()
         if vars:
             for var in vars:
-                varlist.append((var["Name"], var["Class"], var["Type"]))
+                if var["Edit"]:
+                    varlist.append((var["Name"], var["Class"], var["Type"]))
         returntype = self.Controler.GetCurrentElementEditingInterfaceReturnType()
         if returntype:
             varlist.append((self.Controler.GetCurrentElementEditingName(), "Output", returntype))
@@ -1143,7 +1146,7 @@
         dialog.Destroy()
 
     def AddNewTransition(self, bbox):
-        dialog = TransitionContentDialog(self.Parent)
+        dialog = TransitionContentDialog(self.Parent, self.GetDrawingMode() == FREEDRAWING_MODE)
         dialog.SetTransitions(self.Controler.GetCurrentElementEditingTransitions())
         if dialog.ShowModal() == wx.ID_OK:
             id = self.GetNewId()
@@ -1186,6 +1189,8 @@
     def EditBlockContent(self, block):
         dialog = BlockPropertiesDialog(self.Parent)
         dialog.SetBlockList(self.Controler.GetBlockTypes())
+        dialog.SetPouNames(self.Controler.GetProjectPouNames())
+        dialog.SetPouElementNames(self.Controler.GetCurrentElementEditingVariables())
         dialog.SetMinBlockSize(block.GetSize())
         values = {"name" : block.GetName(), "type" : block.GetType(), "inputs" : block.GetInputTypes()}
         values["extension"] = block.GetExtension()
@@ -1209,7 +1214,8 @@
         vars = self.Controler.GetCurrentElementEditingInterfaceVars()
         if vars:
             for var in vars:
-                varlist.append((var["Name"], var["Class"], var["Type"]))
+                if var["Edit"]:
+                    varlist.append((var["Name"], var["Class"], var["Type"]))
         returntype = self.Controler.GetCurrentElementEditingInterfaceReturnType()
         if returntype:
             varlist.append((self.Controler.GetCurrentElementEditingName(), "Output", returntype))
--- a/examples/example.xml	Mon Aug 13 18:04:19 2007 +0200
+++ b/examples/example.xml	Mon Aug 13 18:06:50 2007 +0200
@@ -347,7 +347,7 @@
             <REAL/>
           </returnType>
           <inputVars>
-            <variable name="X3">
+            <variable name="X1">
               <type>
                 <REAL/>
               </type>