Quote:
Originally Posted by chaley
If action chains remembers the result of a call to connected_device_name() during event processing then it will remember the wrong value.
|
No, action chains does not remember the value of connected_device_name().
Quote:
Originally Posted by chaley
This is definitely a problem with the semantics of the device_connection_changed signal. The device information available to action chains is still set/valid during the disconnect event. I can see this by adding print() to the disconnect event template.
I can "fix" this in calibre but that will change the information available to every client of the device_connection_changed signal. I am willing to do this if Kovid agrees.
Action chains can fix this by using a QTimer.singleShot(0, ...) to run anything associated with a disconnect event.
|
I tried QTimer.singleShot(0, ...) and for some reason it is not working (print() returns the name of the device during the disconnect event.). I started playing with timeout value and found that QTimer.singleShot(5000, ...) works. I will add this to next release (I should have one later tonight or tomorrow). However, I am not sure this will solve the problem if it occurs outside the action chains disconnect event.