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") |