66 """ |
66 """ |
67 Private method to resort the tree. |
67 Private method to resort the tree. |
68 """ |
68 """ |
69 self.resultList.sortItems(self.resultList.sortColumn(), |
69 self.resultList.sortItems(self.resultList.sortColumn(), |
70 self.resultList.header().sortIndicatorOrder() |
70 self.resultList.header().sortIndicatorOrder() |
71 ) |
71 ) |
72 |
72 |
73 def __createResultItem(self, file, line, index, error, sourcecode, |
73 def __createResultItem(self, file, line, index, error, sourcecode, |
74 isWarning=False): |
74 isWarning=False): |
75 """ |
75 """ |
76 Private method to create an entry in the result list. |
76 Private method to create an entry in the result list. |
178 source = Utilities.normalizeCode(source) |
178 source = Utilities.normalizeCode(source) |
179 except (UnicodeError, IOError) as msg: |
179 except (UnicodeError, IOError) as msg: |
180 self.noResults = False |
180 self.noResults = False |
181 self.__createResultItem( |
181 self.__createResultItem( |
182 file, 1, 0, |
182 file, 1, 0, |
183 self.trUtf8("Error: {0}").format(str(msg))\ |
183 self.trUtf8("Error: {0}").format(str(msg)) |
184 .rstrip()[1:-1], "") |
184 .rstrip()[1:-1], "") |
185 progress += 1 |
185 progress += 1 |
186 continue |
186 continue |
187 |
187 |
188 flags = Utilities.extractFlags(source) |
188 flags = Utilities.extractFlags(source) |
189 ext = os.path.splitext(file)[1] |
189 ext = os.path.splitext(file)[1] |
190 if "FileType" in flags: |
190 if "FileType" in flags: |
191 isPy2 = flags["FileType"] in ["Python", "Python2"] |
191 isPy2 = flags["FileType"] in ["Python", "Python2"] |
192 elif (Preferences.getProject("DeterminePyFromProject") and \ |
192 elif (Preferences.getProject("DeterminePyFromProject") and \ |
193 self.__project.isOpen() and \ |
193 self.__project.isOpen() and |
194 self.__project.isProjectFile(file)): |
194 self.__project.isProjectFile(file)): |
195 isPy2 = self.__project.getProjectLanguage() in \ |
195 isPy2 = self.__project.getProjectLanguage() in \ |
196 ["Python", "Python2"] |
196 ["Python", "Python2"] |
197 else: |
197 else: |
198 isPy2 = flags.get("FileType") in ["Python", "Python2"] or \ |
198 isPy2 = flags.get("FileType") in ["Python", "Python2"] or \ |