UI/FindFileDialog.py

changeset 3039
8dd0165d805d
parent 3034
7ce719013078
child 3060
5883ce99ee12
child 3160
209a07d7e401
equal deleted inserted replaced
3038:7fe9a53280bd 3039:8dd0165d805d
307 if self.projectButton.isChecked(): 307 if self.projectButton.isChecked():
308 if self.filterCheckBox.isChecked(): 308 if self.filterCheckBox.isChecked():
309 files = [self.project.getRelativePath(file) 309 files = [self.project.getRelativePath(file)
310 for file in 310 for file in
311 self.__getFileList( 311 self.__getFileList(
312 self.project.getProjectPath(), filterRe)] 312 self.project.getProjectPath(), filterRe)]
313 else: 313 else:
314 files = [] 314 files = []
315 if self.sourcesCheckBox.isChecked(): 315 if self.sourcesCheckBox.isChecked():
316 files += self.project.pdata["SOURCES"] 316 files += self.project.pdata["SOURCES"]
317 if self.formsCheckBox.isChecked(): 317 if self.formsCheckBox.isChecked():
326 if self.sourcesCheckBox.isChecked(): 326 if self.sourcesCheckBox.isChecked():
327 filters.extend( 327 filters.extend(
328 ["^{0}$".format( 328 ["^{0}$".format(
329 assoc.replace(".", "\.").replace("*", ".*")) 329 assoc.replace(".", "\.").replace("*", ".*"))
330 for assoc in list( 330 for assoc in list(
331 Preferences.getEditorLexerAssocs().keys()) 331 Preferences.getEditorLexerAssocs().keys())
332 if assoc not in self.formsExt + self.interfacesExt]) 332 if assoc not in self.formsExt + self.interfacesExt])
333 if self.formsCheckBox.isChecked(): 333 if self.formsCheckBox.isChecked():
334 filters.append(self.filterForms) 334 filters.append(self.filterForms)
335 if self.interfacesCheckBox.isChecked(): 335 if self.interfacesCheckBox.isChecked():
336 filters.append(self.filterInterfaces) 336 filters.append(self.filterInterfaces)
556 files = [] 556 files = []
557 for dirname, _, names in os.walk(path): 557 for dirname, _, names in os.walk(path):
558 files.extend([os.path.join(dirname, f) 558 files.extend([os.path.join(dirname, f)
559 for f in names 559 for f in names
560 if re.match(filterRe, f)] 560 if re.match(filterRe, f)]
561 ) 561 )
562 return files 562 return files
563 563
564 def setSearchDirectory(self, searchDir): 564 def setSearchDirectory(self, searchDir):
565 """ 565 """
566 Public slot to set the name of the directory to search in. 566 Public slot to set the name of the directory to search in.
608 self, 608 self,
609 self.trUtf8("Replace in Files"), 609 self.trUtf8("Replace in Files"),
610 self.trUtf8( 610 self.trUtf8(
611 """<p>Could not read the file <b>{0}</b>.""" 611 """<p>Could not read the file <b>{0}</b>."""
612 """ Skipping it.</p><p>Reason: {1}</p>""") 612 """ Skipping it.</p><p>Reason: {1}</p>""")
613 .format(fn, str(err)) 613 .format(fn, str(err))
614 ) 614 )
615 progress += 1 615 progress += 1
616 self.findProgress.setValue(progress) 616 self.findProgress.setValue(progress)
617 continue 617 continue
618 618
624 self.trUtf8("Replace in Files"), 624 self.trUtf8("Replace in Files"),
625 self.trUtf8( 625 self.trUtf8(
626 """<p>The current and the original hash of the""" 626 """<p>The current and the original hash of the"""
627 """ file <b>{0}</b> are different. Skipping it.""" 627 """ file <b>{0}</b> are different. Skipping it."""
628 """</p><p>Hash 1: {1}</p><p>Hash 2: {2}</p>""") 628 """</p><p>Hash 1: {1}</p><p>Hash 2: {2}</p>""")
629 .format(fn, origHash, hash) 629 .format(fn, origHash, hash)
630 ) 630 )
631 progress += 1 631 progress += 1
632 self.findProgress.setValue(progress) 632 self.findProgress.setValue(progress)
633 continue 633 continue
634 634
649 self, 649 self,
650 self.trUtf8("Replace in Files"), 650 self.trUtf8("Replace in Files"),
651 self.trUtf8( 651 self.trUtf8(
652 """<p>Could not save the file <b>{0}</b>.""" 652 """<p>Could not save the file <b>{0}</b>."""
653 """ Skipping it.</p><p>Reason: {1}</p>""") 653 """ Skipping it.</p><p>Reason: {1}</p>""")
654 .format(fn, str(err)) 654 .format(fn, str(err))
655 ) 655 )
656 656
657 progress += 1 657 progress += 1
658 self.findProgress.setValue(progress) 658 self.findProgress.setValue(progress)
659 659

eric ide

mercurial