Sun, 31 Dec 2017 16:52:09 +0100
Updated copyright for 2018.
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 | |
6048
82ad8ec9548c
Updated copyright for 2018.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5710
diff
changeset
|
3 | # Copyright (c) 2012 - 2018 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 | |
3656
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3484
diff
changeset
|
12 | from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt |
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3484
diff
changeset
|
13 | from PyQt5.QtWidgets 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 | 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 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
18 | class SearchWidget(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
|
19 | """ |
3366
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
20 | 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
|
21 | |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
22 | @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
|
23 | 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
|
24 | @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
|
25 | 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
|
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 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
30 | def __init__(self, mainWindow, parent=None, spacer=True, showLine=False): |
1823
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 | |
2965
d133c7edd88a
Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2302
diff
changeset
|
34 | @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
|
35 | @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
|
36 | @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
|
37 | main layout (boolean) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
38 | @param showLine flag indicating to show all widget in one row (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
|
39 | """ |
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
|
40 | super(SearchWidget, self).__init__(parent) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
41 | |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
42 | if showLine: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
43 | from .Ui_SearchWidgetLine import Ui_SearchWidgetLine |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
44 | self.__ui = Ui_SearchWidgetLine() |
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
|
45 | else: |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
46 | from .Ui_SearchWidget import Ui_SearchWidget |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
47 | self.__ui = Ui_SearchWidget() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
48 | self.__ui.setupUi(self) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
49 | if not showLine: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
50 | if spacer: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
51 | spacerItem = QSpacerItem( |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
52 | 20, 1, QSizePolicy.Minimum, QSizePolicy.Expanding) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
53 | self.__ui.verticalLayout.addItem(spacerItem) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
54 | else: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
55 | # change the size policy of the search combo if the spacer is |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
56 | # not wanted, i.e. it is below the to be searched widget |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
57 | sizePolicy = self.__ui.findtextCombo.sizePolicy() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
58 | sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
59 | self.__ui.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
|
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.__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
|
62 | 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
|
63 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
64 | self.__ui.closeButton.setIcon( |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
65 | UI.PixmapCache.getIcon("close.png")) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
66 | self.__ui.findPrevButton.setIcon( |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
67 | UI.PixmapCache.getIcon("1leftarrow.png")) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
68 | self.__ui.findNextButton.setIcon( |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
69 | UI.PixmapCache.getIcon("1rightarrow.png")) |
1823
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 | 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
|
72 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
73 | self.__ui.findtextCombo.setCompleter(None) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
74 | self.__ui.findtextCombo.lineEdit().returnPressed.connect( |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
75 | 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
|
76 | |
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
77 | 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
|
78 | 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
|
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 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | 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
|
82 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | 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
|
84 | """ |
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 | 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
|
88 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | 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
|
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 | @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
|
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 | 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
|
94 | 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
|
95 | 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
|
96 | 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
|
97 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | 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
|
100 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | 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
|
102 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
103 | txt = self.__ui.findtextCombo.currentText() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
104 | if not txt and not self.isVisible(): |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
105 | self.showFind() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
106 | return |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
107 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | 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
|
109 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | # 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
|
111 | # 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
|
112 | 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
|
113 | 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
|
114 | self.findHistory.insert(0, txt) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
115 | self.__ui.findtextCombo.clear() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
116 | self.__ui.findtextCombo.addItems(self.findHistory) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | |
3030
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
118 | self.searchNext.emit( |
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
119 | txt, |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
120 | self.__ui.caseCheckBox.isChecked(), |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
121 | self.__ui.wordCheckBox.isChecked()) |
1823
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 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | 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
|
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 | 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
|
127 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
128 | txt = self.__ui.findtextCombo.currentText() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
129 | if not txt and not self.isVisible(): |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
130 | self.showFind() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
131 | return |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
132 | |
1823
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.__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
|
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 | # 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
|
136 | # 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
|
137 | 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
|
138 | 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
|
139 | self.findHistory.insert(0, txt) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
140 | self.__ui.findtextCombo.clear() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
141 | self.__ui.findtextCombo.addItems(self.findHistory) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | |
3030
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
143 | self.searchPrevious.emit( |
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
144 | txt, |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
145 | self.__ui.caseCheckBox.isChecked(), |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
146 | self.__ui.wordCheckBox.isChecked()) |
1823
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 | @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
|
149 | 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
|
150 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | 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
|
152 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | @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
|
154 | """ |
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.__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
|
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 __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
|
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 | 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
|
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 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
|
162 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
163 | self.__ui.findPrevButton.setEnabled(enabled) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
164 | self.__ui.findNextButton.setEnabled(enabled) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | 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
|
167 | """ |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
168 | 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
|
169 | 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
|
170 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | 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
|
172 | 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
|
173 | else: |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | 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
|
175 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | 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
|
177 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | 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
|
179 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | @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
|
181 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
182 | self.__ui.findtextCombo.clear() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
183 | self.__ui.findtextCombo.addItems(self.findHistory) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
184 | self.__ui.findtextCombo.setEditText(txt) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
185 | self.__ui.findtextCombo.setFocus() |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
187 | 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
|
188 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | 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
|
190 | |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
191 | 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
|
192 | """ |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
193 | 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
|
194 | |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
195 | @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
|
196 | """ |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
197 | if found: |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
198 | self.__ui.statusLabel.clear() |
1830
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
199 | else: |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
200 | txt = self.__ui.findtextCombo.currentText() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
201 | self.__ui.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
|
202 | self.tr("'{0}' was not found.").format(txt)) |