308 if values[2] is not None: |
308 if values[2] is not None: |
309 var_type = values[2] |
309 var_type = values[2] |
310 else: |
310 else: |
311 var_type = LOCATIONDATATYPES.get(location[2], ["BOOL"])[0] |
311 var_type = LOCATIONDATATYPES.get(location[2], ["BOOL"])[0] |
312 if not var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]: |
312 if not var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]: |
313 self.ParentWindow.Controler.AddEditedElementPouVar(tagname, var_type, var_name, location, values[4]) |
313 self.ParentWindow.Controler.AddEditedElementPouVar(tagname, var_type, var_name, location=location, description=values[4]) |
|
314 self.ParentWindow.RefreshVariablePanel() |
|
315 self.ParentWindow.ParentWindow.RefreshPouInstanceVariablesPanel() |
|
316 self.ParentWindow.AddVariableBlock(x, y, scaling, var_class, var_name, var_type) |
|
317 elif values[1] == "NamedConstant": |
|
318 if pou_type == "program": |
|
319 initval = values[0] |
|
320 var_name = values[3] |
|
321 if var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]: |
|
322 message = _("\"%s\" pou already exists!")%var_name |
|
323 else: |
|
324 var_class = INPUT |
|
325 var_type = values[2] |
|
326 if not var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]: |
|
327 self.ParentWindow.Controler.AddEditedElementPouVar(tagname, var_type, var_name, description=values[4], initval=initval) |
314 self.ParentWindow.RefreshVariablePanel() |
328 self.ParentWindow.RefreshVariablePanel() |
315 self.ParentWindow.ParentWindow.RefreshPouInstanceVariablesPanel() |
329 self.ParentWindow.ParentWindow.RefreshPouInstanceVariablesPanel() |
316 self.ParentWindow.AddVariableBlock(x, y, scaling, var_class, var_name, var_type) |
330 self.ParentWindow.AddVariableBlock(x, y, scaling, var_class, var_name, var_type) |
317 elif values[1] == "Global": |
331 elif values[1] == "Global": |
318 var_name = values[0] |
332 var_name = values[0] |