I'm currently porting a small application from PyGTK to PySide which sits in your systray and periodically checks a server for updates.
When I initially wrote this, I used a custom state model to represent its behaviour:
- init: initial state
- check: check server for updates
- disconnected: no connection to server (wait for some time to try again)
- error: server reported an error (user needs to check settings before proceeding)
- idle: wait for POLLING INTERVAL seconds before checking again
- quit
I since discovered that Qt has QStateMachine, which seems perfect for this type of structure. However, I was not able to apply the examples satisfyingly to my problem!
In particular:
- In the context of QStateMachine, what is the difference between Signal and QEvent?
- How do I define a conditional transition, i.e. on error go to... ?
- Should program logic happen in Transition.onTransition() or in QState.onEnter()?
Any pointers are appreciated muchly!