core.qt
Event loop using the Qt "main thread" (or "GUI thread"). |
|
Event loop using a Qt "worker thread". |
- class QtEventLoop(owner, **kwds)[source]
Bases:
object
Event loop using the Qt “main thread” (or “GUI thread”).
Use this event loop if your component is a Qt widget or needs to run in the main Qt thread for any other reason. See the
QtDisplay
component for an example.Pyctools event loops are described in more detail in the
ThreadEventLoop
documentation.- queue_command(command)[source]
Put a command on the queue to be called in the component’s thread.
- Parameters:
command (callable) – the method to be invoked, e.g.
new_frame_event
.
- start()[source]
Start the component’s event loop (thread-safe).
After the event loop is started the Qt thread calls the component’s
start_event
method, then calls itsnew_frame_event
andnew_config_event
methods as required untilstop
is called. Finally the component’sstop_event
method is called before the event loop terminates.
- class QtThreadEventLoop(owner, **kwds)[source]
Bases:
QtEventLoop
Event loop using a Qt “worker thread”.
Use this event loop if your component is a Qt component that does not need to run in the main thread. This allows a Pyctools component to send or receive Qt signals, giving easy integration with other Qt components.
I have experimented with using
QtThreadEventLoop
instead ofThreadEventLoop
in all the components in a network. Surprisingly it ran at the same speed.Pyctools event loops are described in more detail in the
ThreadEventLoop
documentation.- queue_command()
Put a command on the queue to be called in the component’s thread.
- Parameters:
command (callable) – the method to be invoked, e.g.
new_frame_event
.
- start()
Start the component’s event loop (thread-safe).
After the event loop is started the Qt thread calls the component’s
start_event
method, then calls itsnew_frame_event
andnew_config_event
methods as required untilstop
is called. Finally the component’sstop_event
method is called before the event loop terminates.
Comments or questions? Please email jim@jim-easterbrook.me.uk.