Sat, 04 Dec 2021 18:40:05 +0100
Added a 'Clear' button to the 'search in files' and 'search location' panes.
--- a/eric7/UI/FindFileWidget.py Sat Dec 04 18:06:17 2021 +0100 +++ b/eric7/UI/FindFileWidget.py Sat Dec 04 18:40:05 2021 +0100 @@ -89,6 +89,10 @@ self.findButton.clicked.connect(self.__doSearch) 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.replaceButton.setIcon(UI.PixmapCache.getIcon("editReplace")) self.modeToggleButton.clicked.connect(self.__toggleReplaceMode) @@ -249,6 +253,8 @@ # change some interface elements and properties self.findList.clear() + self.clearButton.setEnabled(False) + if self.__replaceMode: self.replaceButton.show() self.replaceLabel.show() @@ -576,6 +582,7 @@ # set the button states self.stopButton.setEnabled(True) self.findButton.setEnabled(False) + self.clearButton.setEnabled(False) # now go through all the files self.__populating = True @@ -655,6 +662,16 @@ self.stopButton.setEnabled(False) self.findButton.setEnabled(True) + self.clearButton.setEnabled(self.findList.topLevelItemCount() != 0) + + @pyqtSlot() + def __clearResults(self): + """ + Private slot to clear the current search results. + """ + self.findList.clear() + self.replaceButton.setEnabled(False) + self.clearButton.setEnabled(False) @pyqtSlot(QTreeWidgetItem, int) def on_findList_itemDoubleClicked(self, itm, column): @@ -836,6 +853,7 @@ self.findList.clear() self.replaceButton.setEnabled(False) self.findButton.setEnabled(True) + self.clearButton.setEnabled(False) @pyqtSlot(QPoint) def __contextMenuRequested(self, pos):
--- a/eric7/UI/FindFileWidget.ui Sat Dec 04 18:06:17 2021 +0100 +++ b/eric7/UI/FindFileWidget.ui Sat Dec 04 18:40:05 2021 +0100 @@ -340,7 +340,7 @@ <string>Press to start the search process</string> </property> <property name="text"> - <string>Find</string> + <string>Search</string> </property> </widget> </item> @@ -377,17 +377,31 @@ </widget> </item> <item> - <widget class="EricSqueezeLabelPath" name="findProgressLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string/> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout_4"> + <item> + <widget class="EricSqueezeLabelPath" name="findProgressLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="clearButton"> + <property name="toolTip"> + <string>Press to clear the search results</string> + </property> + <property name="text"> + <string>Clear</string> + </property> + </widget> + </item> + </layout> </item> <item> <widget class="QProgressBar" name="findProgress"> @@ -480,6 +494,7 @@ <tabstop>excludeHiddenCheckBox</tabstop> <tabstop>findButton</tabstop> <tabstop>stopButton</tabstop> + <tabstop>clearButton</tabstop> <tabstop>findList</tabstop> <tabstop>replaceButton</tabstop> </tabstops>
--- 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.
--- a/eric7/UI/FindLocationWidget.ui Sat Dec 04 18:06:17 2021 +0100 +++ b/eric7/UI/FindLocationWidget.ui Sat Dec 04 18:40:05 2021 +0100 @@ -142,7 +142,7 @@ <string>Press to start the search process</string> </property> <property name="text"> - <string>Find</string> + <string>Search</string> </property> </widget> </item> @@ -179,17 +179,31 @@ </widget> </item> <item> - <widget class="EricSqueezeLabelPath" name="findStatusLabel"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text"> - <string/> - </property> - </widget> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <item> + <widget class="EricSqueezeLabelPath" name="findStatusLabel"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="clearButton"> + <property name="toolTip"> + <string>Press to clear the search results</string> + </property> + <property name="text"> + <string>Clear</string> + </property> + </widget> + </item> + </layout> </item> <item> <widget class="QTreeWidget" name="fileList"> @@ -245,6 +259,7 @@ <tabstop>syspathCheckBox</tabstop> <tabstop>findButton</tabstop> <tabstop>stopButton</tabstop> + <tabstop>clearButton</tabstop> <tabstop>fileList</tabstop> <tabstop>openButton</tabstop> </tabstops>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eric7/icons/breeze-dark/clear.svg Sat Dec 04 18:40:05 2021 +0100 @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css">.ColorScheme-Text { + color:#eff0f1; + }</style></defs><path class="ColorScheme-Text" d="m19.871 1-4.2313 7.1636-3.1305-1.7675-1.3235 2.1161 7.3213 4.1361 1.3235-2.1186-3.0773-1.7386 4.2465-7.1901zm-13.688 3.9942a1.2957 1.2312 0 0 0-1.2957 1.2312 1.2957 1.2312 0 0 0 1.2957 1.2312 1.2957 1.2312 0 0 0 1.2957-1.2312 1.2957 1.2312 0 0 0-1.2957-1.2312zm-4.535 1.2312a0.64786 0.61561 0 0 0-0.64786 0.61561 0.64786 0.61561 0 0 0 0.64786 0.61561 0.64786 0.61561 0 0 0 0.64786-0.61561 0.64786 0.61561 0 0 0-0.64786-0.61561zm1.9436 2.4624a1.2957 1.2312 0 0 0-1.2957 1.2312 1.2957 1.2312 0 0 0 1.2957 1.2312 1.2957 1.2312 0 0 0 1.2957-1.2312 1.2957 1.2312 0 0 0-1.2957-1.2312zm6.4786 1.2312c-1.4492 1.9259-4.1003 3.4608-9.07 3.6936v1.2312c2.7388 4.1513 6.4786 6.1561 11.661 6.1561h1.2957c1.699-1.9542 3.0547-3.7335 3.8871-6.1561v-1.2312l-6.4786-3.6936zm0.68582 1.3563 5.608 3.1983c-0.74222 1.9042-1.9073 3.575-3.3481 5.2567-4.2414 0.038476-8.0602-1.7584-10.297-5.0956 4.0403-0.38244 6.5039-1.5818 8.0375-3.3594z" color="#eff0f1" fill="currentColor"/></svg>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eric7/icons/breeze-light/clear.svg Sat Dec 04 18:40:05 2021 +0100 @@ -0,0 +1,4 @@ +<?xml version="1.0" encoding="UTF-8"?> +<svg version="1.1" viewBox="0 0 22 22" xmlns="http://www.w3.org/2000/svg"><defs><style type="text/css">.ColorScheme-Text { + color:#232629; + }</style></defs><path class="ColorScheme-Text" d="m19.871 1-4.2313 7.1636-3.1305-1.7675-1.3235 2.1161 7.3213 4.1361 1.3235-2.1186-3.0773-1.7386 4.2465-7.1901zm-13.688 3.9942a1.2957 1.2312 0 0 0-1.2957 1.2312 1.2957 1.2312 0 0 0 1.2957 1.2312 1.2957 1.2312 0 0 0 1.2957-1.2312 1.2957 1.2312 0 0 0-1.2957-1.2312zm-4.535 1.2312a0.64786 0.61561 0 0 0-0.64786 0.61561 0.64786 0.61561 0 0 0 0.64786 0.61561 0.64786 0.61561 0 0 0 0.64786-0.61561 0.64786 0.61561 0 0 0-0.64786-0.61561zm1.9436 2.4624a1.2957 1.2312 0 0 0-1.2957 1.2312 1.2957 1.2312 0 0 0 1.2957 1.2312 1.2957 1.2312 0 0 0 1.2957-1.2312 1.2957 1.2312 0 0 0-1.2957-1.2312zm6.4786 1.2312c-1.4492 1.9259-4.1003 3.4608-9.07 3.6936v1.2312c2.7388 4.1513 6.4786 6.1561 11.661 6.1561h1.2957c1.699-1.9542 3.0547-3.7335 3.8871-6.1561v-1.2312l-6.4786-3.6936zm0.68582 1.3563 5.608 3.1983c-0.74222 1.9042-1.9073 3.575-3.3481 5.2567-4.2414 0.038476-8.0602-1.7584-10.297-5.0956 4.0403-0.38244 6.5039-1.5818 8.0375-3.3594z" color="#232629" fill="currentColor"/></svg>