eric6/Tasks/TaskViewer.py

Sun, 02 Feb 2020 11:04:32 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 02 Feb 2020 11:04:32 +0100
changeset 7380
c99320e859ca
parent 7360
9190402e4505
child 7533
88261c96484b
permissions
-rw-r--r--

Fixed an issue related to showing the application name in the menu bar of Gnome desktop under Wayland.

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
7360
9190402e4505 Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7259
diff changeset
3 # Copyright (c) 2005 - 2020 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
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
14
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 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
16 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
17 import threading
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
19 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
20 from PyQt5.QtWidgets import (
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
21 QHeaderView, QLineEdit, QTreeWidget, QDialog, QInputDialog, QApplication,
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
22 QMenu, QAbstractItemView, QTreeWidgetItem
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
23 )
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
25 from E5Gui.E5Application import e5App
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 501
diff changeset
26 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
27 from E5Gui.E5ProgressDialog import E5ProgressDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
29 from .Task import Task
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 import UI.PixmapCache
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35
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
36 from Utilities.AutoSaver import AutoSaver
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
38
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 class TaskViewer(QTreeWidget):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 Class implementing the task viewer.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
43 @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
44 """
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 458
diff changeset
45 displayFile = pyqtSignal(str, int)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 458
diff changeset
46
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 def __init__(self, parent, project):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 @param parent the parent (QWidget)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 @param project reference to the project object
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 """
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
54 super(TaskViewer, self).__init__(parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.setSortingEnabled(True)
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
57 self.setExpandsOnDoubleClick(False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
59 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
60 ["", "", 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
61 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
62 self.__headerItem.setIcon(
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
63 0, UI.PixmapCache.getIcon("taskCompleted.png"))
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
64 self.__headerItem.setIcon(
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
65 1, UI.PixmapCache.getIcon("taskPriority.png"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.setHeaderItem(self.__headerItem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 self.header().setSortIndicator(2, Qt.AscendingOrder)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.__resizeColumns()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.tasks = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.copyTask = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.projectOpen = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.project = project
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
75 self.projectTasksScanFilter = ""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
77 from .TaskFilter import TaskFilter
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.taskFilter = TaskFilter()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.taskFilter.setActive(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80
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
81 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
82 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
83 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
84
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
85 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
86 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
87 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
88 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
89 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
90 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
91 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
92 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
93 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
94
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 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
96 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
97 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
98 self.tr("New &Sub-Task..."), self.__newSubTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 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
100 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
101 self.__projectTasksMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 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
103 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
104 self.tr("&Go To"), self.__goToTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 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
106 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
107 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
108 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
109 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
110 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
111 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
112 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
113 self.tr("&Delete"), self.__deleteTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 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
115 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
116 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
117 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
118 self.tr("Delete Completed &Tasks"), self.__deleteCompleted)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 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
120 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
121 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
122 self.__menu.addSeparator()
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
123 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
124 self.tr("&Filtered display"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 self.__menuFilteredAct.setCheckable(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 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
127 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
128 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
129 self.tr("Filter c&onfiguration..."), self.__configureFilter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 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
131 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
132 self.tr("Resi&ze columns"), self.__resizeColumns)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 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
134 self.__menu.addAction(self.tr("Configure..."), self.__configure)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 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
137 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
138 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
139 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
140 self.__projectTasksMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 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
142 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
143 self.tr("&Paste"), self.__pasteTask)
4866
7a2cecb49b5b Fixed an issue in the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4631
diff changeset
144 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
145 self.tr("Paste as &Main Task"), self.__pasteMainTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 self.__backMenu.addSeparator()
4883
ae0ee88c9d62 Improved the context menu of the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4866
diff changeset
147 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
148 self.tr("Delete Completed &Tasks"), self.__deleteCompleted)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 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
150 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
151 self.tr("&Filtered display"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 self.__backMenuFilteredAct.setCheckable(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 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
154 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
155 self.__activateFilter)
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
156 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
157 self.tr("Filter c&onfiguration..."), self.__configureFilter)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 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
159 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
160 self.tr("Resi&ze columns"), self.__resizeColumns)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 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
162 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
163 self.tr("Configure..."), self.__configure)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164
2099
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
165 self.__activating = False
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
166
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 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
168 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
169 self.itemActivated.connect(self.__taskItemActivated)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
172
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
173 self.__generateTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
174
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
175 def __generateTopLevelItems(self):
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
176 """
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
177 Private method to generate the 'Extracted Tasks' item.
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
178 """
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
179 self.__extractedItem = QTreeWidgetItem(self,
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
180 [self.tr("Extracted Tasks")])
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
181 self.__manualItem = QTreeWidgetItem(self,
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
182 [self.tr("Manual Tasks")])
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
183 for itm in [self.__extractedItem, self.__manualItem]:
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
184 itm.setFirstColumnSpanned(True)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
185 itm.setExpanded(True)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
186 itm.setHidden(True)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
187 font = itm.font(0)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
188 font.setUnderline(True)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
189 itm.setFont(0, font)
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
190
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
191 def __checkTopLevelItems(self):
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
192 """
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
193 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
194 """
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
195 for itm in [self.__extractedItem, self.__manualItem]:
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
196 visibleCount = itm.childCount()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
197 for index in range(itm.childCount()):
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
198 if itm.child(index).isHidden():
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
199 visibleCount -= 1
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
200 itm.setHidden(visibleCount == 0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 def __resort(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 Private method to resort the tree.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 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
207
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 def __resizeColumns(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 Private method to resize the list columns.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 self.header().resizeSections(QHeaderView.ResizeToContents)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 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
214
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 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
216 """
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
217 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
218
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
219 @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
220 @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
221 """
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 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
223 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
224
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 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
226 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
227 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
228 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
229 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
230
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 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
232
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 def __refreshDisplay(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 Private method to refresh the display.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 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
238 task.setHidden(not self.taskFilter.showTask(task))
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
239
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
240 self.__checkTopLevelItems()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241 self.__resort()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 self.__resizeColumns()
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
243
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 def __taskItemActivated(self, itm, col):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
246 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
247
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 @param itm reference to the activated item (QTreeWidgetItem)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 @param col column the item was activated in (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 """
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
251 if (
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
252 not self.__activating and
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
253 itm is not self.__extractedItem and
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
254 itm is not self.__manualItem
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
255 ):
2099
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
256 self.__activating = True
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
257 fn = itm.getFilename()
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
258 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
259 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
260 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
261 else:
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
262 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
263 self.__deleteTask(itm)
2099
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
264 else:
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
265 self.__editTaskProperties()
afde0e9110f7 Implemented guards against double activation of list entries.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2000
diff changeset
266 self.__activating = False
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 def __showContextMenu(self, coord):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 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
271
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 @param coord the position of the mouse pointer (QPoint)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 itm = self.itemAt(coord)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 coord = self.mapToGlobal(coord)
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
276 if (
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
277 itm is None or
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
278 itm is self.__extractedItem or
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
279 itm is self.__manualItem
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
280 ):
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
281 self.backProjectTasksMenuItem.setEnabled(self.projectOpen)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 if self.copyTask:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 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
284 self.backPasteMainItem.setEnabled(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 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
287 self.backPasteMainItem.setEnabled(False)
4883
ae0ee88c9d62 Improved the context menu of the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4866
diff changeset
288 self.backDeleteCompletedItem.setEnabled(
ae0ee88c9d62 Improved the context menu of the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4866
diff changeset
289 bool(self.tasks))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 self.__backMenu.popup(coord)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 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
292 self.projectTasksMenuItem.setEnabled(self.projectOpen)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 if itm.getFilename():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 self.gotoItem.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 self.deleteItem.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 self.markCompletedItem.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 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
298 self.subtaskItem.setEnabled(False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 self.gotoItem.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 self.deleteItem.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 self.markCompletedItem.setEnabled(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
303 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
304 self.subtaskItem.setEnabled(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
305 if self.copyTask:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
306 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
307 self.pasteMainItem.setEnabled(True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
308 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 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
310 self.pasteMainItem.setEnabled(False)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 self.__menu.popup(coord)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
314 def setProjectOpen(self, o=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 Public slot to set the project status.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 @param o flag indicating the project status
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 self.projectOpen = o
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
322 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
323 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
324 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
325 parentTask=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 Public slot to add a task.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
329 @param summary summary text of the task (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 @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
331 @param filename filename containing the task (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 @param lineno line number containing the task (integer)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 @param completed flag indicating completion status (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 @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
335 @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
336 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
337 @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
338 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
339 @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
340 @param uid unique id of the 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
341 @param parentTask reference to the parent task item (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
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 """
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
344 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
345 parentUid = parentTask.getUuid()
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
346 else:
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
347 parentUid = ""
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
348 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
349 _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
350 self.project, description, uid, parentUid)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351 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
352 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
353 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
354 parentTask.setExpanded(True)
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
355 elif filename:
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
356 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
357 else:
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
358 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
359 task.setHidden(not self.taskFilter.showTask(task))
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
360
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
361 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
362 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
363 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
364
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
365 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
366 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
367
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
368 return task
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
370 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
371 description=""):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 Public slot to add a file related task.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
375 @param summary summary text of the task (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 @param filename filename containing the task (string)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 @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
378 @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
379 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
380 @param description explanatory text of the task (string)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 """
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
382 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
383 isProjectTask=(
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
384 self.project and
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
385 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
386 taskType=taskType, description=description)
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
387
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 def getProjectTasks(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 Public method to retrieve all project related tasks.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
391
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 @return copy of tasks (list of Task)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 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
395 return tasks[:]
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
396
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 def getGlobalTasks(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 Public method to retrieve all non project related tasks.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 @return copy of tasks (list of Task)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 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
404 return tasks[:]
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
405
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 def clearTasks(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 Public slot to clear all tasks from display.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 self.tasks = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 self.clear()
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
412 self.__generateTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
413
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1965
diff changeset
414 def clearProjectTasks(self, fileOnly=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 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
417
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1965
diff changeset
418 @keyparam fileOnly flag indicating to clear only file related
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1965
diff changeset
419 project tasks (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 """
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
421 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
422 if (
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
423 (fileOnly and task.isProjectFileTask()) or
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
424 (not fileOnly and task.isProjectTask())
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
425 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 if self.copyTask == task:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 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
428 parent = task.parent()
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
429 parent.removeChild(task)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 self.tasks.remove(task)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 del task
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
433 self.__checkTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
434 self.__resort()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
435 self.__resizeColumns()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
436
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
437 def clearFileTasks(self, filename, conditionally=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 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
440
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 @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
442 @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
443 checking some conditions (boolean)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 """
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
445 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
446 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
447 # 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
448 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
449 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
450 return
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
451 for task in self.tasks[:]:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
452 if task.getFilename() == filename:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
453 if self.copyTask == task:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
454 self.copyTask = None
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
455 self.__extractedItem.removeChild(task)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
456 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
457 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
458 self.__projectTasksSaveTimer.changeOccurred()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
459 del task
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
461 self.__checkTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
462 self.__resort()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
463 self.__resizeColumns()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
464
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 def __editTaskProperties(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
466 """
2965
d133c7edd88a Continued correcting doc strings by using the new doc string checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2409
diff changeset
467 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
468 """
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
469 from .TaskPropertiesDialog import TaskPropertiesDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
470 task = self.currentItem()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
471 dlg = TaskPropertiesDialog(task, self, self.projectOpen)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
472 ro = task.getFilename() != ""
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 if ro:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
474 dlg.setReadOnly()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 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
476 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
477 dlg.getData()
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
478 )
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
479 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
480 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
481 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
482 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
483 task.setDescription(description)
1965
96f5a76e1845 Fixed some PEP-8 related issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1819
diff changeset
484 self.__projectTasksSaveTimer.changeOccurred()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
485
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
486 def __newTask(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
487 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
488 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
489 """
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
490 from .TaskPropertiesDialog import TaskPropertiesDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
491 dlg = TaskPropertiesDialog(None, self, self.projectOpen)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
492 if dlg.exec_() == QDialog.Accepted:
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
493 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
494 dlg.getData()
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
495 )
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
496 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
497 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
498
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
499 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
500 """
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
501 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
502 """
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
503 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
504 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
505
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 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
507 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
508 dlg.setSubTaskMode(projectTask)
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 if dlg.exec_() == QDialog.Accepted:
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
510 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
511 dlg.getData()
7259
7c017076c12e Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
512 )
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
513 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
514 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
515 parentTask=parentTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 def __markCompleted(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 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
520 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 task = self.currentItem()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 task.setCompleted(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 def __deleteCompleted(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
526 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
527 """
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
528 for task in reversed(self.tasks[:]):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
529 if task.isCompleted():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530 if self.copyTask == task:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
531 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
532 parent = task.parent()
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
533 parent.removeChild(task)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534 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
535 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
536 self.__projectTasksSaveTimer.changeOccurred()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
537 del task
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
538
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
539 self.__checkTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
540 self.__resort()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
541 self.__resizeColumns()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
542
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 ci = self.currentItem()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 if ci:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 ind = self.indexFromItem(ci, self.currentColumn())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 self.scrollTo(ind, QAbstractItemView.PositionAtCenter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 def __copyTask(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 Private slot to handle the "Copy" context menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
552 task = self.currentItem()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
553 self.copyTask = task
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
554
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
555 def __pasteTask(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
556 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
557 Private slot to handle the "Paste" context menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
558 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
559 if self.copyTask:
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
560 parent = self.copyTask.parent()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
561 if not isinstance(parent, Task):
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
562 parent = None
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
563
2197
c4f24f8f34c0 Some harminisation of nomenclature in the various Task dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2099
diff changeset
564 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
565 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
566 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
567 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
568 isProjectTask=self.copyTask._isProjectTask,
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
569 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
570
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
571 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
572 """
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
573 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
574 """
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
575 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
576 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
577 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
578 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
579 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
580 isProjectTask=self.copyTask._isProjectTask)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581
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
582 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
583 """
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 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
585
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 @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
587 """
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 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
589 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
590 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
591 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
592 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
593 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
594
5851
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
595 def __deleteTask(self, task=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
596 """
5851
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
597 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
598
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
599 @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
600 @type Task
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
601 """
5851
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
602 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
603 # 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
604 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
605
8f8b264e5d5f Fixed an issue with the task viewer causing empty files being created.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5603
diff changeset
606 if self.copyTask is task:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
607 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
608 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
609 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
610 parent = task.parent()
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
611 parent.removeChild(task)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
612 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
613 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
614 self.__projectTasksSaveTimer.changeOccurred()
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
615 del task
3994
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
616
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
617 self.__checkTopLevelItems()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
618 self.__resort()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
619 self.__resizeColumns()
04792ff88ddf Refined the task viewer.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3990
diff changeset
620
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
621 ci = self.currentItem()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
622 if ci:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
623 ind = self.indexFromItem(ci, self.currentColumn())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
624 self.scrollTo(ind, QAbstractItemView.PositionAtCenter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
625
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
626 def __goToTask(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
627 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 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
629 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
630 task = self.currentItem()
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 458
diff changeset
631 self.displayFile.emit(task.getFilename(), task.getLineno())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
632
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 def handlePreferencesChanged(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 Public slot to react to changes of the preferences.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 for task in self.tasks:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 task.colorizeTask()
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 def __activateFilter(self, on):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
642 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
643
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 @param on flag indicating the filter state (boolean)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
645 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
646 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
647 res = E5MessageBox.yesNo(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2997
diff changeset
648 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
649 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
650 self.tr(
2997
7f0ef975da9e Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2965
diff changeset
651 """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
652 """ 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
653 yesDefault=True)
541
00e1a5d060c5 Continued replacing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 538
diff changeset
654 if not res:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
655 on = False
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 self.__configureFilter()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658 on = self.taskFilter.hasActiveFilter()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 self.taskFilter.setActive(on)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 self.__menuFilteredAct.setChecked(on)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 self.__backMenuFilteredAct.setChecked(on)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
663 self.__refreshDisplay()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665 def __configureFilter(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
666 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 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
668 """
2409
df3820f08247 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
669 from .TaskFilterConfigDialog import TaskFilterConfigDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
670 dlg = TaskFilterConfigDialog(self.taskFilter)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 if dlg.exec_() == QDialog.Accepted:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 dlg.configureTaskFilter(self.taskFilter)
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
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
675 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
676 """
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
677 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
678 """
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
679 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
680 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
681 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
682 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
683 " 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
684 QLineEdit.Normal,
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 self.projectTasksScanFilter)
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 if ok:
5603
4f2dd0850803 Continued fixing code style issues detected by the extended style checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5389
diff changeset
687 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
688
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
689 def regenerateProjectTasks(self, quiet=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690 """
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
691 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
692
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
693 @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
694 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
695 """
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
696 markers = {
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
697 Task.TypeWarning:
3039
8dd0165d805d Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
698 Preferences.getTasks("TasksWarningMarkers").split(),
1819
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
699 Task.TypeNote: Preferences.getTasks("TasksNoteMarkers").split(),
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
700 Task.TypeTodo: Preferences.getTasks("TasksTodoMarkers").split(),
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
701 Task.TypeFixme: Preferences.getTasks("TasksFixmeMarkers").split(),
cfcfd617216a Changed the tasks handling to allow for more fine grained task designations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1653
diff changeset
702 }
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703 files = self.project.pdata["SOURCES"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704
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
705 # apply file filter
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
706 filterList = [f.strip() for f in self.projectTasksScanFilter.split(",")
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
707 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
708 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
709 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
710 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
711 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
712
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713 # remove all project tasks
2000
a81bf687e4ee Fixed an issue with the task manager.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1965
diff changeset
714 self.clearProjectTasks(fileOnly=True)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 # 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
717 if quiet:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
718 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
719 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
720 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
721 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
722 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
723 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
724 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
725 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
726 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
727 count = 0
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
728
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
729 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
730 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
731 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
732 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
733 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
734 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
735 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
736 break
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
737
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
738 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
739 # 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
740 try:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
741 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
742 lines = text.splitlines()
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
743 except (UnicodeError, IOError):
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
744 count += 1
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
745 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
746 continue
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
747
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
748 # 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
749 lineIndex = 0
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
750 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
751 lineIndex += 1
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
752 shouldBreak = False
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
753
6494
72e3d61e5a20 TaskViewer: amended another place to check for '__NO-TASK__' marker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6493
diff changeset
754 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
755 # 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
756 continue
72e3d61e5a20 TaskViewer: amended another place to check for '__NO-TASK__' marker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6493
diff changeset
757
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
758 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
759 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
760 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
761 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
762 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
763 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
764 shouldBreak = True
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
765 break
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
766 if shouldBreak:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
767 break
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
768
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769 count += 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770
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
771 progress.setValue(len(files))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 def __configure(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 Private method to open the configuration dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 """
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
777 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
778
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
779 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
780 """
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
781 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
782 """
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
783 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
784 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
785
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
786 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
787 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
788 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
789 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
790 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
791 self.__projectTaskExtractionThread.wait()
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
792
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 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
795 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
796 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
797
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
798 @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
799 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
800 a task
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
801 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
802 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
803
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
804 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
805 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
806 Constructor
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
807
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
808 @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
809 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
810 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
811
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
812 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
813 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
814
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
815 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
816 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
817 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
818 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
819 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
820 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
821
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
822 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
823 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
824 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
825
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
826 @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
827 @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
828 @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
829 @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
830 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
831 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
832 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
833 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
834 self.__markers = {}
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
835 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
836 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
837
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
838 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
839 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
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 run(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 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
844 """
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
845 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
846 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
847 markers = {}
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
848 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
849 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
850
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
851 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
852 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
853 break
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
854
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
855 # 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
856 try:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
857 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
858 lines = text.splitlines()
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
859 except (UnicodeError, IOError):
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
860 continue
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
861
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
862 # 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
863 lineIndex = 0
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
864 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
865 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
866 break
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
867
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
868 lineIndex += 1
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
869 found = False
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
870
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
871 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
872 # 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
873 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
874
5117
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
875 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
876 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
877 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
878 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
879 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
880 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
881 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
882 taskType)
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
883 found = True
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
884 break
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
885 if found:
1faa0780ae1d Improved the quiet task extraction process by implementing a threaded solution.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5114
diff changeset
886 break

eric ide

mercurial