48 Constructor |
48 Constructor |
49 |
49 |
50 @param parent the parent (QWidget) |
50 @param parent the parent (QWidget) |
51 @param project reference to the project object |
51 @param project reference to the project object |
52 """ |
52 """ |
53 super(TaskViewer, self).__init__(parent) |
53 super().__init__(parent) |
54 |
54 |
55 self.setSortingEnabled(True) |
55 self.setSortingEnabled(True) |
56 self.setExpandsOnDoubleClick(False) |
56 self.setExpandsOnDoubleClick(False) |
57 |
57 |
58 self.__headerItem = QTreeWidgetItem( |
58 self.__headerItem = QTreeWidgetItem( |
730 progress = E5ProgressDialog( |
730 progress = E5ProgressDialog( |
731 self.tr("Extracting project tasks..."), |
731 self.tr("Extracting project tasks..."), |
732 self.tr("Abort"), 0, len(files), self.tr("%v/%m Files")) |
732 self.tr("Abort"), 0, len(files), self.tr("%v/%m Files")) |
733 progress.setMinimumDuration(0) |
733 progress.setMinimumDuration(0) |
734 progress.setWindowTitle(self.tr("Tasks")) |
734 progress.setWindowTitle(self.tr("Tasks")) |
735 count = 0 |
|
736 |
735 |
737 ppath = self.project.getProjectPath() |
736 ppath = self.project.getProjectPath() |
738 for file in files: |
737 for count, file in enumerate(files): |
739 progress.setLabelText( |
738 progress.setLabelText( |
740 self.tr("Extracting project tasks...\n{0}").format(file)) |
739 self.tr("Extracting project tasks...\n{0}").format(file)) |
741 progress.setValue(count) |
740 progress.setValue(count) |
742 QApplication.processEvents() |
741 QApplication.processEvents() |
743 if progress.wasCanceled(): |
742 if progress.wasCanceled(): |
752 count += 1 |
751 count += 1 |
753 progress.setValue(count) |
752 progress.setValue(count) |
754 continue |
753 continue |
755 |
754 |
756 # now search tasks and record them |
755 # now search tasks and record them |
757 lineIndex = 0 |
756 for lineIndex, line in enumerate(lines, start=1): |
758 for line in lines: |
|
759 lineIndex += 1 |
|
760 shouldBreak = False |
757 shouldBreak = False |
761 |
758 |
762 if line.endswith("__NO-TASK__"): |
759 if line.endswith("__NO-TASK__"): |
763 # ignore potential task marker |
760 # ignore potential task marker |
764 continue |
761 continue |
884 lines = text.splitlines() |
879 lines = text.splitlines() |
885 except (UnicodeError, OSError): |
880 except (UnicodeError, OSError): |
886 continue |
881 continue |
887 |
882 |
888 # now search tasks and record them |
883 # now search tasks and record them |
889 lineIndex = 0 |
884 for lineIndex, line in enumerate(lines, start=1): |
890 for line in lines: |
|
891 if self.__interrupt: |
885 if self.__interrupt: |
892 break |
886 break |
893 |
887 |
894 lineIndex += 1 |
|
895 found = False |
888 found = False |
896 |
889 |
897 if line.endswith("__NO-TASK__"): |
890 if line.endswith("__NO-TASK__"): |
898 # ignore potential task marker |
891 # ignore potential task marker |
899 continue |
892 continue |