158 from eric7.QScintilla.SearchReplaceWidget import SearchReplaceSlidingWidget |
158 from eric7.QScintilla.SearchReplaceWidget import SearchReplaceSlidingWidget |
159 |
159 |
160 self.ui = ui |
160 self.ui = ui |
161 self.dbs = dbs |
161 self.dbs = dbs |
162 |
162 |
163 self.__searchWidget = SearchReplaceSlidingWidget(False, self, ui) |
163 self.__searchReplaceWidget = SearchReplaceSlidingWidget(self, ui) |
164 self.__replaceWidget = SearchReplaceSlidingWidget(True, self, ui) |
164 |
165 |
165 self.checkActions.connect(self.__searchReplaceWidget.updateSelectionCheckBox) |
166 self.checkActions.connect(self.__searchWidget.updateSelectionCheckBox) |
166 |
167 self.checkActions.connect(self.__replaceWidget.updateSelectionCheckBox) |
167 def searchReplaceWidget(self): |
168 |
|
169 def searchWidget(self): |
|
170 """ |
168 """ |
171 Public method to get a reference to the search widget. |
169 Public method to get a reference to the search widget. |
172 |
170 |
173 @return reference to the search widget (SearchReplaceSlidingWidget) |
171 @return reference to the search widget (SearchReplaceSlidingWidget) |
174 """ |
172 """ |
175 return self.__searchWidget |
173 return self.__searchReplaceWidget |
176 |
|
177 def replaceWidget(self): |
|
178 """ |
|
179 Public method to get a reference to the replace widget. |
|
180 |
|
181 @return reference to the replace widget (SearchReplaceSlidingWidget) |
|
182 """ |
|
183 return self.__replaceWidget |
|
184 |
174 |
185 def __loadRecent(self): |
175 def __loadRecent(self): |
186 """ |
176 """ |
187 Private method to load the recently opened filenames. |
177 Private method to load the recently opened filenames. |
188 """ |
178 """ |
3678 """<p>Replace the found occurrence of text in the current""" |
3668 """<p>Replace the found occurrence of text in the current""" |
3679 """ editor and search for the next one. The previously entered""" |
3669 """ editor and search for the next one. The previously entered""" |
3680 """ search text and options are reused.</p>""", |
3670 """ search text and options are reused.</p>""", |
3681 ) |
3671 ) |
3682 ) |
3672 ) |
3683 self.replaceAndSearchAct.triggered.connect(self.__replaceWidget.replaceSearch) |
3673 self.replaceAndSearchAct.triggered.connect( |
|
3674 self.__searchReplaceWidget.replaceSearch |
|
3675 ) |
3684 self.searchActions.append(self.replaceAndSearchAct) |
3676 self.searchActions.append(self.replaceAndSearchAct) |
3685 |
3677 |
3686 self.replaceSelectionAct = EricAction( |
3678 self.replaceSelectionAct = EricAction( |
3687 QCoreApplication.translate("ViewManager", "Replace Occurrence"), |
3679 QCoreApplication.translate("ViewManager", "Replace Occurrence"), |
3688 EricPixmapCache.getIcon("editReplace"), |
3680 EricPixmapCache.getIcon("editReplace"), |
3705 """<b>Replace Occurrence</b>""" |
3697 """<b>Replace Occurrence</b>""" |
3706 """<p>Replace the found occurrence of the search text in the""" |
3698 """<p>Replace the found occurrence of the search text in the""" |
3707 """ current editor.</p>""", |
3699 """ current editor.</p>""", |
3708 ) |
3700 ) |
3709 ) |
3701 ) |
3710 self.replaceSelectionAct.triggered.connect(self.__replaceWidget.replace) |
3702 self.replaceSelectionAct.triggered.connect(self.__searchReplaceWidget.replace) |
3711 self.searchActions.append(self.replaceSelectionAct) |
3703 self.searchActions.append(self.replaceSelectionAct) |
3712 |
3704 |
3713 self.replaceAllAct = EricAction( |
3705 self.replaceAllAct = EricAction( |
3714 QCoreApplication.translate("ViewManager", "Replace All"), |
3706 QCoreApplication.translate("ViewManager", "Replace All"), |
3715 EricPixmapCache.getIcon("editReplaceAll"), |
3707 EricPixmapCache.getIcon("editReplaceAll"), |
3732 """<b>Replace All</b>""" |
3724 """<b>Replace All</b>""" |
3733 """<p>Replace all occurrences of the search text in the current""" |
3725 """<p>Replace all occurrences of the search text in the current""" |
3734 """ editor.</p>""", |
3726 """ editor.</p>""", |
3735 ) |
3727 ) |
3736 ) |
3728 ) |
3737 self.replaceAllAct.triggered.connect(self.__replaceWidget.replaceAll) |
3729 self.replaceAllAct.triggered.connect(self.__searchReplaceWidget.replaceAll) |
3738 self.searchActions.append(self.replaceAllAct) |
3730 self.searchActions.append(self.replaceAllAct) |
3739 |
3731 |
3740 self.gotoAct = EricAction( |
3732 self.gotoAct = EricAction( |
3741 QCoreApplication.translate("ViewManager", "Goto Line"), |
3733 QCoreApplication.translate("ViewManager", "Goto Line"), |
3742 EricPixmapCache.getIcon("goto"), |
3734 EricPixmapCache.getIcon("goto"), |
5662 editor.changeMarkersUpdated.connect(self.__changeMarkersUpdated) |
5654 editor.changeMarkersUpdated.connect(self.__changeMarkersUpdated) |
5663 editor.languageChanged.connect(lambda: self.__editorConfigChanged(editor)) |
5655 editor.languageChanged.connect(lambda: self.__editorConfigChanged(editor)) |
5664 editor.eolChanged.connect(lambda: self.__editorConfigChanged(editor)) |
5656 editor.eolChanged.connect(lambda: self.__editorConfigChanged(editor)) |
5665 editor.encodingChanged.connect(lambda: self.__editorConfigChanged(editor)) |
5657 editor.encodingChanged.connect(lambda: self.__editorConfigChanged(editor)) |
5666 editor.selectionChanged.connect( |
5658 editor.selectionChanged.connect( |
5667 lambda: self.__searchWidget.selectionChanged(editor) |
5659 lambda: self.__searchReplaceWidget.selectionChanged(editor) |
5668 ) |
|
5669 editor.selectionChanged.connect( |
|
5670 lambda: self.__replaceWidget.selectionChanged(editor) |
|
5671 ) |
5660 ) |
5672 editor.selectionChanged.connect(lambda: self.__editorSelectionChanged(editor)) |
5661 editor.selectionChanged.connect(lambda: self.__editorSelectionChanged(editor)) |
5673 editor.lastEditPositionAvailable.connect(self.__lastEditPositionAvailable) |
5662 editor.lastEditPositionAvailable.connect(self.__lastEditPositionAvailable) |
5674 editor.zoomValueChanged.connect(lambda v: self.zoomValueChanged(v, editor)) |
5663 editor.zoomValueChanged.connect(lambda v: self.zoomValueChanged(v, editor)) |
5675 editor.mouseDoubleClick.connect( |
5664 editor.mouseDoubleClick.connect( |
6665 |
6654 |
6666 def showSearchWidget(self): |
6655 def showSearchWidget(self): |
6667 """ |
6656 """ |
6668 Public method to show the search widget. |
6657 Public method to show the search widget. |
6669 """ |
6658 """ |
6670 self.__replaceWidget.hide() |
6659 self.__searchReplaceWidget.show(text=self.textForFind(), replaceMode=False) |
6671 self.__searchWidget.show() |
|
6672 self.__searchWidget.show(self.textForFind()) |
|
6673 |
6660 |
6674 def __searchNext(self): |
6661 def __searchNext(self): |
6675 """ |
6662 """ |
6676 Private slot to handle the search next action. |
6663 Private slot to handle the search next action. |
6677 """ |
6664 """ |
6678 if self.__replaceWidget.isVisible(): |
6665 self.__searchReplaceWidget.findNext() |
6679 self.__replaceWidget.findNext() |
|
6680 else: |
|
6681 self.__searchWidget.findNext() |
|
6682 |
6666 |
6683 def __searchPrev(self): |
6667 def __searchPrev(self): |
6684 """ |
6668 """ |
6685 Private slot to handle the search previous action. |
6669 Private slot to handle the search previous action. |
6686 """ |
6670 """ |
6687 if self.__replaceWidget.isVisible(): |
6671 self.__searchReplaceWidget.findPrev() |
6688 self.__replaceWidget.findPrev() |
|
6689 else: |
|
6690 self.__searchWidget.findPrev() |
|
6691 |
6672 |
6692 def showReplaceWidget(self): |
6673 def showReplaceWidget(self): |
6693 """ |
6674 """ |
6694 Public method to show the replace widget. |
6675 Public method to show the replace widget. |
6695 """ |
6676 """ |
6696 self.__searchWidget.hide() |
6677 self.__searchReplaceWidget.show(text=self.textForFind(), replaceMode=True) |
6697 self.__replaceWidget.show(self.textForFind()) |
|
6698 |
6678 |
6699 def __findNextWord(self): |
6679 def __findNextWord(self): |
6700 """ |
6680 """ |
6701 Private slot to find the next occurrence of the current word of the |
6681 Private slot to find the next occurrence of the current word of the |
6702 current editor. |
6682 current editor. |
7456 |
7436 |
7457 # stop the autosave timer |
7437 # stop the autosave timer |
7458 if self.autosaveTimer.isActive(): |
7438 if self.autosaveTimer.isActive(): |
7459 self.autosaveTimer.stop() |
7439 self.autosaveTimer.stop() |
7460 |
7440 |
7461 # hide search and replace widgets |
7441 # hide search and replace widget |
7462 self.__searchWidget.hide() |
7442 self.__searchReplaceWidget.hide() |
7463 self.__replaceWidget.hide() |
|
7464 |
7443 |
7465 # hide the AST Viewer via its action |
7444 # hide the AST Viewer via its action |
7466 self.astViewerAct.setChecked(False) |
7445 self.astViewerAct.setChecked(False) |
7467 |
7446 |
7468 # hide the DIS Viewer via its action |
7447 # hide the DIS Viewer via its action |