Sat, 31 Dec 2016 13:34:21 +0100
Updated copyright for 2017.
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
5389
9b1c800daff3
Updated copyright for 2017.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4631
diff
changeset
|
3 | # Copyright (c) 2012 - 2017 Detlev Offenbach <detlev@die-offenbachs.de> |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a horizontal search widget for QTextEdit. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | from __future__ import unicode_literals |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | from PyQt5.QtCore import pyqtSlot, Qt |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | from PyQt5.QtGui import QTextDocument |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
14 | from PyQt5.QtWidgets import QWidget |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
15 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | from E5Gui import E5MessageBox |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
17 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | from .Ui_E5TextEditSearchWidget import Ui_E5TextEditSearchWidget |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | import UI.PixmapCache |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | class E5TextEditSearchWidget(QWidget, Ui_E5TextEditSearchWidget): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
25 | Class implementing a horizontal search widget for QTextEdit. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | def __init__(self, parent=None): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | Constructor |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | @param parent reference to the parent widget (QWidget) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | super(E5TextEditSearchWidget, self).__init__(parent) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | self.setupUi(self) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | self.__textedit = None |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | self.__findBackwards = True |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | self.findPrevButton.setIcon(UI.PixmapCache.getIcon("1leftarrow.png")) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | self.findNextButton.setIcon(UI.PixmapCache.getIcon("1rightarrow.png")) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | self.findHistory = [] |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | self.findtextCombo.setCompleter(None) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | self.findtextCombo.lineEdit().returnPressed.connect( |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | self.__findByReturnPressed) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | self.__setSearchButtons(False) |
4586
9221c0c5c66f
Fixed a forgotten focus proxy for the E5TextEditSearchWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4039
diff
changeset
|
49 | |
9221c0c5c66f
Fixed a forgotten focus proxy for the E5TextEditSearchWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4039
diff
changeset
|
50 | self.setFocusProxy(self.findtextCombo) |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | def attachTextEdit(self, textedit): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | Public method to attach a QTextEdit widget. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | @param textedit reference to the QTextEdit to be attached (QTextEdit) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | self.__textedit = textedit |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | def keyPressEvent(self, event): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | Protected slot to handle key press events. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | @param event reference to the key press event (QKeyEvent) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | if self.__textedit and event.key() == Qt.Key_Escape: |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | self.__textedit.setFocus(Qt.ActiveWindowFocusReason) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | event.accept() |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | @pyqtSlot(str) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | def on_findtextCombo_editTextChanged(self, txt): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | Private slot to enable/disable the find buttons. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | @param txt text of the combobox (string) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | self.__setSearchButtons(txt != "") |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | def __setSearchButtons(self, enabled): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | Private slot to set the state of the search buttons. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | @param enabled flag indicating the state (boolean) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | self.findPrevButton.setEnabled(enabled) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | self.findNextButton.setEnabled(enabled) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | def __findByReturnPressed(self): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | Private slot to handle the returnPressed signal of the findtext |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | combobox. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
92 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
93 | self.__find(self.__findBackwards) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | @pyqtSlot() |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | def on_findPrevButton_clicked(self): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | Private slot to find the previous occurrence. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | self.__find(True) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
101 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | @pyqtSlot() |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | def on_findNextButton_clicked(self): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
105 | Private slot to find the next occurrence. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | self.__find(False) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
109 | def __find(self, backwards): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | Private method to search the associated text edit. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
113 | @param backwards flag indicating a backwards search (boolean) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | if not self.__textedit: |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | return |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | txt = self.findtextCombo.currentText() |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
119 | self.__findBackwards = backwards |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | # This moves any previous occurrence of this statement to the head |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | # of the list and updates the combobox |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
123 | if txt in self.findHistory: |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | self.findHistory.remove(txt) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | self.findHistory.insert(0, txt) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | self.findtextCombo.clear() |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | self.findtextCombo.addItems(self.findHistory) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | if backwards: |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | flags = QTextDocument.FindFlags(QTextDocument.FindBackward) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | else: |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | flags = QTextDocument.FindFlags() |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | if self.caseCheckBox.isChecked(): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | flags |= QTextDocument.FindCaseSensitively |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | if self.wordCheckBox.isChecked(): |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | flags |= QTextDocument.FindWholeWords |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | ok = self.__textedit.find(txt, flags) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | if not ok: |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | E5MessageBox.information( |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | self, |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | self.tr("Find"), |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | self.tr("""'{0}' was not found.""").format(txt)) |