# eric4.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

Task | Class implementing the task data structure.
TaskFilter | Class implementing a filter for tasks.
TaskViewer | Class implementing the task viewer.

### Functions

None

## Task

Class implementing the task data structure.

### Derived from

QTreeWidgetItem

### Class Attributes

None

### Class Methods

None

### Methods

Task | Constructor
colorizeTask | Public slot to set the colors of the task item.
getFilename | Public method to retrieve the tasks filename.
getLineno | Public method to retrieve the tasks linenumber.
isCompleted | Public slot to return the completion status.
isProjectFileTask | Public slot to get an indication, if this task is related to a project file.
isProjectTask | Public slot to return the project relation status.
setCompleted | Public slot to update the completed flag.
setDescription | Public slot to update the description.
setLongText | Public slot to update the longtext field.
setPriority | Public slot to update the priority.
setProjectTask | Public method to set the project relation flag.

### Static Methods

None

#### Task (Constructor)

Task(description, priority = 1, filename = "", lineno = 0, completed = False, _time = 0, isProjectTask = False, isBugfixTask = False, project = None, longtext = "")

Constructor

parent
  parent widget of the task (QWidget)
description
  descriptive text of the task (string or QString)
priority
  priority of the task (0=high, 1=normal, 2=low)
filename
  filename containing the task (string or QString)
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)
isBugfixTask
  flag indicating a bugfix task (boolean)
project
  reference to the project object (Project)
longtext
  explanatory text of the task (string or QString)

#### Task.colorizeTask

colorizeTask()

Public slot to set the colors of the task item.

#### Task.getFilename

getFilename()

Public method to retrieve the tasks filename.

Returns:
  filename (string)

#### Task.getLineno

getLineno()

Public method to retrieve the tasks linenumber.

Returns:
  linenumber (integer)

#### Task.isCompleted

isCompleted()

Public slot to return the completion status.

Returns:
  flag indicating the completion status (boolean)

#### Task.isProjectFileTask

isProjectFileTask()

Public slot to get an indication, if this task is related to a project file.

Returns:
  flag indicating a project file task (boolean)

#### Task.isProjectTask

isProjectTask()

Public slot to return the project relation status.

Returns:
  flag indicating the project relation status (boolean)

#### Task.setCompleted

setCompleted(completed)

Public slot to update the completed flag.

completed
  flag indicating completion status (boolean)

#### Task.setDescription

setDescription(description)

Public slot to update the description.

longtext
  explanatory text of the task (string or QString)

#### Task.setLongText

setLongText(longtext)

Public slot to update the longtext field.

longtext
  descriptive text of the task (string or QString)

#### Task.setPriority

setPriority(priority)

Public slot to update the priority.

priority
  priority of the task (0=high, 1=normal, 2=low)

#### Task.setProjectTask

setProjectTask(pt)

Public method to set the project relation flag.

pt
  flag indicating a project task (boolean)

Up

## TaskFilter

Class implementing a filter for tasks.

### Derived from

object

### Class Attributes

None

### Class Methods

None

### Methods

TaskFilter | Constructor
hasActiveFilter | Public method to check for active filters.
setActive | Public method to activate the filter.
setDescriptionFilter | Public method to set the description filter.
setFileNameFilter | Public method to set the filename filter.
setPrioritiesFilter | Public method to set the priorities filter.
setScopeFilter | Public method to set the scope filter.
setStatusFilter | Public method to set the status filter.
setTypeFilter | Public method to set the type filter.
showTask | Public method to check, if a task should be shown.

### Static Methods

None

#### TaskFilter (Constructor)

TaskFilter()

Constructor

#### TaskFilter.hasActiveFilter

hasActiveFilter()

Public method to check for active filters.

Returns:
  flag indicating an active filter was found (boolean)

#### TaskFilter.setActive

setActive(enabled)

Public method to activate the filter.

enabled
  flag indicating the activation state (boolean)

#### TaskFilter.setDescriptionFilter

setDescriptionFilter(filter)

Public method to set the description filter.

filter
  a regular expression for the description filter to set (string or QString) or None

#### TaskFilter.setFileNameFilter

setFileNameFilter(filter)

Public method to set the filename filter.

filter
  a wildcard expression for the filename filter to set (string or QString) or None

#### TaskFilter.setPrioritiesFilter

setPrioritiesFilter(priorities)

Public method to set the priorities filter.

priorities
  list of task priorities (list of integer) or None

#### TaskFilter.setScopeFilter

setScopeFilter(scope)

Public method to set the scope filter.

scope
  flag indicating a project task (boolean) or None

#### TaskFilter.setStatusFilter

setStatusFilter(status)

Public method to set the status filter.

status
  flag indicating a completed task (boolean) or None

#### TaskFilter.setTypeFilter

setTypeFilter(type_)

Public method to set the type filter.

type_
  flag indicating a bugfix task (boolean) or None

#### TaskFilter.showTask

showTask(task)

Public method to check, if a task should be shown.

task
  reference to the task object to check (Task)

Returns:
  flag indicatin whether the task should be shown (boolean)

Up

## TaskViewer

Class implementing the task viewer.

### Signals

displayFile(string, integer)
  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.
__configure | Private method to open the configuration dialog.
__configureFilter | Private slot to handle the "Configure filter" context menu entry.
__copyTask | Private slot to handle the "Copy" context menu entry.
__deleteCompleted | Private slot to handle the "Delete Completed Tasks" context menu entry.
__deleteTask | Private slot to handle the "Delete Task" context menu entry.
__editTaskProperties | Private slot to handle the "Properties" context menu entry
__goToTask | Private slot to handle the "Go To" context menu entry.
__markCompleted | Private slot to handle the "Mark Completed" context menu entry.
__newTask | Private slot to handle the "New Task" context menu entry.
__pasteTask | Private slot to handle the "Paste" context menu entry.
__refreshDisplay | Private method to refresh the display.
__regenerateProjectTasks | Private slot to handle the "Regenerated projet tasks" context menu entry.
__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.
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.
setProjectOpen | Public slot to set the project status.

### 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.__configure

__configure()

Private method to open the configuration dialog.

#### TaskViewer.__configureFilter

__configureFilter()

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

#### 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.__deleteTask

__deleteTask()

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

#### TaskViewer.__editTaskProperties

__editTaskProperties()

Private slot to handle the "Properties" context menu entry

#### 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.__newTask

__newTask()

Private slot to handle the "New 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.__regenerateProjectTasks

__regenerateProjectTasks()

Private slot to handle the "Regenerated projet tasks" context menu entry.

#### 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(description, filename, lineno, isBugfixTask = False, longtext = "")

Public slot to add a file related task.

description
  descriptive text of the task (string or QString)
filename
  filename containing the task (string or QString)
lineno
  line number containing the task (integer)
isBugfixTask
  flag indicating a bugfix task (boolean)
longtext
  explanatory text of the task (string or QString)

#### TaskViewer.addTask

addTask(description, priority = 1, filename = "", lineno = 0, completed = False, _time = 0, isProjectTask = False, isBugfixTask = False, longtext = "")

Public slot to add a task.

description
  descriptive text of the task (string or QString)
priority
  priority of the task (0=high, 1=normal, 2=low)
filename
  filename containing the task (string or QString)
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)
isBugfixTask
  flag indicating a bugfix task (boolean)
longtext
  explanatory text of the task (string or QString)

#### TaskViewer.clearFileTasks

clearFileTasks(filename, conditionally=False)

Public slot to clear all tasks related to a file.

filename
  name of the file (string or QString)
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.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.setProjectOpen

setProjectOpen(o = False)

Public slot to set the project status.

o
  flag indicating the project status

Up