Problem with getSelectedItem after window.close and doModa
#1
Hey guys,

first of all I am pretty new to xbmc plugin development, and tried to figure it out myself and I used search function but I couldn't find a proper solution.

I am working on plugin and we are actually working on a sexy skin for our plugin. We are facing just one issue with some List control functions after playing a videostream.

//edit: need to say, that we do this with WindowXMLDialog. I included the definition of the class:

PHP Code:
class GamepassGUI(xbmcgui.WindowXMLDialog):
    
season_list ''
    
weeks_list ''
    
games_list ''
    
selectedSeason ''
    
selectedWeek ''
    
main_selection ''


    
def __init__(self, *args, **kwargs):
        
xbmcgui.WindowXMLDialog.__init__(self)
        
self.action_previous_menu = (910922162472572756146761448)

    
def onInit(self):
        
self.window xbmcgui.Window(xbmcgui.getCurrentWindowDialogId())
        
self.season_list self.window.getControl(210)
        
self.weeks_list self.window.getControl(220)
        
self.games_list self.window.getControl(230)
        
self.setFocus(self.window.getControl(100)) 

Here is my player class:

PHP Code:
class myPlayer(xbmc.Player):
    
def __init__(selfparent, *args, **kwargs):
        
xbmc.Player.__init__(self)
        
self.dawindow parent

    def onPlayBackStarted
(self):
        
self.dawindow.close()

    
def onPlayBackStopped(self):
        
self.onPlayBackEnded()

    
def onPlayBackEnded(self):
        
self.dawindow.doModal() 

This is how we call the player:

PHP Code:
def playUrl(selfurl):
        
player myPlayer(parent=window)
        
player.play(url)

        while 
player.isPlaying():
            
xbmc.sleep(2000

Everything works fine, the videos are played and after they are finished or playback is stopped I see my window again and I see the list controls are filled with items.
However if a listitem is selected to start another video I get an error cause getSelectedItem() returns NONE.

Here is an example of such an error:
PHP Code:
if self.main_selection == 'GP' and self.games_list.getSelectedItem().getProperty('isPlayable') == 'true':
AttributeError'NoneType' object has no attribute 'getProperty' 

How does this come? What would be the proper way to close the window to bring it in the background, so the player is in foreground?

Thanks for all your support!

-- BaumSchorle
Reply
#2
Seems like the doModal() function fires the onInit() function and maybe all Lists are emptied!?

Thanks.
Reply
#3
Correct, doModal will initiate the window etc.

You shouldn't need to close your window if you start a video playing back - it should automatically be in front, and on stop will return to where XBMC was in the UI.
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
#4
(2014-07-16, 08:23)jmarshall Wrote: Correct, doModal will initiate the window etc.

You shouldn't need to close your window if you start a video playing back - it should automatically be in front, and on stop will return to where XBMC was in the UI.

hm... this is definitely not happening. I can hear the sound of the video in the background and as soon as I close the window I can see the video.
I already tried to activate the window 12005 but this didn't help.

What am I missing? Is it a problem, that we use WindowXMLDialog class?

Any help is much appreciated! Thanks!!

If you want to look at the code you can do this: https://github.com/Alexqw/xbmc-gamepass/tree/skin
Reply
#5
After a lot of debugging and try and error coding I found out, that the problem with the player not poping up in the foreground is caused by using the WindowXMLDialog class.
As soon as I use the WindowXML class the player pops up in the foreground. I have some problems with the plugin looping after calling the doModal function. (I can't select or navigate in the plugin, as soon as I press escape once, everything works fine)

BUT after stopping the playback of a video and selecting the next ListItem in one of the list controls we face the same issue with getSelectedItem() returning NONE.

Is the only proper solution to refill the lists after stopping the video?

Thanks!
Reply
#6
Yes. The lists go when your window goes.
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

Logout Mark Read Team Forum Stats Members Help
Problem with getSelectedItem after window.close and doModa0