Tue, 01 May 2012 18:01:13 +0200
Added the capability to search in the output of the terminal window.
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
3 | # Copyright (c) 2012 Detlev Offenbach <detlev@die-offenbachs.de> |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing the search box for the shel, terminal and log viewer. |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | from PyQt4.QtCore import pyqtSlot, pyqtSignal, Qt |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | from PyQt4.QtGui import QWidget |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | from .Ui_SearchWidget import Ui_SearchWidget |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | import UI.PixmapCache |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | class SearchWidget(QWidget, Ui_SearchWidget): |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | Class implementing the search box for the shel, terminal and log viewer. |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | @signal searchNext(text, caseSensitive, wholeWord) emitted when the user pressed |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | the next button (string, boolean, boolean) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | @signal searchPrevious(text, caseSensitive, wholeWord) emitted when the user pressed |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | the previous button (string, boolean, boolean) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | searchNext = pyqtSignal(str, bool, bool) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | searchPrevious = pyqtSignal(str, bool, bool) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | def __init__(self, mainWindow, parent=None): |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | Constructor |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | @param parent reference to the parent widget (QWidget) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | super().__init__(parent) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | self.setupUi(self) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | self.__mainWindow = mainWindow |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | self.__findBackwards = True |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | self.closeButton.setIcon(UI.PixmapCache.getIcon("close.png")) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | self.findPrevButton.setIcon(UI.PixmapCache.getIcon("1leftarrow.png")) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | self.findNextButton.setIcon(UI.PixmapCache.getIcon("1rightarrow.png")) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | self.findHistory = [] |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | self.findtextCombo.lineEdit().returnPressed.connect(self.__findByReturnPressed) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | def on_closeButton_clicked(self): |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | Private slot to close the widget. |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | self.close() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | def keyPressEvent(self, event): |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | Protected slot to handle key press events. |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | @param event reference to the key press event (QKeyEvent) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | if event.key() == Qt.Key_Escape: |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | self.__mainWindow.setFocus(Qt.ActiveWindowFocusReason) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | event.accept() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | self.close() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | def on_findNextButton_clicked(self): |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | Private slot to find the next occurrence. |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | txt = self.findtextCombo.currentText() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | self.__findBackwards = False |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | # This moves any previous occurrence of this statement to the head |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | # of the list and updates the combobox |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | if txt in self.findHistory: |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | self.findHistory.remove(txt) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | self.findHistory.insert(0, txt) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | self.findtextCombo.clear() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | self.findtextCombo.addItems(self.findHistory) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | self.searchNext.emit(txt, |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | self.caseCheckBox.isChecked(), |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | self.wordCheckBox.isChecked()) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | def on_findPrevButton_clicked(self): |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | Private slot to find the previous occurrence. |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | txt = self.findtextCombo.currentText() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | self.__findBackwards = True |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | # This moves any previous occurrence of this statement to the head |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | # of the list and updates the combobox |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | if txt in self.findHistory: |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | self.findHistory.remove(txt) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | self.findHistory.insert(0, txt) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | self.findtextCombo.clear() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | self.findtextCombo.addItems(self.findHistory) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | self.searchPrevious.emit(txt, |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | self.caseCheckBox.isChecked(), |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | self.wordCheckBox.isChecked()) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | @pyqtSlot(str) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
109 | def on_findtextCombo_editTextChanged(self, txt): |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | Private slot to enable/disable the find buttons. |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | @param txt text of the combobox (string) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | self.__setSearchButtons(txt != "") |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | def __setSearchButtons(self, enabled): |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | Private slot to set the state of the search buttons. |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | @param enabled flag indicating the state (boolean) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | self.findPrevButton.setEnabled(enabled) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | self.findNextButton.setEnabled(enabled) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | def __findByReturnPressed(self): |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | Private slot to handle the returnPressed signal of the findtext combobox. |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | if self.__findBackwards: |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | self.on_findPrevButton_clicked() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | else: |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | self.on_findNextButton_clicked() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | def showFind(self, txt=""): |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | Public method to display this widget. |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | @param txt text to be shown in the combo (string) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | self.findtextCombo.clear() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | self.findtextCombo.addItems(self.findHistory) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | self.findtextCombo.setEditText(txt) |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | self.findtextCombo.setFocus() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | self.__setSearchButtons(txt != "") |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | self.show() |
1830
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
149 | |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
150 | def searchStringFound(self, found): |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
151 | """ |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
152 | Public slot to indicate that the search string was found. |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
153 | |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
154 | @param found flag indicating success (boolean) |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
155 | """ |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
156 | if found: |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
157 | self.statusLabel.clear() |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
158 | else: |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
159 | txt = self.findtextCombo.currentText() |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
160 | self.statusLabel.setText(self.trUtf8("'{0}' was not found.").format(txt)) |