--- a/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py Tue Oct 15 22:03:54 2013 +0200 +++ b/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py Fri Oct 18 23:00:41 2013 +0200 @@ -45,7 +45,8 @@ act = self.__fontButtonMenu.addAction(self.trUtf8("Font")) act.setData(self.FONT) self.__fontButtonMenu.addSeparator() - act = self.__fontButtonMenu.addAction(self.trUtf8("Family and Size only")) + act = self.__fontButtonMenu.addAction( + self.trUtf8("Family and Size only")) act.setData(self.FAMILYANDSIZE) act = self.__fontButtonMenu.addAction(self.trUtf8("Family only")) act.setData(self.FAMILYONLY) @@ -58,13 +59,15 @@ act = self.__allFontsButtonMenu.addAction(self.trUtf8("Font")) act.setData(self.FONT) self.__allFontsButtonMenu.addSeparator() - act = self.__allFontsButtonMenu.addAction(self.trUtf8("Family and Size only")) + act = self.__allFontsButtonMenu.addAction( + self.trUtf8("Family and Size only")) act.setData(self.FAMILYANDSIZE) act = self.__allFontsButtonMenu.addAction(self.trUtf8("Family only")) act.setData(self.FAMILYONLY) act = self.__allFontsButtonMenu.addAction(self.trUtf8("Size only")) act.setData(self.SIZEONLY) - self.__allFontsButtonMenu.triggered.connect(self.__allFontsButtonMenuTriggered) + self.__allFontsButtonMenu.triggered.connect( + self.__allFontsButtonMenuTriggered) self.allFontsButton.setMenu(self.__allFontsButtonMenu) self.lexer = None @@ -135,8 +138,8 @@ @pyqtSlot() def on_foregroundButton_clicked(self): """ - Private method used to select the foreground colour of the selected style - and lexer. + Private method used to select the foreground colour of the selected + style and lexer. """ colour = QColorDialog.getColor(self.lexer.color(self.style)) if colour.isValid(): @@ -146,7 +149,8 @@ self.sampleText.repaint() if len(self.styleElementList.selectedItems()) > 1: for selItem in self.styleElementList.selectedItems(): - style = self.lexer.ind2style[self.styleElementList.row(selItem)] + style = self.lexer.ind2style[ + self.styleElementList.row(selItem)] self.lexer.setColor(colour, style) else: self.lexer.setColor(colour, self.style) @@ -154,8 +158,8 @@ @pyqtSlot() def on_backgroundButton_clicked(self): """ - Private method used to select the background colour of the selected style - and lexer. + Private method used to select the background colour of the selected + style and lexer. """ colour = QColorDialog.getColor(self.lexer.paper(self.style)) if colour.isValid(): @@ -165,7 +169,8 @@ self.sampleText.repaint() if len(self.styleElementList.selectedItems()) > 1: for selItem in self.styleElementList.selectedItems(): - style = self.lexer.ind2style[self.styleElementList.row(selItem)] + style = self.lexer.ind2style[ + self.styleElementList.row(selItem)] self.lexer.setPaper(colour, style) else: self.lexer.setPaper(colour, self.style) @@ -189,7 +194,8 @@ """ Private slot to change the highlighter font. - @param doAll flag indicating to change the font for all styles (boolean) + @param doAll flag indicating to change the font for all styles + (boolean) @param familyOnly flag indicating to set the font family only (boolean) @param sizeOnly flag indicating to set the font size only (boolean """ @@ -199,7 +205,8 @@ @param font font to be set (QFont) @param style style to set the font for (integer) - @param familyOnly flag indicating to set the font family only (boolean) + @param familyOnly flag indicating to set the font family only + (boolean) @param sizeOnly flag indicating to set the font size only (boolean """ if familyOnly or sizeOnly: @@ -217,7 +224,8 @@ Local function to set the font of the sample text. @param font font to be set (QFont) - @param familyOnly flag indicating to set the font family only (boolean) + @param familyOnly flag indicating to set the font family only + (boolean) @param sizeOnly flag indicating to set the font size only (boolean """ if familyOnly or sizeOnly: @@ -238,7 +246,8 @@ setFont(font, style, familyOnly, sizeOnly) elif len(self.styleElementList.selectedItems()) > 1: for selItem in self.styleElementList.selectedItems(): - style = self.lexer.ind2style[self.styleElementList.row(selItem)] + style = self.lexer.ind2style[ + self.styleElementList.row(selItem)] setFont(font, style, familyOnly, sizeOnly) else: setFont(font, self.style, familyOnly, sizeOnly) @@ -271,7 +280,8 @@ def on_eolfillCheckBox_toggled(self, b): """ - Private method used to set the eolfill for the selected style and lexer. + Private method used to set the eolfill for the selected style and + lexer. @param b Flag indicating enabled or disabled state. """ @@ -280,7 +290,8 @@ @pyqtSlot() def on_allEolFillButton_clicked(self): """ - Private method used to set the eolfill for all styles of a selected lexer. + Private method used to set the eolfill for all styles of a selected + lexer. """ on = self.trUtf8("Enabled") off = self.trUtf8("Disabled") @@ -303,11 +314,13 @@ """ if len(self.styleElementList.selectedItems()) > 1: for selItem in self.styleElementList.selectedItems(): - style = self.lexer.ind2style[self.styleElementList.row(selItem)] + style = self.lexer.ind2style[ + self.styleElementList.row(selItem)] self.__setToDefault(style) else: self.__setToDefault(self.style) - self.on_styleElementList_currentRowChanged(self.styleElementList.currentRow()) + self.on_styleElementList_currentRowChanged( + self.styleElementList.currentRow()) @pyqtSlot() def on_allDefaultButton_clicked(self): @@ -316,7 +329,8 @@ """ for style in list(self.lexer.ind2style.values()): self.__setToDefault(style) - self.on_styleElementList_currentRowChanged(self.styleElementList.currentRow()) + self.on_styleElementList_currentRowChanged( + self.styleElementList.currentRow()) def __setToDefault(self, style): """ @@ -388,8 +402,9 @@ else: E5MessageBox.critical(self, self.trUtf8("Export Highlighting Styles"), - self.trUtf8("""<p>The highlighting styles could not be exported""" - """ to file <b>{0}</b>.</p><p>Reason: {1}</p>""")\ + self.trUtf8( + """<p>The highlighting styles could not be exported""" + """ to file <b>{0}</b>.</p><p>Reason: {1}</p>""")\ .format(fn, f.errorString()) ) @@ -397,7 +412,8 @@ """ Private method to import the styles of the given lexers. - @param lexers dictionary of lexer objects for which to import the styles + @param lexers dictionary of lexer objects for which to import the + styles """ fn = E5FileDialog.getOpenFileName( self, @@ -417,8 +433,9 @@ else: E5MessageBox.critical(self, self.trUtf8("Import Highlighting Styles"), - self.trUtf8("""<p>The highlighting styles could not be read""" - """ from file <b>{0}</b>.</p><p>Reason: {1}</p>""")\ + self.trUtf8( + """<p>The highlighting styles could not be read""" + """ from file <b>{0}</b>.</p><p>Reason: {1}</p>""")\ .format(fn, f.errorString()) ) return @@ -441,8 +458,8 @@ """ Public method to save the current state of the widget. - @return array containing the index of the selected lexer language (integer) - and the index of the selected lexer entry (integer) + @return array containing the index of the selected lexer language + (integer) and the index of the selected lexer entry (integer) """ savedState = [ self.lexerLanguageComboBox.currentIndex(), @@ -457,7 +474,8 @@ @param state state data generated by saveState """ self.lexerLanguageComboBox.setCurrentIndex(state[0]) - self.on_lexerLanguageComboBox_activated(self.lexerLanguageComboBox.currentText()) + self.on_lexerLanguageComboBox_activated( + self.lexerLanguageComboBox.currentText()) self.styleElementList.setCurrentRow(state[1]) @@ -466,6 +484,7 @@ Module function to create the configuration page. @param dlg reference to the configuration dialog + @return reference to the instantiated page (ConfigurationPageBase) """ page = EditorHighlightingStylesPage(dlg.getLexers()) return page