natcap.invest.ui.execution

A class for a Qt-enabled python Thread.

class natcap.invest.ui.execution.Executor(target, args=None, kwargs=None, log_events=True)

Bases: MockQObject, Thread

A thread of control that will emit a Qt signal when finished.

finished = <MagicMock name='mock.QtCore.Signal()' id='140108894629760'>
run()

Run the target callable in a separate thread of control.

The callable will be run with whatever args and kwargs are provided to the thread’s __init__ method.

If an exception is encountered while executing the target, several things happen:

  • The exception is logged.

  • self.failed is set to True.

  • self.exception refers to the exception object that was raised.

  • self.traceback refers to the formatted traceback.

Finally, the signal self.finished is emitted, regardless of whether an exception was raised.