diff -r de812e258213 -r bf3b6998f7b6 controls/LocationCellEditor.py --- a/controls/LocationCellEditor.py Tue Mar 26 23:24:30 2013 +0100 +++ b/controls/LocationCellEditor.py Tue Mar 26 23:25:18 2013 +0100 @@ -85,13 +85,36 @@ dialog = BrowseLocationsDialog(self, self.VarType, self.Controller) if dialog.ShowModal() == wx.ID_OK: infos = dialog.GetValues() - + else: + infos = None + dialog.Destroy() + + if infos is not None: + location = infos["location"] # set the location - self.Location.SetValue(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() + else: + selected = None + dialog.Destroy() + if selected is None: + self.Location.SetFocus() + return + if selected == 0: + location = "%I" + location + elif selected == 1: + location = "%Q" + location + else: + location = "%M" + location + + self.Location.SetValue(location) self.VarType = infos["IEC_type"] - dialog.Destroy() - self.Location.SetFocus() def OnLocationChar(self, event):