Bug on located variable defined with devived type when dropping location fixed
authorlbessard
Tue, 01 Jul 2008 11:13:22 +0200
changeset 219 ca1f1d3734f9
parent 218 1b8e9bb83f25
child 220 127d1323e5e0
Bug on located variable defined with devived type when dropping location fixed
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Tue Jul 01 10:33:29 2008 +0200
+++ b/PLCOpenEditor.py	Tue Jul 01 11:13:22 2008 +0200
@@ -3430,20 +3430,21 @@
                 if values is not None and values[1] == "location":
                     location = values[0]
                     variable_type = self.ParentWindow.Table.GetValueByName(row, "Type")
+                    base_type = self.ParentWindow.Controler.GetBaseType(variable_type)
                     message = None
                     if location.startswith("%"):
-                        if variable_type != values[2]:
+                        if base_type != values[2]:
                             message = "Incompatible data types between \"%s\" and \"%s\""%(values[2], variable_type)
                         else:
                             self.ParentWindow.Table.SetValue(row, col, location)
                             self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid)
                             self.ParentWindow.SaveValues()
                     else:
-                        if location[0].isdigit() and variable_type != "BOOL":
+                        if location[0].isdigit() and base_type != "BOOL":
                             message = "Incompatible size of data between \"%s\" and \"BOOL\""%location
                         elif location[0] not in LOCATIONDATATYPES:
                             message = "Unrecognized data size \"%s\""%location[0]
-                        elif variable_type not in LOCATIONDATATYPES[location[0]]:
+                        elif base_type not in LOCATIONDATATYPES[location[0]]:
                             message = "Incompatible size of data between \"%s\" and \"%s\""%(location, variable_type)
                         else:
                             dialog = wx.SingleChoiceDialog(self.ParentWindow, "Select a variable class:", "Variable class", ["Input", "Output", "Memory"], wx.OK|wx.CANCEL)