Customized thread class (based on QThread) that adds progress, error etc.
More...
|
def | __init__ (self, default_priority=QtCore.QThread.NormalPriority, on_start=None, on_finish=None, on_run=None, on_error=None, start_signal=None, stop_signal=None, free_on_finish=False, start_now=False, can_terminate=True) |
| Constructor. More...
|
|
def | __del__ (self) |
| Destructor: waits for the thread to complete. More...
|
|
def | init (self, default_priority=QtCore.QThread.NormalPriority, on_start=None, on_finish=None, on_run=None, on_error=None, start_signal=None, stop_signal=None, free_on_finish=False, can_terminate=True) |
| Initializes signals binding them to callbacks and other members. More...
|
|
def | lock (self) |
|
def | unlock (self) |
|
def | run (self) |
|
|
| sig_error = QtCore.pyqtSignal(QtCore.QThread, str) |
| Error signal (args are: instance of this thread and the error message) More...
|
|
Customized thread class (based on QThread) that adds progress, error etc.
signals and mutex locking to avoid thread racing.
◆ __init__()
def pycross.utils.utils.QThreadStump.__init__ |
( |
|
self, |
|
|
|
default_priority = QtCore.QThread.NormalPriority , |
|
|
|
on_start = None , |
|
|
|
on_finish = None , |
|
|
|
on_run = None , |
|
|
|
on_error = None , |
|
|
|
start_signal = None , |
|
|
|
stop_signal = None , |
|
|
|
free_on_finish = False , |
|
|
|
start_now = False , |
|
|
|
can_terminate = True |
|
) |
| |
Constructor.
- Parameters
-
default_priority | int thread default priority (default = normal) |
on_start | callable callback function called before the main operation is executed (callback has no args or returned result) |
on_finish | callable callback function called after the main operation completes (callback has no args or returned result) |
on_run | callable callback function for the main operation (callback has no args or returned result) |
on_error | callable callback function to handle exceptions raised during the thread operation (see QThreadStump::sig_error) |
start_signal | QtCore.pyqtSignal signal that can be connected to the start slot (if not None ) |
stop_signal | QtCore.pyqtSignal signal that can be connected to the terminate slot (if not None ) |
free_on_finish | bool whether the thread instance will be deleted from memory after it completes its operation (default = False ) |
start_now | bool whether to start the thread upon creation (default = False ) |
can_terminate | bool whether the thread can be terminated (default = True ) |
Reimplemented in pycross.gui.ShareThread.
◆ __del__()
def pycross.utils.utils.QThreadStump.__del__ |
( |
|
self | ) |
|
Destructor: waits for the thread to complete.
◆ init()
def pycross.utils.utils.QThreadStump.init |
( |
|
self, |
|
|
|
default_priority = QtCore.QThread.NormalPriority , |
|
|
|
on_start = None , |
|
|
|
on_finish = None , |
|
|
|
on_run = None , |
|
|
|
on_error = None , |
|
|
|
start_signal = None , |
|
|
|
stop_signal = None , |
|
|
|
free_on_finish = False , |
|
|
|
can_terminate = True |
|
) |
| |
Initializes signals binding them to callbacks and other members.
◆ lock()
def pycross.utils.utils.QThreadStump.lock |
( |
|
self | ) |
|
◆ run()
def pycross.utils.utils.QThreadStump.run |
( |
|
self | ) |
|
◆ unlock()
def pycross.utils.utils.QThreadStump.unlock |
( |
|
self | ) |
|
◆ default_priority
pycross.utils.utils.QThreadStump.default_priority |
◆ mutex
pycross.utils.utils.QThreadStump.mutex |
◆ on_run
pycross.utils.utils.QThreadStump.on_run |
◆ sig_error
pycross.utils.utils.QThreadStump.sig_error = QtCore.pyqtSignal(QtCore.QThread, str) |
|
static |
Error signal (args are: instance of this thread and the error message)
The documentation for this class was generated from the following file: