73 |
73 |
74 self.findButton.setEnabled(False) |
74 self.findButton.setEnabled(False) |
75 self.findButton.clicked.connect(self.__searchFile) |
75 self.findButton.clicked.connect(self.__searchFile) |
76 self.findButton.setIcon(UI.PixmapCache.getIcon("find")) |
76 self.findButton.setIcon(UI.PixmapCache.getIcon("find")) |
77 |
77 |
|
78 self.clearButton.setEnabled(False) |
|
79 self.clearButton.clicked.connect(self.__clearResults) |
|
80 self.clearButton.setIcon(UI.PixmapCache.getIcon("clear")) |
|
81 |
|
82 self.openButton.setEnabled(False) |
78 self.openButton.setIcon(UI.PixmapCache.getIcon("open")) |
83 self.openButton.setIcon(UI.PixmapCache.getIcon("open")) |
79 self.openButton.clicked.connect(self.__openFile) |
84 self.openButton.clicked.connect(self.__openFile) |
80 |
85 |
81 self.__project = project |
86 self.__project = project |
82 self.__project.projectOpened.connect(self.__projectOpened) |
87 self.__project.projectOpened.connect(self.__projectOpened) |
167 |
172 |
168 self.fileList.clear() |
173 self.fileList.clear() |
169 locations = {} |
174 locations = {} |
170 self.__shouldStop = False |
175 self.__shouldStop = False |
171 self.stopButton.setEnabled(True) |
176 self.stopButton.setEnabled(True) |
|
177 self.clearButton.setEnabled(False) |
172 QApplication.processEvents() |
178 QApplication.processEvents() |
173 |
179 |
174 for path in searchPaths: |
180 for path in searchPaths: |
175 if os.path.isdir(path): |
181 if os.path.isdir(path): |
176 files = direntries(path, True, fileNamePattern, |
182 files = direntries(path, True, fileNamePattern, |
197 self.fileList.header().resizeSection(0, self.width() // 2) |
203 self.fileList.header().resizeSection(0, self.width() // 2) |
198 self.fileList.header().setStretchLastSection(True) |
204 self.fileList.header().setStretchLastSection(True) |
199 |
205 |
200 self.findStatusLabel.setText(self.tr( |
206 self.findStatusLabel.setText(self.tr( |
201 "%n file(s) found", "", self.fileList.topLevelItemCount())) |
207 "%n file(s) found", "", self.fileList.topLevelItemCount())) |
202 |
208 |
|
209 self.clearButton.setEnabled(self.fileList.topLevelItemCount() != 0) |
|
210 |
|
211 @pyqtSlot() |
|
212 def __clearResults(self): |
|
213 """ |
|
214 Private slot to clear the current search results. |
|
215 """ |
|
216 self.fileList.clear() |
|
217 self.clearButton.setEnabled(False) |
|
218 self.openButton.setEnabled(False) |
|
219 |
203 def checkStop(self): |
220 def checkStop(self): |
204 """ |
221 """ |
205 Public method to check, if the search should be stopped. |
222 Public method to check, if the search should be stopped. |
206 |
223 |
207 @return flag indicating the search should be stopped |
224 @return flag indicating the search should be stopped |