eric7/UI/FindLocationWidget.py

branch
eric7
changeset 8809
29471a3867ac
parent 8643
5adf87ac0c3e
child 8844
cae9a0840828
--- a/eric7/UI/FindLocationWidget.py	Sat Dec 04 18:06:17 2021 +0100
+++ b/eric7/UI/FindLocationWidget.py	Sat Dec 04 18:40:05 2021 +0100
@@ -75,6 +75,11 @@
         self.findButton.clicked.connect(self.__searchFile)
         self.findButton.setIcon(UI.PixmapCache.getIcon("find"))
         
+        self.clearButton.setEnabled(False)
+        self.clearButton.clicked.connect(self.__clearResults)
+        self.clearButton.setIcon(UI.PixmapCache.getIcon("clear"))
+        
+        self.openButton.setEnabled(False)
         self.openButton.setIcon(UI.PixmapCache.getIcon("open"))
         self.openButton.clicked.connect(self.__openFile)
         
@@ -169,6 +174,7 @@
         locations = {}
         self.__shouldStop = False
         self.stopButton.setEnabled(True)
+        self.clearButton.setEnabled(False)
         QApplication.processEvents()
         
         for path in searchPaths:
@@ -199,7 +205,18 @@
         
         self.findStatusLabel.setText(self.tr(
             "%n file(s) found", "", self.fileList.topLevelItemCount()))
-
+        
+        self.clearButton.setEnabled(self.fileList.topLevelItemCount() != 0)
+    
+    @pyqtSlot()
+    def __clearResults(self):
+        """
+        Private slot to clear the current search results.
+        """
+        self.fileList.clear()
+        self.clearButton.setEnabled(False)
+        self.openButton.setEnabled(False)
+    
     def checkStop(self):
         """
         Public method to check, if the search should be stopped.

eric ide

mercurial