Sun, 12 Apr 2020 19:07:49 +0200
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
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 | |
7360
9190402e4505
Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
3 | # Copyright (c) 2012 - 2020 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 | """ |
6987
3371a03ed0a7
Performed some interface cleanups.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
7 | Module implementing the search box for the shell 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 | |
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
|
10 | |
3656
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3484
diff
changeset
|
11 | from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt |
441956d8fce5
Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3484
diff
changeset
|
12 | 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
|
13 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | 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
|
15 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
17 | 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
|
18 | """ |
6987
3371a03ed0a7
Performed some interface cleanups.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
19 | Class implementing the search box for the shell 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
|
20 | |
6573
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
21 | @signal searchNext(text, caseSensitive, wholeWord, regexp) emitted when the |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
22 | user pressed the next button (string, boolean, boolean) |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
23 | @signal searchPrevious(text, caseSensitive, wholeWord, regexp) emitted when |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
24 | the 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
|
25 | """ |
6573
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
26 | searchNext = pyqtSignal(str, bool, bool, bool) |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
27 | searchPrevious = pyqtSignal(str, bool, bool, bool) |
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 | |
7206
74666c6679af
Removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6987
diff
changeset
|
29 | 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
|
30 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | Constructor |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | |
6573
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
33 | @param mainWindow reference to the main window |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
34 | @type QWidget |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
35 | @param parent reference to the parent widget |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
36 | @type 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
|
37 | @param spacer flag indicating to add a vertical spacer to the |
6573
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
38 | main layout |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
39 | @type bool |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
40 | @param showLine flag indicating to show all widget in one row |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
41 | @type bool |
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 | """ |
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
|
43 | super(SearchWidget, self).__init__(parent) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
44 | |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
45 | if showLine: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
46 | from .Ui_SearchWidgetLine import Ui_SearchWidgetLine |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
47 | 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
|
48 | else: |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
49 | from .Ui_SearchWidget import Ui_SearchWidget |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
50 | self.__ui = Ui_SearchWidget() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
51 | self.__ui.setupUi(self) |
6573
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
52 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
53 | if not showLine: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
54 | if spacer: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
55 | spacerItem = QSpacerItem( |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
56 | 20, 1, QSizePolicy.Minimum, QSizePolicy.Expanding) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
57 | self.__ui.verticalLayout.addItem(spacerItem) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
58 | else: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
59 | # 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
|
60 | # 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
|
61 | sizePolicy = self.__ui.findtextCombo.sizePolicy() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
62 | sizePolicy.setHorizontalPolicy(QSizePolicy.Expanding) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
63 | 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
|
64 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | 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
|
66 | 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
|
67 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
68 | self.__ui.closeButton.setIcon( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
69 | UI.PixmapCache.getIcon("close")) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
70 | self.__ui.findPrevButton.setIcon( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
71 | UI.PixmapCache.getIcon("1leftarrow")) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
72 | self.__ui.findNextButton.setIcon( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
73 | UI.PixmapCache.getIcon("1rightarrow")) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | 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
|
76 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
77 | self.__ui.findtextCombo.setCompleter(None) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
78 | 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
|
79 | 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
|
80 | |
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
81 | 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
|
82 | 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
|
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 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | 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
|
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 | 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
|
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 | 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
|
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 | 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
|
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 | 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
|
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 | @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
|
96 | """ |
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 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
|
98 | 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
|
99 | 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
|
100 | 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
|
101 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | 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
|
104 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | 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
|
106 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
107 | txt = self.__ui.findtextCombo.currentText() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
108 | if not txt and not self.isVisible(): |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
109 | self.showFind() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
110 | return |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
111 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | 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
|
113 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | # 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
|
115 | # 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
|
116 | 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
|
117 | 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
|
118 | self.findHistory.insert(0, txt) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
119 | self.__ui.findtextCombo.clear() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
120 | 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
|
121 | |
3030
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
122 | self.searchNext.emit( |
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
123 | txt, |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
124 | self.__ui.caseCheckBox.isChecked(), |
6573
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
125 | self.__ui.wordCheckBox.isChecked(), |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
126 | self.__ui.regexpCheckBox.isChecked(), |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
127 | ) |
1823
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() |
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_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
|
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 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
|
133 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
134 | txt = self.__ui.findtextCombo.currentText() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
135 | if not txt and not self.isVisible(): |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
136 | self.showFind() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
137 | return |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
138 | |
1823
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.__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
|
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 | # 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
|
142 | # 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
|
143 | 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
|
144 | 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
|
145 | self.findHistory.insert(0, txt) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
146 | self.__ui.findtextCombo.clear() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
147 | 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
|
148 | |
3030
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
149 | self.searchPrevious.emit( |
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
150 | txt, |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
151 | self.__ui.caseCheckBox.isChecked(), |
6573
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
152 | self.__ui.wordCheckBox.isChecked(), |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
153 | self.__ui.regexpCheckBox.isChecked(), |
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
154 | ) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | @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
|
157 | 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
|
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 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
|
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 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
|
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.__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
|
164 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | 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
|
166 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | 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
|
168 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | @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
|
170 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
171 | self.__ui.findPrevButton.setEnabled(enabled) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
172 | 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
|
173 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | 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
|
175 | """ |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
176 | 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
|
177 | 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
|
178 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | 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
|
180 | 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
|
181 | else: |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
182 | 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
|
183 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
184 | 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
|
185 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | 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
|
187 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | @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
|
189 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
190 | self.__ui.findtextCombo.clear() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
191 | self.__ui.findtextCombo.addItems(self.findHistory) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
192 | self.__ui.findtextCombo.setEditText(txt) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
193 | 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
|
194 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | 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
|
196 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | 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
|
198 | |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
199 | 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
|
200 | """ |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
201 | 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
|
202 | |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
203 | @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
|
204 | """ |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
205 | if found: |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
206 | 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
|
207 | else: |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
208 | txt = self.__ui.findtextCombo.currentText() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
209 | 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
|
210 | self.tr("'{0}' was not found.").format(txt)) |