I am just getting started with writing Kodi Python scripts (although I do have prior Python experience. I have taken the following code from the Kodi wiki to generate a list on screen:
import xbmc, xbmcgui
#get actioncodes from https://github.com/xbmc/xbmc/blob/master/xbmc/guilib/Key.h
ACTION_PREVIOUS_MENU = 10
class MyClass(xbmcgui.Window):
def __init__(self):
self.strActionInfo = xbmcgui.ControlLabel(250, 80, 200, 200, '', 'font14', '0xFFBBBBFF')
self.addControl(self.strActionInfo)
self.strActionInfo.setLabel('Push BACK to quit')
self.list = xbmcgui.ControlList(500, 150, 300, 400)
self.addControl(self.list)
self.list.addItem('Item 1')
self.list.addItem('Item 2')
self.list.addItem('Item 3')
self.setFocus(self.list)
def onAction(self, action):
if action == ACTION_PREVIOUS_MENU:
self.close()
def onControl(self, control):
if control == self.list:
item = self.list.getSelectedItem()
self.message('You selected : ' + item.getLabel())
self.close()
def message(self, message):
dialog = xbmcgui.Dialog()
dialog.ok(" My message title", message)
mydisplay = MyClass()
mydisplay.doModal()
del mydisplay
If you run this script the 'loading' icon with the rotating circles (v.17) persists on the screen until you click either ESC or the right mouse button. I've tried playing around with the code, but I am not sure what I need to amend so that the script loads the list up and the loading icon disappears on it's own.
Any ideas?
EDIT:
Addon.xml as requested...
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="script.video.testaddon" name="testaddon" version="1.0.9" provider-name="Avigdor">
<requires>
<import addon="xbmc.python" version="2.1.0"/>
<import addon="repository.xbmc-israel" />
</requires>
<extension point="xbmc.python.pluginsource" library="default.py">
<provides>video</provides>
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en">Playlist Loader - downloaded for free from:
http://www.hometheater.co.il</summary>
<description lang="en">Playlist Loader - downloaded for free from:
http://www.hometheater.co.il</description>
<platform>all</platform>
</extension>
</addon>
That's what I thought. You are using a wrong addon type. xbmc.python.pluginsource
or simply a plugin is meant for media content listings created with xbmcplugin
module, while you aren't creating any plugin listing.
If you aren't calling xbmcplugin
module, use xbmc.python.script
or other appropriate addon type. More info: http://kodi.wiki/view/Addon.xml#.3Cextension.3E