5 |
5 |
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 |
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, QWidget, \ |
12 QHBoxLayout, QTextDocument |
12 QHBoxLayout, QTextDocument |
13 |
13 |
14 from E5Gui.E5Application import e5App |
14 from E5Gui.E5Application import e5App |
15 |
15 |
42 self.__layout.addWidget(self.__logViewer) |
42 self.__layout.addWidget(self.__logViewer) |
43 self.__layout.addWidget(self.__searchWidget) |
43 self.__layout.addWidget(self.__searchWidget) |
44 |
44 |
45 self.__searchWidget.searchNext.connect(self.__logViewer.searchNext) |
45 self.__searchWidget.searchNext.connect(self.__logViewer.searchNext) |
46 self.__searchWidget.searchPrevious.connect(self.__logViewer.searchPrev) |
46 self.__searchWidget.searchPrevious.connect(self.__logViewer.searchPrev) |
|
47 self.__logViewer.searchStringFound.connect(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 |
71 """ |
72 """ |
72 Public method to display the search widget. |
73 Public method to display the search widget. |
73 |
74 |
74 @param txt text to be shown in the combo (string) |
75 @param txt text to be shown in the combo (string) |
75 """ |
76 """ |
76 self.__searchWidget.showFind() |
77 self.__searchWidget.showFind(txt) |
77 |
78 |
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 |
|
84 @signal searchStringFound(found) emitted to indicate the search result (boolean) |
|
85 """ |
|
86 searchStringFound = pyqtSignal(bool) |
|
87 |
83 def __init__(self, parent=None): |
88 def __init__(self, parent=None): |
84 """ |
89 """ |
85 Constructor |
90 Constructor |
86 |
91 |
87 @param parent reference to the parent widget (QWidget) |
92 @param parent reference to the parent widget (QWidget) |
183 flags = QTextDocument.FindFlags() |
188 flags = QTextDocument.FindFlags() |
184 if caseSensitive: |
189 if caseSensitive: |
185 flags |= QTextDocument.FindCaseSensitively |
190 flags |= QTextDocument.FindCaseSensitively |
186 if wholeWord: |
191 if wholeWord: |
187 flags |= QTextDocument.FindWholeWords |
192 flags |= QTextDocument.FindWholeWords |
188 self.find(txt, flags) |
193 ok = self.find(txt, flags) |
|
194 self.searchStringFound.emit(ok) |
189 |
195 |
190 def searchPrev(self, txt, caseSensitive, wholeWord): |
196 def searchPrev(self, txt, caseSensitive, wholeWord): |
191 """ |
197 """ |
192 Public method to search the previous occurrence of the given text. |
198 Public method to search the previous occurrence of the given text. |
193 """ |
199 """ |
195 flags = QTextDocument.FindFlags(QTextDocument.FindBackward) |
201 flags = QTextDocument.FindFlags(QTextDocument.FindBackward) |
196 if caseSensitive: |
202 if caseSensitive: |
197 flags |= QTextDocument.FindCaseSensitively |
203 flags |= QTextDocument.FindCaseSensitively |
198 if wholeWord: |
204 if wholeWord: |
199 flags |= QTextDocument.FindWholeWords |
205 flags |= QTextDocument.FindWholeWords |
200 self.find(txt, flags) |
206 ok = self.find(txt, flags) |
|
207 self.searchStringFound.emit(ok) |
201 |
208 |
202 def keyPressEvent(self, evt): |
209 def keyPressEvent(self, evt): |
203 """ |
210 """ |
204 Protected method handling key press events. |
211 Protected method handling key press events. |
205 |
212 |