Fixed crash while draging connector from pins with undefined types
authoretisserant
Tue, 02 Oct 2007 18:00:13 +0200
changeset 101 3f06a178b960
parent 100 4e3f5b320bc3
child 102 85875dcb7754
Fixed crash while draging connector from pins with undefined types
Dialogs.py
PLCControler.py
--- a/Dialogs.py	Thu Sep 20 17:38:27 2007 +0200
+++ b/Dialogs.py	Tue Oct 02 18:00:13 2007 +0200
@@ -526,7 +526,7 @@
             values["name"] = expression
         else:
             values["name"] = self.VariableName.GetStringSelection()
-        values["value_type"] = ""
+        values["value_type"] = None
         for var_name, var_type, value_type in self.VarList:
             if var_name == values["name"]:
                 values["value_type"] = value_type
--- a/PLCControler.py	Thu Sep 20 17:38:27 2007 +0200
+++ b/PLCControler.py	Tue Oct 02 18:00:13 2007 +0200
@@ -1455,7 +1455,7 @@
                 for var in varlist.getVariable():
                     if var.getName() == varname:
                         return var.getType().getValue()
-        return ""
+        return None
     
     def SetConnectionWires(self, connection, connector):
         wires = connector.GetWires()
@@ -1975,14 +1975,12 @@
         instance = element.getInstance(id)
         if isinstance(instance, plcopen.block):
             blocktype = instance.getTypeName()
-            blocktype_infos = GetBlockType(blocktype)
-            if blocktype_infos["type"] != "function":
-                if self.CurrentElementEditing != None:
-                    name = self.ElementsOpened[self.CurrentElementEditing]
-                    words = name.split("::")
-                    if words[0] in ["P","T","A"]:
-                        pou = self.Project.getPou(words[1])
-                        pou.removePouVar(blocktype, instance.getInstanceName())    
+            if self.CurrentElementEditing != None:
+                name = self.ElementsOpened[self.CurrentElementEditing]
+                words = name.split("::")
+                if words[0] in ["P","T","A"]:
+                    pou = self.Project.getPou(words[1])
+                    pou.removePouVar(blocktype, instance.getInstanceName())    
         element.removeInstance(id)
         self.RefreshPouUsingTree()