3347 values = None |
3347 values = None |
3348 if values and values[1] == "location": |
3348 if values and values[1] == "location": |
3349 location = values[0] |
3349 location = values[0] |
3350 variable_type = self.ParentWindow.Table.GetValueByName(row, "Type") |
3350 variable_type = self.ParentWindow.Table.GetValueByName(row, "Type") |
3351 message = None |
3351 message = None |
3352 if location[0].isdigit() and variable_type != "BOOL": |
3352 if location.startswith("%"): |
3353 message = "Incompatible size of data between \"%s\" and \"BOOL\""%location |
3353 if variable_type != values[2]: |
3354 elif location[0] not in LOCATIONDATATYPES: |
3354 message = "Incompatible data types between \"%s\" and \"%s\""%(values[2], variable_type) |
3355 message = "Unrecognized data size \"%s\""%location[0] |
3355 else: |
3356 elif variable_type not in LOCATIONDATATYPES[location[0]]: |
|
3357 message = "Incompatible size of data between \"%s\" and \"%s\""%(location, variable_type) |
|
3358 else: |
|
3359 dialog = wx.SingleChoiceDialog(self.ParentWindow, "Select a variable class:", "Variable class", ["Input", "Output", "Memory"], wx.OK|wx.CANCEL) |
|
3360 if dialog.ShowModal() == wx.ID_OK: |
|
3361 selected = dialog.GetSelection() |
|
3362 if selected == 0: |
|
3363 location = "%I" + location |
|
3364 elif selected == 1: |
|
3365 location = "%Q" + location |
|
3366 else: |
|
3367 location = "%M" + location |
|
3368 self.ParentWindow.Table.SetValue(row, col, location) |
3356 self.ParentWindow.Table.SetValue(row, col, location) |
3369 self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid) |
3357 self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid) |
3370 self.ParentWindow.SaveValues() |
3358 self.ParentWindow.SaveValues() |
3371 dialog.Destroy() |
3359 else: |
|
3360 if location[0].isdigit() and variable_type != "BOOL": |
|
3361 message = "Incompatible size of data between \"%s\" and \"BOOL\""%location |
|
3362 elif location[0] not in LOCATIONDATATYPES: |
|
3363 message = "Unrecognized data size \"%s\""%location[0] |
|
3364 elif variable_type not in LOCATIONDATATYPES[location[0]]: |
|
3365 message = "Incompatible size of data between \"%s\" and \"%s\""%(location, variable_type) |
|
3366 else: |
|
3367 dialog = wx.SingleChoiceDialog(self.ParentWindow, "Select a variable class:", "Variable class", ["Input", "Output", "Memory"], wx.OK|wx.CANCEL) |
|
3368 if dialog.ShowModal() == wx.ID_OK: |
|
3369 selected = dialog.GetSelection() |
|
3370 if selected == 0: |
|
3371 location = "%I" + location |
|
3372 elif selected == 1: |
|
3373 location = "%Q" + location |
|
3374 else: |
|
3375 location = "%M" + location |
|
3376 self.ParentWindow.Table.SetValue(row, col, location) |
|
3377 self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid) |
|
3378 self.ParentWindow.SaveValues() |
|
3379 dialog.Destroy() |
3372 if message is not None: |
3380 if message is not None: |
3373 message = wx.MessageDialog(self.ParentWindow, message, "Error", wx.OK|wx.ICON_ERROR) |
3381 message = wx.MessageDialog(self.ParentWindow, message, "Error", wx.OK|wx.ICON_ERROR) |
3374 message.ShowModal() |
3382 message.ShowModal() |
3375 message.Destroy() |
3383 message.Destroy() |
3376 |
3384 |