editors/CodeFileEditor.py
changeset 1878 fb73a6b6622d
parent 1872 866fb3ab8778
child 1881 091005ec69c4
equal deleted inserted replaced
1877:da5f1fa46f2b 1878:fb73a6b6622d
   140                 self.COMMENT_HEADER * (len_headers / 2) + \
   140                 self.COMMENT_HEADER * (len_headers / 2) + \
   141                 section_comment + \
   141                 section_comment + \
   142                 self.COMMENT_HEADER * (len_headers - len_headers / 2)
   142                 self.COMMENT_HEADER * (len_headers - len_headers / 2)
   143 
   143 
   144             self.SectionsComments[section] = {
   144             self.SectionsComments[section] = {
   145                  "comment": section_comment,
   145                 "comment": section_comment,
   146             }
   146             }
   147 
   147 
   148         for i, section in enumerate(self.Controler.SECTIONS_NAMES):
   148         for i, section in enumerate(self.Controler.SECTIONS_NAMES):
   149             section_infos = self.SectionsComments[section]
   149             section_infos = self.SectionsComments[section]
   150             if i + 1 < len(self.Controler.SECTIONS_NAMES):
   150             if i + 1 < len(self.Controler.SECTIONS_NAMES):
   320             newline_size = 2
   320             newline_size = 2
   321         else:
   321         else:
   322             newline_size = 1
   322             newline_size = 1
   323 
   323 
   324         # Disable to type any character in section header lines
   324         # Disable to type any character in section header lines
   325         if (self.GetLineState(self.LineFromPosition(current_pos)) and
   325         if self.GetLineState(self.LineFromPosition(current_pos)) and \
   326             not text_selected and
   326            not text_selected and \
   327             key not in NAVIGATION_KEYS + [
   327            key not in NAVIGATION_KEYS + [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]:
   328                 wx.WXK_RETURN,
       
   329                 wx.WXK_NUMPAD_ENTER]):
       
   330             return
   328             return
   331 
   329 
   332         # Disable to delete line between code and header lines
   330         # Disable to delete line between code and header lines
   333         elif (self.GetCurLine()[0].strip() != "" and not text_selected and
   331         elif (self.GetCurLine()[0].strip() != "" and not text_selected and
   334               (key == wx.WXK_BACK and
   332               (key == wx.WXK_BACK and
   704                         start_idx = 0
   702                         start_idx = 0
   705                 else:
   703                 else:
   706                     name = row_content["Name"]
   704                     name = row_content["Name"]
   707                     start_idx = 0
   705                     start_idx = 0
   708                 row_content["Name"] = self.Controler.GenerateNewName(
   706                 row_content["Name"] = self.Controler.GenerateNewName(
   709                         name + "%d", start_idx)
   707                     name + "%d", start_idx)
   710             else:
   708             else:
   711                 row_content = self.VariablesDefaultValue.copy()
   709                 row_content = self.VariablesDefaultValue.copy()
   712             self.Table.InsertRow(new_row, row_content)
   710             self.Table.InsertRow(new_row, row_content)
   713             self.RefreshModel()
   711             self.RefreshModel()
   714             self.RefreshView()
   712             self.RefreshView()