Sat, 26 Apr 2025 12:34:32 +0200
MicroPython
- Added a configuration option to disable the support for the no longer produced Pimoroni Pico Wireless Pack.
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 | |
11090
f5f5f5803935
Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10439
diff
changeset
|
3 | # Copyright (c) 2012 - 2025 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 | |
9473
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
10 | from PyQt6.QtCore import Qt, pyqtSignal, pyqtSlot |
3f23dbf37dbe
Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9413
diff
changeset
|
11 | from PyQt6.QtWidgets import QSizePolicy, QSpacerItem, 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
|
12 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
13 | from eric7.EricGui import EricPixmapCache |
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 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
16 | 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
|
17 | """ |
6987
3371a03ed0a7
Performed some interface cleanups.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6942
diff
changeset
|
18 | Class implementing the search box for the shell and log viewer. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
19 | |
6573
ccac2d1f6858
SearchReplaceWidget: changed the regexp search to use QScintilla's POSIX mode
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
20 | @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
|
21 | 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
|
22 | @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
|
23 | 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
|
24 | """ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
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) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
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 |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
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 | """ |
8218
7c09585bd960
Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8143
diff
changeset
|
43 | super().__init__(parent) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
44 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
45 | if showLine: |
11148
15e30f0c76a8
Adjusted the code to the modified issue codes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
46 | from .Ui_SearchWidgetLine import ( # __IGNORE_WARNING_I-101__ |
9482
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
47 | Ui_SearchWidgetLine, |
a2bc06a54d9d
Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9473
diff
changeset
|
48 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
49 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
50 | 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
|
51 | else: |
11148
15e30f0c76a8
Adjusted the code to the modified issue codes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
11090
diff
changeset
|
52 | from .Ui_SearchWidget import Ui_SearchWidget # __IGNORE_WARNING_I-101__ |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
53 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
54 | self.__ui = Ui_SearchWidget() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
55 | self.__ui.setupUi(self) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
56 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
57 | if not showLine: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
58 | if spacer: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
59 | spacerItem = QSpacerItem( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
60 | 20, 1, QSizePolicy.Policy.Minimum, QSizePolicy.Policy.Expanding |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
61 | ) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
62 | self.__ui.verticalLayout.addItem(spacerItem) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
63 | else: |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
64 | # 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
|
65 | # 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
|
66 | sizePolicy = self.__ui.findtextCombo.sizePolicy() |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
67 | sizePolicy.setHorizontalPolicy(QSizePolicy.Policy.Expanding) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
68 | self.__ui.findtextCombo.setSizePolicy(sizePolicy) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
69 | |
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 | 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
|
71 | self.__findBackwards = True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
72 | |
9413
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
73 | self.__ui.closeButton.setIcon(EricPixmapCache.getIcon("close")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
74 | self.__ui.findPrevButton.setIcon(EricPixmapCache.getIcon("1leftarrow")) |
80c06d472826
Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9221
diff
changeset
|
75 | self.__ui.findNextButton.setIcon(EricPixmapCache.getIcon("1rightarrow")) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
76 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | self.findHistory = [] |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
78 | |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
79 | self.__ui.findtextCombo.setCompleter(None) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
80 | self.__ui.findtextCombo.lineEdit().returnPressed.connect( |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
81 | self.__findByReturnPressed |
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
82 | ) |
10190
dbe6394786ea
Little improvement to the various search (and replace) widgets.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9653
diff
changeset
|
83 | self.__ui.findtextCombo.lineEdit().setClearButtonEnabled(True) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
84 | |
3366
6084bb3c3911
Made some changes to have a bunch of dialogs with correct sizes.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3190
diff
changeset
|
85 | 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
|
86 | self.resize(max(self.width(), msh.width()), msh.height()) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
87 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | def on_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
|
90 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | Private slot to 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
|
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 | self.close() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
94 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | 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
|
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 | Protected slot to handle key press events. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
98 | |
10433
328f3ec4b77a
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10190
diff
changeset
|
99 | @param event reference to the key press event |
328f3ec4b77a
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10190
diff
changeset
|
100 | @type QKeyEvent |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | """ |
8143
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
102 | if event.key() == Qt.Key.Key_Escape: |
2c730d5fd177
Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7923
diff
changeset
|
103 | self.__mainWindow.setFocus(Qt.FocusReason.ActiveWindowFocusReason) |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | 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
|
105 | self.close() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
106 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | 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
|
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 | 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
|
111 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
112 | txt = self.__ui.findtextCombo.currentText() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
113 | if not txt and not self.isVisible(): |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
114 | self.showFind() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
115 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
116 | |
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 | self.__findBackwards = False |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
118 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | # 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
|
120 | # 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
|
121 | 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
|
122 | 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
|
123 | self.findHistory.insert(0, txt) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
124 | self.__ui.findtextCombo.clear() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
125 | self.__ui.findtextCombo.addItems(self.findHistory) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
126 | |
3030
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
127 | self.searchNext.emit( |
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
128 | txt, |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
129 | 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
|
130 | 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
|
131 | 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
|
132 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
133 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | @pyqtSlot() |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | def 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
|
136 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | 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
|
138 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
139 | txt = self.__ui.findtextCombo.currentText() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
140 | if not txt and not self.isVisible(): |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
141 | self.showFind() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
142 | return |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
143 | |
1823
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.__findBackwards = True |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
145 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | # 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
|
147 | # 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
|
148 | 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
|
149 | 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
|
150 | self.findHistory.insert(0, txt) |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
151 | self.__ui.findtextCombo.clear() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
152 | self.__ui.findtextCombo.addItems(self.findHistory) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
153 | |
3030
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
154 | self.searchPrevious.emit( |
4a0a82ddd9d2
Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
3012
diff
changeset
|
155 | txt, |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
156 | 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
|
157 | 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
|
158 | 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
|
159 | ) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
160 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | @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
|
162 | 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
|
163 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | Private slot to enable/disable the find buttons. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
165 | |
10433
328f3ec4b77a
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10190
diff
changeset
|
166 | @param txt text of the combobox |
328f3ec4b77a
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10190
diff
changeset
|
167 | @type str |
1823
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 | self.__setSearchButtons(txt != "") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
170 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | 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
|
172 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
173 | Private slot to set the state of the search buttons. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
174 | |
10433
328f3ec4b77a
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10190
diff
changeset
|
175 | @param enabled flag indicating the state |
328f3ec4b77a
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10190
diff
changeset
|
176 | @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
|
177 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
178 | self.__ui.findPrevButton.setEnabled(enabled) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
179 | self.__ui.findNextButton.setEnabled(enabled) |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
180 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
181 | 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
|
182 | """ |
3012
d177226027e2
Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
2965
diff
changeset
|
183 | 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
|
184 | 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
|
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 | 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
|
187 | 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
|
188 | else: |
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.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
|
190 | |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | 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
|
192 | """ |
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | Public method to display this widget. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
194 | |
10433
328f3ec4b77a
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10190
diff
changeset
|
195 | @param txt text to be shown in the combo |
328f3ec4b77a
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10190
diff
changeset
|
196 | @type str |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | """ |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
198 | self.__ui.findtextCombo.clear() |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
199 | self.__ui.findtextCombo.addItems(self.findHistory) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
200 | self.__ui.findtextCombo.setEditText(txt) |
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
201 | self.__ui.findtextCombo.setFocus() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
202 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
203 | self.__setSearchButtons(txt != "") |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
204 | |
1823
21d988eaf1bf
Added the capability to search in the recorded log of the log viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | self.show() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
206 | |
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 | 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
|
208 | """ |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
209 | Public slot to indicate that the search string was found. |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
210 | |
10433
328f3ec4b77a
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10190
diff
changeset
|
211 | @param found flag indicating success |
328f3ec4b77a
Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10190
diff
changeset
|
212 | @type bool |
1830
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
213 | """ |
f2fccb8c2ab4
Added the capability to search in the output of the terminal window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1823
diff
changeset
|
214 | if found: |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
215 | 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
|
216 | else: |
5710
b5809b948010
Continued implementing the standalone shell window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
217 | txt = self.__ui.findtextCombo.currentText() |
9221
bf71ee032bb4
Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
9209
diff
changeset
|
218 | self.__ui.statusLabel.setText(self.tr("'{0}' was not found.").format(txt)) |