Package timedrive :: Package background :: Module backgroundtask :: Class BackgroundTask
[frames] | no frames]

Class BackgroundTask


BackgroundTask class: base class for threads used in time-drive

Nested Classes

Inherited from PyQt4.QtCore.QThread: Priority

Instance Methods
 
__init__(self, taskName, parent=None)
Initialization function for BackgroundTask
 
taskComplete(self, taskName, userMessage)
emits a message when a run is complete need to call manually
 
taskError(self, taskName, error, userMessage)
emits a message when a task has an error need to call manually
 
setupTaskProgress(self, maximum, message=None)
emits a message with task progress need to call manually
 
updateTaskProgress(self, progress, message=None)
emits a int to update the progress bar
 
toggleControls(self, option)
emits a boolean to indicate if the controls need to be toggled in the ui
 
questionPrompt(self, title, question)
emits a question and passes on the thread that fire this method
 
start(self)
The start method, keeps tracks af all the threads calling the start method Invokes the super start method to start the Qthread run

Inherited from PyQt4.QtCore.QThread: currentThread, currentThreadId, exec_, exit, finished, idealThreadCount, isFinished, isRunning, msleep, priority, quit, run, setPriority, setStackSize, setTerminationEnabled, sleep, stackSize, started, terminate, terminated, usleep, wait, yieldCurrentThread

Inherited from PyQt4.QtCore.QObject: blockSignals, childEvent, children, connect, connectNotify, customEvent, deleteLater, destroyed, disconnect, disconnectNotify, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, emit, event, eventFilter, findChild, findChildren, inherits, installEventFilter, isWidgetType, killTimer, metaObject, moveToThread, objectName, parent, property, pyqtConfigure, receivers, removeEventFilter, sender, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent, tr, trUtf8

Inherited from sip.simplewrapper: __delattr__, __getattribute__, __new__, __setattr__

Inherited from object: __format__, __hash__, __reduce__, __reduce_ex__, __repr__, __sizeof__, __str__, __subclasshook__

Class Variables

Inherited from PyQt4.QtCore.QThread: HighPriority, HighestPriority, IdlePriority, InheritPriority, LowPriority, LowestPriority, NormalPriority, TimeCriticalPriority

Inherited from PyQt4.QtCore.QObject: staticMetaObject

Properties
String default_message
default message when emiting a signal and no message is defined
String task_name
the name of the task, for logging and output purpose
Boolean restart
restart status
Boolean stop
stop status of current task

Inherited from object: __class__

Method Details

__init__(self, taskName, parent=None)
(Constructor)

 

Initialization function for BackgroundTask

Parameters:
  • parent (QThread Object)
Overrides: object.__init__

taskComplete(self, taskName, userMessage)

 

emits a message when a run is complete need to call manually

Parameters:
  • taskName (String) - the task who sents the message
  • userMessage (String) - the message you want to show the user

taskError(self, taskName, error, userMessage)

 

emits a message when a task has an error need to call manually

Parameters:
  • taskName (String) - the task who sents the message
  • error (String) - type of error as string
  • userMessage (String) - the message you want to show the user

setupTaskProgress(self, maximum, message=None)

 

emits a message with task progress need to call manually

Parameters:
  • maximum (int) - the maximum of elements to process
  • message (String) - default=None(will be the default message defined), informative message or task name

updateTaskProgress(self, progress, message=None)

 

emits a int to update the progress bar

Parameters:
  • progress (int)
  • message (String) - default=None(will be the default message defined), informative message or task name

toggleControls(self, option)

 

emits a boolean to indicate if the controls need to be toggled in the ui

Parameters:
  • option (Boolean)

questionPrompt(self, title, question)

 

emits a question and passes on the thread that fire this method

Parameters:
  • title (String)
  • question (String)

start(self)

 

The start method, keeps tracks af all the threads calling the start method Invokes the super start method to start the Qthread run

Overrides: PyQt4.QtCore.QThread.start

Property Details

default_message

default message when emiting a signal and no message is defined

Get Method:
_get_default_message(self) - default message when emiting a signal and no message is defined
Set Method:
_set_default_message(self, value) - default message when emiting a signal and no message is defined
Type:
String

task_name

the name of the task, for logging and output purpose

Get Method:
_get_task_name(self) - the name of the task, for logging and output purpose
Set Method:
_set_task_name(self, value) - the name of the task, for logging and output purpose
Type:
String

restart

restart status

Get Method:
_get_restart(self) - restart status
Set Method:
_set_restart(self, value) - restart status
Type:
Boolean

stop

stop status of current task

Get Method:
_get_stop(self) - stop status of current task
Set Method:
_set_stop(self, value) - stop status of current task
Type:
Boolean