UI/FindFileDialog.py

changeset 3343
f7a6d271bb40
parent 3192
34689c08f095
child 3484
645c12de6b0c
equal deleted inserted replaced
3342:f8cd11fa94ed 3343:f7a6d271bb40
416 # now go through all the files 416 # now go through all the files
417 self.__populating = True 417 self.__populating = True
418 self.findList.setUpdatesEnabled(False) 418 self.findList.setUpdatesEnabled(False)
419 progress = 0 419 progress = 0
420 breakSearch = False 420 breakSearch = False
421 occurrences = 0
422 fileOccurrences = 0
421 for file in files: 423 for file in files:
422 self.__lastFileItem = None 424 self.__lastFileItem = None
425 found = False
423 if self.__cancelSearch or breakSearch: 426 if self.__cancelSearch or breakSearch:
424 break 427 break
425 428
426 self.findProgressLabel.setPath(file) 429 self.findProgressLabel.setPath(file)
427 430
445 break 448 break
446 449
447 count += 1 450 count += 1
448 contains = search.search(line) 451 contains = search.search(line)
449 if contains: 452 if contains:
453 occurrences += 1
454 found = True
450 start = contains.start() 455 start = contains.start()
451 end = contains.end() 456 end = contains.end()
452 if self.__replaceMode: 457 if self.__replaceMode:
453 rline = search.sub(replTxt, line) 458 rline = search.sub(replTxt, line)
454 else: 459 else:
471 breakSearch = True 476 breakSearch = True
472 break 477 break
473 478
474 QApplication.processEvents() 479 QApplication.processEvents()
475 480
481 if found:
482 fileOccurrences += 1
476 progress += 1 483 progress += 1
477 self.findProgress.setValue(progress) 484 self.findProgress.setValue(progress)
478 485
479 if not files: 486 if not files:
480 self.findProgress.setMaximum(1) 487 self.findProgress.setMaximum(1)
481 self.findProgress.setValue(1) 488 self.findProgress.setValue(1)
482 489
483 self.findProgressLabel.setPath("") 490 resultFormat = self.tr("{0} / {1}", "occurrences / files")
491 self.findProgressLabel.setPath(resultFormat.format(
492 self.tr("%n occurrence(s)", "", occurrences),
493 self.tr("%n file(s)", "", fileOccurrences)))
484 494
485 self.findList.setUpdatesEnabled(True) 495 self.findList.setUpdatesEnabled(True)
486 self.findList.sortItems(self.findList.sortColumn(), 496 self.findList.sortItems(self.findList.sortColumn(),
487 self.findList.header().sortIndicatorOrder()) 497 self.findList.header().sortIndicatorOrder())
488 self.findList.resizeColumnToContents(1) 498 self.findList.resizeColumnToContents(1)

eric ide

mercurial