--- a/PLCOpenEditor.py Fri Apr 25 10:53:18 2008 +0200
+++ b/PLCOpenEditor.py Fri May 23 10:42:09 2008 +0200
@@ -3349,26 +3349,34 @@
location = values[0]
variable_type = self.ParentWindow.Table.GetValueByName(row, "Type")
message = None
- if location[0].isdigit() and variable_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]]:
- 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)
- if dialog.ShowModal() == wx.ID_OK:
- selected = dialog.GetSelection()
- if selected == 0:
- location = "%I" + location
- elif selected == 1:
- location = "%Q" + location
- else:
- location = "%M" + location
+ if location.startswith("%"):
+ if variable_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()
- dialog.Destroy()
+ else:
+ if location[0].isdigit() and variable_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]]:
+ 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)
+ if dialog.ShowModal() == wx.ID_OK:
+ selected = dialog.GetSelection()
+ if selected == 0:
+ location = "%I" + location
+ elif selected == 1:
+ location = "%Q" + location
+ else:
+ location = "%M" + location
+ self.ParentWindow.Table.SetValue(row, col, location)
+ self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid)
+ self.ParentWindow.SaveValues()
+ dialog.Destroy()
if message is not None:
message = wx.MessageDialog(self.ParentWindow, message, "Error", wx.OK|wx.ICON_ERROR)
message.ShowModal()