Sun, 05 Nov 2017 11:35:32 +0100
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
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 | |
5959
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
12 | from PyQt5.QtCore import pyqtSlot, Qt, QMetaObject, QSize |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
13 | from PyQt5.QtGui import QPalette, QBrush, QColor, QTextDocument, QTextCursor |
5959
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
14 | from PyQt5.QtWidgets import QWidget, QVBoxLayout, QHBoxLayout, QLabel, \ |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
15 | QComboBox, QCheckBox, QToolButton, QSizePolicy |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
16 | |
5959
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
17 | from E5Gui.E5ComboBox import E5ClearableComboBox |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
18 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
19 | 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
|
20 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | |
5959
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
22 | class E5TextEditSearchWidget(QWidget): |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
24 | 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
|
25 | """ |
5959
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
26 | def __init__(self, parent=None, widthForHeight=True): |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | Constructor |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | |
5959
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
30 | @param parent reference to the parent widget |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
31 | @type QWidget |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
32 | @param widthForHeight flag indicating to prefer width for height. |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
33 | If this parameter is False, some widgets are shown in a third |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
34 | line. |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
35 | @type bool |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | super(E5TextEditSearchWidget, self).__init__(parent) |
5959
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
38 | self.__setupUi(widthForHeight) |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | self.__textedit = None |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
41 | self.__texteditType = "" |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | 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
|
43 | |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
44 | self.__defaultBaseColor = \ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
45 | self.findtextCombo.lineEdit().palette().color(QPalette.Base) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
46 | self.__defaultTextColor = \ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
47 | self.findtextCombo.lineEdit().palette().color(QPalette.Text) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
48 | |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | self.findHistory = [] |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | 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
|
52 | 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
|
53 | self.__findByReturnPressed) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | self.__setSearchButtons(False) |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
56 | self.infoLabel.hide() |
4586
9221c0c5c66f
Fixed a forgotten focus proxy for the E5TextEditSearchWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4039
diff
changeset
|
57 | |
9221c0c5c66f
Fixed a forgotten focus proxy for the E5TextEditSearchWidget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
4039
diff
changeset
|
58 | 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
|
59 | |
5959
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
60 | def __setupUi(self, widthForHeight): |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
61 | """ |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
62 | Private method to generate the UI. |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
63 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
64 | @param widthForHeight flag indicating to prefer width for height |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
65 | @type bool |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
66 | """ |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
67 | self.setObjectName("E5TextEditSearchWidget") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
68 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
69 | self.verticalLayout = QVBoxLayout(self) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
70 | self.verticalLayout.setObjectName("verticalLayout") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
71 | self.verticalLayout.setContentsMargins(0, 0, 0, 0) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
72 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
73 | # row 1 of widgets |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
74 | self.horizontalLayout1 = QHBoxLayout() |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
75 | self.horizontalLayout1.setObjectName("horizontalLayout1") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
76 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
77 | self.label = QLabel(self) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
78 | self.label.setObjectName("label") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
79 | self.label.setText(self.tr("Find:")) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
80 | self.horizontalLayout1.addWidget(self.label) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
81 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
82 | self.findtextCombo = E5ClearableComboBox(self) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
83 | sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
84 | sizePolicy.setHorizontalStretch(0) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
85 | sizePolicy.setVerticalStretch(0) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
86 | sizePolicy.setHeightForWidth( |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
87 | self.findtextCombo.sizePolicy().hasHeightForWidth()) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
88 | self.findtextCombo.setSizePolicy(sizePolicy) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
89 | self.findtextCombo.setMinimumSize(QSize(200, 0)) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
90 | self.findtextCombo.setEditable(True) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
91 | self.findtextCombo.setInsertPolicy(QComboBox.InsertAtTop) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
92 | self.findtextCombo.setDuplicatesEnabled(False) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
93 | self.findtextCombo.setObjectName("findtextCombo") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
94 | self.horizontalLayout1.addWidget(self.findtextCombo) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
95 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
96 | # row 2 (maybe) of widgets |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
97 | self.horizontalLayout2 = QHBoxLayout() |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
98 | self.horizontalLayout2.setObjectName("horizontalLayout2") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
99 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
100 | self.caseCheckBox = QCheckBox(self) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
101 | self.caseCheckBox.setObjectName("caseCheckBox") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
102 | self.caseCheckBox.setText(self.tr("Match case")) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
103 | self.horizontalLayout2.addWidget(self.caseCheckBox) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
104 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
105 | self.wordCheckBox = QCheckBox(self) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
106 | self.wordCheckBox.setObjectName("wordCheckBox") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
107 | self.wordCheckBox.setText(self.tr("Whole word")) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
108 | self.horizontalLayout2.addWidget(self.wordCheckBox) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
109 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
110 | # layout for the navigation buttons |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
111 | self.horizontalLayout3 = QHBoxLayout() |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
112 | self.horizontalLayout3.setSpacing(0) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
113 | self.horizontalLayout3.setObjectName("horizontalLayout3") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
114 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
115 | self.findPrevButton = QToolButton(self) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
116 | self.findPrevButton.setObjectName("findPrevButton") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
117 | self.findPrevButton.setToolTip(self.tr( |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
118 | "Press to find the previous occurrence")) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
119 | self.findPrevButton.setIcon(UI.PixmapCache.getIcon("1leftarrow.png")) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
120 | self.horizontalLayout3.addWidget(self.findPrevButton) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
121 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
122 | self.findNextButton = QToolButton(self) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
123 | self.findNextButton.setObjectName("findNextButton") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
124 | self.findNextButton.setToolTip(self.tr( |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
125 | "Press to find the next occurrence")) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
126 | self.findNextButton.setIcon(UI.PixmapCache.getIcon("1rightarrow.png")) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
127 | self.horizontalLayout3.addWidget(self.findNextButton) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
128 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
129 | self.horizontalLayout2.addLayout(self.horizontalLayout3) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
130 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
131 | # info label (in row 2 or 3) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
132 | self.infoLabel = QLabel(self) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
133 | self.infoLabel.setText("") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
134 | self.infoLabel.setObjectName("infoLabel") |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
135 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
136 | # place everything together |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
137 | self.verticalLayout.addLayout(self.horizontalLayout1) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
138 | if widthForHeight: |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
139 | self.horizontalLayout1.addLayout(self.horizontalLayout2) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
140 | else: |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
141 | self.verticalLayout.addLayout(self.horizontalLayout2) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
142 | self.verticalLayout.addWidget(self.infoLabel) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
143 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
144 | QMetaObject.connectSlotsByName(self) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
145 | |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
146 | self.setTabOrder(self.findtextCombo, self.caseCheckBox) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
147 | self.setTabOrder(self.caseCheckBox, self.wordCheckBox) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
148 | self.setTabOrder(self.wordCheckBox, self.findPrevButton) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
149 | self.setTabOrder(self.findPrevButton, self.findNextButton) |
4c716b02e10d
Changed the search widget used in the documentation viewer (and other places) to allow to save width but make it higher.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5924
diff
changeset
|
150 | |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
151 | def attachTextEdit(self, textedit, editType="QTextEdit"): |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | 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
|
154 | |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
155 | @param textedit reference to the edit widget to be attached |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
156 | @type QTextEdit, QWebEngineView or QWebView |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
157 | @param editType type of the attached edit widget |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
158 | @type str (one of "QTextEdit", "QWebEngineView" or "QWebView") |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | """ |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
160 | assert editType in ["QTextEdit", "QWebEngineView", "QWebView"] |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
161 | |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | self.__textedit = textedit |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
163 | self.__texteditType = editType |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
164 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
165 | self.wordCheckBox.setVisible(editType == "QTextEdit") |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | 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
|
168 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | 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
|
170 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | @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
|
172 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
173 | 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
|
174 | 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
|
175 | event.accept() |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
177 | @pyqtSlot(str) |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | 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
|
179 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | 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
|
181 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
182 | @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
|
183 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
184 | self.__setSearchButtons(txt != "") |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
185 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
186 | self.infoLabel.hide() |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
187 | self.__setFindtextComboBackground(False) |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | 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
|
190 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | 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
|
192 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | @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
|
194 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | 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
|
196 | 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
|
197 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | 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
|
199 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
200 | 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
|
201 | combobox. |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
203 | 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
|
204 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | @pyqtSlot() |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | 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
|
207 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
208 | 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
|
209 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
210 | 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
|
211 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | @pyqtSlot() |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | 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
|
214 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
215 | 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
|
216 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
217 | 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
|
218 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | 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
|
220 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | 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
|
222 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | @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
|
224 | """ |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
225 | 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
|
226 | return |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
228 | self.infoLabel.clear() |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
229 | self.infoLabel.hide() |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
230 | self.__setFindtextComboBackground(False) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
231 | |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | txt = self.findtextCombo.currentText() |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
233 | if not txt: |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
234 | return |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | 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
|
236 | |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | # 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
|
238 | # 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
|
239 | 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
|
240 | 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
|
241 | 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
|
242 | 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
|
243 | 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
|
244 | |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
245 | if self.__texteditType == "QTextEdit": |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
246 | ok = self.__findPrevNextQTextEdit(backwards) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
247 | self.__findNextPrevCallback(ok) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
248 | elif self.__texteditType == "QWebEngineView": |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
249 | self.__findPrevNextQWebEngineView(backwards) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
250 | elif self.__texteditType == "QWebView": |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
251 | ok = self.__findPrevNextQWebView(backwards) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
252 | self.__findNextPrevCallback(ok) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
253 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
254 | def __findPrevNextQTextEdit(self, backwards): |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
255 | """ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
256 | Private method to to search the associated edit widget of |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
257 | type QTextEdit. |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
258 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
259 | @param backwards flag indicating a backwards search |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
260 | @type bool |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
261 | @return flag indicating the search result |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
262 | @rtype bool |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
263 | """ |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | if backwards: |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | 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
|
266 | else: |
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
267 | 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
|
268 | 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
|
269 | 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
|
270 | 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
|
271 | 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
|
272 | |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
273 | ok = self.__textedit.find(self.findtextCombo.currentText(), flags) |
4039
661167a99aef
Added the capability to search in the output to the Diff dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | if not ok: |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
275 | # wrap around once |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
276 | cursor = self.__textedit.textCursor() |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
277 | if backwards: |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
278 | moveOp = QTextCursor.End # move to end of document |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
279 | else: |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
280 | moveOp = QTextCursor.Start # move to start of document |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
281 | cursor.movePosition(moveOp) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
282 | self.__textedit.setTextCursor(cursor) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
283 | ok = self.__textedit.find(self.findtextCombo.currentText(), flags) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
284 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
285 | return ok |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
286 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
287 | def __findPrevNextQWebView(self, backwards): |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
288 | """ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
289 | Private method to to search the associated edit widget of |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
290 | type QWebView. |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
291 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
292 | @param backwards flag indicating a backwards search |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
293 | @type bool |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
294 | @return flag indicating the search result |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
295 | @rtype bool |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
296 | """ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
297 | from PyQt5.QtWebKitWidgets import QWebPage |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
298 | |
5924
85e126ab4ca5
Fixed some issues detected using Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5913
diff
changeset
|
299 | findFlags = QWebPage.FindFlags(QWebPage.FindWrapsAroundDocument) |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
300 | if self.caseCheckBox.isChecked(): |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
301 | findFlags |= QWebPage.FindCaseSensitively |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
302 | if backwards: |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
303 | findFlags |= QWebPage.FindBackward |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
304 | |
5924
85e126ab4ca5
Fixed some issues detected using Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5913
diff
changeset
|
305 | return self.__textedit.findText(self.findtextCombo.currentText(), |
85e126ab4ca5
Fixed some issues detected using Python2.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5913
diff
changeset
|
306 | findFlags) |
5913
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
307 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
308 | def __findPrevNextQWebEngineView(self, backwards): |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
309 | """ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
310 | Private method to to search the associated edit widget of |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
311 | type QWebEngineView. |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
312 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
313 | @param backwards flag indicating a backwards search |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
314 | @type bool |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
315 | """ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
316 | from PyQt5.QtWebEngineWidgets import QWebEnginePage |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
317 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
318 | findFlags = QWebEnginePage.FindFlags() |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
319 | if self.caseCheckBox.isChecked(): |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
320 | findFlags |= QWebEnginePage.FindCaseSensitively |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
321 | if backwards: |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
322 | findFlags |= QWebEnginePage.FindBackward |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
323 | self.__textedit.findText(self.findtextCombo.currentText(), |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
324 | findFlags, self.__findNextPrevCallback) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
325 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
326 | def __findNextPrevCallback(self, found): |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
327 | """ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
328 | Private method to process the result of the last search. |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
329 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
330 | @param found flag indicating if the last search succeeded |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
331 | @type bool |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
332 | """ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
333 | if not found: |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
334 | txt = self.findtextCombo.currentText() |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
335 | self.infoLabel.setText( |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
336 | self.tr("'{0}' was not found.").format(txt)) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
337 | self.infoLabel.show() |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
338 | self.__setFindtextComboBackground(True) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
339 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
340 | def __setFindtextComboBackground(self, error): |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
341 | """ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
342 | Private slot to change the findtext combo background to indicate |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
343 | errors. |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
344 | |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
345 | @param error flag indicating an error condition (boolean) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
346 | """ |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
347 | le = self.findtextCombo.lineEdit() |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
348 | p = le.palette() |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
349 | if error: |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
350 | p.setBrush(QPalette.Base, QBrush(QColor("#FF6666"))) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
351 | p.setBrush(QPalette.Text, QBrush(QColor("#000000"))) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
352 | else: |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
353 | p.setBrush(QPalette.Base, self.__defaultBaseColor) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
354 | p.setBrush(QPalette.Text, self.__defaultTextColor) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
355 | le.setPalette(p) |
7ab2293917f8
Changed the rich text display of the document viewer to use a QWebEngineView or QWebView based widget.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
5389
diff
changeset
|
356 | le.update() |