Hey guys,
I am currently working on an addon, that controls a spotify instance (either a “real” spotify application or something like librespot or spotify-connect-web) using the new awesome web api endpoints spotify released a month ago or so. For this I am building my own GUI using the WindowXML class.
A worker thread checks the endpoint every second if there are changes in the playback and calls then a function inside the Main class, which updates all the controls and images accordingly.
I have implemented the play/pause button as a radiobutton, so that it can show a pause symbol, when the music is playing and a play symbol when it is not. The problem with this is now the following.
When I press the button with a bad timing, it might happen that it changes the state to play for instance (because I have pressed it) and immediately afterwards the worker thread checks the server for updates and realizes, that the music is still paused (because it needs some time) and changes the state of the radiobutton back to pause. On the next loop iteration of the worker thread the state actually has changed, leading it to change the radiobutton again to play. All this leads to a rarely occurring flicker of the button.
I hope this was somewhat understandable..
Is there any way of disabling the automatic value change of a radiobutton so that its state is only determined from one place?
I have already tried to substitute it with a normal button and, since there is no method to change the image from the code, assign a variable to the texture flag, but it cannot load the texture.
I thought about putting a “blank” button with no texture at all right under a image, that I can change from the code, but since there is no texturefocus and texturenofocus flag I would have to change it even on selected or something and that is all not really beautiful imo.
I am thankful for every suggestion how to solve this issue..