|
Uranium
Application Framework
|
Public Member Functions | |
| None | __init__ (self) |
| None | run (self) |
| Any | getResult (self) |
| None | setResult (self, Any result) |
| None | setError (self, Exception error) |
| None | start (self) |
| None | cancel (self) |
| bool | isRunning (self) |
| bool | isFinished (self) |
| bool | hasError (self) |
| Optional[Exception] | getError (self) |
Static Public Member Functions | |
| None | yieldThread () |
Static Public Attributes | |
| finished = Signal() | |
| progress = Signal() | |
Protected Attributes | |
| bool | _running = False |
| bool | _finished = False |
| _result = None | |
| _message = None | |
| _error = None | |
Base class for things that should be performed in a thread. The Job class provides a basic interface for a 'job', that is a self-contained task that should be performed in a thread. It makes use of the JobQueue for the actual threading. :sa JobQueue
| None UM.Job.Job.cancel | ( | self | ) |
Cancel the job. This will remove the Job from the JobQueue. If the run() function has already been called, this will do nothing.
| Optional[Exception] UM.Job.Job.getError | ( | self | ) |
Get the error that was encountered during execution. :return: The error encountered during execution or None if there was no error.
| Any UM.Job.Job.getResult | ( | self | ) |
Get the result of the job. The actual result object returned by this method is dependant on the implementation.
| bool UM.Job.Job.hasError | ( | self | ) |
Check whether the Job has encountered an error during execution. :return: True if an error was set, False if not.
| bool UM.Job.Job.isFinished | ( | self | ) |
Check whether the job has finished processing.
| bool UM.Job.Job.isRunning | ( | self | ) |
Check whether the job is currently running. :return:
| None UM.Job.Job.run | ( | self | ) |
Perform the actual task of this job. Should be reimplemented by subclasses. :exception NotImplementedError
Reimplemented in UM.FileHandler.ReadFileJob.ReadFileJob, UM.FileHandler.WriteFileJob.WriteFileJob, UM.Mesh.ReadMeshJob.ReadMeshJob, and UM.Scene.Platform._LoadPlatformJob.
| None UM.Job.Job.setError | ( | self, | |
| Exception | error ) |
Set an exception that was thrown while the job was being executed. Setting error to something else than None implies the Job failed to execute properly. :param error: The exception to set.
| None UM.Job.Job.setResult | ( | self, | |
| Any | result ) |
Set the result of this job. This should be called by run() to set the actual result of the Job.
| None UM.Job.Job.start | ( | self | ) |
Start the job. This will put the Job into the JobQueue to be processed whenever a thread is available. :sa JobQueue::add()
|
static |
Utility function that allows us to yield thread processing. This is mostly a workaround for broken python threads. This function forces a GIL release and allows a different thread to start processing if it is waiting.