itom
Loading...
Searching...
No Matches
ito::PythonStatePublisher Class Reference

One instance of this class is created by MainApplication::setupApplication and runs in the main thread of itom. Its onPythonStateChanged slot is connected to the pythonStateChanged signal of PythonEngine. Other widgets should rather connect to pythonStateChanged of this class than to the direct signal of PythonEngine. This is mainly for one reason: Whenever a short script is run in Python (not debug), it might be that the execution is so short, that it is a waste of computing resources to switch the GUI to a busy state during this short execution. Therefore, the transition to the run state is signalled by this class with a short delay. Whenever, the 'idle' state is signalled by the PythonEngine before the delay exceeds, nothing is signalled by this class. This only holds for this transition. All other python state transitions are immediately reported to all connected classes. More...

#include <pythonStatePublisher.h>

Inheritance diagram for ito::PythonStatePublisher:

Classes

struct  DelayedTransition
 

Signals

void pythonStateChanged (tPythonTransitions pyTransition)
 

Public Member Functions

 PythonStatePublisher (const PythonEngine *engine)
 

Protected Member Functions

void timerEvent (QTimerEvent *event)
 

Private Slots

void onPythonStateChanged (tPythonTransitions pyTransition, bool immediate)
 
void propertiesChanged ()
 

Private Attributes

DelayedTransition m_delayedTrans
 
int m_delayMs
 delay time of non-immediate state changes in ms
 

Detailed Description

One instance of this class is created by MainApplication::setupApplication and runs in the main thread of itom. Its onPythonStateChanged slot is connected to the pythonStateChanged signal of PythonEngine. Other widgets should rather connect to pythonStateChanged of this class than to the direct signal of PythonEngine. This is mainly for one reason: Whenever a short script is run in Python (not debug), it might be that the execution is so short, that it is a waste of computing resources to switch the GUI to a busy state during this short execution. Therefore, the transition to the run state is signalled by this class with a short delay. Whenever, the 'idle' state is signalled by the PythonEngine before the delay exceeds, nothing is signalled by this class. This only holds for this transition. All other python state transitions are immediately reported to all connected classes.

If the PythonEngine emits the signal pythonStateChanged with immediate = true, this transition is directly reported (e.g. necessary for commands, executed in the command line).


The documentation for this class was generated from the following files: