Activating a listitem with python
#1
I have a need in my addon to select and activate a listitem in a certain condition. In python, I have been able to figure out how to select the listitem but not activate it/choose it. Here's what I've tried:

wid = xbmcgui.getCurrentWindowId()
win = xbmcgui.Window(wid)
control = win.getFocus()
control.selectItem(1) #This correctly selects the listitem
xbmc.executebuiltin('SendClick(%(current_wid)s,%(current_item)s)'%{'current_wid':wid,'current_item':control}) #Doesn't work, debug shows WARNING: Attempt to use invalid handle xxx
xbmc.executebuiltin('SendClick(%(current_wid)s,%(current_item)s)'%{'current_wid':wid,'current_item':control.getSelectedItem()}) #Doesn't work, debug shows WARNING: Attempt to use invalid handle xxx
xbmc.executebuiltin('SendClick(%(current_item)s)'%{'current_wid':wid,'current_item':control.getSelectedItem()}) #Doesn't work, debug shows WARNING: Attempt to use invalid handle xxx

Any way to accomplish what I'm trying to do?

Thanks in advance
Reply
#2
I had the same requirement. Nothing worked for me and I ended up with JSON-RPC calls: just move the focus and select the item:
build_song_list(*bandcamp.get_album_by_url(url))
xbmc.executeJSONRPC(
'{"jsonrpc":"2.0","method":"Input.Down","id":1}')
xbmc.executeJSONRPC(
'{"jsonrpc":"2.0","method":"Input.Select","id":1}')
You can check full sourcecode on:
https://github.com/Virusmater/plugin.aud...x.bandcamp
Reply



Logout Mark Read Team Forum Stats Members Help
Activating a listitem with python0
This forum uses Lukasz Tkacz MyBB addons.