controls/VariablePanel.py
changeset 1416 d4222bad4841
parent 1414 8a3998d10b81
child 1417 374238039643
equal deleted inserted replaced
1415:c411fc7246eb 1416:d4222bad4841
   305                         self.ParentWindow.Table.SetValue(row, col, values[0])
   305                         self.ParentWindow.Table.SetValue(row, col, values[0])
   306                         self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid)
   306                         self.ParentWindow.Table.ResetView(self.ParentWindow.VariablesGrid)
   307                         self.ParentWindow.SaveValues()
   307                         self.ParentWindow.SaveValues()
   308             elif (element_type not in ["config", "resource", "function"] and values[1] == "Global" and
   308             elif (element_type not in ["config", "resource", "function"] and values[1] == "Global" and
   309                   self.ParentWindow.Filter in ["All", "Interface", "External"] or
   309                   self.ParentWindow.Filter in ["All", "Interface", "External"] or
   310                   element_type != "function" and values[1] == "location"):
   310                   element_type != "function" and values[1] in ["location", "NamedConstant"]):
   311                 if values[1] == "location":
   311                 if values[1] in  ["location","NamedConstant"]:
   312                     var_name = values[3]
   312                     var_name = values[3]
   313                 else:
   313                 else:
   314                     var_name = values[0]
   314                     var_name = values[0]
   315                 tagname = self.ParentWindow.GetTagName()
   315                 tagname = self.ParentWindow.GetTagName()
   316                 if var_name.upper() in [name.upper()
   316                 if var_name.upper() in [name.upper()
   321                         for name in self.ParentWindow.Controler.\
   321                         for name in self.ParentWindow.Controler.\
   322                             GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
   322                             GetEditedElementVariables(tagname, self.ParentWindow.Debug)]:
   323                     var_infos = self.ParentWindow.DefaultValue.copy()
   323                     var_infos = self.ParentWindow.DefaultValue.copy()
   324                     var_infos.Name = var_name
   324                     var_infos.Name = var_name
   325                     var_infos.Type = values[2]
   325                     var_infos.Type = values[2]
       
   326                     var_infos.Documentation = values[4]
   326                     if values[1] == "location":
   327                     if values[1] == "location":
   327                         location = values[0]
   328                         location = values[0]
   328                         if not location.startswith("%"):
   329                         if not location.startswith("%"):
   329                             dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
   330                             dialog = wx.SingleChoiceDialog(self.ParentWindow.ParentWindow.ParentWindow,
   330                                   _("Select a variable class:"), _("Variable class"),
   331                                   _("Select a variable class:"), _("Variable class"),
   358                             if element_type == "program":
   359                             if element_type == "program":
   359                                 var_infos.Class = "Local"
   360                                 var_infos.Class = "Local"
   360                             else:
   361                             else:
   361                                 var_infos.Class = "Global"
   362                                 var_infos.Class = "Global"
   362                             var_infos.Location = location
   363                             var_infos.Location = location
       
   364                     elif values[1] == "NamedConstant":
       
   365                         print "Fuck"
       
   366                         if element_type in ["functionBlock","program"]:
       
   367                             var_infos.Class = "Local"
       
   368                             var_infos.InitialValue = values[0]
       
   369                         else :
       
   370                             return
   363                     else:
   371                     else:
   364                         var_infos.Class = "External"
   372                         var_infos.Class = "External"
   365                     var_infos.Number = len(self.ParentWindow.Values)
   373                     var_infos.Number = len(self.ParentWindow.Values)
   366                     self.ParentWindow.Values.append(var_infos)
   374                     self.ParentWindow.Values.append(var_infos)
   367                     self.ParentWindow.SaveValues()
   375                     self.ParentWindow.SaveValues()