eric6/Tasks/TaskViewer.py

Tue, 02 Mar 2021 17:12:08 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 02 Mar 2021 17:12:08 +0100
branch
maintenance
changeset 8142
43248bafe9b2
parent 8043
0acf98cd089a
parent 8068
28457602b8f8
child 8176
31965986ecd1
permissions
-rw-r--r--

Merged with default branch to prepare a new release.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7900
diff changeset
3 # Copyright (c) 2005 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a task viewer and associated classes.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 Tasks can be defined manually or automatically. Automatically
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 generated tasks are derived from a comment with a special
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 introductory text. This text is configurable.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 import os
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
15 import fnmatch
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
16 import threading
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
18 from PyQt5.QtCore import pyqtSignal, Qt, QThread
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
19 from PyQt5.QtWidgets import (
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
20 QHeaderView, QLineEdit, QTreeWidget, QDialog, QInputDialog, QApplication,
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
21 QMenu, QAbstractItemView, QTreeWidgetItem
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
22 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
24 from E5Gui.E5Application import e5App
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 501
diff changeset
25 from E5Gui import E5MessageBox
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3039
diff changeset
26 from E5Gui.E5ProgressDialog import E5ProgressDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
28 from .Task import Task
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 import UI.PixmapCache
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
1653
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
35 from Utilities.AutoSaver import AutoSaver
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
37
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 class TaskViewer(QTreeWidget):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 Class implementing the task viewer.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
42 @signal displayFile(str, int) emitted to go to a file task
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 """
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 458
diff changeset
44 displayFile = pyqtSignal(str, int)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 458
diff changeset
45
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 def __init__(self, parent, project):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 @param parent the parent (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 @param project reference to the project object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2409
diff changeset
53 super(TaskViewer, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 self.setSortingEnabled(True)
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
56 self.setExpandsOnDoubleClick(False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
58 self.__headerItem = QTreeWidgetItem(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
59 ["", "", self.tr("Summary"), self.tr("Filename"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
60 self.tr("Line"), ""])
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
61 self.__headerItem.setIcon(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
62 0, UI.PixmapCache.getIcon("taskCompleted"))
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
63 self.__headerItem.setIcon(
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
64 1, UI.PixmapCache.getIcon("taskPriority"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 self.setHeaderItem(self.__headerItem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.header().setSortIndicator(2, Qt.AscendingOrder)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.__resizeColumns()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.tasks = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.copyTask = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.projectOpen = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.project = project
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
74 self.__projectTasksScanFilter = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
76 from .TaskFilter import TaskFilter
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 self.taskFilter = TaskFilter()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.taskFilter.setActive(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79
1653
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
80 self.__projectTasksSaveTimer = AutoSaver(self, self.saveProjectTasks)
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
81 self.__projectTaskExtractionThread = ProjectTaskExtractionThread()
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
82 self.__projectTaskExtractionThread.taskFound.connect(self.addFileTask)
1653
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
83
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
84 self.__projectTasksMenu = QMenu(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
85 self.tr("P&roject Tasks"), self)
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
86 self.__projectTasksMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
87 self.tr("&Regenerate project tasks"),
5105
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
88 self.regenerateProjectTasks)
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
89 self.__projectTasksMenu.addSeparator()
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
90 self.__projectTasksMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
91 self.tr("&Configure scan options"),
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
92 self.__configureProjectTasksScanOptions)
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
93
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 self.__menu = QMenu(self)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
95 self.__menu.addAction(self.tr("&New Task..."), self.__newTask)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
96 self.subtaskItem = self.__menu.addAction(
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
97 self.tr("New &Sub-Task..."), self.__newSubTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 self.__menu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
99 self.projectTasksMenuItem = self.__menu.addMenu(
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
100 self.__projectTasksMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 self.__menu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
102 self.gotoItem = self.__menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
103 self.tr("&Go To"), self.__goToTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 self.__menu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
105 self.copyItem = self.__menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
106 self.tr("&Copy"), self.__copyTask)
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
107 self.pasteItem = self.__menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
108 self.tr("&Paste"), self.__pasteTask)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
109 self.pasteMainItem = self.__menu.addAction(
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
110 self.tr("Paste as &Main Task"), self.__pasteMainTask)
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
111 self.deleteItem = self.__menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
112 self.tr("&Delete"), self.__deleteTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 self.__menu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
114 self.markCompletedItem = self.__menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
115 self.tr("&Mark Completed"), self.__markCompleted)
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
116 self.__menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
117 self.tr("Delete Completed &Tasks"), self.__deleteCompleted)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 self.__menu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
119 self.__menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
120 self.tr("P&roperties..."), self.__editTaskProperties)
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
121 self.__menu.addSeparator()
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
122 self.__menuFilteredAct = self.__menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
123 self.tr("&Filtered display"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 self.__menuFilteredAct.setCheckable(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 self.__menuFilteredAct.setChecked(False)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 458
diff changeset
126 self.__menuFilteredAct.triggered[bool].connect(self.__activateFilter)
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
127 self.__menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
128 self.tr("Filter c&onfiguration..."), self.__configureFilter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 self.__menu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
130 self.__menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
131 self.tr("Resi&ze columns"), self.__resizeColumns)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 self.__menu.addSeparator()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
133 self.__menu.addAction(self.tr("Configure..."), self.__configure)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 self.__backMenu = QMenu(self)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
136 self.__backMenu.addAction(self.tr("&New Task..."), self.__newTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 self.__backMenu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
138 self.backProjectTasksMenuItem = self.__backMenu.addMenu(
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
139 self.__projectTasksMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 self.__backMenu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
141 self.backPasteItem = self.__backMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
142 self.tr("&Paste"), self.__pasteTask)
4866
7a2cecb49b5b Fixed an issue in the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
143 self.backPasteMainItem = self.__backMenu.addAction(
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
144 self.tr("Paste as &Main Task"), self.__pasteMainTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 self.__backMenu.addSeparator()
4883
ae0ee88c9d62 Improved the context menu of the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4866
diff changeset
146 self.backDeleteCompletedItem = self.__backMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
147 self.tr("Delete Completed &Tasks"), self.__deleteCompleted)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 self.__backMenu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
149 self.__backMenuFilteredAct = self.__backMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
150 self.tr("&Filtered display"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 self.__backMenuFilteredAct.setCheckable(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 self.__backMenuFilteredAct.setChecked(False)
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
153 self.__backMenuFilteredAct.triggered[bool].connect(
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
154 self.__activateFilter)
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
155 self.__backMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
156 self.tr("Filter c&onfiguration..."), self.__configureFilter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 self.__backMenu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
158 self.__backMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
159 self.tr("Resi&ze columns"), self.__resizeColumns)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 self.__backMenu.addSeparator()
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
161 self.__backMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
162 self.tr("Configure..."), self.__configure)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163
2099
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
164 self.__activating = False
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
165
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 self.setContextMenuPolicy(Qt.CustomContextMenu)
458
1695e7a2db54 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 428
diff changeset
167 self.customContextMenuRequested.connect(self.__showContextMenu)
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 458
diff changeset
168 self.itemActivated.connect(self.__taskItemActivated)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169
7533
88261c96484b Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
170 self.setWindowIcon(UI.PixmapCache.getIcon("eric"))
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
171
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
172 self.__generateTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
173
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
174 def __generateTopLevelItems(self):
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
175 """
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
176 Private method to generate the 'Extracted Tasks' item.
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
177 """
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
178 self.__extractedItem = QTreeWidgetItem(self,
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
179 [self.tr("Extracted Tasks")])
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
180 self.__manualItem = QTreeWidgetItem(self,
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
181 [self.tr("Manual Tasks")])
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
182 for itm in [self.__extractedItem, self.__manualItem]:
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
183 itm.setFirstColumnSpanned(True)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
184 itm.setExpanded(True)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
185 itm.setHidden(True)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
186 font = itm.font(0)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
187 font.setUnderline(True)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
188 itm.setFont(0, font)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
189
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
190 def __checkTopLevelItems(self):
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
191 """
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
192 Private slot to check the 'Extracted Tasks' item for children.
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
193 """
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
194 for itm in [self.__extractedItem, self.__manualItem]:
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
195 visibleCount = itm.childCount()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
196 for index in range(itm.childCount()):
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
197 if itm.child(index).isHidden():
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
198 visibleCount -= 1
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
199 itm.setHidden(visibleCount == 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 def __resort(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 Private method to resort the tree.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 self.sortItems(self.sortColumn(), self.header().sortIndicatorOrder())
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
206
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 def __resizeColumns(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 Private method to resize the list columns.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 self.header().resizeSections(QHeaderView.ResizeToContents)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 self.header().setStretchLastSection(True)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
213
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
214 def findParentTask(self, parentUid):
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
215 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
216 Public method to find a parent task by its ID.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
218 @param parentUid uid of the parent task (string)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
219 @return reference to the task (Task)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
220 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
221 if not parentUid:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
222 return None
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
223
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
224 parentTask = None
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
225 for task in self.tasks:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
226 if task.getUuid() == parentUid:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
227 parentTask = task
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
228 break
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
229
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
230 return parentTask
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
231
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 def __refreshDisplay(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 Private method to refresh the display.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 for task in self.tasks:
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
237 task.setHidden(not self.taskFilter.showTask(task))
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
238
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
239 self.__checkTopLevelItems()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 self.__resort()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 self.__resizeColumns()
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
242
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 def __taskItemActivated(self, itm, col):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
245 Private slot to handle the activation of an item.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 @param itm reference to the activated item (QTreeWidgetItem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 @param col column the item was activated in (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 """
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
250 if (
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
251 not self.__activating and
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
252 itm is not self.__extractedItem and
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
253 itm is not self.__manualItem
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
254 ):
2099
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
255 self.__activating = True
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
256 fn = itm.getFilename()
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
257 if fn:
5851
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
258 if os.path.exists(fn):
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
259 self.displayFile.emit(fn, itm.getLineno())
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
260 else:
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
261 if itm.isProjectTask():
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
262 self.__deleteTask(itm)
2099
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
263 else:
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
264 self.__editTaskProperties()
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
265 self.__activating = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 def __showContextMenu(self, coord):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 Private slot to show the context menu of the list.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 @param coord the position of the mouse pointer (QPoint)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 itm = self.itemAt(coord)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 coord = self.mapToGlobal(coord)
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
275 if (
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
276 itm is None or
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
277 itm is self.__extractedItem or
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
278 itm is self.__manualItem
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
279 ):
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
280 self.backProjectTasksMenuItem.setEnabled(self.projectOpen)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 if self.copyTask:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 self.backPasteItem.setEnabled(True)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
283 self.backPasteMainItem.setEnabled(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 self.backPasteItem.setEnabled(False)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
286 self.backPasteMainItem.setEnabled(False)
4883
ae0ee88c9d62 Improved the context menu of the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4866
diff changeset
287 self.backDeleteCompletedItem.setEnabled(
ae0ee88c9d62 Improved the context menu of the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4866
diff changeset
288 bool(self.tasks))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 self.__backMenu.popup(coord)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 else:
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
291 self.projectTasksMenuItem.setEnabled(self.projectOpen)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 if itm.getFilename():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 self.gotoItem.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 self.deleteItem.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 self.markCompletedItem.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 self.copyItem.setEnabled(False)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
297 self.subtaskItem.setEnabled(False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
298 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 self.gotoItem.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 self.deleteItem.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 self.markCompletedItem.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 self.copyItem.setEnabled(True)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
303 self.subtaskItem.setEnabled(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 if self.copyTask:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 self.pasteItem.setEnabled(True)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
306 self.pasteMainItem.setEnabled(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
307 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 self.pasteItem.setEnabled(False)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
309 self.pasteMainItem.setEnabled(False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 self.__menu.popup(coord)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
313 def setProjectOpen(self, o=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 Public slot to set the project status.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 @param o flag indicating the project status
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 self.projectOpen = o
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
321 def addTask(self, summary, priority=1, filename="", lineno=0,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
322 completed=False, _time=0, isProjectTask=False,
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
323 taskType=Task.TypeTodo, description="", uid="",
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
324 parentTask=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 Public slot to add a task.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
328 @param summary summary text of the task (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 @param priority priority of the task (0=high, 1=normal, 2=low)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 @param filename filename containing the task (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 @param lineno line number containing the task (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 @param completed flag indicating completion status (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 @param _time creation time of the task (float, if 0 use current time)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
334 @param isProjectTask flag indicating a task related to the current
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 project (boolean)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
336 @param taskType type of the task (one of Task.TypeFixme, Task.TypeTodo,
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
337 Task.TypeWarning, Task.TypeNote)
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
338 @param description explanatory text of the task (string)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
339 @param uid unique id of the task (string)
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
340 @param parentTask reference to the parent task item (Task) or the
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
341 UID of the parent task
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
342 @return reference to the task item (Task)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 """
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
344 if isinstance(parentTask, str):
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
345 # UID of parent task
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
346 if parentTask == "":
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
347 parentUid = ""
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
348 parentTask = None
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
349 else:
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
350 parentUid = parentTask
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
351 parentTask = self.findParentTask(parentUid)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
352 else:
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
353 # parent task item
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
354 if parentTask:
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
355 parentUid = parentTask.getUuid()
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
356 else:
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
357 parentUid = ""
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
358 task = Task(summary, priority, filename, lineno, completed,
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
359 _time, isProjectTask, taskType,
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
360 self.project, description, uid, parentUid)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 self.tasks.append(task)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
362 if parentTask:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
363 parentTask.addChild(task)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
364 parentTask.setExpanded(True)
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
365 elif filename:
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
366 self.__extractedItem.addChild(task)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
367 else:
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
368 self.__manualItem.addChild(task)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
369 task.setHidden(not self.taskFilter.showTask(task))
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
370
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
371 self.__checkTopLevelItems()
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
372 self.__resort()
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
373 self.__resizeColumns()
1653
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
374
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
375 if isProjectTask:
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
376 self.__projectTasksSaveTimer.changeOccurred()
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
377
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
378 return task
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
380 def addFileTask(self, summary, filename, lineno, taskType=Task.TypeTodo,
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
381 description=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 Public slot to add a file related task.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
385 @param summary summary text of the task (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 @param filename filename containing the task (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 @param lineno line number containing the task (integer)
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
388 @param taskType type of the task (one of Task.TypeFixme, Task.TypeTodo,
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
389 Task.TypeWarning, Task.TypeNote)
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
390 @param description explanatory text of the task (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391 """
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
392 self.addTask(summary, filename=filename, lineno=lineno,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
393 isProjectTask=(
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
394 self.project and
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
395 self.project.isProjectSource(filename)),
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
396 taskType=taskType, description=description)
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
397
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 def getProjectTasks(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 Public method to retrieve all project related tasks.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 @return copy of tasks (list of Task)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 tasks = [task for task in self.tasks if task.isProjectTask()]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 return tasks[:]
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
406
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 def getGlobalTasks(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 Public method to retrieve all non project related tasks.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 @return copy of tasks (list of Task)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 tasks = [task for task in self.tasks if not task.isProjectTask()]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 return tasks[:]
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
415
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 def clearTasks(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 Public slot to clear all tasks from display.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 self.tasks = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 self.clear()
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
422 self.__generateTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
423
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1965
diff changeset
424 def clearProjectTasks(self, fileOnly=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 Public slot to clear project related tasks.
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1965
diff changeset
427
7900
72b88fb20261 Corrected the use of '@keyparam' in the source documentation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7836
diff changeset
428 @param fileOnly flag indicating to clear only file related
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1965
diff changeset
429 project tasks (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 """
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
431 for task in reversed(self.tasks[:]):
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
432 if (
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
433 (fileOnly and task.isProjectFileTask()) or
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
434 (not fileOnly and task.isProjectTask())
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
435 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 if self.copyTask == task:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 self.copyTask = None
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
438 parent = task.parent()
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
439 parent.removeChild(task)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440 self.tasks.remove(task)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 del task
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
443 self.__checkTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
444 self.__resort()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
445 self.__resizeColumns()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
446
1373
b3b3c99dba01 Made tasks manager forget about global file tasks when file is closed (configurable via configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
447 def clearFileTasks(self, filename, conditionally=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
449 Public slot to clear all tasks related to a file.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
450
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 @param filename name of the file (string)
1373
b3b3c99dba01 Made tasks manager forget about global file tasks when file is closed (configurable via configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
452 @param conditionally flag indicating to clear the tasks of the file
b3b3c99dba01 Made tasks manager forget about global file tasks when file is closed (configurable via configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
453 checking some conditions (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 """
1373
b3b3c99dba01 Made tasks manager forget about global file tasks when file is closed (configurable via configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
455 if conditionally:
b3b3c99dba01 Made tasks manager forget about global file tasks when file is closed (configurable via configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
456 if self.project and self.project.isProjectSource(filename):
b3b3c99dba01 Made tasks manager forget about global file tasks when file is closed (configurable via configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
457 # project related tasks will not be cleared
b3b3c99dba01 Made tasks manager forget about global file tasks when file is closed (configurable via configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
458 return
b3b3c99dba01 Made tasks manager forget about global file tasks when file is closed (configurable via configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
459 if not Preferences.getTasks("ClearOnFileClose"):
b3b3c99dba01 Made tasks manager forget about global file tasks when file is closed (configurable via configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
460 return
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
461 for task in self.tasks[:]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 if task.getFilename() == filename:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463 if self.copyTask == task:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
464 self.copyTask = None
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
465 self.__extractedItem.removeChild(task)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 self.tasks.remove(task)
1653
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
467 if task.isProjectTask:
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
468 self.__projectTasksSaveTimer.changeOccurred()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
469 del task
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
471 self.__checkTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
472 self.__resort()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
473 self.__resizeColumns()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
474
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 def __editTaskProperties(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
476 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
477 Private slot to handle the "Properties" context menu entry.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
478 """
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
479 from .TaskPropertiesDialog import TaskPropertiesDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
480 task = self.currentItem()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
481 dlg = TaskPropertiesDialog(task, self, self.projectOpen)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
482 ro = task.getFilename() != ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
483 if ro:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
484 dlg.setReadOnly()
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7663
diff changeset
485 if dlg.exec() == QDialog.Accepted and not ro:
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
486 summary, priority, completed, isProjectTask, description = (
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
487 dlg.getData()
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
488 )
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
489 task.setSummary(summary)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
490 task.setPriority(priority)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
491 task.setCompleted(completed)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
492 task.setProjectTask(isProjectTask)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
493 task.setDescription(description)
1965
96f5a76e1845 Fixed some PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
494 self.__projectTasksSaveTimer.changeOccurred()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
495
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
496 def __newTask(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 Private slot to handle the "New Task" context menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
499 """
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
500 from .TaskPropertiesDialog import TaskPropertiesDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 dlg = TaskPropertiesDialog(None, self, self.projectOpen)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7663
diff changeset
502 if dlg.exec() == QDialog.Accepted:
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
503 summary, priority, completed, isProjectTask, description = (
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
504 dlg.getData()
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
505 )
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
506 self.addTask(summary, priority, completed=completed,
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
507 isProjectTask=isProjectTask, description=description)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
508
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
509 def __newSubTask(self):
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
510 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
511 Private slot to handle the "New Sub-Task" context menu entry.
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
512 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
513 parentTask = self.currentItem()
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
514 projectTask = parentTask.isProjectTask()
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
515
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
516 from .TaskPropertiesDialog import TaskPropertiesDialog
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
517 dlg = TaskPropertiesDialog(None, self, self.projectOpen)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
518 dlg.setSubTaskMode(projectTask)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7663
diff changeset
519 if dlg.exec() == QDialog.Accepted:
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
520 summary, priority, completed, isProjectTask, description = (
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
521 dlg.getData()
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
522 )
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
523 self.addTask(summary, priority, completed=completed,
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
524 isProjectTask=isProjectTask, description=description,
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
525 parentTask=parentTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
527 def __markCompleted(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 Private slot to handle the "Mark Completed" context menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 task = self.currentItem()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 task.setCompleted(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
533
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 def __deleteCompleted(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
535 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
536 Private slot to handle the "Delete Completed Tasks" context menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 """
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
538 for task in reversed(self.tasks[:]):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
539 if task.isCompleted():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
540 if self.copyTask == task:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 self.copyTask = None
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
542 parent = task.parent()
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
543 parent.removeChild(task)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 self.tasks.remove(task)
1653
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
545 if task.isProjectTask:
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
546 self.__projectTasksSaveTimer.changeOccurred()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 del task
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
548
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
549 self.__checkTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
550 self.__resort()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
551 self.__resizeColumns()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
552
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 ci = self.currentItem()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554 if ci:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 ind = self.indexFromItem(ci, self.currentColumn())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 self.scrollTo(ind, QAbstractItemView.PositionAtCenter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 def __copyTask(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
560 Private slot to handle the "Copy" context menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 task = self.currentItem()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 self.copyTask = task
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 def __pasteTask(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 Private slot to handle the "Paste" context menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
569 if self.copyTask:
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
570 parent = self.copyTask.parent()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
571 if not isinstance(parent, Task):
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
572 parent = None
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
573
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
574 self.addTask(self.copyTask.summary,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
575 priority=self.copyTask.priority,
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
576 completed=self.copyTask.completed,
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
577 description=self.copyTask.description,
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
578 isProjectTask=self.copyTask._isProjectTask,
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
579 parentTask=parent)
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
580
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
581 def __pasteMainTask(self):
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
582 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
583 Private slot to handle the "Paste as Main Task" context menu entry.
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
584 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
585 if self.copyTask:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
586 self.addTask(self.copyTask.summary,
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
587 priority=self.copyTask.priority,
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
588 completed=self.copyTask.completed,
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
589 description=self.copyTask.description,
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
590 isProjectTask=self.copyTask._isProjectTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
591
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
592 def __deleteSubTasks(self, task):
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
593 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
594 Private method to delete all sub-tasks.
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
595
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
596 @param task task to delete sub-tasks of (Task)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
597 """
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
598 for subtask in task.takeChildren():
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
599 if self.copyTask == subtask:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
600 self.copyTask = None
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
601 if subtask.childCount() > 0:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
602 self.__deleteSubTasks(subtask)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
603 self.tasks.remove(subtask)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
604
5851
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
605 def __deleteTask(self, task=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
606 """
5851
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
607 Private slot to delete a task.
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
608
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
609 @param task task to be deleted
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
610 @type Task
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
611 """
5851
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
612 if task is None:
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
613 # called via "Delete Task" context menu entry
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
614 task = self.currentItem()
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
615
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
616 if self.copyTask is task:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
617 self.copyTask = None
3990
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
618 if task.childCount() > 0:
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
619 self.__deleteSubTasks(task)
5dd6edf8540a Aadded capability to add sub-tasks (i.e. a task hierarchy) for manually generated tasks to the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3656
diff changeset
620 parent = task.parent()
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
621 parent.removeChild(task)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 self.tasks.remove(task)
1653
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
623 if task.isProjectTask:
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
624 self.__projectTasksSaveTimer.changeOccurred()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625 del task
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
626
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
627 self.__checkTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
628 self.__resort()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
629 self.__resizeColumns()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
630
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
631 ci = self.currentItem()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632 if ci:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 ind = self.indexFromItem(ci, self.currentColumn())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 self.scrollTo(ind, QAbstractItemView.PositionAtCenter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 def __goToTask(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 Private slot to handle the "Go To" context menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
639 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
640 task = self.currentItem()
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 458
diff changeset
641 self.displayFile.emit(task.getFilename(), task.getLineno())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 def handlePreferencesChanged(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 Public slot to react to changes of the preferences.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647 for task in self.tasks:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
648 task.colorizeTask()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
650 def __activateFilter(self, on):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
652 Private slot to handle the "Filtered display" context menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
653
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 @param on flag indicating the filter state (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 if on and not self.taskFilter.hasActiveFilter():
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
657 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
658 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
659 self.tr("Activate task filter"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
660 self.tr(
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
661 """The task filter doesn't have any active filters."""
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
662 """ Do you want to configure the filter settings?"""),
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
663 yesDefault=True)
541
00e1a5d060c5 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 538
diff changeset
664 if not res:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 on = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 self.__configureFilter()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668 on = self.taskFilter.hasActiveFilter()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 self.taskFilter.setActive(on)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 self.__menuFilteredAct.setChecked(on)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 self.__backMenuFilteredAct.setChecked(on)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673 self.__refreshDisplay()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 def __configureFilter(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 Private slot to handle the "Configure filter" context menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 """
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
679 from .TaskFilterConfigDialog import TaskFilterConfigDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
680 dlg = TaskFilterConfigDialog(self.taskFilter)
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7663
diff changeset
681 if dlg.exec() == QDialog.Accepted:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
682 dlg.configureTaskFilter(self.taskFilter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 self.__refreshDisplay()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
684
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
685 def __configureProjectTasksScanOptions(self):
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
686 """
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
687 Private slot to configure scan options for project tasks.
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
688 """
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
689 scanFilter, ok = QInputDialog.getText(
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
690 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
691 self.tr("Scan Filter Patterns"),
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
692 self.tr("Enter filename patterns of files"
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
693 " to be excluded separated by a comma:"),
992
566e87428fc8 Fixed a few PEP-8 issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 961
diff changeset
694 QLineEdit.Normal,
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
695 self.__projectTasksScanFilter)
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
696 if ok:
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
697 self.__projectTasksScanFilter = scanFilter
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
698
5105
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
699 def regenerateProjectTasks(self, quiet=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 """
5105
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
701 Public slot to regenerate project related tasks.
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
702
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
703 @param quiet flag indicating quiet operation
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
704 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
705 """
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
706 markers = {
7663
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
707 taskType: Preferences.getTasks(markersName).split()
b4d5234f92e7 Tasks: added separate task categories for 'Test' and 'Documentation' tasks
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
708 for taskType, markersName in Task.TaskType2MarkersName.items()
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
709 }
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 files = self.project.pdata["SOURCES"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
712 # apply file filter
8068
28457602b8f8 TaskViewer: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
713 filterList = [f.strip()
28457602b8f8 TaskViewer: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
714 for f in self.__projectTasksScanFilter.split(",")
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
715 if f.strip()]
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
716 if filterList:
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
717 for scanFilter in filterList:
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
718 files = [f for f in files
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
719 if not fnmatch.fnmatch(f, scanFilter)]
960
64a6e66b4707 Added capability to the tasks viewer to ignore files based on a wildcard during a project tasks scan.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 945
diff changeset
720
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721 # remove all project tasks
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1965
diff changeset
722 self.clearProjectTasks(fileOnly=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
724 # now process them
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
725 if quiet:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
726 ppath = self.project.getProjectPath()
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
727 self.__projectTaskExtractionThread.scan(
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
728 markers, [os.path.join(ppath, f) for f in files])
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
729 else:
5105
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
730 progress = E5ProgressDialog(
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
731 self.tr("Extracting project tasks..."),
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
732 self.tr("Abort"), 0, len(files), self.tr("%v/%m Files"))
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
733 progress.setMinimumDuration(0)
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
734 progress.setWindowTitle(self.tr("Tasks"))
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
735 count = 0
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
736
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
737 ppath = self.project.getProjectPath()
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
738 for file in files:
5105
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
739 progress.setLabelText(
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
740 self.tr("Extracting project tasks...\n{0}").format(file))
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
741 progress.setValue(count)
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
742 QApplication.processEvents()
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
743 if progress.wasCanceled():
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
744 break
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
745
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
746 fn = os.path.join(ppath, file)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
747 # read the file and split it into textlines
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
748 try:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
749 text, encoding = Utilities.readEncodedFile(fn)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
750 lines = text.splitlines()
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
751 except (UnicodeError, OSError):
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
752 count += 1
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
753 progress.setValue(count)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
754 continue
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
755
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
756 # now search tasks and record them
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
757 lineIndex = 0
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
758 for line in lines:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
759 lineIndex += 1
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
760 shouldBreak = False
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
761
6494
72e3d61e5a20 TaskViewer: amended another place to check for '__NO-TASK__' marker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6493
diff changeset
762 if line.endswith("__NO-TASK__"):
72e3d61e5a20 TaskViewer: amended another place to check for '__NO-TASK__' marker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6493
diff changeset
763 # ignore potential task marker
72e3d61e5a20 TaskViewer: amended another place to check for '__NO-TASK__' marker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6493
diff changeset
764 continue
72e3d61e5a20 TaskViewer: amended another place to check for '__NO-TASK__' marker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6493
diff changeset
765
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
766 for taskType, taskMarkers in markers.items():
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
767 for taskMarker in taskMarkers:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
768 index = line.find(taskMarker)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
769 if index > -1:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
770 task = line[index:]
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
771 self.addFileTask(task, fn, lineIndex, taskType)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
772 shouldBreak = True
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
773 break
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
774 if shouldBreak:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
775 break
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
776
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 count += 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778
5105
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
779 progress.setValue(len(files))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 def __configure(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
783 Private method to open the configuration dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
785 e5App().getObject("UserInterface").showPreferences("tasksPage")
1653
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
786
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
787 def saveProjectTasks(self):
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
788 """
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
789 Public method to write the project tasks.
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
790 """
5105
8a773a100c34 Added an option to the project to rescan the project for tasks upon open.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4883
diff changeset
791 if self.projectOpen and Preferences.getProject("TasksProjectAutoSave"):
1653
fed1920ff53b Added capability to save project tasks automatically (configurable on project configuration page of configuration dialog).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
792 self.project.writeTasks()
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
793
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
794 def stopProjectTaskExtraction(self):
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
795 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
796 Public method to stop the project task extraction thread.
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
797 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
798 self.__projectTaskExtractionThread.requestInterrupt()
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
799 self.__projectTaskExtractionThread.wait()
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
800
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
801 def getTasksScanFilter(self) -> str:
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
802 """
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
803 Public method to get the project scan filter.
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
804
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
805 @return project scan filter
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
806 @rtype str
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
807 """
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
808 return self.__projectTasksScanFilter.strip()
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
809
8068
28457602b8f8 TaskViewer: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
810 def setTasksScanFilter(self, filterStr: str):
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
811 """
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
812 Public method to set the project scan filter.
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
813
8068
28457602b8f8 TaskViewer: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
814 @param filterStr project scan filter
8011
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
815 @type str
630a173cb137 Implemented the JSON based tasks files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
816 """
8068
28457602b8f8 TaskViewer: fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8011
diff changeset
817 self.__projectTasksScanFilter = filterStr
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
818
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
819
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
820 class ProjectTaskExtractionThread(QThread):
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
821 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
822 Class implementing a thread to extract tasks related to a project.
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
823
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
824 @signal taskFound(str, str, int, int) emitted with the task description,
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
825 the file name, the line number and task type to signal the presence of
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
826 a task
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
827 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
828 taskFound = pyqtSignal(str, str, int, int)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
829
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
830 def __init__(self, parent=None):
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
831 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
832 Constructor
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
833
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
834 @param parent reference to the parent object (QObject)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
835 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
836 super(ProjectTaskExtractionThread, self).__init__()
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
837
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
838 self.__lock = threading.Lock()
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
839 self.__interrupt = False
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
840
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
841 def requestInterrupt(self):
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
842 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
843 Public method to request iterruption of the thread.
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
844 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
845 if self.isRunning():
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
846 self.__interrupt = True
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
847
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
848 def scan(self, markers, files):
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
849 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
850 Public method to scan the given list of files for tasks.
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
851
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
852 @param markers dictionary of defined task markers
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
853 @type dict of lists of str
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
854 @param files list of file names to be scanned
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
855 @type list of str
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
856 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
857 with self.__lock:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
858 self.__interrupt = False
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
859 self.__files = files[:]
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
860 self.__markers = {}
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
861 for markerType in markers:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
862 self.__markers[markerType] = markers[markerType][:]
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
863
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
864 if not self.isRunning():
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
865 self.start(QThread.LowPriority)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
866
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
867 def run(self):
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
868 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
869 Public thread method to scan the given files.
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
870 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
871 with self.__lock:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
872 files = self.__files[:]
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
873 markers = {}
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
874 for markerType in self.__markers:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
875 markers[markerType] = self.__markers[markerType][:]
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
876
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
877 for fn in files:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
878 if self.__interrupt:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
879 break
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
880
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
881 # read the file and split it into textlines
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
882 try:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
883 text, encoding = Utilities.readEncodedFile(fn)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
884 lines = text.splitlines()
7836
2f0d208b8137 Changed code to not use the OSError aliases (IOError, EnvironmentError, socket.error and select.error) anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7781
diff changeset
885 except (UnicodeError, OSError):
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
886 continue
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
887
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
888 # now search tasks and record them
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
889 lineIndex = 0
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
890 for line in lines:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
891 if self.__interrupt:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
892 break
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
893
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
894 lineIndex += 1
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
895 found = False
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
896
6493
b64d6d0b4175 TaskViewer, Editor: added code to mark a line as not containing a task with '__NO-TASK__'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
897 if line.endswith("__NO-TASK__"):
b64d6d0b4175 TaskViewer, Editor: added code to mark a line as not containing a task with '__NO-TASK__'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
898 # ignore potential task marker
b64d6d0b4175 TaskViewer, Editor: added code to mark a line as not containing a task with '__NO-TASK__'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
899 continue
b64d6d0b4175 TaskViewer, Editor: added code to mark a line as not containing a task with '__NO-TASK__'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6048
diff changeset
900
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
901 for taskType, taskMarkers in markers.items():
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
902 for taskMarker in taskMarkers:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
903 index = line.find(taskMarker)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
904 if index > -1:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
905 task = line[index:]
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
906 with self.__lock:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
907 self.taskFound.emit(task, fn, lineIndex,
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
908 taskType)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
909 found = True
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
910 break
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
911 if found:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
912 break

eric ide

mercurial