controls/VariablePanel.py
changeset 1764 d5df428640ff
parent 1762 fcc406143e5b
child 1766 c1e5b9f19483
equal deleted inserted replaced
1763:bcc07ff2362c 1764:d5df428640ff
   340                 var_name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None
   340                 var_name = dlg.GetValue() if dlg.ShowModal() == wx.ID_OK else None
   341                 dlg.Destroy()
   341                 dlg.Destroy()
   342                 if var_name is None:
   342                 if var_name is None:
   343                     return
   343                     return
   344                 elif var_name.upper() in [name.upper()
   344                 elif var_name.upper() in [name.upper()
   345                         for name in self.ParentWindow.Controler.\
   345                         for name in self.ParentWindow.Controler.GetProjectPouNames(self.ParentWindow.Debug)]:
   346                             GetProjectPouNames(self.ParentWindow.Debug)]:
       
   347                     message = _("\"%s\" pou already exists!") % var_name
   346                     message = _("\"%s\" pou already exists!") % var_name
   348                 elif not var_name.upper() in [name.upper()
   347                 elif not var_name.upper() in [name.upper()
   349                         for name in self.ParentWindow.Controler.\
   348                         for name in self.ParentWindow.Controler.
   350                             GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
   349                             GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
   351                     var_infos = self.ParentWindow.DefaultValue.copy()
   350                     var_infos = self.ParentWindow.DefaultValue.copy()
   352                     var_infos.Name = var_name
   351                     var_infos.Name = var_name
   353                     var_infos.Type = values[2]
   352                     var_infos.Type = values[2]
   354                     var_infos.Documentation = values[4]
   353                     var_infos.Documentation = values[4]
   376                             configs = self.ParentWindow.Controler.GetProjectConfigNames(
   375                             configs = self.ParentWindow.Controler.GetProjectConfigNames(
   377                                                                 self.ParentWindow.Debug)
   376                                                                 self.ParentWindow.Debug)
   378                             if len(configs) == 0:
   377                             if len(configs) == 0:
   379                                 return
   378                                 return
   380                             if not var_name.upper() in [name.upper()
   379                             if not var_name.upper() in [name.upper()
   381                                 for name in self.ParentWindow.Controler.\
   380                                 for name in self.ParentWindow.Controler.GetConfigurationVariableNames(configs[0])]:
   382                                     GetConfigurationVariableNames(configs[0])]:
       
   383                                 self.ParentWindow.Controler.AddConfigurationGlobalVar(
   381                                 self.ParentWindow.Controler.AddConfigurationGlobalVar(
   384                                     configs[0], values[2], var_name, location, "")
   382                                     configs[0], values[2], var_name, location, "")
   385                             var_infos.Class = "External"
   383                             var_infos.Class = "External"
   386                         else:
   384                         else:
   387                             if element_type == "program":
   385                             if element_type == "program":