xbmcgui window related question
#1
Hi there,

I am relatively new to xbmc, and attempting to write a program addon.

I am writing it as a python script, and have imported xbmcgui to use its window functionality, but I am a little confused as to how the window's DoModal function works.

I have a class that inherits from xbmcgui.Window, and to handle events I override the onaction and oncontrol functions, and do a load of stuff at __init__ to set up.

To run this window I call doModal, but of course this stalls while displaying the window/handling events and I cannot do anything else while the window is open (anything that isnt triggered by a control/action)

What I would like to do is have a function that can run every frame so-to-speak, somewhere I can do stuff in the background that will happen while waiting for events. For example I would like a tcp server waiting for any incoming connections to be active, or at least to check for waiting connections once a frame or so. A host of other things I would like to be happening, but all while the window is open and waiting for events...

I see that I can also call window.show() rather than domodal, so i guess that could be used as the render portion of a 'main' loop so-to-speak, but I assume this means no events would be handled for me? If so then is there any info about handling your own events? Everywhere I have looked tends to say to use domodal for all event handling, and the events are passed in somehow in domodal...

I might add, this is on a Raspberry Pi, so I guess I cant have a second thread with the window doing its domodal and my other stuff going on in the background, which would have been my first solution to this...

Any ideas or suggestions as to how I should be doing this?
Could I maybe find the the source for domodal, override that and replicate what it currently does but with my own function that is being run while it is listening for events etc?

Thanks very much.

Reply
#2
Why can't you have a second thread on RPi ?
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
I was under the impression (or more likely assumption...) that it wasnt possible to start up a second thread in a python script for xbmc, I didnt think there was support for threading, your response has me doubting my assumption lol. (I must admit im fairly new to python as well...) Would you say the solution I suggested is the one to go for then? (a second thread running background processes)

Is that the usual way one would run processes while an xbmcgui window is open?
Reply
#4
Yup.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#5
Ah yes I have it working, thanks for the heads up
Reply

Logout Mark Read Team Forum Stats Members Help
xbmcgui window related question0