2007-02-07, 21:49
I noticed that the thumbsticks are difficult to use in python since they also key for the seekbar / volume bar so am trying to find a solution to this.
Looking at the code if True is returned from OnAction I think the action is consumed/used up. Is that right?
If so the problem then is here:
http://xbmc.svn.sourceforge.net/viewvc/x...arkup#l_24
As you can see it calls the base window first which im guessing is what will bring up the seekbars or whatever. Ideally I'd like for the python xbmcgui.Window.onAction method to return the bool. I can get that in the Py_XBMC_Event_OnAction method but a problem I think with that is that the python module is on a different thread than the main gui ?
I know there is a Py_MakePendingCalls which consumes the Py_AddPendingCalls but that shouldnt be called from the main thread? Basically this threading seems to only allow one way communication... as in you cant send arguments to python and get the return value at one time...
A solution I have is to add a field to the py Window Object like setConsumeActions(bool) which will cause OnAction to always return true. Is there a major problem with this? Can anyone think of a better way? Is it bad to call PyObject_CallMethod in the main thread?
Lotta questions here and would like to know if I am following the right track...
Looking at the code if True is returned from OnAction I think the action is consumed/used up. Is that right?
If so the problem then is here:
http://xbmc.svn.sourceforge.net/viewvc/x...arkup#l_24
Code:
24 bool CGUIPythonWindow::OnAction(const CAction &action)
25 {
26 // do the base class window first, and the call to python after this
27 bool ret = CGUIWindow::OnAction(action);
28 if(pCallbackWindow)
29 {
30 PyXBMCAction* inf = new PyXBMCAction;
31 inf->pObject = Action_FromAction(action);
32 inf->pCallbackWindow = pCallbackWindow;
33
34 // aquire lock?
35 Py_AddPendingCall(Py_XBMC_Event_OnAction, inf);
36 PulseActionEvent();
37 }
38 return ret;
39 }
As you can see it calls the base window first which im guessing is what will bring up the seekbars or whatever. Ideally I'd like for the python xbmcgui.Window.onAction method to return the bool. I can get that in the Py_XBMC_Event_OnAction method but a problem I think with that is that the python module is on a different thread than the main gui ?
I know there is a Py_MakePendingCalls which consumes the Py_AddPendingCalls but that shouldnt be called from the main thread? Basically this threading seems to only allow one way communication... as in you cant send arguments to python and get the return value at one time...
A solution I have is to add a field to the py Window Object like setConsumeActions(bool) which will cause OnAction to always return true. Is there a major problem with this? Can anyone think of a better way? Is it bad to call PyObject_CallMethod in the main thread?
Lotta questions here and would like to know if I am following the right track...