src/eric7/Preferences/ConfigurationPages/LogViewerPage.py

Thu, 07 Jul 2022 11:23:56 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 07 Jul 2022 11:23:56 +0200
branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
eric7/Preferences/ConfigurationPages/LogViewerPage.py@54e42bc2437a
child 9221
bf71ee032bb4
permissions
-rw-r--r--

Reorganized the project structure to use the source layout in order to support up-to-date build systems with "pyproject.toml".

4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8879
diff changeset
3 # Copyright (c) 2006 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing the Log Viewer configuration page.
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
8869
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
10 from PyQt6.QtCore import pyqtSlot
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
11 from PyQt6.QtGui import QColor
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
12
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from .ConfigurationPageBase import ConfigurationPageBase
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 from .Ui_LogViewerPage import Ui_LogViewerPage
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import Preferences
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 class LogViewerPage(ConfigurationPageBase, Ui_LogViewerPage):
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21 Class implementing the Log Viewer configuration page.
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 """
4097
ad2a6bd965d9 Added a configuration page to edit the list of mime types to be opened in an eric editor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4095
diff changeset
23 def __init__(self, parent=None):
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Constructor
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 @param parent reference to the parent widget (QWidget)
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
29 super().__init__()
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 self.setupUi(self)
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 self.setObjectName("LogViewerPage")
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 self.stdoutFilterEdit.setListWhatsThis(self.tr(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 "<b>Message Filters for Standard Output</b>"
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 "<p>This list shows the configured message filters used to"
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 " suppress messages received via stdout.</p>"
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 ))
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 self.stderrFilterEdit.setListWhatsThis(self.tr(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 "<b>Message Filters for Standard Error </b>"
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 "<p>This list shows the configured message filters used to"
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 " suppress messages received via stderr.</p>"
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 ))
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.stdxxxFilterEdit.setListWhatsThis(self.tr(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 "<b>Message Filters for both</b>"
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 "<p>This list shows the configured message filters used to"
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 " suppress messages received via stdout or stderr.</p>"
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 ))
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
8869
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
49 self.colourChanged.connect(self.__colorChanged)
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
50
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 # set initial values
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 self.lvAutoRaiseCheckBox.setChecked(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 Preferences.getUI("LogViewerAutoRaise"))
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 self.initColour(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 "LogStdErrColour", self.stderrTextColourButton,
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 Preferences.getUI)
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.stdoutFilterEdit.setList(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 Preferences.getUI("LogViewerStdoutFilter"))
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.stderrFilterEdit.setList(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 Preferences.getUI("LogViewerStderrFilter"))
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 self.stdxxxFilterEdit.setList(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 Preferences.getUI("LogViewerStdxxxFilter"))
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 def save(self):
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 Public slot to save the Interface configuration.
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 Preferences.setUI(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 "LogViewerAutoRaise",
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.lvAutoRaiseCheckBox.isChecked())
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.saveColours(Preferences.setUI)
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 Preferences.setUI(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 "LogViewerStdoutFilter",
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.stdoutFilterEdit.getList())
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 Preferences.setUI(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 "LogViewerStderrFilter",
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 self.stderrFilterEdit.getList())
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 Preferences.setUI(
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 "LogViewerStdxxxFilter",
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 self.stdxxxFilterEdit.getList())
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85
8869
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
86 @pyqtSlot(str, QColor)
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
87 def __colorChanged(self, colorKey, color):
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
88 """
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
89 Private slot handling the selection of a color.
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
90
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
91 @param colorKey key of the color entry
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
92 @type str
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
93 @param color selected color
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
94 @type QColor
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
95 """
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
96 if colorKey == "LogStdErrColour":
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
97 self.errorTextExample.setStyleSheet(f"color: {color.name()}")
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98
8879
159a4d6bab47 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8869
diff changeset
99
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 def create(dlg):
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 Module function to create the configuration page.
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 @param dlg reference to the configuration dialog
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 @return reference to the instantiated page (ConfigurationPageBase)
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 page = LogViewerPage()
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 return page

eric ide

mercurial