src/eric7/Preferences/ConfigurationPages/LogViewerPage.py

Tue, 12 Nov 2024 18:01:04 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 12 Nov 2024 18:01:04 +0100
branch
eric7
changeset 11049
c23e1dddf6a3
parent 10692
9becf9ca115c
child 11090
f5f5f5803935
permissions
-rw-r--r--

Added a configuration entry on the Qt page to enter the path of the 'lrelease' program for that cases, where it cannot be detected automatically (e.g. due to different name).

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
10439
21c28b0f9e41 Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10428
diff changeset
3 # Copyright (c) 2006 - 2024 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
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
13 from eric7 import Preferences
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
14
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 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
16 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
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 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
23
10692
9becf9ca115c Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10683
diff changeset
24 def __init__(self):
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 Constructor
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 """
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
28 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
29 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
30 self.setObjectName("LogViewerPage")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
31
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
32 self.stdoutFilterEdit.setListWhatsThis(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
33 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
34 "<b>Message Filters for Standard Output</b>"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
35 "<p>This list shows the configured message filters used to"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
36 " suppress messages received via stdout.</p>"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
37 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
38 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
39 self.stderrFilterEdit.setListWhatsThis(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
40 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
41 "<b>Message Filters for Standard Error </b>"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
42 "<p>This list shows the configured message filters used to"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
43 " suppress messages received via stderr.</p>"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
44 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
45 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
46 self.stdxxxFilterEdit.setListWhatsThis(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
47 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
48 "<b>Message Filters for both</b>"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
49 "<p>This list shows the configured message filters used to"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
50 " suppress messages received via stdout or stderr.</p>"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
51 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
52 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
53
8869
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
54 self.colourChanged.connect(self.__colorChanged)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
55
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 # set initial values
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
57 self.lvAutoRaiseCheckBox.setChecked(Preferences.getUI("LogViewerAutoRaise"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
58
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 self.initColour(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60 "LogStdErrColour", self.stderrTextColourButton, Preferences.getUI
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
61 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
63 self.stdoutFilterEdit.setList(Preferences.getUI("LogViewerStdoutFilter"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
64 self.stderrFilterEdit.setList(Preferences.getUI("LogViewerStderrFilter"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65 self.stdxxxFilterEdit.setList(Preferences.getUI("LogViewerStdxxxFilter"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
66
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 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
68 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 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
70 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
71 Preferences.setUI("LogViewerAutoRaise", self.lvAutoRaiseCheckBox.isChecked())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
72
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.saveColours(Preferences.setUI)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
74
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75 Preferences.setUI("LogViewerStdoutFilter", self.stdoutFilterEdit.getList())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76 Preferences.setUI("LogViewerStderrFilter", self.stderrFilterEdit.getList())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
77 Preferences.setUI("LogViewerStdxxxFilter", self.stdxxxFilterEdit.getList())
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
78
8869
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
79 @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
80 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
81 """
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
82 Private slot handling the selection of a color.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
83
8869
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
84 @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
85 @type str
3dbb04832c21 Added an error text example to the log viewer configuration page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8863
diff changeset
86 @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
87 @type QColor
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 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
90 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
91
8879
159a4d6bab47 Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8869
diff changeset
92
10683
779cda568acb Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
93 def create(_dlg):
4095
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 """
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 Module function to create the configuration page.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
96
10683
779cda568acb Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
97 @param _dlg reference to the configuration dialog (unused)
10428
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
98 @type ConfigurationDialog
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
99 @return reference to the instantiated page
a071d4065202 Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
100 @rtype ConfigurationPageBase
4095
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 page = LogViewerPage()
c78cdc1a3c14 Added a configuration page for the log viewer to the configuration dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 return page

eric ide

mercurial