30 self.setupUi(self) |
30 self.setupUi(self) |
31 |
31 |
32 self.editorLexerList.headerItem().setText( |
32 self.editorLexerList.headerItem().setText( |
33 self.editorLexerList.columnCount(), "") |
33 self.editorLexerList.columnCount(), "") |
34 header = self.editorLexerList.header() |
34 header = self.editorLexerList.header() |
35 header.setSectionResizeMode(QHeaderView.ResizeToContents) |
35 header.setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents) |
36 header.setSortIndicator(0, Qt.AscendingOrder) |
36 header.setSortIndicator(0, Qt.SortOrder.AscendingOrder) |
37 |
37 |
38 try: |
38 try: |
39 self.extsep = os.extsep |
39 self.extsep = os.extsep |
40 except AttributeError: |
40 except AttributeError: |
41 self.extsep = "." |
41 self.extsep = "." |
59 |
59 |
60 # set initial values |
60 # set initial values |
61 self.project = project |
61 self.project = project |
62 for ext, lexer in list(self.project.pdata["LEXERASSOCS"].items()): |
62 for ext, lexer in list(self.project.pdata["LEXERASSOCS"].items()): |
63 QTreeWidgetItem(self.editorLexerList, [ext, lexer]) |
63 QTreeWidgetItem(self.editorLexerList, [ext, lexer]) |
64 self.editorLexerList.sortByColumn(0, Qt.AscendingOrder) |
64 self.editorLexerList.sortByColumn(0, Qt.SortOrder.AscendingOrder) |
65 |
65 |
66 @pyqtSlot() |
66 @pyqtSlot() |
67 def on_addLexerButton_clicked(self): |
67 def on_addLexerButton_clicked(self): |
68 """ |
68 """ |
69 Private slot to add the lexer association displayed to the list. |
69 Private slot to add the lexer association displayed to the list. |
78 lexer = pygmentsLexer |
78 lexer = pygmentsLexer |
79 else: |
79 else: |
80 lexer = "Pygments|{0}".format(pygmentsLexer) |
80 lexer = "Pygments|{0}".format(pygmentsLexer) |
81 if ext and lexer: |
81 if ext and lexer: |
82 itmList = self.editorLexerList.findItems( |
82 itmList = self.editorLexerList.findItems( |
83 ext, Qt.MatchFlags(Qt.MatchExactly), 0) |
83 ext, Qt.MatchFlags(Qt.MatchFlag.MatchExactly), 0) |
84 if itmList: |
84 if itmList: |
85 index = self.editorLexerList.indexOfTopLevelItem(itmList[0]) |
85 index = self.editorLexerList.indexOfTopLevelItem(itmList[0]) |
86 itm = self.editorLexerList.takeTopLevelItem(index) |
86 itm = self.editorLexerList.takeTopLevelItem(index) |
87 # __IGNORE_WARNING__ |
87 # __IGNORE_WARNING__ |
88 del itm |
88 del itm |
146 @param column column the item was clicked or activated (integer) |
146 @param column column the item was clicked or activated (integer) |
147 (ignored) |
147 (ignored) |
148 """ |
148 """ |
149 self.on_editorLexerList_itemClicked(itm, column) |
149 self.on_editorLexerList_itemClicked(itm, column) |
150 |
150 |
151 @pyqtSlot(str) |
151 @pyqtSlot(int) |
152 def on_editorLexerCombo_currentIndexChanged(self, text): |
152 def on_editorLexerCombo_currentIndexChanged(self, index): |
153 """ |
153 """ |
154 Private slot to handle the selection of a lexer. |
154 Private slot to handle the selection of a lexer. |
155 |
155 |
156 @param text text of the line edit (string) |
156 @param index index of the current item |
|
157 @type int |
157 """ |
158 """ |
|
159 text = self.editorLexerCombo.itemText(index) |
158 if text in self.extras: |
160 if text in self.extras: |
159 self.pygmentsLexerCombo.setEnabled(True) |
161 self.pygmentsLexerCombo.setEnabled(True) |
160 self.pygmentsLabel.setEnabled(True) |
162 self.pygmentsLabel.setEnabled(True) |
161 else: |
163 else: |
162 self.pygmentsLexerCombo.setEnabled(False) |
164 self.pygmentsLexerCombo.setEnabled(False) |