Thu, 03 Apr 2014 23:05:31 +0200
Merge with default branch.
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 | |
3160
209a07d7e401
Updated copyright for 2014.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3030
diff
changeset
|
3 | # Copyright (c) 2012 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> |
1823
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 | """ |
3366
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
7 | Module implementing the search box for the shell, terminal and log viewer. |
1823
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 | |
3145
a9de05d4a22f
# __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
3058
diff
changeset
|
10 | from __future__ import unicode_literals |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
11 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | from PyQt4.QtCore import pyqtSlot, pyqtSignal, Qt |
1833
f7cd855680f1
Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1830
diff
changeset
|
13 | from PyQt4.QtGui import QWidget, QSpacerItem, QSizePolicy |
1823
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 | 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
|
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 | 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
|
18 | |
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 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
|
21 | """ |
3366
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
22 | Class implementing the search box for the shell, terminal and log viewer. |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
24 | @signal searchNext(text, caseSensitive, wholeWord) emitted when the user |
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
25 | pressed the next button (string, boolean, boolean) |
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
26 | @signal searchPrevious(text, caseSensitive, wholeWord) emitted when the |
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
27 | user pressed the previous button (string, boolean, boolean) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | 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
|
30 | 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
|
31 | |
1833
f7cd855680f1
Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1830
diff
changeset
|
32 | def __init__(self, mainWindow, parent=None, spacer=True): |
1823
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 | Constructor |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | |
2965
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
36 | @param mainWindow reference to the main window (QWidget) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | @param parent reference to the parent widget (QWidget) |
1833
f7cd855680f1
Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1830
diff
changeset
|
38 | @param spacer flag indicating to add a vertical spacer to the |
f7cd855680f1
Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1830
diff
changeset
|
39 | main layout (boolean) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | """ |
2525
8b507a9a2d40
Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents:
2302
diff
changeset
|
41 | super(SearchWidget, self).__init__(parent) |
1823
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.setupUi(self) |
1833
f7cd855680f1
Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1830
diff
changeset
|
43 | if spacer: |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
44 | spacerItem = QSpacerItem( |
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
45 | 20, 1, QSizePolicy.Minimum, QSizePolicy.Expanding) |
1833
f7cd855680f1
Added the capability to search in the output of the shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1830
diff
changeset
|
46 | self.verticalLayout.addItem(spacerItem) |
1848
aa5003c03f83
A little enhancement to the new search widget for the shell, terminal and log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1833
diff
changeset
|
47 | else: |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
48 | # change the size policy of the search combo if the spacer is not |
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
49 | # wanted, i.e. it is below the to be searched widget |
1848
aa5003c03f83
A little enhancement to the new search widget for the shell, terminal and log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1833
diff
changeset
|
50 | sizePolicy = self.findtextCombo.sizePolicy() |
aa5003c03f83
A little enhancement to the new search widget for the shell, terminal and log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1833
diff
changeset
|
51 | sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding) |
aa5003c03f83
A little enhancement to the new search widget for the shell, terminal and log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1833
diff
changeset
|
52 | self.findtextCombo.setSizePolicy(sizePolicy) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | 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
|
55 | 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
|
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 | 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
|
58 | 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
|
59 | 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
|
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 | 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
|
62 | |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
63 | self.findtextCombo.lineEdit().returnPressed.connect( |
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
64 | self.__findByReturnPressed) |
3366
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
65 | |
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
66 | msh = self.minimumSizeHint() |
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
67 | self.resize(max(self.width(), msh.width()), msh.height()) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | 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
|
71 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | 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
|
73 | """ |
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.close() |
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 | 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
|
77 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | 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
|
79 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | @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
|
81 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | 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
|
83 | 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
|
84 | 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
|
85 | 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
|
86 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | 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
|
89 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | 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
|
91 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | 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
|
93 | 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
|
94 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | # 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
|
96 | # 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
|
97 | 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
|
98 | 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
|
99 | 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
|
100 | 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
|
101 | 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
|
102 | |
3030
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
103 | self.searchNext.emit( |
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
104 | txt, |
1823
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() |
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_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
|
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 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
|
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 | 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
|
114 | 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
|
115 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | # 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
|
117 | # 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
|
118 | 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
|
119 | 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
|
120 | 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
|
121 | 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
|
122 | 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
|
123 | |
3030
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
124 | self.searchPrevious.emit( |
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
125 | txt, |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | 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
|
127 | 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
|
128 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | @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
|
130 | 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
|
131 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | 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
|
133 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | @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
|
135 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | 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
|
137 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | 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
|
139 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | 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
|
141 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | @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
|
143 | """ |
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.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
|
145 | 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
|
146 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | 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
|
148 | """ |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
149 | Private slot to handle the returnPressed signal of the findtext |
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
150 | combobox. |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | 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
|
153 | 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
|
154 | else: |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | 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
|
156 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | 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
|
158 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | 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
|
160 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | @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
|
162 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | 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
|
164 | 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
|
165 | 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
|
166 | 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
|
167 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | 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
|
169 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | 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
|
171 | |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
172 | 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
|
173 | """ |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
174 | 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
|
175 | |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
176 | @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
|
177 | """ |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
178 | 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
|
179 | 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
|
180 | else: |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
181 | txt = self.findtextCombo.currentText() |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
182 | self.statusLabel.setText( |
3190
a9a94491c4fd
Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3160
diff
changeset
|
183 | self.tr("'{0}' was not found.").format(txt)) |