# eric6.Tasks.TaskViewer

Module implementing a task viewer and associated classes.

Tasks can be defined manually or automatically. Automatically generated tasks are derived from a comment with a special introductory text. This text is configurable.

### Global Attributes

None

### Classes

ProjectTaskExtractionThread | Class implementing a thread to extract tasks related to a project.
TaskViewer | Class implementing the task viewer.

### Functions

None

## ProjectTaskExtractionThread

Class implementing a thread to extract tasks related to a project.

### Signals

taskFound(str, str, int, int)
  emitted with the task description, the file name, the line number and task type to signal the presence of a task

### Derived from

QThread

### Class Attributes

None

### Class Methods

None

### Methods

ProjectTaskExtractionThread | Constructor
requestInterrupt | Public method to request iterruption of the thread.
run | Public thread method to scan the given files.
scan | Public method to scan the given list of files for tasks.

### Static Methods

None

#### ProjectTaskExtractionThread (Constructor)

ProjectTaskExtractionThread(parent=None)

Constructor

parent
  reference to the parent object (QObject)

#### ProjectTaskExtractionThread.requestInterrupt

requestInterrupt()

Public method to request iterruption of the thread.

#### ProjectTaskExtractionThread.run

run()

Public thread method to scan the given files.

#### ProjectTaskExtractionThread.scan

scan(markers, files)

Public method to scan the given list of files for tasks.

markers (dict of lists of str)
  dictionary of defined task markers
files (list of str)
  list of file names to be scanned

Up

## TaskViewer

Class implementing the task viewer.

### Signals

displayFile(str, int)
  emitted to go to a file task

### Derived from

QTreeWidget

### Class Attributes

None

### Class Methods

None

### Methods

TaskViewer | Constructor
__activateFilter | Private slot to handle the "Filtered display" context menu entry.
__checkTopLevelItems | Private slot to check the 'Extracted Tasks' item for children.
__configure | Private method to open the configuration dialog.
__configureFilter | Private slot to handle the "Configure filter" context menu entry.
__configureProjectTasksScanOptions | Private slot to configure scan options for project tasks.
__copyTask | Private slot to handle the "Copy" context menu entry.
__deleteCompleted | Private slot to handle the "Delete Completed Tasks" context menu entry.
__deleteSubTasks | Private method to delete all sub-tasks.
__deleteTask | Private slot to delete a task.
__editTaskProperties | Private slot to handle the "Properties" context menu entry.
__generateTopLevelItems | Private method to generate the 'Extracted Tasks' item.
__goToTask | Private slot to handle the "Go To" context menu entry.
__markCompleted | Private slot to handle the "Mark Completed" context menu entry.
__newSubTask | Private slot to handle the "New Sub-Task" context menu entry.
__newTask | Private slot to handle the "New Task" context menu entry.
__pasteMainTask | Private slot to handle the "Paste as Main Task" context menu entry.
__pasteTask | Private slot to handle the "Paste" context menu entry.
__refreshDisplay | Private method to refresh the display.
__resizeColumns | Private method to resize the list columns.
__resort | Private method to resort the tree.
__showContextMenu | Private slot to show the context menu of the list.
__taskItemActivated | Private slot to handle the activation of an item.
addFileTask | Public slot to add a file related task.
addTask | Public slot to add a task.
clearFileTasks | Public slot to clear all tasks related to a file.
clearProjectTasks | Public slot to clear project related tasks.
clearTasks | Public slot to clear all tasks from display.
findParentTask | Public method to find a parent task by its ID.
getGlobalTasks | Public method to retrieve all non project related tasks.
getProjectTasks | Public method to retrieve all project related tasks.
handlePreferencesChanged | Public slot to react to changes of the preferences.
regenerateProjectTasks | Public slot to regenerate project related tasks.
saveProjectTasks | Public method to write the project tasks.
setProjectOpen | Public slot to set the project status.
stopProjectTaskExtraction | Public method to stop the project task extraction thread.

### Static Methods

None

#### TaskViewer (Constructor)

TaskViewer(parent, project)

Constructor

parent
  the parent (QWidget)
project
  reference to the project object

#### TaskViewer.__activateFilter

__activateFilter(on)

Private slot to handle the "Filtered display" context menu entry.

on
  flag indicating the filter state (boolean)

#### TaskViewer.__checkTopLevelItems

__checkTopLevelItems()

Private slot to check the 'Extracted Tasks' item for children.

#### TaskViewer.__configure

__configure()

Private method to open the configuration dialog.

#### TaskViewer.__configureFilter

__configureFilter()

Private slot to handle the "Configure filter" context menu entry.

#### TaskViewer.__configureProjectTasksScanOptions

__configureProjectTasksScanOptions()

Private slot to configure scan options for project tasks.

#### TaskViewer.__copyTask

__copyTask()

Private slot to handle the "Copy" context menu entry.

#### TaskViewer.__deleteCompleted

__deleteCompleted()

Private slot to handle the "Delete Completed Tasks" context menu entry.

#### TaskViewer.__deleteSubTasks

__deleteSubTasks(task)

Private method to delete all sub-tasks.

task
  task to delete sub-tasks of (Task)

#### TaskViewer.__deleteTask

__deleteTask(task=None)

Private slot to delete a task.

task (Task)
  task to be deleted

#### TaskViewer.__editTaskProperties

__editTaskProperties()

Private slot to handle the "Properties" context menu entry.

#### TaskViewer.__generateTopLevelItems

__generateTopLevelItems()

Private method to generate the 'Extracted Tasks' item.

#### TaskViewer.__goToTask

__goToTask()

Private slot to handle the "Go To" context menu entry.

#### TaskViewer.__markCompleted

__markCompleted()

Private slot to handle the "Mark Completed" context menu entry.

#### TaskViewer.__newSubTask

__newSubTask()

Private slot to handle the "New Sub-Task" context menu entry.

#### TaskViewer.__newTask

__newTask()

Private slot to handle the "New Task" context menu entry.

#### TaskViewer.__pasteMainTask

__pasteMainTask()

Private slot to handle the "Paste as Main Task" context menu entry.

#### TaskViewer.__pasteTask

__pasteTask()

Private slot to handle the "Paste" context menu entry.

#### TaskViewer.__refreshDisplay

__refreshDisplay()

Private method to refresh the display.

#### TaskViewer.__resizeColumns

__resizeColumns()

Private method to resize the list columns.

#### TaskViewer.__resort

__resort()

Private method to resort the tree.

#### TaskViewer.__showContextMenu

__showContextMenu(coord)

Private slot to show the context menu of the list.

coord
  the position of the mouse pointer (QPoint)

#### TaskViewer.__taskItemActivated

__taskItemActivated(itm, col)

Private slot to handle the activation of an item.

itm
  reference to the activated item (QTreeWidgetItem)
col
  column the item was activated in (integer)

#### TaskViewer.addFileTask

addFileTask(summary, filename, lineno, taskType=Task.TypeTodo, description="")

Public slot to add a file related task.

summary
  summary text of the task (string)
filename
  filename containing the task (string)
lineno
  line number containing the task (integer)
taskType
  type of the task (one of Task.TypeFixme, Task.TypeTodo, Task.TypeWarning, Task.TypeNote)
description
  explanatory text of the task (string)

#### TaskViewer.addTask

addTask(summary, priority=1, filename="", lineno=0, completed=False, _time=0, isProjectTask=False, taskType=Task.TypeTodo, description="", uid="", parentTask=None)

Public slot to add a task.

summary
  summary text of the task (string)
priority
  priority of the task (0=high, 1=normal, 2=low)
filename
  filename containing the task (string)
lineno
  line number containing the task (integer)
completed
  flag indicating completion status (boolean)
_time
  creation time of the task (float, if 0 use current time)
isProjectTask
  flag indicating a task related to the current project (boolean)
taskType
  type of the task (one of Task.TypeFixme, Task.TypeTodo, Task.TypeWarning, Task.TypeNote)
description
  explanatory text of the task (string)
uid
  unique id of the task (string)
parentTask
  reference to the parent task item (Task)

Returns:
  reference to the task item (Task)

#### TaskViewer.clearFileTasks

clearFileTasks(filename, conditionally=False)

Public slot to clear all tasks related to a file.

filename
  name of the file (string)
conditionally
  flag indicating to clear the tasks of the file checking some conditions (boolean)

#### TaskViewer.clearProjectTasks

clearProjectTasks(fileOnly=False)

Public slot to clear project related tasks.

fileOnly=
  flag indicating to clear only file related project tasks (boolean)

#### TaskViewer.clearTasks

clearTasks()

Public slot to clear all tasks from display.

#### TaskViewer.findParentTask

findParentTask(parentUid)

Public method to find a parent task by its ID.

parentUid
  uid of the parent task (string)

Returns:
  reference to the task (Task)

#### TaskViewer.getGlobalTasks

getGlobalTasks()

Public method to retrieve all non project related tasks.

Returns:
  copy of tasks (list of Task)

#### TaskViewer.getProjectTasks

getProjectTasks()

Public method to retrieve all project related tasks.

Returns:
  copy of tasks (list of Task)

#### TaskViewer.handlePreferencesChanged

handlePreferencesChanged()

Public slot to react to changes of the preferences.

#### TaskViewer.regenerateProjectTasks

regenerateProjectTasks(quiet=False)

Public slot to regenerate project related tasks.

quiet (bool)
  flag indicating quiet operation

#### TaskViewer.saveProjectTasks

saveProjectTasks()

Public method to write the project tasks.

#### TaskViewer.setProjectOpen

setProjectOpen(o=False)

Public slot to set the project status.

o
  flag indicating the project status

#### TaskViewer.stopProjectTaskExtraction

stopProjectTaskExtraction()

Public method to stop the project task extraction thread.

Up