create window that looks like video window
#1
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!
Reply
#2
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.
Reply
#3
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?
Reply
#4
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
Reply
#5
Thanks!

But how can I call my plugin when the user access some button in the UI? The same way? I read about it in http://wiki.xbmc.org/index.php?title=Python_development the difference it's only theoretical?
Reply
#6
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.
Reply
#7
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! Wink
Reply
#8
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)
Reply

Logout Mark Read Team Forum Stats Members Help
create window that looks like video window0