eric6/Tasks/TaskViewer.py

Mon, 01 Feb 2021 10:38:16 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 01 Feb 2021 10:38:16 +0100
branch
maintenance
changeset 8043
0acf98cd089a
parent 7924
8a96736d465e
parent 7923
91e843545d9a
child 8142
43248bafe9b2
permissions
-rw-r--r--

Merged with default branch to prepare a new release.

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

eric ide

mercurial