eric6/Preferences/ConfigurationPages/EditorHighlightersPage.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
35 self.setObjectName("EditorHighlightersPage") 35 self.setObjectName("EditorHighlightersPage")
36 36
37 self.editorLexerList.headerItem().setText( 37 self.editorLexerList.headerItem().setText(
38 self.editorLexerList.columnCount(), "") 38 self.editorLexerList.columnCount(), "")
39 header = self.editorLexerList.header() 39 header = self.editorLexerList.header()
40 header.setSectionResizeMode(QHeaderView.ResizeToContents) 40 header.setSectionResizeMode(QHeaderView.ResizeMode.ResizeToContents)
41 header.setSortIndicator(0, Qt.AscendingOrder) 41 header.setSortIndicator(0, Qt.SortOrder.AscendingOrder)
42 42
43 try: 43 try:
44 self.extsep = os.extsep 44 self.extsep = os.extsep
45 except AttributeError: 45 except AttributeError:
46 self.extsep = "." 46 self.extsep = "."
58 58
59 # set initial values 59 # set initial values
60 lexerAssocs = Preferences.getEditorLexerAssocs() 60 lexerAssocs = Preferences.getEditorLexerAssocs()
61 for ext in lexerAssocs: 61 for ext in lexerAssocs:
62 QTreeWidgetItem(self.editorLexerList, [ext, lexerAssocs[ext]]) 62 QTreeWidgetItem(self.editorLexerList, [ext, lexerAssocs[ext]])
63 self.editorLexerList.sortByColumn(0, Qt.AscendingOrder) 63 self.editorLexerList.sortByColumn(0, Qt.SortOrder.AscendingOrder)
64 64
65 def save(self): 65 def save(self):
66 """ 66 """
67 Public slot to save the Editor Highlighter Associations configuration. 67 Public slot to save the Editor Highlighter Associations configuration.
68 """ 68 """
88 lexer = pygmentsLexer 88 lexer = pygmentsLexer
89 else: 89 else:
90 lexer = "Pygments|{0}".format(pygmentsLexer) 90 lexer = "Pygments|{0}".format(pygmentsLexer)
91 if ext and lexer: 91 if ext and lexer:
92 itmList = self.editorLexerList.findItems( 92 itmList = self.editorLexerList.findItems(
93 ext, Qt.MatchFlags(Qt.MatchExactly), 0) 93 ext, Qt.MatchFlags(Qt.MatchFlag.MatchExactly), 0)
94 if itmList: 94 if itmList:
95 index = self.editorLexerList.indexOfTopLevelItem(itmList[0]) 95 index = self.editorLexerList.indexOfTopLevelItem(itmList[0])
96 itm = self.editorLexerList.takeTopLevelItem(index) 96 itm = self.editorLexerList.takeTopLevelItem(index)
97 # __IGNORE_WARNING__ 97 # __IGNORE_WARNING__
98 del itm 98 del itm
156 @param column column the item was clicked or activated (integer) 156 @param column column the item was clicked or activated (integer)
157 (ignored) 157 (ignored)
158 """ 158 """
159 self.on_editorLexerList_itemClicked(itm, column) 159 self.on_editorLexerList_itemClicked(itm, column)
160 160
161 @pyqtSlot(str) 161 @pyqtSlot(int)
162 def on_editorLexerCombo_currentIndexChanged(self, text): 162 def on_editorLexerCombo_currentIndexChanged(self, index):
163 """ 163 """
164 Private slot to handle the selection of a lexer. 164 Private slot to handle the selection of a lexer.
165 165
166 @param text text of the lexer combo (string) 166 @param index index of the current item
167 @type int
167 """ 168 """
169 text = self.editorLexerCombo.itemText(index)
168 if text in self.extras: 170 if text in self.extras:
169 self.pygmentsLexerCombo.setEnabled(True) 171 self.pygmentsLexerCombo.setEnabled(True)
170 self.pygmentsLabel.setEnabled(True) 172 self.pygmentsLabel.setEnabled(True)
171 else: 173 else:
172 self.pygmentsLexerCombo.setEnabled(False) 174 self.pygmentsLexerCombo.setEnabled(False)

eric ide

mercurial