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:
objectEvent 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
QtDisplaycomponent for an example.Pyctools event loops are described in more detail in the
ThreadEventLoopdocumentation.- 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_eventmethod, then calls itsnew_frame_eventandnew_config_eventmethods as required untilstopis called. Finally the component’sstop_eventmethod is called before the event loop terminates.
- class QtThreadEventLoop(owner, **kwds)[source]
Bases:
QtEventLoopEvent 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
QtThreadEventLoopinstead ofThreadEventLoopin all the components in a network. Surprisingly it ran at the same speed.Pyctools event loops are described in more detail in the
ThreadEventLoopdocumentation.- 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_eventmethod, then calls itsnew_frame_eventandnew_config_eventmethods as required untilstopis called. Finally the component’sstop_eventmethod is called before the event loop terminates.
Comments or questions? Please email jim@jim-easterbrook.me.uk.