Sun, 24 Nov 2013 15:24:24 +0100
Made the editor highlighting styles page more colorful (i.e. show the colors and fonts in line).
--- a/Documentation/Help/source.qhp Thu Nov 21 18:43:54 2013 +0100 +++ b/Documentation/Help/source.qhp Sun Nov 24 15:24:24 2013 +0100 @@ -4625,6 +4625,7 @@ <keyword name="EditorHighlightingStylesPage.__fontButtonMenuTriggered" id="EditorHighlightingStylesPage.__fontButtonMenuTriggered" ref="eric5.Preferences.ConfigurationPages.EditorHighlightingStylesPage.html#EditorHighlightingStylesPage.__fontButtonMenuTriggered" /> <keyword name="EditorHighlightingStylesPage.__importStyles" id="EditorHighlightingStylesPage.__importStyles" ref="eric5.Preferences.ConfigurationPages.EditorHighlightingStylesPage.html#EditorHighlightingStylesPage.__importStyles" /> <keyword name="EditorHighlightingStylesPage.__setToDefault" id="EditorHighlightingStylesPage.__setToDefault" ref="eric5.Preferences.ConfigurationPages.EditorHighlightingStylesPage.html#EditorHighlightingStylesPage.__setToDefault" /> + <keyword name="EditorHighlightingStylesPage.__styleAllItems" id="EditorHighlightingStylesPage.__styleAllItems" ref="eric5.Preferences.ConfigurationPages.EditorHighlightingStylesPage.html#EditorHighlightingStylesPage.__styleAllItems" /> <keyword name="EditorHighlightingStylesPage.on_allBackgroundColoursButton_clicked" id="EditorHighlightingStylesPage.on_allBackgroundColoursButton_clicked" ref="eric5.Preferences.ConfigurationPages.EditorHighlightingStylesPage.html#EditorHighlightingStylesPage.on_allBackgroundColoursButton_clicked" /> <keyword name="EditorHighlightingStylesPage.on_allDefaultButton_clicked" id="EditorHighlightingStylesPage.on_allDefaultButton_clicked" ref="eric5.Preferences.ConfigurationPages.EditorHighlightingStylesPage.html#EditorHighlightingStylesPage.on_allDefaultButton_clicked" /> <keyword name="EditorHighlightingStylesPage.on_allEolFillButton_clicked" id="EditorHighlightingStylesPage.on_allEolFillButton_clicked" ref="eric5.Preferences.ConfigurationPages.EditorHighlightingStylesPage.html#EditorHighlightingStylesPage.on_allEolFillButton_clicked" />
--- a/Documentation/Source/eric5.Preferences.ConfigurationPages.EditorHighlightingStylesPage.html Thu Nov 21 18:43:54 2013 +0100 +++ b/Documentation/Source/eric5.Preferences.ConfigurationPages.EditorHighlightingStylesPage.html Sun Nov 24 15:24:24 2013 +0100 @@ -81,6 +81,9 @@ <td><a href="#EditorHighlightingStylesPage.__setToDefault">__setToDefault</a></td> <td>Private method to set a specific style to its default values.</td> </tr><tr> +<td><a href="#EditorHighlightingStylesPage.__styleAllItems">__styleAllItems</a></td> +<td>Private method to style all items of the style element list.</td> +</tr><tr> <td><a href="#EditorHighlightingStylesPage.on_allBackgroundColoursButton_clicked">on_allBackgroundColoursButton_clicked</a></td> <td>Private method used to select the background colour of all styles of a selected lexer.</td> </tr><tr> @@ -218,7 +221,12 @@ <dd> style to be reset (integer) </dd> -</dl><a NAME="EditorHighlightingStylesPage.on_allBackgroundColoursButton_clicked" ID="EditorHighlightingStylesPage.on_allBackgroundColoursButton_clicked"></a> +</dl><a NAME="EditorHighlightingStylesPage.__styleAllItems" ID="EditorHighlightingStylesPage.__styleAllItems"></a> +<h4>EditorHighlightingStylesPage.__styleAllItems</h4> +<b>__styleAllItems</b>(<i></i>) +<p> + Private method to style all items of the style element list. +</p><a NAME="EditorHighlightingStylesPage.on_allBackgroundColoursButton_clicked" ID="EditorHighlightingStylesPage.on_allBackgroundColoursButton_clicked"></a> <h4>EditorHighlightingStylesPage.on_allBackgroundColoursButton_clicked</h4> <b>on_allBackgroundColoursButton_clicked</b>(<i></i>) <p>
--- a/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py Thu Nov 21 18:43:54 2013 +0100 +++ b/Preferences/ConfigurationPages/EditorHighlightingStylesPage.py Sun Nov 24 15:24:24 2013 +0100 @@ -107,8 +107,24 @@ self.styleGroup.setEnabled(True) self.styleElementList.addItems(self.lexer.styles) + self.__styleAllItems() self.styleElementList.setCurrentRow(0) + def __styleAllItems(self): + """ + Private method to style all items of the style element list. + """ + for row in range(self.styleElementList.count()): + style = self.lexer.ind2style[row] + colour = self.lexer.color(style) + paper = self.lexer.paper(style) + font = self.lexer.font(style) + + itm = self.styleElementList.item(row) + itm.setFont(font) + itm.setBackground(paper) + itm.setForeground(colour) + def on_styleElementList_currentRowChanged(self, index): """ Private method to set up the style element part of the source page. @@ -150,8 +166,10 @@ style = self.lexer.ind2style[ self.styleElementList.row(selItem)] self.lexer.setColor(colour, style) + selItem.setForeground(colour) else: self.lexer.setColor(colour, self.style) + self.styleElementList.currentItem().setForeground(colour) @pyqtSlot() def on_backgroundButton_clicked(self): @@ -170,8 +188,10 @@ style = self.lexer.ind2style[ self.styleElementList.row(selItem)] self.lexer.setPaper(colour, style) + selItem.setBackground(colour) else: self.lexer.setPaper(colour, self.style) + self.styleElementList.currentItem().setBackground(colour) @pyqtSlot() def on_allBackgroundColoursButton_clicked(self): @@ -187,6 +207,7 @@ self.sampleText.repaint() for style in list(self.lexer.ind2style.values()): self.lexer.setPaper(colour, style) + self.__styleAllItems() def __changeFont(self, doAll, familyOnly, sizeOnly): """ @@ -242,13 +263,18 @@ if doAll: for style in list(self.lexer.ind2style.values()): setFont(font, style, familyOnly, sizeOnly) + self.__styleAllItems() elif len(self.styleElementList.selectedItems()) > 1: for selItem in self.styleElementList.selectedItems(): style = self.lexer.ind2style[ self.styleElementList.row(selItem)] setFont(font, style, familyOnly, sizeOnly) + itmFont = self.lexer.font(style) + selItem.setFont(itmFont) else: setFont(font, self.style, familyOnly, sizeOnly) + itmFont = self.lexer.font(self.style) + self.styleElementList.currentItem().setFont(itmFont) def __fontButtonMenuTriggered(self, act): """ @@ -319,6 +345,7 @@ self.__setToDefault(self.style) self.on_styleElementList_currentRowChanged( self.styleElementList.currentRow()) + self.__styleAllItems() @pyqtSlot() def on_allDefaultButton_clicked(self): @@ -329,6 +356,7 @@ self.__setToDefault(style) self.on_styleElementList_currentRowChanged( self.styleElementList.currentRow()) + self.__styleAllItems() def __setToDefault(self, style): """ @@ -453,6 +481,8 @@ self.sampleText.setPalette(pl) self.sampleText.repaint() self.eolfillCheckBox.setChecked(eolfill) + + self.__styleAllItems() def saveState(self): """