cut 3.3.0
Loading...
Searching...
No Matches
task.taskmodel.TaskModel Class Reference

Receives and stores Task executions and results. More...

Public Member Functions

 __init__ (self, QObject parent=None)
 Initializes the TaskModel object, setting a list of headers and basic members.
 
QModelIndex index (self, int row, int column, QModelIndex parent=QModelIndex())
 Creates a valid index to identify a cell in the model.
 
QModelIndex parent (self, QModelIndex child)
 Returns the parent of a cell.
 
int rowCount (self, QModelIndex parent=QModelIndex())
 Indicates how many rows the model has.
 
int columnCount (self, QModelIndex parent=QModelIndex())
 Indicates how many columns the model has.
 
object data (self, QModelIndex index, int role)
 For a particular cell, it returns its Qt.DisplayData or the role asked.
 
 headerData (self, int section, Qt.Orientation orientation, int role)
 Returns the headers of the rows and columns.
 
 hasChildren (self, QModelIndex parent=QModelIndex())
 Indicates wether the cell can be expanded in case it has children.
 
TaskSummary get_ts_from_id (self, int id)
 Convinience method that returns a TaskSummary out of the id.
 
 push_initial_data (self, int id, str name, str args)
 Creates initial tasksummary object and fills it with data.
 
 push_start_time (self, int task_id)
 Indicates that the Task identified by task_id has started.
 
 push_end_time (self, int task_id)
 Indicates that the Task identified by task_id has finished.
 
 push_result_value (self, int task_id, str outcome, object obj)
 Indicates that there is a result available from the task.
 

Detailed Description

Receives and stores Task executions and results.

Constructor & Destructor Documentation

◆ __init__()

task.taskmodel.TaskModel.__init__ ( self,
QObject parent = None )

Initializes the TaskModel object, setting a list of headers and basic members.

Parameters
[in]parentParent to this QObject. Used by Qt to set parent/children relations.

Member Function Documentation

◆ columnCount()

int task.taskmodel.TaskModel.columnCount ( self,
QModelIndex parent = QModelIndex() )

Indicates how many columns the model has.

It returns the number of headers in the table.

Note
This is part of the QAbstractItemModel interface

◆ data()

object task.taskmodel.TaskModel.data ( self,
QModelIndex index,
int role )

For a particular cell, it returns its Qt.DisplayData or the role asked.

This is the most important method in the model, since this is the method that the view will use to query the data from the model.

Note
This is part of the QAbstractItemModel interface

◆ get_ts_from_id()

TaskSummary task.taskmodel.TaskModel.get_ts_from_id ( self,
int id )

Convinience method that returns a TaskSummary out of the id.

Parameters
[in]idTask id we are looking for
Returns
TaskSummary object corresponding to the given id

◆ hasChildren()

task.taskmodel.TaskModel.hasChildren ( self,
QModelIndex parent = QModelIndex() )

Indicates wether the cell can be expanded in case it has children.

This in reserved to tree-structured models, so in this case, we return False.

Note
This is part of the QAbstractItemModel interface

◆ headerData()

task.taskmodel.TaskModel.headerData ( self,
int section,
Qt.Orientation orientation,
int role )

Returns the headers of the rows and columns.

Used to quickly identify the data.

Note
This is part of the QAbstractItemModel interface

◆ index()

QModelIndex task.taskmodel.TaskModel.index ( self,
int row,
int column,
QModelIndex parent = QModelIndex() )

Creates a valid index to identify a cell in the model.

It is required by Qt that you create indeces to a particular model by its provided index() method.

Note
This is part of the QAbstractItemModel interface

◆ parent()

QModelIndex task.taskmodel.TaskModel.parent ( self,
QModelIndex child )

Returns the parent of a cell.

This is reserved for Tree structured models. Since this is a table, we return an invalid QModelIndex that indicates there is no parent. The cell is at the top level of the model.

Note
This is part of the QAbstractItemModel interface

◆ push_end_time()

task.taskmodel.TaskModel.push_end_time ( self,
int task_id )

Indicates that the Task identified by task_id has finished.

This method records the timestamp.

Parameters
[in]task_idTask ID of the Task we wish to update.

◆ push_initial_data()

task.taskmodel.TaskModel.push_initial_data ( self,
int id,
str name,
str args )

Creates initial tasksummary object and fills it with data.

Stores it in a dict.

Parameters
[in]idID of the Task we are adding to the model.
[in]nameName of the Task (method name).
[in]argsArguments to be passed to the method in the task.

◆ push_result_value()

task.taskmodel.TaskModel.push_result_value ( self,
int task_id,
str outcome,
object obj )

Indicates that there is a result available from the task.

This method records the values.

Parameters
[in]task_idTask ID of the Task we wish to update.
[in]outcomeThe outcome of the execution (Error, Progress, Ok)
[in]objThe return value, progress value, or exception tuple.

◆ push_start_time()

task.taskmodel.TaskModel.push_start_time ( self,
int task_id )

Indicates that the Task identified by task_id has started.

This method records the timestamp.

Parameters
[in]task_idTask ID of the Task we wish to update.

◆ rowCount()

int task.taskmodel.TaskModel.rowCount ( self,
QModelIndex parent = QModelIndex() )

Indicates how many rows the model has.

It returns the number of segments.

Note
This is part of the QAbstractItemModel interface

The documentation for this class was generated from the following file: