Preferences/ConfigurationPages/EditorHighlightersPage.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2525
8b507a9a2d40
parent 3010
befeff46ec0f
child 3058
0a02c433f52d
equal deleted inserted replaced
3056:9986ec0e559a 3057:10516539f238
34 """ 34 """
35 super(EditorHighlightersPage, self).__init__() 35 super(EditorHighlightersPage, self).__init__()
36 self.setupUi(self) 36 self.setupUi(self)
37 self.setObjectName("EditorHighlightersPage") 37 self.setObjectName("EditorHighlightersPage")
38 38
39 self.editorLexerList.headerItem().setText(self.editorLexerList.columnCount(), "") 39 self.editorLexerList.headerItem().setText(
40 self.editorLexerList.columnCount(), "")
40 header = self.editorLexerList.header() 41 header = self.editorLexerList.header()
41 if qVersion() >= "5.0.0": 42 if qVersion() >= "5.0.0":
42 header.setSectionResizeMode(QHeaderView.ResizeToContents) 43 header.setSectionResizeMode(QHeaderView.ResizeToContents)
43 else: 44 else:
44 header.setResizeMode(QHeaderView.ResizeToContents) 45 header.setResizeMode(QHeaderView.ResizeToContents)
103 self.editorLexerList.header().sortIndicatorOrder()) 104 self.editorLexerList.header().sortIndicatorOrder())
104 105
105 @pyqtSlot() 106 @pyqtSlot()
106 def on_deleteLexerButton_clicked(self): 107 def on_deleteLexerButton_clicked(self):
107 """ 108 """
108 Private slot to delete the currently selected lexer association of the list. 109 Private slot to delete the currently selected lexer association of the
110 list.
109 """ 111 """
110 itmList = self.editorLexerList.selectedItems() 112 itmList = self.editorLexerList.selectedItems()
111 if itmList: 113 if itmList:
112 index = self.editorLexerList.indexOfTopLevelItem(itmList[0]) 114 index = self.editorLexerList.indexOfTopLevelItem(itmList[0])
113 itm = self.editorLexerList.takeTopLevelItem(index) 115 itm = self.editorLexerList.takeTopLevelItem(index)
117 self.editorFileExtEdit.clear() 119 self.editorFileExtEdit.clear()
118 self.editorLexerCombo.setCurrentIndex(0) 120 self.editorLexerCombo.setCurrentIndex(0)
119 121
120 def on_editorLexerList_itemClicked(self, itm, column): 122 def on_editorLexerList_itemClicked(self, itm, column):
121 """ 123 """
122 Private slot to handle the clicked signal of the lexer association list. 124 Private slot to handle the clicked signal of the lexer association
125 list.
123 126
124 @param itm reference to the selecte item (QTreeWidgetItem) 127 @param itm reference to the selecte item (QTreeWidgetItem)
125 @param column column the item was clicked or activated (integer) (ignored) 128 @param column column the item was clicked or activated (integer)
129 (ignored)
126 """ 130 """
127 if itm is None: 131 if itm is None:
128 self.editorFileExtEdit.clear() 132 self.editorFileExtEdit.clear()
129 self.editorLexerCombo.setCurrentIndex(0) 133 self.editorLexerCombo.setCurrentIndex(0)
130 self.pygmentsLexerCombo.setCurrentIndex(0) 134 self.pygmentsLexerCombo.setCurrentIndex(0)
141 self.editorLexerCombo.setCurrentIndex(index) 145 self.editorLexerCombo.setCurrentIndex(index)
142 self.pygmentsLexerCombo.setCurrentIndex(pygmentsIndex) 146 self.pygmentsLexerCombo.setCurrentIndex(pygmentsIndex)
143 147
144 def on_editorLexerList_itemActivated(self, itm, column): 148 def on_editorLexerList_itemActivated(self, itm, column):
145 """ 149 """
146 Private slot to handle the activated signal of the lexer association list. 150 Private slot to handle the activated signal of the lexer association
151 list.
147 152
148 @param itm reference to the selecte item (QTreeWidgetItem) 153 @param itm reference to the selecte item (QTreeWidgetItem)
149 @param column column the item was clicked or activated (integer) (ignored) 154 @param column column the item was clicked or activated (integer)
155 (ignored)
150 """ 156 """
151 self.on_editorLexerList_itemClicked(itm, column) 157 self.on_editorLexerList_itemClicked(itm, column)
152 158
153 @pyqtSlot(str) 159 @pyqtSlot(str)
154 def on_editorLexerCombo_currentIndexChanged(self, text): 160 def on_editorLexerCombo_currentIndexChanged(self, text):
155 """ 161 """
156 Private slot to handle the selection of a lexer. 162 Private slot to handle the selection of a lexer.
163
164 @param text text of the lexer combo (string)
157 """ 165 """
158 if text in self.extras: 166 if text in self.extras:
159 self.pygmentsLexerCombo.setEnabled(True) 167 self.pygmentsLexerCombo.setEnabled(True)
160 self.pygmentsLabel.setEnabled(True) 168 self.pygmentsLabel.setEnabled(True)
161 else: 169 else:
166 def create(dlg): 174 def create(dlg):
167 """ 175 """
168 Module function to create the configuration page. 176 Module function to create the configuration page.
169 177
170 @param dlg reference to the configuration dialog 178 @param dlg reference to the configuration dialog
179 @return reference to the instantiated page (ConfigurationPageBase)
171 """ 180 """
172 page = EditorHighlightersPage(dlg.getLexers()) 181 page = EditorHighlightersPage(dlg.getLexers())
173 return page 182 return page

eric ide

mercurial