--- a/Viewer.py Fri Jun 15 18:02:09 2012 +0200
+++ b/Viewer.py Fri Jun 15 18:03:25 2012 +0200
@@ -260,21 +260,37 @@
self.ParentWindow.RefreshVariablePanel()
self.ParentWindow.Refresh(False)
elif values[1] == "location":
- if len(values) > 2 and pou_type == "program":
+ if pou_type == "program":
+ location = values[0]
+ if not location.startswith("%"):
+ 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()
+ else:
+ selected = None
+ dialog.Destroy()
+ if selected is None:
+ return
+ if selected == 0:
+ location = "%I" + location
+ elif selected == 1:
+ location = "%Q" + location
+ else:
+ location = "%M" + location
var_name = values[3]
if var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
message = _("\"%s\" pou already exists!")%var_name
else:
- if values[0][1] == "Q":
+ if location[1] == "Q":
var_class = OUTPUT
else:
var_class = INPUT
if values[2] is not None:
var_type = values[2]
else:
- var_type = LOCATIONDATATYPES.get(values[0][2], ["BOOL"])[0]
+ var_type = LOCATIONDATATYPES.get(location[2], ["BOOL"])[0]
if not var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
- self.ParentWindow.Controler.AddEditedElementPouVar(tagname, var_type, var_name, values[0], values[4])
+ self.ParentWindow.Controler.AddEditedElementPouVar(tagname, var_type, var_name, location, values[4])
self.ParentWindow.RefreshVariablePanel()
self.ParentWindow.AddVariableBlock(x, y, scaling, var_class, var_name, var_type)
elif values[1] == "Global":