133 self.__lastFileItem.setFlags(self.__lastFileItem.flags() | \ |
133 self.__lastFileItem.setFlags(self.__lastFileItem.flags() | \ |
134 Qt.ItemFlags(Qt.ItemIsUserCheckable | Qt.ItemIsTristate)) |
134 Qt.ItemFlags(Qt.ItemIsUserCheckable | Qt.ItemIsTristate)) |
135 # Qt bug: |
135 # Qt bug: |
136 # item is not user checkable if setFirstColumnSpanned is True (< 4.5.0) |
136 # item is not user checkable if setFirstColumnSpanned is True (< 4.5.0) |
137 |
137 |
138 itm = QTreeWidgetItem(self.__lastFileItem, [' %5d ' % line, text]) |
138 itm = QTreeWidgetItem(self.__lastFileItem, [' {0:5d} '.format(line), text]) |
139 itm.setTextAlignment(0, Qt.AlignRight) |
139 itm.setTextAlignment(0, Qt.AlignRight) |
140 itm.setData(0, self.lineRole, line) |
140 itm.setData(0, self.lineRole, line) |
141 itm.setData(0, self.startRole, start) |
141 itm.setData(0, self.startRole, start) |
142 itm.setData(0, self.endRole, end) |
142 itm.setData(0, self.endRole, end) |
143 itm.setData(0, self.replaceRole, replTxt) |
143 itm.setData(0, self.replaceRole, replTxt) |
269 self.stopButton.setDefault(True) |
269 self.stopButton.setDefault(True) |
270 self.findButton.setEnabled(False) |
270 self.findButton.setEnabled(False) |
271 |
271 |
272 if self.filterCheckBox.isChecked(): |
272 if self.filterCheckBox.isChecked(): |
273 fileFilter = self.filterEdit.text() |
273 fileFilter = self.filterEdit.text() |
274 fileFilterList = ["^%s$" % filter.replace(".", "\.").replace("*", ".*") \ |
274 fileFilterList = ["^{0}$".format(filter.replace(".", "\.").replace("*", ".*")) \ |
275 for filter in fileFilter.split(";")] |
275 for filter in fileFilter.split(";")] |
276 filterRe = re.compile("|".join(fileFilterList)) |
276 filterRe = re.compile("|".join(fileFilterList)) |
277 |
277 |
278 if self.projectButton.isChecked(): |
278 if self.projectButton.isChecked(): |
279 if self.filterCheckBox.isChecked(): |
279 if self.filterCheckBox.isChecked(): |
293 elif self.dirButton.isChecked(): |
293 elif self.dirButton.isChecked(): |
294 if not self.filterCheckBox.isChecked(): |
294 if not self.filterCheckBox.isChecked(): |
295 filters = [] |
295 filters = [] |
296 if self.sourcesCheckBox.isChecked(): |
296 if self.sourcesCheckBox.isChecked(): |
297 filters.extend( |
297 filters.extend( |
298 ["^%s$" % assoc.replace(".", "\.").replace("*", ".*") \ |
298 ["^{0}$".format(assoc.replace(".", "\.").replace("*", ".*")) \ |
299 for assoc in list(Preferences.getEditorLexerAssocs().keys()) \ |
299 for assoc in list(Preferences.getEditorLexerAssocs().keys()) \ |
300 if assoc not in self.formsExt + self.interfacesExt]) |
300 if assoc not in self.formsExt + self.interfacesExt]) |
301 if self.formsCheckBox.isChecked(): |
301 if self.formsCheckBox.isChecked(): |
302 filters.append(self.filterForms) |
302 filters.append(self.filterForms) |
303 if self.interfacesCheckBox.isChecked(): |
303 if self.interfacesCheckBox.isChecked(): |
411 if self.__replaceMode: |
411 if self.__replaceMode: |
412 rline = search.sub(replTxt, line) |
412 rline = search.sub(replTxt, line) |
413 else: |
413 else: |
414 rline = "" |
414 rline = "" |
415 if len(line) > 1024: |
415 if len(line) > 1024: |
416 line = "%s ..." % line[:1024] |
416 line = "{0} ...".format(line[:1024]) |
417 if self.__replaceMode: |
417 if self.__replaceMode: |
418 if len(rline) > 1024: |
418 if len(rline) > 1024: |
419 rline = "%s ..." % line[:1024] |
419 rline = "{0} ...".format(line[:1024]) |
420 line = "- %s\n+ %s" % (line, rline) |
420 line = "- {0}\n+ {1}".format(line, rline) |
421 self.__createItem(file, count, line, start, end, rline) |
421 self.__createItem(file, count, line, start, end, rline) |
422 |
422 |
423 if self.feelLikeCheckBox.isChecked(): |
423 if self.feelLikeCheckBox.isChecked(): |
424 fn = os.path.join(self.project.ppath, file) |
424 fn = os.path.join(self.project.ppath, file) |
425 self.emit(SIGNAL('sourceFile'), fn, count, "", (start, end)) |
425 self.emit(SIGNAL('sourceFile'), fn, count, "", (start, end)) |