Added an error text example to the log viewer configuration page. eric7

Tue, 28 Dec 2021 16:36:53 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 28 Dec 2021 16:36:53 +0100
branch
eric7
changeset 8869
3dbb04832c21
parent 8868
612e9b9b5ad9
child 8870
081e5bc340dc

Added an error text example to the log viewer configuration page.

eric7/Preferences/ConfigurationPages/ConfigurationPageBase.py file | annotate | diff | comparison | revisions
eric7/Preferences/ConfigurationPages/LogViewerPage.py file | annotate | diff | comparison | revisions
eric7/Preferences/ConfigurationPages/LogViewerPage.ui file | annotate | diff | comparison | revisions
--- a/eric7/Preferences/ConfigurationPages/ConfigurationPageBase.py	Tue Dec 28 15:48:39 2021 +0100
+++ b/eric7/Preferences/ConfigurationPages/ConfigurationPageBase.py	Tue Dec 28 16:36:53 2021 +0100
@@ -86,7 +86,7 @@
         colDlg = QColorDialog(self)
         if hasAlpha:
             colDlg.setOptions(QColorDialog.ColorDialogOption.ShowAlphaChannel)
-        # Set current colour last to avoid conflicts with alpha channel
+        # Set current color last to avoid conflicts with alpha channel
         colDlg.setCurrentColor(self.__coloursDict[colorKey][0])
         colDlg.currentColorChanged.connect(
             lambda col: self.colourChanged.emit(colorKey, col))
@@ -100,7 +100,7 @@
             button.setIcon(QIcon(pm))
             self.__coloursDict[colorKey][0] = colour
         
-        # Update colour selection
+        # Update color selection
         self.colourChanged.emit(colorKey, self.__coloursDict[colorKey][0])
         
     def saveColours(self, prefMethod):
--- a/eric7/Preferences/ConfigurationPages/LogViewerPage.py	Tue Dec 28 15:48:39 2021 +0100
+++ b/eric7/Preferences/ConfigurationPages/LogViewerPage.py	Tue Dec 28 16:36:53 2021 +0100
@@ -7,13 +7,15 @@
 Module implementing the Log Viewer configuration page.
 """
 
+from PyQt6.QtCore import pyqtSlot
+from PyQt6.QtGui import QColor
+
 from .ConfigurationPageBase import ConfigurationPageBase
 from .Ui_LogViewerPage import Ui_LogViewerPage
 
 import Preferences
 
 
-# TODO: add a line edit with an error sample
 class LogViewerPage(ConfigurationPageBase, Ui_LogViewerPage):
     """
     Class implementing the Log Viewer configuration page.
@@ -44,6 +46,8 @@
             " suppress messages received via stdout or stderr.</p>"
         ))
         
+        self.colourChanged.connect(self.__colorChanged)
+        
         # set initial values
         self.lvAutoRaiseCheckBox.setChecked(
             Preferences.getUI("LogViewerAutoRaise"))
@@ -79,6 +83,18 @@
             "LogViewerStdxxxFilter",
             self.stdxxxFilterEdit.getList())
     
+    @pyqtSlot(str, QColor)
+    def __colorChanged(self, colorKey, color):
+        """
+        Private slot handling the selection of a color.
+        
+        @param colorKey key of the color entry
+        @type str
+        @param color selected color
+        @type QColor
+        """
+        if colorKey == "LogStdErrColour":
+            self.errorTextExample.setStyleSheet(f"color: {color.name()}")
 
 def create(dlg):
     """
--- a/eric7/Preferences/ConfigurationPages/LogViewerPage.ui	Tue Dec 28 15:48:39 2021 +0100
+++ b/eric7/Preferences/ConfigurationPages/LogViewerPage.ui	Tue Dec 28 16:36:53 2021 +0100
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>442</width>
-    <height>388</height>
+    <width>601</width>
+    <height>479</height>
    </rect>
   </property>
   <layout class="QVBoxLayout" name="verticalLayout">
@@ -67,17 +67,14 @@
       </widget>
      </item>
      <item>
-      <spacer name="horizontalSpacer">
-       <property name="orientation">
-        <enum>Qt::Horizontal</enum>
+      <widget class="QLineEdit" name="errorTextExample">
+       <property name="text">
+        <string>There was an error condition reported.</string>
        </property>
-       <property name="sizeHint" stdset="0">
-        <size>
-         <width>316</width>
-         <height>20</height>
-        </size>
+       <property name="readOnly">
+        <bool>true</bool>
        </property>
-      </spacer>
+      </widget>
      </item>
     </layout>
    </item>

eric ide

mercurial