RefactoringRope/HelpDialog.py

branch
eric7
changeset 377
5a183579f5ef
parent 374
958f34e97952
child 389
4f53795beff0
--- a/RefactoringRope/HelpDialog.py	Thu Dec 30 12:33:38 2021 +0100
+++ b/RefactoringRope/HelpDialog.py	Thu Jan 06 12:25:25 2022 +0100
@@ -8,15 +8,13 @@
 """
 
 from PyQt6.QtCore import Qt
-from PyQt6.QtGui import QTextDocument, QTextCursor
-from PyQt6.QtWidgets import QDialog, QDialogButtonBox
+from PyQt6.QtWidgets import QDialog
 
 from .Ui_HelpDialog import Ui_HelpDialog
 
 import Globals
 
 
-# TODO: modify help dialog to use the eric7 EricTextEditSearchWidget
 class HelpDialog(QDialog, Ui_HelpDialog):
     """
     Class implementing a dialog to show help about rope.
@@ -36,10 +34,6 @@
         self.setupUi(self)
         self.setWindowFlags(Qt.WindowType.Window)
         
-        self.searchButton = self.buttonBox.addButton(
-            self.tr("Search..."), QDialogButtonBox.ButtonRole.ActionRole)
-        self.__searchDlg = None
-        
         if Globals.isWindowsPlatform():
             self.helpEdit.setFontFamily("Lucida Console")
         else:
@@ -53,61 +47,5 @@
             self.helpEdit.setPlainText(
                 self.tr("Could not read file {0}.\nReason: {1}")
                     .format(helpfile, str(err)))
-
-    def on_buttonBox_clicked(self, button):
-        """
-        Private slot called by a button of the button box clicked.
         
-        @param button button that was clicked
-        @type QAbstractButton
-        """
-        if button == self.searchButton:
-            if self.__searchDlg is None:
-                from .SearchDialog import SearchDialog
-                self.__searchDlg = SearchDialog(self)
-            self.__searchDlg.showFind()
-    
-    def findNextPrev(self, txt, case, word, backwards):
-        """
-        Public slot to find the next occurrence of a text.
-        
-        @param txt text to search for
-        @type str
-        @param case flag indicating a case sensitive search
-        @type bool
-        @param word flag indicating a word based search
-        @type bool
-        @param backwards flag indicating a backwards search
-        @type bool
-        @return flag indicating the search found another occurrence
-        @rtype bool
-        """
-        doc = self.helpEdit.document()
-        cur = self.helpEdit.textCursor()
-        
-        findFlags = QTextDocument.FindFlag(0)
-        if case:
-            findFlags |= QTextDocument.FindCaseSensitively
-        if word:
-            findFlags |= QTextDocument.FindWholeWords
-        if backwards:
-            findFlags |= QTextDocument.FindBackward
-        
-        if cur.hasSelection():
-            cur.setPosition(backwards and cur.anchor() or cur.position(),
-                            QTextCursor.MoveMode.MoveAnchor)
-        newCur = doc.find(txt, cur, findFlags)
-        if newCur.isNull():
-            return False
-        else:
-            self.helpEdit.setTextCursor(newCur)
-            return True
-    
-    def helpWidget(self):
-        """
-        Public method to get a reference to the help widget.
-        
-        @return reference to the help widget
-        @rtype QTextEdit
-        """
-        return self.helpEdit
+        self.searchWidget.attachTextEdit(self.helpEdit)

eric ide

mercurial