12 """ |
12 """ |
13 |
13 |
14 import os |
14 import os |
15 import fnmatch |
15 import fnmatch |
16 import threading |
16 import threading |
|
17 import time |
17 |
18 |
18 from PyQt6.QtCore import pyqtSignal, Qt, QThread |
19 from PyQt6.QtCore import pyqtSignal, Qt, QThread |
19 from PyQt6.QtWidgets import ( |
20 from PyQt6.QtWidgets import ( |
20 QHeaderView, QLineEdit, QTreeWidget, QDialog, QInputDialog, QApplication, |
21 QHeaderView, QLineEdit, QTreeWidget, QDialog, QInputDialog, QApplication, |
21 QMenu, QAbstractItemView, QTreeWidgetItem |
22 QMenu, QAbstractItemView, QTreeWidgetItem |
772 self.tr("Abort"), 0, len(files), self.tr("%v/%m Files")) |
773 self.tr("Abort"), 0, len(files), self.tr("%v/%m Files")) |
773 progress.setMinimumDuration(0) |
774 progress.setMinimumDuration(0) |
774 progress.setWindowTitle(self.tr("Tasks")) |
775 progress.setWindowTitle(self.tr("Tasks")) |
775 |
776 |
776 ppath = self.project.getProjectPath() |
777 ppath = self.project.getProjectPath() |
|
778 |
|
779 now = time.monotonic() |
777 for count, file in enumerate(files): |
780 for count, file in enumerate(files): |
778 progress.setLabelText( |
781 progress.setLabelText( |
779 self.tr("Extracting project tasks...\n{0}").format(file)) |
782 self.tr("Extracting project tasks...\n{0}").format(file)) |
780 progress.setValue(count) |
783 progress.setValue(count) |
781 QApplication.processEvents() |
784 if time.monotonic() - now > 0.01: |
|
785 QApplication.processEvents() |
|
786 now = time.monotonic() |
782 if progress.wasCanceled(): |
787 if progress.wasCanceled(): |
783 break |
788 break |
784 |
789 |
785 fn = os.path.join(ppath, file) |
790 fn = os.path.join(ppath, file) |
786 # read the file and split it into textlines |
791 # read the file and split it into textlines |