3428 message = "Invalid value \"%s\" for location"%data |
3428 message = "Invalid value \"%s\" for location"%data |
3429 values = None |
3429 values = None |
3430 if values is not None and values[1] == "location": |
3430 if values is not None and values[1] == "location": |
3431 location = values[0] |
3431 location = values[0] |
3432 variable_type = self.ParentWindow.Table.GetValueByName(row, "Type") |
3432 variable_type = self.ParentWindow.Table.GetValueByName(row, "Type") |
|
3433 base_type = self.ParentWindow.Controler.GetBaseType(variable_type) |
3433 message = None |
3434 message = None |
3434 if location.startswith("%"): |
3435 if location.startswith("%"): |
3435 if variable_type != values[2]: |
3436 if base_type != values[2]: |
3436 message = "Incompatible data types between \"%s\" and \"%s\""%(values[2], variable_type) |
3437 message = "Incompatible data types between \"%s\" and \"%s\""%(values[2], variable_type) |
3437 else: |
3438 else: |
3438 self.ParentWindow.Table.SetValue(row, col, location) |
3439 self.ParentWindow.Table.SetValue(row, col, location) |
3439 self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid) |
3440 self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid) |
3440 self.ParentWindow.SaveValues() |
3441 self.ParentWindow.SaveValues() |
3441 else: |
3442 else: |
3442 if location[0].isdigit() and variable_type != "BOOL": |
3443 if location[0].isdigit() and base_type != "BOOL": |
3443 message = "Incompatible size of data between \"%s\" and \"BOOL\""%location |
3444 message = "Incompatible size of data between \"%s\" and \"BOOL\""%location |
3444 elif location[0] not in LOCATIONDATATYPES: |
3445 elif location[0] not in LOCATIONDATATYPES: |
3445 message = "Unrecognized data size \"%s\""%location[0] |
3446 message = "Unrecognized data size \"%s\""%location[0] |
3446 elif variable_type not in LOCATIONDATATYPES[location[0]]: |
3447 elif base_type not in LOCATIONDATATYPES[location[0]]: |
3447 message = "Incompatible size of data between \"%s\" and \"%s\""%(location, variable_type) |
3448 message = "Incompatible size of data between \"%s\" and \"%s\""%(location, variable_type) |
3448 else: |
3449 else: |
3449 dialog = wx.SingleChoiceDialog(self.ParentWindow, "Select a variable class:", "Variable class", ["Input", "Output", "Memory"], wx.OK|wx.CANCEL) |
3450 dialog = wx.SingleChoiceDialog(self.ParentWindow, "Select a variable class:", "Variable class", ["Input", "Output", "Memory"], wx.OK|wx.CANCEL) |
3450 if dialog.ShowModal() == wx.ID_OK: |
3451 if dialog.ShowModal() == wx.ID_OK: |
3451 selected = dialog.GetSelection() |
3452 selected = dialog.GetSelection() |