--- a/LPCManager.py Tue Aug 08 09:08:03 2017 +0200
+++ b/LPCManager.py Tue Aug 08 15:01:00 2017 +0200
@@ -193,8 +193,68 @@
from UriLocationEditor import UriLocationEditor
from UriLocationEditor import UriTextControl
from controls import TextCtrlAutoComplete
+from controls.LocationCellEditor import LocationCellControl, LocationCellEditor +from dialogs.BrowseLocationsDialog import BrowseLocationsDialog from py_ext import PythonFileCTNMixin
+# start region // change name and location on selected variable +def OnBrowseButtonClick(self, event): + # pop up the location browser dialog + dialog = BrowseLocationsDialog(self, self.VarType, self.Controller) + if dialog.ShowModal() == wx.ID_OK: + infos = dialog.GetValues() + location = infos["location"] + if not infos["location"].startswith("%"): + dialog = wx.SingleChoiceDialog(self, + _("Select a variable class:"), _("Variable class"), + [_("Input"), _("Output"), _("Memory")], + wx.DEFAULT_DIALOG_STYLE|wx.OK|wx.CANCEL) + if dialog.ShowModal() == wx.ID_OK: + selected = dialog.GetSelection() + self.Location.SetFocus() + location = "%I" + location + location = "%Q" + location + location = "%M" + location + self.Location.SetValue(location) + self.VariableName = infos["name"] + self.VarType = infos["IEC_type"] + self.Location.SetFocus() + return self.VariableName +LocationCellControl.OnBrowseButtonClick = OnBrowseButtonClick +LocationCellControl.GetName = GetName +def EndEditInternal(self, row, col, grid, old_loc): + loc = self.CellControl.GetValue() + changed = loc != old_loc + name = self.CellControl.GetName() + self.Table.SetValueByName(row, 'Name', name) + self.Table.SetValueByName(row, 'Location', loc) + self.Table.SetValueByName(row, 'Type', self.CellControl.GetVarType()) + self.CellControl.Disable() +LocationCellEditor.EndEditInternal = EndEditInternal def CTNGenerate_C(self, buildpath, locations):
# location string for that CTN