src/eric7/Project/LexerAssociationDialog.py

branch
eric7
changeset 9514
2b104ad132a4
parent 9482
a2bc06a54d9d
child 9653
e67609152c5e
equal deleted inserted replaced
9513:6e260b424396 9514:2b104ad132a4
53 pygmentsLexers = [""] + sorted(lex[0] for lex in get_all_lexers()) 53 pygmentsLexers = [""] + sorted(lex[0] for lex in get_all_lexers())
54 self.pygmentsLexerCombo.addItems(pygmentsLexers) 54 self.pygmentsLexerCombo.addItems(pygmentsLexers)
55 55
56 # set initial values 56 # set initial values
57 self.project = project 57 self.project = project
58 for ext, lexer in list(self.project.pdata["LEXERASSOCS"].items()): 58 for ext, lexer in list(
59 self.project.getProjectData(dataKey="LEXERASSOCS").items()
60 ):
59 QTreeWidgetItem(self.editorLexerList, [ext, lexer]) 61 QTreeWidgetItem(self.editorLexerList, [ext, lexer])
60 self.editorLexerList.sortByColumn(0, Qt.SortOrder.AscendingOrder) 62 self.editorLexerList.sortByColumn(0, Qt.SortOrder.AscendingOrder)
61 63
62 @pyqtSlot() 64 @pyqtSlot()
63 def on_addLexerButton_clicked(self): 65 def on_addLexerButton_clicked(self):
163 def transferData(self): 165 def transferData(self):
164 """ 166 """
165 Public slot to transfer the associations into the projects data 167 Public slot to transfer the associations into the projects data
166 structure. 168 structure.
167 """ 169 """
168 self.project.pdata["LEXERASSOCS"] = {} 170 self.project.setProjectData({}, dataKey="LEXERASSOCS")
169 for index in range(self.editorLexerList.topLevelItemCount()): 171 for index in range(self.editorLexerList.topLevelItemCount()):
170 itm = self.editorLexerList.topLevelItem(index) 172 itm = self.editorLexerList.topLevelItem(index)
171 pattern = itm.text(0) 173 pattern = itm.text(0)
172 self.project.pdata["LEXERASSOCS"][pattern] = itm.text(1) 174 lexerAssocs = self.project.getProjectData("LEXERASSOCS")
175 lexerAssocs[pattern] = itm.text(1)
176 self.project.setProjectData(lexerAssocs, "LEXERASSOCS")

eric ide

mercurial