controls/VariablePanel.py
changeset 2240 e684aed23407
parent 1973 cc7a46953471
child 2301 5b8a7dd43f9f
equal deleted inserted replaced
2239:813792f22527 2240:e684aed23407
   103     "Global": lambda x: {"Constant": "Constant", "Retain": "Retain"}.get(x, ""),
   103     "Global": lambda x: {"Constant": "Constant", "Retain": "Retain"}.get(x, ""),
   104     "External": lambda x: {"Constant": "Constant"}.get(x, "")
   104     "External": lambda x: {"Constant": "Constant"}.get(x, "")
   105 }
   105 }
   106 
   106 
   107 LOCATION_MODEL = re.compile("((?:%[IQM](?:\*|(?:[XBWLD]?[0-9]+(?:\.[0-9]+)*)))?)$")
   107 LOCATION_MODEL = re.compile("((?:%[IQM](?:\*|(?:[XBWLD]?[0-9]+(?:\.[0-9]+)*)))?)$")
       
   108 LOCATION_MODEL_SET = re.compile("((?:%[IQM](?:[XBWLD]?[0-9]+(?:\.[0-9]+)*))?)$")
   108 
   109 
   109 
   110 
   110 # -------------------------------------------------------------------------------
   111 # -------------------------------------------------------------------------------
   111 #                            Variables Panel Table
   112 #                            Variables Panel Table
   112 # -------------------------------------------------------------------------------
   113 # -------------------------------------------------------------------------------
   595                 if self.Values[new_row-1].Edit:
   596                 if self.Values[new_row-1].Edit:
   596                     row_content = self.Values[new_row-1].copy()
   597                     row_content = self.Values[new_row-1].copy()
   597                 old_name = self.Values[new_row-1].Name
   598                 old_name = self.Values[new_row-1].Name
   598                 row_content.Name = self.Controler.GenerateNewName(
   599                 row_content.Name = self.Controler.GenerateNewName(
   599                     self.TagName, old_name, old_name+'%d')
   600                     self.TagName, old_name, old_name+'%d')
       
   601 
       
   602                 # increment location address
       
   603                 if row_content.Location != "" and LOCATION_MODEL_SET.match(row_content.Location):
       
   604                     old_location = row_content.Location
       
   605                     model = re.compile("%[IQM][XBWLD]?(.*\.|)")
       
   606                     prefix = model.match(old_location).group(0)
       
   607                     addr = int(re.split(model, old_location)[-1]) + 1
       
   608                     row_content.Location = prefix + unicode(addr)
       
   609 
   600             if not row_content.Class:
   610             if not row_content.Class:
   601                 row_content.Class = self.DefaultTypes.get(self.Filter, self.Filter)
   611                 row_content.Class = self.DefaultTypes.get(self.Filter, self.Filter)
   602 
   612 
   603             if self.Filter == "All" and len(self.Values) > 0:
   613             if self.Filter == "All" and len(self.Values) > 0:
   604                 self.Values.insert(new_row, row_content)
   614                 self.Values.insert(new_row, row_content)