Hi, I writing a python script, and executing it throuhg skin with Runscript(path-to-python-file). Ok until here.
The script must be able to create a window that looks like video window (capable of list item and if selected do something), but I not sure about wich class I must use.
I tried xbmcgui.Window with addControl method, but I got only a black screen.
I tried with xbmcgui.ListItem but without success.
Wich class should I use?
Thanks!
do you actually need a custom window / a full blown script? sounds like you're trying to write a plugin..
EDIT: in case you're not aware. a 'script' is a full-blown window written in python. a 'plugin' is a virtual filesystem entry written in python. you provide a virtual filesystem, and it's listed as any other dirs in xbmc.
I guess I need because what I trying to do is show the file content (a list of items)
The scenario is:
I have a website that registers some quiz. The XBMC it's responsible to go to the server and get the quiz and store in a file.
I already have an addon that do this.
I think that the best way to show the quiz it's in the same way of videos or images. If the best practice it's to write a plugin then I'm going write a plugin. But I'm a little lost in what to do.
What do you mean with full-blown?
so you have a virtual filesystem with videos and pictures. by full-blown mean the need for custom controls, layouts etc. i still think you can do a plugin.
if you want to do a script, see
http://forum.xbmc.org/showthread.php?tid=174859
other way around. the core calls your plugin. as i said it's a vfs, so you'll get a callback with whatever url you assigned to the item being clicked. encode all info in the url (typically, url parameters..). bam.
I guess I need to read more about python development xbmc addon.
I guess it's not needed to use xbmcvfs, I already read the files content and I'm able to log this information.
Thanks!
I found this addon (
https://github.com/zstorok/xbmc-plugin-t...default.py)
It's more or less what I need. What url parameters is this one?
Looks like it must be 'plugin://..'...
Here some code:
Code:
class quizWindow( object ):
def __init__( self ):
self.persister = QuizPersister()
self.quizQueue = self.persister.loadFromDisk()
self.handle = int(sys.argv[1])
def run( self ):
if XBMC_ENABLE:
self.populateWindow()
def populateWindow(self):
logging.info('\n------------\nExecutando populateWindow\n------------')
li1 = xbmcgui.ListItem('Item Adicionado 1')
xbmcplugin.addDirectoryItem(self.handle, 'plugin://teste', li1, False, totalItems=1)
xbmcplugin.endOfDirectory(handle=self.handle, succeeded=True)
But I'm getting error: list index out of range (when I set self.handle)