WebBrowser/SearchWidget.py

branch
QtWebEngine
changeset 4881
c269212cceac
parent 4715
79009bc4acd5
child 5389
9b1c800daff3
equal deleted inserted replaced
4880:561f2bd9cfb9 4881:c269212cceac
32 super(SearchWidget, self).__init__(parent) 32 super(SearchWidget, self).__init__(parent)
33 self.setupUi(self) 33 self.setupUi(self)
34 34
35 self.__mainWindow = mainWindow 35 self.__mainWindow = mainWindow
36 36
37 # TODO: Check what Qt 5.6 can offer (maybe using JavaScript)
38 self.wrapCheckBox.setVisible(False)
39 self.highlightAllCheckBox.setVisible(False)
40 ## self.wrapCheckBox.setChecked(True)
41 self.closeButton.setIcon(UI.PixmapCache.getIcon("close.png")) 37 self.closeButton.setIcon(UI.PixmapCache.getIcon("close.png"))
42 self.findPrevButton.setIcon(UI.PixmapCache.getIcon("1leftarrow.png")) 38 self.findPrevButton.setIcon(UI.PixmapCache.getIcon("1leftarrow.png"))
43 self.findNextButton.setIcon(UI.PixmapCache.getIcon("1rightarrow.png")) 39 self.findNextButton.setIcon(UI.PixmapCache.getIcon("1rightarrow.png"))
44 40
45 self.__defaultBaseColor = \ 41 self.__defaultBaseColor = \
71 Private slot to perform an incremental search. 67 Private slot to perform an incremental search.
72 68
73 @param txt current text of the search combos line edit (string) 69 @param txt current text of the search combos line edit (string)
74 (unused) 70 (unused)
75 """ 71 """
76 self.on_highlightAllCheckBox_toggled(True)
77 self.__findNextPrev() 72 self.__findNextPrev()
78 73
79 def __findNextPrev(self): 74 def __findNextPrev(self):
80 """ 75 """
81 Private slot to find the next occurrence of text. 76 Private slot to find the next occurrence of text.
84 self.__setFindtextComboBackground(False) 79 self.__setFindtextComboBackground(False)
85 80
86 if not self.findtextCombo.currentText(): 81 if not self.findtextCombo.currentText():
87 return 82 return
88 83
89 # TODO: adjust this to the browser API
90 self.__mainWindow.currentBrowser().findNextPrev( 84 self.__mainWindow.currentBrowser().findNextPrev(
91 self.findtextCombo.currentText(), 85 self.findtextCombo.currentText(),
92 self.caseCheckBox.isChecked(), 86 self.caseCheckBox.isChecked(),
93 self.__findBackwards, 87 self.__findBackwards,
94 self.wrapCheckBox.isChecked(),
95 False,
96 self.__findNextPrevCallback) 88 self.__findNextPrevCallback)
97 89
98 def __findNextPrevCallback(self, found): 90 def __findNextPrevCallback(self, found):
99 """ 91 """
100 Private method to process the result of the last search. 92 Private method to process the result of the last search.
103 @type bool 95 @type bool
104 """ 96 """
105 if not found: 97 if not found:
106 self.infoLabel.setText(self.tr("Expression was not found.")) 98 self.infoLabel.setText(self.tr("Expression was not found."))
107 self.__setFindtextComboBackground(True) 99 self.__setFindtextComboBackground(True)
108 ##
109 ## @pyqtSlot(bool)
110 ## def on_highlightAllCheckBox_toggled(self, checked):
111 ## """
112 ## Private slot to toggle the highlight of all occurrences.
113 ##
114 ## @param checked flag indicating the check box toggle state (boolean)
115 ## """
116 ## cbr = self.__mainWindow.currentBrowser()
117 ## if cbr is None:
118 ## return
119 ## cbr.findNextPrev(
120 ## "", False, False, False, True)
121 ## if self.highlightAllCheckBox.isChecked():
122 ## cbr.findNextPrev(
123 ## self.findtextCombo.currentText(),
124 ## self.caseCheckBox.isChecked(),
125 ## False, False, True)
126 100
127 @pyqtSlot() 101 @pyqtSlot()
128 def on_findNextButton_clicked(self): 102 def on_findNextButton_clicked(self):
129 """ 103 """
130 Private slot to find the next occurrence. 104 Private slot to find the next occurrence.

eric ide

mercurial