ControlList, ListItem and Emulator
#1
im currently using the 11nov2005 version of the emulatorn and is having issues with adding a listitem to a controllist. apparently the emulator/python wont find the definition for it. but when i look into xbmcgui.py, i can see that it exists there.

my script looks like this (besides the other crap):
Quote:class myclass(xbmcgui.window):
def (self):
if emulating: xbmcgui.window.(self)

self.listitems = xbmcgui.controllist(100, 10, 600, 500)
self.addcontrol(self.listitems)
li = listitem("lble1")
self.listitems.additem(li)

but when i run it with the emulator it throws an exception
Quote: li = listitem("lble1")
nameerror: global name 'listitem' is not defined

could someone please help me as i dont understand why it cant find the listitem in the xbmcgui.py when it founds all other classes in that file.

and is it possible to add images to the list, next to the text?
Check out my XBMC scripts at http://xbmc.ramfelt.se
Reply
#2
prefix it with xbmcgui.

ie. xbmcgui.listitem("text label1", label2="text label2")

you can add images to controllist and listitem, but you wont see the images with the emu. you also need a version of the emu that understands those params if you dont want it to crash. look for an updated version on xbmcscripts.com



Reply
#3
Thumbs Up 
thanks alot, that helped. im too new to python so i havent learned all the ins-an-outs of it yet.

do anyone know what the different params is to the listitem?

[string label, string label2, string iconimage, string thumbnailimage]

label = default label
label2 = ?
iconimage = ?
thumbnailimage = ?

any help would be nice
Check out my XBMC scripts at http://xbmc.ramfelt.se
Reply
#4
the best way to learn python is to get a load of scripts and try and find if what your trying to do exists already.

i use a tool called 'agent ransack' to search python files across many folders.

script 'mytv' (my own) uses pretty much every func/param available you've a good chance you'll find what your after in there.

no point in trying to reinvent to wheel.

python xbmc emu docs: http://home.no.net/thor918/xbmc/xbmcgui.html and http://home.no.net/thor918/xbmc/xbmc.html are essential to have.



Reply
#5
so far it has been mostly hit and miss. because i do mostly of the work in the emulator, and then i try it on the xbox. and im having huge issues that sometimes simple controllabels wont show up on the xbox for any reason. oh well, someday i will find out why.

thanks for the link, im using a somewhat newer xbcmgui.py that i found somewhere. it is from nov 11 2005 and i saw that your doc was from 2004.

but do you know the difference between a list items thumbnail and icon?
Check out my XBMC scripts at http://xbmc.ramfelt.se
Reply
#6
that doc states at the top 'this file was generated from a cvs, builded on 'apr 3 2006'
if you've got a newer version could you send me it ?

the emu on xbmcscripts.com is the latest i've seen, with icon image support.

i suspect one image overrides the other. best way is to knock up a sample script to try on xbox.
Reply
#7
nope, i was just confused from the "xbmcgui (version 1.1, 18 august 2004)" text. apparently xbmcscripts has the november 20 2005 changes, so you would have the latest version.

yeah, i will try that as soon as i get home. it gets tedious to dry-code for a few hours.

thanks for your help
Check out my XBMC scripts at http://xbmc.ramfelt.se
Reply
#8
@redsolo, there was a bug in xbmc that controllabels wouldn't always show up.

- 21-04-2006 fixed: [ 1473940 ] controllabel don't always display

i don't remember when it started, but make sure your build is new enough.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply

Logout Mark Read Team Forum Stats Members Help
ControlList, ListItem and Emulator0