eric6/Tasks/TaskViewer.py

branch
maintenance
changeset 8273
698ae46f40a4
parent 8176
31965986ecd1
parent 8220
006ee31b4835
child 8400
b3eefd7e58d1
equal deleted inserted replaced
8190:fb0ef164f536 8273:698ae46f40a4
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
771 self.addFileTask(task, fn, lineIndex, taskType) 768 self.addFileTask(task, fn, lineIndex, taskType)
772 shouldBreak = True 769 shouldBreak = True
773 break 770 break
774 if shouldBreak: 771 if shouldBreak:
775 break 772 break
776
777 count += 1
778 773
779 progress.setValue(len(files)) 774 progress.setValue(len(files))
780 775
781 def __configure(self): 776 def __configure(self):
782 """ 777 """
831 """ 826 """
832 Constructor 827 Constructor
833 828
834 @param parent reference to the parent object (QObject) 829 @param parent reference to the parent object (QObject)
835 """ 830 """
836 super(ProjectTaskExtractionThread, self).__init__() 831 super().__init__()
837 832
838 self.__lock = threading.Lock() 833 self.__lock = threading.Lock()
839 self.__interrupt = False 834 self.__interrupt = False
840 835
841 def requestInterrupt(self): 836 def requestInterrupt(self):
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

eric ide

mercurial