6 """ |
6 """ |
7 Module implementing the log viewer widget and the log widget. |
7 Module implementing the log viewer widget and the log widget. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import Qt, pyqtSignal |
10 from PyQt4.QtCore import Qt, pyqtSignal |
11 from PyQt4.QtGui import QTextEdit, QBrush, QApplication, QMenu, QTextCursor, QWidget, \ |
11 from PyQt4.QtGui import QTextEdit, QBrush, QApplication, QMenu, QTextCursor, \ |
12 QHBoxLayout, QTextDocument |
12 QWidget, QHBoxLayout, QTextDocument |
13 |
13 |
14 from E5Gui.E5Application import e5App |
14 from E5Gui.E5Application import e5App |
15 |
15 |
16 import UI.PixmapCache |
16 import UI.PixmapCache |
17 import Preferences |
17 import Preferences |
41 self.__layout.addWidget(self.__logViewer) |
41 self.__layout.addWidget(self.__logViewer) |
42 self.__layout.addWidget(self.__searchWidget) |
42 self.__layout.addWidget(self.__searchWidget) |
43 |
43 |
44 self.__searchWidget.searchNext.connect(self.__logViewer.searchNext) |
44 self.__searchWidget.searchNext.connect(self.__logViewer.searchNext) |
45 self.__searchWidget.searchPrevious.connect(self.__logViewer.searchPrev) |
45 self.__searchWidget.searchPrevious.connect(self.__logViewer.searchPrev) |
46 self.__logViewer.searchStringFound.connect(self.__searchWidget.searchStringFound) |
46 self.__logViewer.searchStringFound.connect( |
|
47 self.__searchWidget.searchStringFound) |
47 |
48 |
48 def appendToStdout(self, txt): |
49 def appendToStdout(self, txt): |
49 """ |
50 """ |
50 Public slot to appand text to the "stdout" tab. |
51 Public slot to appand text to the "stdout" tab. |
51 |
52 |
78 |
79 |
79 class LogViewerEdit(QTextEdit): |
80 class LogViewerEdit(QTextEdit): |
80 """ |
81 """ |
81 Class providing a specialized text edit for displaying logging information. |
82 Class providing a specialized text edit for displaying logging information. |
82 |
83 |
83 @signal searchStringFound(found) emitted to indicate the search result (boolean) |
84 @signal searchStringFound(found) emitted to indicate the search result |
|
85 (boolean) |
84 """ |
86 """ |
85 searchStringFound = pyqtSignal(bool) |
87 searchStringFound = pyqtSignal(bool) |
86 |
88 |
87 def __init__(self, parent=None): |
89 def __init__(self, parent=None): |
88 """ |
90 """ |
112 self.setContextMenuPolicy(Qt.CustomContextMenu) |
114 self.setContextMenuPolicy(Qt.CustomContextMenu) |
113 self.customContextMenuRequested.connect(self.__handleShowContextMenu) |
115 self.customContextMenuRequested.connect(self.__handleShowContextMenu) |
114 |
116 |
115 self.cNormalFormat = self.currentCharFormat() |
117 self.cNormalFormat = self.currentCharFormat() |
116 self.cErrorFormat = self.currentCharFormat() |
118 self.cErrorFormat = self.currentCharFormat() |
117 self.cErrorFormat.setForeground(QBrush(Preferences.getUI("LogStdErrColour"))) |
119 self.cErrorFormat.setForeground( |
|
120 QBrush(Preferences.getUI("LogStdErrColour"))) |
118 |
121 |
119 def __handleShowContextMenu(self, coord): |
122 def __handleShowContextMenu(self, coord): |
120 """ |
123 """ |
121 Private slot to show the context menu. |
124 Private slot to show the context menu. |
122 |
125 |
162 |
165 |
163 def preferencesChanged(self): |
166 def preferencesChanged(self): |
164 """ |
167 """ |
165 Public slot to handle a change of the preferences. |
168 Public slot to handle a change of the preferences. |
166 """ |
169 """ |
167 self.cErrorFormat.setForeground(QBrush(Preferences.getUI("LogStdErrColour"))) |
170 self.cErrorFormat.setForeground( |
|
171 QBrush(Preferences.getUI("LogStdErrColour"))) |
168 |
172 |
169 def __configure(self): |
173 def __configure(self): |
170 """ |
174 """ |
171 Private method to open the configuration dialog. |
175 Private method to open the configuration dialog. |
172 """ |
176 """ |