PDA

View Full Version : WindowXML GUI Toolkit (replaces GUIBuilder for XBMC python scripts)


donno
2007-02-14, 14:33
Hello, I finally had some success at adding a new Window Type. (Called WindowXML). The purpose of this is to remove the need for GUIBuilder and let XBMC load the xmls and handle it correctly. This even means onclicks for builtins, animation and visibility should work without the need for tons of python code powering it.

Class xbmcgui.WindowXML()
Function xbmcgui.WindowXML().onInit(self) #Replacement for __init__
Function xbmcgui.WindowXML().onAction(self,action)
Function xbmcgui.WindowXML().onClick(self,controlID) #Replacement for onControl
Function xbmcgui.WindowXML().onFocus(self,controlID)

If anyone is interested in having the onFocus stuff in old Window and WindowDialog please just say.

Ideas/Long Term Goals
XML PATH
Allow you to do specify currentscriptpath + "\\mainwindow.xml" and automatically check path that the xml is in for images (if it has a path) else it’s assumed that the xml is located in the current skin and images are in the media and XPR. Inital ideas are make the scripter detect if the xml they want such as youtube_window.xml is located in the currentskin\pal or NTSC folders else use the included xml/ stock graphics.

More Control Types
Allow for more controls types (port over more the controls available for skinning to be able to do even more.

Change the Way My Scripts works
Allow you to 'minimize' a script, then if you click on the script in my scripts give you the option to maximize or close it. Of course also have an option for scripter. (The maximize would work but remember the Window id given to the script while its running and activating that id when you click it in my scripts.

Way for Type Checking and Error handling
Way to check that when u get the control with id 2 that it is infact a button and a skinner hasn't made it a image instead :)

Note) I Am going off to uni so i may not get a chance to work on this. Im hoping to create a branch to store my work in before I go.

Example Script showing it from the python scripters side
import xbmcgui

KEY_BUTTON_BACK = 275
KEY_KEYBOARD_ESC = 61467

"""
Problems At The Moment
- Requires the xml to be present in the current running skin (so no way to load a included xml and gfx)
- Currently you can not get ControlList type returned if you do self.getControl(id).
Window.cpp Window_GetControlByID in the switch(pGUIControl->GetControlType()) needs a case for case CGUIControl::GUICONTAINER_LIST: \_
and a matching python type. Making it a ControlList causes access issues
- 'Exiting Problem' if you do use <onclick> in the xml (builtins) [i find u have to activatewindow(13000) 'usually' to show the script again then ESC/BACK to close
"""

"""
xbmcgui.WindowXML()
xbmcgui.WindowXML().onInit(self) Replacement for __init__
xbmcgui.WindowXML().onAction(self,action)
xbmcgui.WindowXML().onClick(self,controlID) Replacement for onControl
xbmcgui.WindowXML().onFocus(self,controlID)
"""

class WindowXML(xbmcgui.WindowXML):
def onInit(self):
"""
This function has been implemented and works
The Idea for this function is to be used to get initial data and populate lists
"""
print "onInit(): Window Initialized"
#self.listctrl = self.getControl(50)
#self.listctrl.addItem("hey")
self.button = self.getControl(2) # Example of getting a control based on ID
self.button.setLabel('Hello 2', 'font14', '0xFFFFFFFF', '0xFFFF3300', '0xFF000000') # changing the control after its on screen

def onAction(self, action):
""""
onAction in WindowXML works same as on a Window or WindowDialog its for keypress/controller buttons etc
This function has been implemented and works
"""
buttonCode = action.getButtonCode()
actionID = action.getId()
print "onAction(): actionID=%i buttonCode=%i" % (actionID,buttonCode)
if (buttonCode == KEY_BUTTON_BACK or buttonCode == KEY_KEYBOARD_ESC):
self.close()

def onClick(self, controlID):
"""
onClick(self, controlID) is the replacement for onControl. It gives an interger.
This function has been implemented and works
"""
print "onclick(): control %i" % controlID

if (controlID == 2):
print "Some Control with id 2 was pressed"

def onFocus(self, controlID):
""""
onFocus(self, int controlID)
This function has been implemented and works
"""
print "onFocus(): control %i" % controlID
if (controlID == 5):
print 'The control with id="5" just got focus'

if __name__ == '__main__':
w = WindowXML("youtube.xml")
w.doModal()
del w

Any ideas, suggestions are appreciated.
More information should be up on http://darkdonno.googlepages.com/xbmc-dev (http://darkdonno.googlepages.com/xbmc-dev) once i get around to documenting more of it :)
Spend quite a few hours today getting the actual code to work so far :)
The goal is make scripts more like plug-ins that fit along with the rest of XBMC, and also try to make it easier and hopefully more efficient.

solexalex
2007-02-14, 15:30
Congratulations !

Looking forward to it !!

Nuka1195
2007-02-14, 17:09
Congrats Donno. :)

"Long Live GUIBuilder"

FrostBox
2007-02-14, 17:40
Hi, Congratulation

This is good news.
I am impatient to test this.

Frost

stanley87
2007-02-15, 01:14
Hey, does this mean I will be able to have my script "sleep" and get control actions without the use of xbmc window class?
Hence, xbmc controls etc will still work...

Asteron
2007-02-15, 01:45
Hey Donno,
Did you derive this from the standard xbmcgui.Window?

You really need its getControl(id) to allow you to modify controls like enable/disable buttons.

Actually looking at the xbmcgui api (http://www.xbmcscripts.com/downloads/documentation/xbmcgui.html#Window) you still really need pretty everything but getFocus(), getWidth/Height/Coordinate resolution. After that there is no real reason to use th old window :)

Ohh Im not really sure why you would want OnInit() instead of __init__ like every other python class... It doesnt seem like you would be able to pass parameters like that so it seems not as good...

One request I have is for an OnShow(). That seems very useful as you could do stuff like update lists or information you are about to display.

Also how about a keyword like fullscreen=True that determines whether the window behaves like a xbmcgui.Window or xbmcgui.WindowDialog ... or does the skin take care of that?

Maybe xbmcgui.SkinnedWindow would be better? It emphasizes the presentation over the implementation... not a big deal though

donno
2007-02-15, 04:28
stanley87: nope it’s the same as Window/WindowXML in that aspect

You really need its getControl(id) to allow you to modify controls like enable/disable buttons. Up as it’s based on the Window its already has that function. The problem is it only returns a 'Control' for some types of controls that don't currently exist in Python

Sorry for the confusion with onInit(), the reason for this is its actually called by the message manger in XBMC says the window has been initialized. You can still pass parameters and have a def __init__(self) as that a generic python function (same as constructors in C/C++) how ever OnInit can be used for modifying the UI. The __init__ is called when the object in python. and its ran before the XBMC has loaded the xml up so no controls would exist at that point so there would be no nice way of populate lists and other stuf at startup.
With reguards to xbmcgui.SkinnedWindow i ll still with WindowXML, as you can say the Window and WindowDialog is Skinned :)

On the full screen/dialog effect It would be best if it was specified in the xml (by <window type="dialog">) how ever at the moment this doesn't work so needs some fixing there.

donno
2007-02-17, 07:35
Made some great improvements for the fallback features with the help and pointers from Spiff :).

WindowXML now takes two arguments. Filename for the XML file to load for the window, and the 'fallback' path.

Exploitation :)
Internally, XBMC will check to see if the filename given exists in the current skin. (eg CurrentSkin\Pal or CurrentSkin\720p etc). Now if the skin the user is running doesn't have the xml (such as youtube_mainwin.xml) it will then check in the Fallback path. A fallback path should be like Q:\scripts\youtube\DefaultSkin and have
Q:\scripts\youtube\DefaultSkin\PAL
Q:\scripts\youtube\DefaultSkin\NTSC\
Q:\scripts\youtube\DefaultSkin\PAL16x9
Q:\scripts\youtube\DefaultSkin\NTSC16x9
Q:\scripts\youtube\DefaultSkin\1080i
Q:\scripts\youtube\DefaultSkin\720p

import os, xbmcgui
scriptPath = os.getcwd().replace(";","") # The replace fixes the fact inside XBMC it adds a ; to the end of the path
i use WindowXML("youtube_mainwin.xml",os.path.join(scriptPath."DefaultSkin"))


Just realised a slight flaw in the way fallback works, as we don't load in our own skin.xml or lock it ot a standard (so it will check like PAL no matter what). So if someone a skin with the default set as NTSC. If you are running 720p for example it may fallback to NTSC16x9 (instead of PAL 16x9) and then NTSC (instead of PAL) like most skins do. So this fix is in my todo list, its an easy fix :) just a matter of checking if g_SkinInfo.GetSkinPath(strXMLname,&res,strFallbackPath) exists if it doesn't do strFallbackPath + " \\pal\\" + strXMLName :). so at least the standard for scripts will be it checks pal last no matter what.
Spiff helped fix the problem i was having with the GUIWindow. (When giving it a path such as q:\script\Youtube\DefaultSkin\youtube.xml) it wouldn't do anything special so XBMC tried loading Q:\skin\project mayhem III\pal\q:\script\Youtube\DefaultSkin\youtube.xml . Now it loads the xmls correctly etc but u just can't see the window (its all black). You can navigate and click stuff thou, so I need to have a look into that.

Fews notes)
in the included skin 'the fallback one' for the sack of good practise yours shouldn't depend on includes (as this ties it to a skin). 2nd you should have every tag for every control in the XML leaving nothing left over to use the default defined by the skin (meaning in a <control type="label"> have a <textcolor> even if its the color you want it without it as it you change skin the default color for a label may be different.

IMO Once the fallback stuff renders correctly and all teh new lists types work in python it should be good enough to start using main stream and go in the trunk (if it doesn't create to many bugs)

Now depending on how much time i get and the avaliablity of the internet migth be a few days/weeks till i can get back on this :)


Now depending on how much time i get and the avaliablity of the internet migth be a few days/weeks till i can get back on this :)

Nuka1195
2007-02-17, 08:29
Hey donno, I have a good script that could be used to test this. XBMC Lyrics. Theres only like four required controls. I would like to play around with animation and things.

spiff
2007-02-17, 11:39
nuka, its in a branch so play all you want :)

asg
2007-02-21, 14:47
Hi donno,

i´ve just compiled the branched windowxml to test it. Could you post a more recent python example, so i could play with it a bit?

Thanks in advance
asciii

donno
2007-02-24, 16:01
After much hard work I have finally got the lists/multi views to work.

This means instead of just having one list/type, you can add items to the 'window's list' and have it shared over up to 10 different lists.
ID 50 to 59 (same as Videos/Music/Pictures/Program windows in skinning :).
So you can have Wide Icons view/ List, List 2 type stuff for your own script.

ID 2 is reserved for the View button so if you don't want the view button or to use multi views simply do not use id 2, 3,4, 12 or 50-59 for any controls.
ID 2 is the View Button, 3 is the Sort Button, 4 is the Asc/Dsc button, 12 is
the number of objects label, 50-59 are the lists.

So if you have View button and lists with ids 50 to 59 :) the following is of intrest
WindowXML Methods
refreshList() -- Updates the Windows Lists (any new items will be shown once this command is ran.

addItem(item[,refreshList]) -- Add a new item to windows list.
refreshList is 1 (true) by default what this means is
If TRUE it will perform a refresh/sync after every add so the lists will be up to date.
If FALSE then it won't perform a update of the lists so anything u added won't be seen until u run refreshList()

Reason for this refresh stuff is say u want to add a lot of entries to a list you may want to wait till they all were added to the internal list before showing them on the screen instead of showing them after each is added.
---------------------------------


I need to get "clearList() -- Clear the Window List" to work

Future) The ListItem may need to be improved so it can set stuff as 'album,artist,title' and such so info labels in the lists would work nicely :)

Sorry if this post is confusing it was :) 12am and im just trying to get down as much as I can think of.


Note) I need to fix the py docs for the window xml stuff :)
I committed the WindowXMLExample script as a zip into the scripts folder in the branch
Download a XBMC_PC exe here (http://www.blackbolt.x-scene.com/personal/donno/xbmc/XBMC_PC-rev7911-WindowXML.rar) If this link is broken it could mean threes a new version :) or windowxml is completed in trunk.

TODO)

Fallback path rendering correctly and using fallbackpath\media [this needs to be done to make it trunk ready]
Open up more controls to python [this can always been done once it is in the trunk no hurry)
Extend ListItem [ Again its whenever]
Extend Script Window Functionality
Clean up file cosemetics (tabs/spaces)


Maybe its best try to read it then ask me little questions about it

asg
2007-02-25, 20:16
Very nice .. thanks donno! Is there already a way to use onControl events from the ListItems? Maybe i am just too dumb/blind ? :)

stanley87
2007-02-25, 20:41
def onClick(self, controlID):
if (controlID == 7):
xbmcgui.Dialog().ok(__title__ + ": About","Example Script coded by Donno :D","WindowXML Class coded by Donno","With help from Spiff :)")

stanley87
2007-02-25, 20:42
oops, just re-read your message, good point.

donno
2007-03-12, 15:04
WindowXML Progress Update
Thanks to JMarshal, I was able to fix the problems remaining in the WindowXML Code.
So now you can navigate to the list if you change the view. Fallback for xml and media also works now.
The only thing off the top of my head I can see missing is the WindowXMLDialog :) to make your own DialogOK etc.
Ill try to code WindowXMLDialog ASAP, unless there is anything other critical thing that is required, I think that makes it close for going in the trunk and public use.

Just to let you know I have a few other little improvements I want to do with the “Scripts window”, so stay tuned.

Asteron
2007-03-12, 17:58
Can you allow being able to specify whether it is a window/dialog in the XML? That would definitely give skinners more flexibility.

How does the xml parsing compare to guibuilder?

asg
2007-03-12, 18:21
How to use getSelectedItem/Position from the Listitem? Is this implemented yet?

cheerz
asciii

Nuka1195
2007-03-12, 22:21
guibuilder, uses the same functions that are in XBMC translated to python, of course WindowXML will be faster and better on memory.

Why do you ask asteron?

ascii you should read the python docs they clearly explain it.

Asteron
2007-03-12, 22:59
Well I was wondering if Donno had some quantitative numbers. I asked "How does it compare?" and not "Is it better?"

I was worried that XML parsing would be similar since the xml.minidom module is from the python.dll which is written in C and I havent done a profile of your code to identify where it spends most of its time :)

But yeah you're probably right in that the initial time load time is probably a lot less than the iterating over the nodes so the savings should be very significant.

asg
2007-03-12, 23:31
@Nuka1195

the python docs dont really help when the listitem is empty :) getcontrol on the list (id 50) doesnt work ..

Nuka1195
2007-03-13, 00:23
Well since Donno's "never" been able to get guibuilder working. I guess not.

donno
2007-03-18, 15:34
Its done WindowXML, is now in the trunk. When i get some time i might document it some more etc. But for now there is a example script in the scripts folder in the xbmc trunk.

WindowXMLDialog is now in, and the thing should fully work. Fallback stuff and all. I will also try to keep looking here for new posts. Please if you have some questions about how ti works put them here? As well as feature suggestions and ideas.

ascii: Listitem does not have a getSelectedItem/Position function.
getSelectedItem returns a ListItem. getSelectedItem/Position are Functions of the ControlList

as for stats i don't know but most of the bulk of hte code is now as c/c++ so it should be ideally faster, its also nicer on the eyes as xbmc handles more stuff, also i reuse things xbmc can already do so its not tottally making hte whole GuiBuilder in c++/c

Updated xbmcgui.html (http://members.ozemail.com.au/~darkdonno/xbmc/xbmcgui.html)

Over the next few days im going to clean up the formatting of the python section of XBMC and also will complete the pydocs. (just noticed that i forgot to explain the paramters needed to run it in the docs)

Nuka1195
2007-03-18, 16:15
Congrats Donno,

I will start converting now :)

blittan
2007-03-18, 17:26
congrats.. great work man..

:)

Jezz_X
2007-03-18, 21:41
Hi guys as on revison 8230 I've commited a new updated version of pm3 skin it no longer has any Tv overscan compenstation in it (and dosn't need it because we have calibration) and is now full screen like all the other new skins.
So you will need to take this into account when making new pm3 versions of skins for scripts because all the alignment / images have changed and if current skins use background.png from pm3 then will not be aligned proper. And if it uses its own images it will look zoomed out because your script uses the old skin zoom scale that compensated for the Overscan in the skin

Hope that makes sense and sorry :( but its needed for better things in the future.

Jezz_X

Asteron
2007-03-20, 02:11
Great job in finishing Donno! Wooo! Ill be sure to put it through its paces :)

Though I would prefer for the "Dialog" part to be either specified in the xml or passed as a keyword argument to WindowXML. I dont see a reason for it to be a seperate python object if no new functionality is exposed... Can't you do a pointer to CGUIWindow or CGUIWindowDialog behind the scenes?

Its not that all that big of an issue but it makes the whole idea of it being a window/dialog to the skinner instead of the scripter...

donno
2007-03-20, 06:54
I'm against the let Windows and Dialogs be interchanged as XBMC doesn't allow this. You can not make the myscripts.xml or home.xml or etc a Dialog. Thou if you really want you could just use WindowXMLDialog instead, there should be nothing really wrong with that. Coz in your opioion a Window just fills the whole screen, where a dialog can fill an area and has a transparent background.

donno
2007-03-21, 00:59
I was looking at making a script using WindowXML, and i wanted to get the position in the list and i noticed whoops i forgot those functions. However :) i quickly added them
print self.getCurrentListPosition()
print self.getListItemself.getSelectedListItem().getLabe l2()
print self.getSelectedListItem().getLabel()

So ive added getListItem and getCurrentListPosition. There was getSelectedListItem but that was removed due to redudancy of hte getListItem.

Note) getListItem is a new object created with the infomation from the list item in the windows vectorlist, im 99% sure that setLabel2 and setLabel will not work. I'll look at adding a setListItem so you can change the infomation.

Also, next day or two i might change the WindowXML so it takes
scriptPath = os.getcwd().replace(';','')

WindowXML("Script_WindowXMLExample.xml",scriptPath,"DefaultSkin")
point of this is WindowXML would now also check scriptPath+"\\skins\\currentskin\\" for the file then scriptPath+"\\skins\\DefaultSkin\\" as a last resort. Thanks Jezz_X for this idea. Ill try to make "DefaultSkin" variable optional and default to "Default". So bare this in mind if you’re considering using WindowXML soon.

dsvensson
2007-03-22, 18:18
In my script I use the list view as a kind of directory tree browser, so I have folders and video clips. This worked well before changing to WindowXML.
I got the select action in onControl, issued the relevant command, and I got the back action and the previous menu action to onAction, so that I could move up in the directory tree.
With WindowXML, when I press back/previous menu buttons they end up both in onClick and onAction, is the way it is supposed to work? Just wanted to know before I start hacking around it.

donno
2007-04-02, 09:22
hmm wierd nano about the both onClick and onActionm ideally back and previous shouldn't be onControl (how ever i expect it may be a result of the usings lists maybe? because generally back on a list will cause the list to go back a directory). Will look into this further, thou i don't really see what real problem you would get.

Fixed: Something in the SetFocus (Spiff pointed it out)
Added: setFocusId(int id) and getFocusId(int id)
Fixed: media now looks in fallback\\skins\\media

The media was silly thing i missed when i changed it to do fallback\\skins.
I was getting some where glitches and exceptions today when running windowsXMl but then when i tried debug/vs they stopped.

Also Nuka mentioned something wrong with using lists with ids other then 50-59. I tried it today and they worked fine, i could add to them and get teh current position.

Im returting home for the break so i won't be able to do anything for two weeks. Feel free to fix stuff :)

Nuka1195
2007-04-05, 00:39
How about you post a sample script with lists working in dialogs and more than one list in windows with different info in each.

Maybe even do a sample script with every control working, then i can see what's going on here.

stanley87
2007-04-07, 10:51
Hmm,

ok, refresh list is done via : self.refreshList()

get list poss is done via: self.getCurrentListPosition()

get the list item is done via: self.getListItem(self.getCurrentListPosition())

how about:

select item, size??

There needs to be more documentation, as using lists like controls stuffs the script when going between two windows, so donno's way of having the list as id 50 seems the only way to do a list that is reliable. I like having lists like this: self.list = self.getControl(67) , but this only causes troubles in the long run which sux. In Donno's example script, as soon as you make the list as I like doing it and change between two windows, XBMC_PC crashes. So, looks like doing all the self.addItem(xbmcgui.ListItem(etc etc which seems more confusing and doesn't appear to be able to do the two functions above.

Help?

Nuka1195
2007-04-07, 17:31
you are correct, only lists within range 50-59 work on Windows not Dialogs.

Scripts like AMT with three lists all wth different information do not work currently.

So I'm stuck also, for now.

stanley87
2007-04-08, 03:47
i did have a list using id 68 going fine, and i did the above : self.list = self.getControl(68), then i would use self.list.additem(etc etc), this worked great until i tried going between to winxml windows.

Nuka1195
2007-04-08, 17:06
ok, i completely didn't understand that :)

If you have an example of a script working with list controls outside of the builtin lists, could you please post it so i can test.

stanley87
2007-04-09, 12:34
List for Donno of possible bugs in winxml:

1) Media fallback path when used on scrollbar textures does not work
PROBLEM = Can not use custom scrollbar textures (Need for Default skin)

2) Media fallback path does not work in winxml Dialog windows
PROBLEM = Can't create my dialog very well

3) Can not set thumbnails on list items.

Thats about if for now.

:-D

stanley87
2007-04-10, 15:03
Nuka, find below a link to a script that Bootsy is writing, I helped him create a cool little fake 3 label list.

Its using three different lists in windowxml outside the builtin lists

stanley87
2007-04-10, 15:04
Link:
http://xbmc-scripting.googlecode.com/svn/trunk/XinBox/XLiveScore.rar

Nuka1195
2007-04-10, 16:46
only one button fills a list and the list selection stays highlighted, but it's a start.

I still don't see what i did different, but thanks, i'll play some more.

Edit: I was accessing the control only with self.getControl(4).addItem(""), that does not work. Should it?

stanley87
2007-04-11, 01:09
thats just the type of list i used in the xml, so you still no what list item you are on when leaving the list - easily changable in the xml file. It was a quick example i did for the author of that script so didn't spend ages making it nice. But yeh, its using a non built in list (well 3 of them). I also in my XinBox script are using a combination of a builtin list + non-builting list, my main email list is a builtin list but my email dialog attachments list is a non-built-in list , and there seems to be no problem going between them at this stage.

Nuka1195
2007-04-11, 01:26
yup, i figured that out. I'm no skinner and never saw that before, thought it was a bug.

The only real issues i'm having now are:
1. Dialogs just dissapear at random times
2. fallback media path, it should be media inside the skins/skinname folder, i did a patch that does this, but as currently it doesn't work with dialogs.
3. onclick() event gets fired by other than select

asg
2007-04-11, 01:31
mixing windowxml style list and old traditional listitems works fine here. thanks for this "simple" solution stanley :)

a function to reformat the list (label,label2..) without just clear and rebuild the list would be great. alter single list items would also be nice.

is the WindowClose animation implemented yet?

great work. thanks
asciii

asg
2007-04-11, 01:35
3. onclick() event gets fired by other than select

could you post an example? works fine here with controlIDs.

stanley87
2007-04-11, 04:05
yup, i figured that out. I'm no skinner and never saw that before, thought it was a bug.

The only real issues i'm having now are:
1. Dialogs just dissapear at random times
2. fallback media path, it should be media inside the skins/skinname folder, i did a patch that does this, but as currently it doesn't work with dialogs.
3. onclick() event gets fired by other than select

1) I have a problem where every now and again my dialog flashes, it doesnt stuff the script, Navigation works etc, but it doesn't stop flashing until another gui function is activated.

2) I sort of told donno to make it so one media folder for all. Could be changed if needed.

3) I noticed this too but bypassed using onacation and getfocus etc.

Nuka1195
2007-04-11, 04:13
#1 is fixed in SVN, by JMarshall :)

stanley87
2007-04-11, 07:39
YAH! this was worrying me.

now if donno just got on2 that problem with winxmldialog fallbackpath not working, i will be one happy camper!! And maybe added the removelistitem feature, this would be perfection! Iv learnt to live with the no set thumbnail images. I just reset the list and add all the items with the new icons.

stanley87
2007-04-11, 07:41
mixing windowxml style list and old traditional listitems works fine here. thanks for this "simple" solution stanley :)
a function to reformat the list (label,label2..) without just clear and rebuild the list would be great. alter single list items would also be nice.
great work. thanks
asciii

Yeh, donno said he might be able to implement a listremoveitem command which would be very handy for my script as, when emails are deleted, they need to be removed from the email list, and at present, i have to reset the list and then rebuild it.

donno
2007-04-11, 09:54
Sorry for forgetting, thou I swear I checked this 2 days ago and last post was stan, usually i don't bother replying here as I always catch stan on irc.
Time to answer some questions

1) OnClick getting fired by stuff like the selecItem
This is now fixed, the problem was i removed code that limited the event to be raised only by controllist (if it was aselect item), or if the contrl was a button or checkmark). However i didn't expleciity set it for the button and checkmark this way stuff like the togglebutton (even thou it doesn't have a python contro equivlent, you can still detect if it got a onClick.
Fixed in SVN

2) Media fallback path does not work in winxml Dialog windows BY Stanley
I have got no idea why that not working, we even look at the code and its fine it should execute the same render function as Dialog
Fixed in SVN

3) Can not set thumbnails on list items.
Well you can set thumbnails on list items, how ever due to limitation bug in the coding of the getListItem, i was unable to get it to pass the real list item so instead, the a 'new list item is created' with the info from the real one, so therefore doing set on it has no effect on the real item that is in the list.
This was done to fix another problem and this was the solution so sorry about that. getListItem can be used for gets fine (just not sets).

Still Broken I won't fix this one as I wrote it the way it currently is.

Nuka1195: self.getControl(4).addItem("") SHOULDN"T work, as control id 4 is reserved for the sort asc button.
Ids 3 and 4 are reserved for the sort and sort asc toggle button, and shouldn't be used at the moment. its not implemented but I left it in just incase.
That being said to clarify you SHOULD NOT use ID 2,12, 50-59 for anything else other then View Button, Label containing number Objects in list, and the lists for multi view types.

Also Nuka. stanley and I decided against fallback\skins\skinname\media in favor of fallback\skins\media (this is how the WindowXML works currently), no idea why the dialog version isn't.

Added:
removeItem to WindowXML, used to remove an item in the Window Lists.
Changed:
WindowXMLDialog is now based on WindowXML (more so), it now has the 'WindowLists' and the ablity to use lists 50-59 as ONE (and supports the view button) so you can have multi view types. on a Dialog :) 'well window with a transparent background'

Might be a good idea to update the pydocs on XBMCScripts.
For now XBMCGUI Python Doc (http://xbmc.sourceforge.net/python-docs/xbmcgui.html) at time of writting it was based on revision 8466 of XBMC.

Nuka1195
2007-04-11, 17:08
self.getControl(4).addItem("") SHOULDN"T work
That's fine, but if i assign control(4) to another variable it works, so your saying self.getControl(44).addItem("") should work?

stanley and I decided against fallback\skins\skinname\media in favor of fallback\skins\media
This needs to be reconsidered, I have a patch that works (except for dialogs as it currently doesn't work either) It would be benificial to me to have the media folder inside the skinname folder. I'm sure if i tell you why, you'll argue :)

stanley87
2007-04-12, 01:04
Media fallback on dialogs now fixed in SVN - yah for donno!
Also, removeitem has been added :-D

Plus, the media folder is fine-and if you want to have a media folder for each skin, easier enought to do like you said and just input the fallback path as script/skins/media etc

:-D

Nuka1195
2007-04-12, 01:26
no stanley, i need multiple media folders, so no need to keep arguing.

donno
2007-04-12, 04:40
:) Got locked out the forums because of your message, tried logging to reply but it locked me out for an hour, then when got in i forgot why.

That's fine, but if i assign control(4) to another variable it works, so your saying self.getControl(44).addItem("") should work?


Tes that will work providing getControl ist a list (pretty sure panels and that won't work as they don't get converted to a ControlList),


The only reason i can see for having multiply media folders
for each skin is if you want to have your own extra imagines deisnged for that skin. and of coruse :) want to use the same xml. stanley87 has pointed out to me that, to avoid conflicts changing the name of the textures to something like dbackground.png for the default skin (this way it also doesn't conflict with any image in the skin path which is probley a good thing due to your feature the 'forceFallback'. Because im 99% with regards to media the current skin or memory/xpr is checked first than the fallback path media.

Like wise you could have like amt-banner-mc360.png and whack that in the skins. However if you must there is on other reason why this 'just change the name is better and leaving media in skins\ rather than PER SKIN.

Which is just if you have generic images that should be used for all the skins like a the title banner for the script that is tied to NO skin.

stanley87
2007-04-12, 06:41
:) Got locked out the forums because of your message, tried logging to reply but it locked me out for an hour, then when got in i forgot why.



Tes that will work providing getControl ist a list (pretty sure panels and that won't work as they don't get converted to a ControlList),


The only reason i can see for having multiply media folders
for each skin is if you want to have your own extra imagines deisnged for that skin. and of coruse :) want to use the same xml. stanley87 has pointed out to me that, to avoid conflicts changing the name of the textures to something like dbackground.png for the default skin (this way it also doesn't conflict with any image in the skin path which is probley a good thing due to your feature the 'forceFallback'. Because im 99% with regards to media the current skin or memory/xpr is checked first than the fallback path media.

Like wise you could have like amt-banner-mc360.png and whack that in the skins. However if you must there is on other reason why this 'just change the name is better and leaving media in skins\ rather than PER SKIN.

Which is just if you have generic images that should be used for all the skins like a the title banner for the script that is tied to NO skin.



for multiple skins i would just name it eg: default_background.png
: mc360_background.png

have them all in the one folder and just change the xml's to use these.

stanley87
2007-04-13, 03:24
Ok,

I have been helping Donno out and testing certain things and in the progress a few bugs have been found and most of them fixed.

There is a known problem that when using non-id 50 control lists
The problem is: You can not getControl of the list twice!
eg: self.list = self.getControl(67) where 67 is the id if your list.

This is a problem as these are set up usually in _oninit_ and _oninit_ is called everytime the window is opened (eg, when switching back from second window). So, this will crash xbmc. As a result we have found a way around this. In the _init_ of windows define a variable to 0 - (eg. self.initon = 0), then in your _oninit_ use if self.initon == 0:, the in this if statement, get all your controls etc. and dont forget then to set: self.initon = 1. Hence, when returning from a window, it will not try to getControl's again and as a result, script wont crash:This also enables the scripter to set controls based on if its the first time the window has been opened etc.
Note: You have to make sure not to use getControl for the list anywhere else in the script! just use the variable you assign to it: eg. self.list = self.getControl(60), then just use self.list in the rest of the script.
Example of code:


def __init__(self,strXMLname, strFallbackPath,strDefaultName,bforeFallback=0):
xbmcgui.lock()
self.initon = 0

def onInit(self):
if self.initon == 0:
self.list = self.getControl(50)
self.initon = 1:
print "This is the first time you have opened this window"
else:
print "This is NOT the first time you have opened this window"
xbmcgui.unlock()


This does not to be used if list with ids 50 are being used, as you then dont need to use the getControl command.

Another bug that has been fixed is if a Textbox had only one page, and page up or down was pressed on the spin control, xbmc would crash - this is fixed in the latest xbmc svn rev.

PS: The problem above does not occur with WindowxmlDialog, as when returning from a winxmldialog to a window, _oninit_ is not called again, but still probably best to keep it the way above and not use self.getControl twice in your script.

Hope this helps some people.

Currently, Donno is trying to fix the media fallback path on textures for spin controls not working. So hope this is fixed soon.

Thanks,
Stanley87

stanley87
2007-04-13, 03:42
PS: may i also just say,
that xbmc-scripting SVN team are king of all scripting!

http://xbmc-scripting.googlecode.com/svn/trunk/

jmarshall
2007-04-13, 04:33
Why on earth does it crash if you GetControl() twice? Clearly there's a bug there. Will chat with Donno next time he's around.

Nuka1195
2007-04-13, 05:12
XBMC Lyrics doesn't crash coming back from settings. It uses lists id=110 and 120

edit: nm, Lyrics is a dialog.

stanley87
2007-04-13, 06:00
Why on earth does it crash if you GetControl() twice? Clearly there's a bug there. Will chat with Donno next time he's around.


Yup, there is. Donno was looking into it. With yours and his head together, im sure it will be solved very soon.
Then all i need is the media fallback path issue on spin controls and scroll bars to work and I will be a very happy camper!

stanley87
2007-04-13, 06:03
XBMC Lyrics doesn't crash coming back from settings. It uses lists id=110 and 120

edit: nm, Lyrics is a dialog.

dam :-(, your the first to have a fully functional script using winxml!, i was hoping i would be first. But i can still have mine to be the first with multiple winxml windows and dialogs.
The Race Is on!

Nuka1195
2007-04-13, 16:27
These are old

XBMC Changelog
Kaid Control Pad (has settings dialog)

XBMC Lyrics has dialogs also
:)

If you're doing a settings, check the *-settings.xml out. Jezz_X and JMarshall helped me. It uses a grouplist of groups. Makes the settings work like XBMC's.

stanley87
2007-04-13, 17:16
i was meaning using winxml :-p

stanley87
2007-04-13, 17:20
wow, havnt updated xbmc lyrics in a while, WOW!!!!

Looks very good! love the song progress bar! and the settings menu! and the smooth scrolling lyrics

stanley87
2007-04-13, 17:22
oh, i think the album art overlay should be hidden if its not overlaying the viz :-D

Nuka1195
2007-04-13, 18:42
i guess i don't understand, XBMC Changelog uses WindowXML?

About the overlay, avisible condition would work.

<visible>Window.IsVisible(2006)</visible> works, but then doesn't slide in until the viz is up.

stanley87
2007-04-14, 02:46
that would work, and maybe somehow have a bit of delay with the music overlay comes up as the album art overlays and looks abit messy..

Hey, im a skilled python coder now, YAH!

stanley87
2007-04-14, 10:00
Update: That getControl bug is now fixed (thanks Donno) in latest xbmc SVN. So it can now be run as many times as you like.

Nuka1195
2007-04-18, 18:12
Checkmarks, doesn't use fallback path for textures

Buttons, textures do not show until the first time it is focused, if it's the default control you have to focus another control then when you move back the texture shows up.

Image controls seem to work properly.

This is with current SVN.

I also have a patch that moves the media folder inside the skins/skinname/ folder where it belongs :) Though it exibits the same behavior as above.

I haven't checked other controls that gain focus.

Edit: Should the arguments passed to WindowXML be allowed to be overridden in __init__()? I can't seem to get it to work. Your keywords in your example don't match either. Could you post an example?

stanley87
2007-04-19, 01:07
Hmm, im not sure what example/code snippet you are talking about.

Also, i made a patch for the self.addItem that has now been commited to SVN - thanks Donno.

It allows for list items to be added to the TOP of the list.
- I needed this for my XinBox script.

Sometime next week i will finish it so it will allow inserting list items at a given position in the list - this is only usable with the self.addItem().

Example:
self.addItem(Listitem, 0) - this will add to the top of the list
self.addItem(Listitem, -1) - this will add to the bottom of the list
self.addItem(Listitem) - defaults to original bottom of the list

to come:
self.addItem(Listitem, 2) - will add to second poss from top of list
self.addItem(Listitem, -2) - will add to the second poss from the bottom of list

But at present, those last two will just default to orignal, adding to end of list

Nuka1195
2007-04-19, 02:47
check your __init__() that you copied from Donno's example.

def __init__(self,strXMLname, strFallbackPath,strDefaultName,bforeFallback=0):

once you pass arguments to the windowXML class, can you override them in __init__().

I want to get skin settings inside the class (Which skin to use), not before the call to the class. This should be possible, I just can't get it to work.

stanley87
2007-04-19, 03:07
check your __init__() that you copied from Donno's example.

def __init__(self,strXMLname, strFallbackPath,strDefaultName,bforeFallback=0):

once you pass arguments to the windowXML class, can you override them in __init__().

I want to get skin settings inside the class (Which skin to use), not before the call to the class. This should be possible, I just can't get it to work.

hmmm, _init_ is called before the window is created, and oninit is called after, so maybe possible to change the arguments in the _init_, but not 100% sure, will try when i get home from work

Nuka1195
2007-04-20, 16:23
Donno, you look into those bugs I posted?

Also here's the link to the fallbackMediaPath patch.

https://sourceforge.net/tracker/index.php?func=detail&aid=1703053&group_id=87054&atid=581840

This really should be changed before too many scripts take advantage of WindowXML.

Nuka1195
2007-04-23, 01:49
donno?

donno
2007-04-24, 15:31
Feel free commit the media path changes


Once you pass arguments to the windowXML class, can you override them in __init__(). << no idea what you mean by that, other :) changing the ones that must be there won't effect anything. (by chaning i mena something like doing
def __init__ (self,xmlname,fallbackPath):
fallbackPath = "Q:\\"

That will have no effect whats so ever on the Window it won't actually change it,or at least im sure it shouldn't.

As for the bug on textures, jm suggested i look in AllocResources.

Im very busy with real life so might be a while until i can look into things again.

Nuka1195
2007-04-24, 16:00
Yeah, I wanted to grab settings, therefore a skin setting inside the class. If it can't be overridden, I'll just grab it before the call to the class. I thought I was doing something wrong.

I'm 99% sure I won't be able to fix it, but I can take a look at AllocResources.

Nuka1195
2007-04-24, 17:53
Yup using AllocResources() fixes the texture bug.

Nuka1195
2007-04-24, 19:19
Ok, When I get approval I'll commit the fix for the texture bug. I will also commit the fallbackMediaPath change at that time.

So scripters be prepared to move your /media/ folders inside your /skinofchoice/ folder with the /Pal/ folder

stanley87
2007-04-25, 02:05
Sounds good Nuka!

Nuka1195
2007-04-25, 05:17
fixed: WindowXML: If fallback media path was used, some controls didn't render until focused
changed: WindowXML: Moved fallback media path inside the /skins/skinname/ folder with PAL, PAL16x9...

I forgot to thank JMarshall for the fix in the log, oops, thanks JMarshall

stanley87
2007-04-25, 06:21
IDEA!!

You should code in a self.getcurrentskinpath(), or self.getcurrentskinname().
ETC, i know you could just find out what skin xbmc is running but this won't work for scripts that allow changing of skins and also, when the script does not have a skin for the current xbmc skin.

jmarshall
2007-04-25, 08:32
Have made some changes so that the fallback path is only set while the window is allocating resources or while the window is rendering (only 2 states where it should require it).

This is so that other windows that are allocating while the python window is up will use the correct directory.

Let me know if it breaks stuff or not.

Also: Are we not using m_fallbackPath (set in constructor of GUIPythonWindowXML ?)

Cheers,
Jonathan

Nuka1195
2007-04-25, 18:13
Also: Are we not using m_fallbackPath (set in constructor of GUIPythonWindowXML ?)

I didn't find any other occurrence, I think the intent was for the xml files though not the media path.

Here's how it works currently:

xml file found in q:\scripts\PMIII\PAL
media search: 1. q:\skin\PMIII\media -> 2. q:\scripts\skins\PMIII\media
works good :)

xml file found in q:\skin\PMIII\PAL
media search: 1. q:\skin\PMIII\media -> 2. q:\scripts\PMIII\media
works good for 1

I didn't bother calling g_graphicsContext.SetMediaDir() if the xml file was found in q:\skin\PMIII\PAL, thinking they would have all the images then.

This current way is fine and maybe a good thing, but, if 2. q:\scripts\PMIII\media is used, the texture doesn't show until focused bug is back.

I'm not sure how to fix that, the only thing I could do would be not set the fallback media path if the xml is found in q:\skin\PMIII\PAL.

I know your busy, by the way really nice additions lately, so I would say this is a low priority since it does work as one would expect. If you would like me to change so it doesn't call g_graphicsContext.SetMediaDir() in scenario 2, I will. If you have a quick change I can test I'll do that.

stanley87
2007-04-28, 15:12
Nuka, have you tried using fallback in a script on an actual xbox? I just tried my script which works great on xbmc_pc but on the actual xbox - no textures at all - even if i put my gfx straight into the skin/media folder. I looked at XBMCLyrics and see, even tho you have a media folder, your script will be using the pm3 gfx as they have the same name. Could you do me a favour and for example rename one of your gfx to "testme.png", and then change the xml to load this image. Then try on the xbox with the latest xbmc rev. And let me know if you can see the image.

Would be a great help.

Cheers Stanley87

Nuka1195
2007-04-28, 16:02
http://xbmc-scripting.googlecode.com/svn/old/WindowXMLTest.zip

That's what I used and your right it works on the PC, but not on the xbox.

I'm not sure what to think, I'll have to do more testing when I get a chance.

Nuka1195
2007-04-28, 18:34
ok, solved. It was a slashatend issue. I need to build for pc now to test to make sure it still works on that. I may need an #ifdef for it.

Nuka1195
2007-04-28, 20:18
Stanley, I just committed a fix. It works on both Xbox and the PC.

I'm not sure if it's the right way to fix it. A developer will have to decide.

stanley87
2007-04-29, 02:12
Thanks, im compiling now.
I was talking to Donno the other day and said hows its funny that we now use xbmc_pc so much, that an issue with the actual xbox goes un-noticed for awhile :-D

l8tig
2007-05-06, 13:41
it is possible to post 2 list different on the same screen with same the xml?
ex: list channel + list epg

Nuka1195
2007-05-06, 16:44
should be as long as they are not both in the id range 50-59

l8tig
2007-05-06, 17:02
thank you, it's work :)

Nuka1195
2007-05-08, 18:48
Hi Donno,

A couple of things:

1. Can the force_fallback, force the media folder in the default skin to be used also, as it should with the xml?

2. Maybe not an issue with WindowXML, I'm not sure. The following code works fine:

import xbmc, xbmcgui
import os
class GUI( xbmcgui.WindowXML ):
def __init__( self, *args, **kwargs ):
self.videoplayer_resolution = int( xbmc.executehttpapi( "getguisetting(0,videoplayer.displayresolution)" ).replace("<li>","") )

def onInit( self ):
self._change_resolution()

def _change_resolution( self ):
print self.videoplayer_resolution
xbmc.executehttpapi( "SetGUISetting(0,videoplayer.displayresolution,%d)" % ( self.videoplayer_resolution, ) )

ui = GUI("httptest.xml", os.getcwd().replace(";",""),"Default", True)
ui.doModal()
del ui

But in real life I have other things going on from onInit() and calling "xbmc.executehttpapi( "SetGUISetting(0,videoplayer.displayresolution,%d)" % ( self.videoplayer_resolution, ) )" before onInit() finishes causes a lockup. I haven't been able to track down the conflict, since it works fine with the above code it may not be related.

Could we have another event OnWindowLoaded() <- not sure if that's the correct event though, but something after onInit(). This may not solve my issue though.

Edit: Another issue, the object count label id="12", when setting the list id="50" invisible and visible, sometimes the labels count is one less than it should be.

Edit2: <info>Listitem.Icon</info> doesn't seem to work for separate cimage controls, unless I'm doing something wrong. I set the list id="50" to have an image with Listitem.icon.


<control type="image" id="201">
<description>Trailer Poster</description>
<posx>520</posx>
<posy>120</posy>
<width>170</width>
<height>250</height>
<info>Listitem.Icon</info>
<aspectratio>keep</aspectratio>
<visible>Control.IsVisible(50)</visible>
</control>

<control type="list" id="50">
<posx>190</posx>
<posy>100</posy>
<width>485</width>
<height>425</height>
<onleft>9000</onleft>
<onright>60</onright>
<onup>50</onup>
<ondown>50</ondown>
<viewtype label="535">list</viewtype>
<pagecontrol>60</pagecontrol>
<scrolltime>200</scrolltime>
<include>contentpanelslide</include>
<itemlayout height="29">
<control type="image">
<posx>5</posx>
<posy>3</posy>
<width>22</width>
<height>22</height>
<info>ListItem.Icon</info>
</control>
<control type="label">
<posx>30</posx>
<posy>3</posy>
<width>430</width>
<height>22</height>
<font>font13</font>
<aligny>center</aligny>
<include>listselectedcolor</include>
<align>left</align>
<info>ListItem.Label</info>
<visible>!Container.Sort(SongRating)</visible>
</control>
<control type="label">
<posx>475</posx>
<posy>3</posy>
<width>300</width>
<height>22</height>
<font>font13</font>
<aligny>center</aligny>
<include>listselectedcolor</include>
<textcolor>60ffffff</textcolor>
<align>right</align>
<info>ListItem.Label2</info>
<visible>!Container.Sort(SongRating)</visible>
</control>
<control type="label">
<posx>30</posx>
<posy>3</posy>
<width>345</width>
<height>22</height>
<font>font13</font>
<aligny>center</aligny>
<include>listselectedcolor</include>
<align>left</align>
<info>ListItem.Label</info>
<visible>Container.Sort(SongRating)</visible>
</control>
<control type="image" id="1">
<description>Song Rating Image</description>
<height>21</height>
<width>121</width>
<posx>380</posx>
<posy>4</posy>
<info>listitem.rating</info>
<aspectratio>stretch</aspectratio>
<texture flipx="true" />
<visible>Container.Sort(SongRating)</visible>
</control>
</itemlayout>
<focusedlayout height="29">
<control type="image">
<width>485</width>
<height>29</height>
<posx>0</posx>
<posy>0</posy>
<visible>Control.HasFocus(50)</visible>
<texture>list-focus.png</texture>
</control>
<control type="image">
<posx>5</posx>
<posy>3</posy>
<width>22</width>
<height>22</height>
<info>ListItem.Icon</info>
</control>
<control type="label">
<posx>30</posx>
<posy>3</posy>
<width>430</width>
<height>22</height>
<font>font13</font>
<aligny>center</aligny>
<include>listselectedcolor</include>
<align>left</align>
<info>ListItem.Label</info>
<visible>!Container.Sort(SongRating)</visible>
</control>
<control type="label">
<posx>475</posx>
<posy>3</posy>
<width>300</width>
<height>22</height>
<font>font13</font>
<aligny>center</aligny>
<include>listselectedcolor</include>
<textcolor>60ffffff</textcolor>
<align>right</align>
<info>ListItem.Label2</info>
<visible>!Container.Sort(SongRating)</visible>
</control>
<control type="label">
<posx>30</posx>
<posy>3</posy>
<width>345</width>
<height>22</height>
<font>font13</font>
<aligny>center</aligny>
<include>listselectedcolor</include>
<align>left</align>
<info>ListItem.Label</info>
<visible>Container.Sort(SongRating)</visible>
</control>
<control type="image" id="1">
<description>Song Rating Image</description>
<height>21</height>
<width>121</width>
<posx>380</posx>
<posy>4</posy>
<info>listitem.rating</info>
<aspectratio>stretch</aspectratio>
<texture flipx="true" />
<visible>Container.Sort(SongRating)</visible>
</control>
</focusedlayout>
</control>

donno
2007-05-10, 14:43
1. Can the force_fallback, force the media folder in the default skin to be used also, as it should with the xml?
No. XBMC afaik won't let you do this.
SOLUTION: name the media for bonus skins and the default skin UNQUIE names like the background other then backgorund.png so it doesn't conflict with that name in any skin.

2.
__init__ is called when the python object is constructors.
OnInit is called when teh Application/Window/Message Manger in XBMC picks up a Window_INIT case. im sure this is after the Load(xml) has been called and after OnWindowLoaded.

As for Another issue, the object count label id="12", when setting the list id="50" invisible and visible, sometimes the labels count is one less than it should be. if u can track it down

as for the <info>Listitem.Icon</info> , not really sure. Simpley don't have time to look into it now.

Nuka1195
2007-05-10, 16:46
1. I figured you were going to say that :) Only an issue for custom skins and they can use unique names.

2. Ok, might be something else conflicting anyways.

3. I'll just use my own and set the value.

4. Ok, again I'll just setImage() manually.

jmarshall
2007-05-11, 00:57
Regarding OnInitWindow/OnWindowLoaded:

The process is as follows for the base class CGUIWindow

1. The GUI_MSG_WINDOW_INIT message is sent from the window manager to the window.

2. It calls AllocResources() which then calls Load() if the window XML is not already loaded.

3. Load() then calls OnWindowLoaded() before exitting.

4. OnInitWindow() is then called at the end of the GUI_MSG_WINDOW_INIT handler.

As for the ListItem.Icon, that looks like it's probably an issue with the window not returning the listitem information to the infomanager. Does ListItem.Label work outside the list?

Cheers
Jonathan

Nuka1195
2007-05-11, 03:27
Hi,

None of the ListItem.* work for the media list.

About the executehttp, there may be other issues with that command.

Edit: I'm also getting intermitten lockups after a movie plays and it returns to the script. I have two controls id="50" is a list and id="51" is a panel. This works, I can select a movie to play from the panel, but when the movie ends and returns back to the script, the list is visible not the panel. Since there is no panel control in python maybe that's why?

19:48:08 M: 20652032 NOTICE: CDVDPlayer::CloseFile()
19:48:08 M: 20652032 NOTICE: DVDPlayer: waiting for threads to exit
19:48:08 M: 20652032 NOTICE: DVDPlayer: finished waiting
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: exception in CApplication::Render()
19:48:08 M: 16842752 ERROR: CApplication::Render(), too many exceptions
19:48:08 M: 16842752 FATAL: EXCEPTION_ACCESS_VIOLATION (0xc0000005)
at 0x001f0332

Nuka1195
2007-05-12, 16:11
Another WindowXML Bug or Python scrollbar bug?

The x factor does not work for a scrollbar in python/windowxml.

It works fine for an image control.

<animation effect="zoom" end="231,115,250,250" time="0" condition="Control.IsVisible(50)">Conditional</animation>

donno
2007-05-13, 13:39
could be that python has no panel. but still the viewControl should still be set for what ever u left it at weather that was a normal control or a panel, python its self doesn't need to change the focus or what visiblities. :( intresting problem,

Nuka1195
2007-05-13, 14:59
So does that mean your looking into it?

If I start a movie from the panel, when it returns it does not lock.

If I start a movie from the list(a python native control), it locks on return.

Even though this doesn't work properly, I'm going to tag AMT and commit this, then if you want to look at it great.

I need a long break from this stuff.

mrz
2007-05-16, 12:19
Hi donno!
Firstly a big thank you for this excellent new capability. I'm currently updating my DagensTV script using WindowXML.
I found a minor bug;- if executing self.getFocus() while a scrollbar is in focus generates "unknown control type for python".
Then a suggestion;- linking a control for control within the script e.g self.getControl(id), would it be tricky to allow names like self.getControl('My special button') maybe by utilizing the description field.

Thanks again,

MrZ

Nuka1195
2007-05-16, 23:30
Then a suggestion;- linking a control for control within the script e.g self.getControl(id), would it be tricky to allow names like self.getControl('My special button') maybe by utilizing the description field.



Just set variables at the top of your script or inside the windowxml class.

CONTROL_MY_SPECIAL_BUTTON = 100

self.getControl( CONTROL_MY_SPECIAL_BUTTON ).setLabel("ok")

remember inside the class, you'll need to add "self."

Basje
2007-05-18, 00:28
I have question regarding the order in which the media files are found.

I have a script which folder looks like this:

Script folder: Q:\scripts\Uitzendinggemist
Skin folder: Q:\scripts\Uitzendinggemist\skins\Project Mayhem III\
Skin file: Q:\scripts\Uitzendinggemist\skins\Project Mayhem III\pal\progwindow.xml
Skin media folder: Q:\scripts\Uitzendinggemist\skins\Project Mayhem III\media\

Now in the media folder is a file: 1on.png. it is in the xml file like this:<control type="button" id="101">
<!-- Do NOT remove. This control is needed by the script -->
<description>Nederland 1</description>
<visible>true</visible>
<posx>0</posx>
<posy>120</posy>
<width>60</width>
<height>60</height>
<onleft>50</onleft>
<onright>50</onright>
<onup>106</onup>
<ondown>102</ondown>
<aligny>center</aligny>
<texturefocus>1on.png</texturefocus>
<texturenofocus>1off.png</texturenofocus>
</control>


Now on my XBMC (both PC and real XBox) this goes fine. But some people actually get these errors:
21:29:26 M: 36941824 ERROR: Texture manager unable to load file: Q:\skin\Project Mayhem III\media\1on.png

So it seems that it cannot find the file? Because it is looking in the wrong folder.

So my question is: how does windowxml look for it's files? Does it default to the main Q:\Skins\Project Mayhem III\media\ folder and then, if the file is not found, it searches Q:\scripts\Uitzendinggemist.v2\skins\Project Mayhem III\media\?

And, is there anyway to have this reversed? First look into the Q:\scripts\Uitzendinggemist.v2\skins\Project Mayhem III\media\ then in the Q:\Skins\Project Mayhem III\media\?

(if somebody wants the complete script to see if more is wrong, please visit http://www.rieter.net/uitzendinggemist/ )

mrz
2007-05-18, 18:12
Nuka1195, agreed thats one way to do it. I think we both can agree that the code gets much more readable when using names instead of IDs. If joins by name was possible you could skip the constants.

Found a second bug.
If you have some controls in the XML file and then add some at runtime these new controls will collide with and therefor be treated like the reserved ones. For example ID 2 is the view button, ID 3 is sort and so on.
You can work arround this by adding 59 dummy controls and the delete them. In my mind self.addControl() should not use these reserved IDs.

mrz
2007-05-18, 18:16
Hi Basje!

I had the same problem until I upgraded to XBMC-SVN_2007-05-14_rev8943-T3CH.rar found herehttp://217.118.215.116/

Nuka1195
2007-05-18, 19:57
mrz, guibuilder can use description as a key, but you would be missing some functionality that windowXML has.

<description> will not be used for id's in WindowXML, either use constants or assign each control to a dictionary, where you can use descriptions.

The conflicting controls is a issue that needs resolved.

Donno, with the latest commit of ControlGroup, did you forget the xbmcguimodule.cpp file, as it's not reference anywhere in that file.

mrz
2007-05-18, 21:52
Nuka1195 thanks for the clarification.
Regarding the cpp that's not me.

Nuka1195
2007-05-18, 22:33
mrz, no that was for Donno


Edit: but about the conflicting controls, can you add some dummy ones in the xml file, with the id you want, then just position and size them as you need them. I do think if there is a way to fix that it should be fixed. In the mean time maybe that will help.

mrz
2007-05-18, 23:53
I could but its a bit tricky. I'm using buttons to show a program calendar and I never know how many programs there will be. I'm currently using the add/delete procedure mentioned above. It works and does not affect anything else (as far as I have noticed).

Another question: <animation .... condition=!Control.HasFocus(90)>Conditional</animation>
It looks as if the condition is true only AFTER control 90 has been focused. Is this right?

Sorry if Im a pain in the ...

mrz
2007-05-19, 00:47
Nuka1195, actually, thinking about it, I could add them in the XML as invisible. I guess empty labels consumes least memory.

mrz
2007-05-19, 01:00
Did not work :-(

Nuka1195
2007-05-19, 01:11
You can't set them <visible>false</false> in the xml, you won't be able to set them visible. So either set them invisible in onInit() or if you can use a visible condition.

mrz
2007-05-19, 01:18
Yap, absolutely.
I thought I could block the IDs by keeping em invisible but unfortunately it looks as if self.addControl() also collides with the IDs used in the XML.

stanley87
2007-05-23, 01:05
Well done on the sticky!

Nuka1195
2007-05-24, 01:49
Any word on fixing the ControlGroup control?

It needs at a minimum a getControl() and addControl() method.

Oh and not freezing XBMC when you actually use the control :)

Nuka1195
2007-05-25, 01:44
I guess the rule of maintaining a feature you introduce, does not apply anymore.

Gamester17
2007-05-25, 09:59
is the WindowXML GUI toolkit documented in the XBMC wiki online-manual (http://www.xboxmediacenter.com/wiki/index.php?title=Xbox_Media_Center_Online_Manual) (should maybe have it's own article?)?

:eek:

donno
2007-05-27, 14:40
@nuka
This rule about maintaining stuff sounds new then, me points at kai :)
and its open source so you can fix it if you like.

If you comment is aimed at the Control Group. The only part of that I coded was to get it to at least compile. Sure I introduce it by committing but it’s not like it affects end users, it only affects those python developers trying to use it. I can revert the change if you want, else please feel free to complete it. I was sure at the time nano had it all working, but I guess not.

@Gamester17
Currently it isn't documented. Do you want me to create a new page and add some information about

Gamester17
2007-05-27, 14:59
@Gamester17
Currently it isn't documented. Do you want me to create a new page and add some information aboutYes please, (will the article be called "WindowXML GUI Toolkit (http://www.xboxmediacenter.com/wiki/index.php?title=WindowXML_GUI_Toolkit&action=edition=edit)", or just "WindowXML (http://www.xboxmediacenter.com/wiki/index.php?title=WindowXML&action=edit)"?) , thank you in advance

donno
2007-06-03, 08:51
Gamester17: its called WindowXML. its not quite fully documetented but its a start.

Good news :) thanks to a recent change to WindowXML by Nuka, getListItem now is fully functional.

You can now use teh set methods on it as it actually points to the real one not a dupe one with same info.


curItem = self.getListItem(self.getCurrentListPosition())
print curItem.getLabel()
curItem.setLabel("Test2")
print curItem.getLabel()
Should work now.



Just tested <visible>false</false> in the xml, and it works fine. did it on a label and a list.

mtz: self.getFocus() actually does the requivlent to self.getControl(self.getFocusId())) which will resuly in the unknown control, as the getControl can only convert controsl that has a python equvilent. Plan to make the getControl return a generic control at some stage. In WindowXML probley best to use getFocusID and do most things based on the id rather then the control object.

Nuka1195
2007-06-05, 18:55
I didn't fix getListItem()?

Your changes though work much better than the way I had it, good job.

About the getListSize(). Wouldn't it be better to keep the methods the same between regular lists and WindowXML lists?

This way you don't have to code specially for WindowXML.

Basje
2007-06-06, 00:13
Hi there,

I am making a script (Uitzendinggemist.v2) which uses WindowXML for windows, too make skinning possible.

But I run into a EXCEPTION ERROR that complete freezes my XBMC. It doesn't happen that every time. Much more on XBMC than XBMC_PC (Which makes it hard to debug). When it occurs, it is in this part of the script:
print("Processing Items into List")
for m in self.episodelistItems:
print ("item: ")
tmp = xbmcgui.ListItem(m.name, "", m.icon, m.icon)
print m.name
print m.icon
self.addItem(tmp)

the m.name and m.icon are both strings. The logfile reads this:

CThread::staticThread : Access violation at 0x00535f0a: Reading location 0x036c70b4

I run the T3CH R9113. More info on the script is in my sign. The code is from the chn_rtl.py in the Channels folder of the script.

stanley87
2007-06-06, 06:04
I also struck a similar problem. My problem also occurs allot more on the xbox than on the PC (memory problem?). It's when I add list items like you have, but I am using two methods of adding them, one is to add them to the top of the list, and the other is to add them to the bottom of the list - this problem annoyed me so much it ended my creative spree :-(

It appears to fail when used in a loop (multiple items being added), but not just when one item is added.

Basje
2007-06-06, 09:27
I also struck a similar problem. My problem also occurs allot more on the xbox than on the PC (memory problem?). It's when I add list items like you have, but I am using two methods of adding them, one is to add them to the top of the list, and the other is to add them to the bottom of the list - this problem annoyed me so much it ended my creative spree :-(

It appears to fail when used in a loop (multiple items being added), but not just when one item is added.

Although it is not great that something like this is happening, I am glad to hear I am not the only one experiencing the problem. The only thing that we need is a solution. Does this problem sound familiar to one of the Devs?

donno
2007-06-06, 11:10
@Nuka1195
I think on
As for getListSize(), the reason i didn't go with getSize is little bit ambious what it means, after all its a WindowXML, 'getSize implies it gets the size of the window' hence why i chose getListSize(), most the other stuff is getCurrentListPosition and getListItem. Ideally i would have pefered something like self.list.addItem() etc (where list is like a 'controlwindowlist' thats automatically part of the WindowXML like the :) otehr methods. The idea would be controlwindowlist ineheirt ControlList and overwrite the methods to provide the infomation from the 'window lists', but i wasn't sure about that.

I tried labeling most the 'WindowList' specific stuff with the 'List' in the name, plus then u don't get confused and think self is suddenly an actual list control.

My getListItem changes are in rev 9223, and few others things are different there as well.

Basje) i don't get an exception like that on XBMC_PC, yet to try my new script on XBOX with WindowXML :). (i had an older one taht used WindowXML and creates listitems/ on screen fine.

Both my scripts uses a loop to create items from an array :)
I might be able to release the new script as a new demo. (part of a bigger script i want to redo :)

Basje
2007-06-06, 11:40
@Nuka1195
Basje) i don't get an exception like that on XBMC_PC, yet to try my new script on XBOX with WindowXML :). (i had an older one taht used WindowXML and creates listitems/ on screen fine.

It only happens like once every 50 lists I try to fill on my XBMC_PC, but once very 10 lists on XBMC. The first is acceptable, but the latter is much to frequent.

stanley87
2007-06-11, 22:34
Basje, my problem has now fixed in REV 9286.
GIVE IT A TRY! :-D

Basje
2007-06-11, 22:50
Basje, my problem has now fixed in REV 9286.
GIVE IT A TRY! :-D

I saw the changelog and will do a build tomorrow. I will let you know the results.

Nuka1195
2007-07-06, 17:44
Some tips for using non-native controls in WindowXML.

1. wrap the control in a group. This allows setting it visible or hidden.
2. use xbmc.executebuiltin( "Skin.SetString(setting-name,setting-value") ) for any info you need to change(e.g.<info>Skin.String(AMT-thumbfolder)</info> for a multiimage control)
3. to use a media panel control. make sure you have a media list control and always reference the media list control for getListItem() and things.

Nuka1195
2007-07-12, 03:22
The getPosition() python method returns what the controls <posx>, <posy> tags are for a list control.

If the control is inside a group when the group has it's own <posx> or <posy>, or if there is a coordinates system. It does not take that into account.

Is thers a way to return the actual position?

I need the actual position to center a context menu.

jmarshall
2007-07-12, 03:56
Not at this point, no.

One way to do it would be to:

1. Grab controls position.

2. Iterate up through it's parents and add their positions.

3. Finally, add the window's position (may not be it's GetPosition() stuff due to conditional origins!)

Alternatively you could implement a CGUIWindow::GetControlPosition(id) routine that does the same thing but in a different way:

1. Iterate through controls. If the id matches, we return it's position + the window position.

2. Else, if it's a group, we call the groups' GetControlPosition function.

3. Once we have a position, we return it.

It's similar to how the mouse handling works (See FocusFromPoint and UnfocusFromPoint).

This will give you the position in the window's XML resolution coordinates relative to the screen. It's probably what you want, but may not be if the context menu's dialog was in a different coordinate system (unlikely though).

Cheers,
Jonathan

Nuka1195
2007-07-12, 05:24
[quote]It's probably what you want, but may not be if the context menu's dialog was in a different coordinate system (unlikely though)./QUOTE]

I can adjust in the context_menu.xml. That never occured to me. Since it's the same skin, won't be an issue. I didn't realize the coordinates was used if I set the position from python.

Thanks it works perfect, :)

I still like being able to grab the actual position, so maybe I'll see what I can do.

jmarshall
2007-07-12, 05:31
Note also, that any animations affect the final on-screen position, and these are only known at render time.

mrz
2007-07-13, 12:29
To me it looks as if there is a problem with the radiobutton control. Once a radiobutton have been fouces all on... functions halts (or reponds very slowly). The workaround is to instead combine button and checkmark. Im on SVN9530 but earlier versions have the same problem.
Xbmcgui never supported radiobuttons so it could be that WindowXML should not either

MrZ

Basje
2007-07-22, 13:19
Hi there,

is there anyway to switch lists via Python? I have two lists with different graphics with ID 50 and 51. How can I change from list 50 to 51 via my pythonscript?

Nuka1195
2007-07-22, 15:04
you need the reserved button with id=2. Don't do anything with it in code it will keep track and switch views of the lists between 50-59.

One thing I don't know why it does this, but after playing a video, when you return to the script, list 50 is viewable again. Maybe a skinning issue on my part, maybe because my other controls between 50-59 are not native python controls. They are wraplists and panels.

Basje
2007-07-22, 15:27
you need the reserved button with id=2. Don't do anything with it in code it will keep track and switch views of the lists between 50-59.

One thing I don't know why it does this, but after playing a video, when you return to the script, list 50 is viewable again. Maybe a skinning issue on my part, maybe because my other controls between 50-59 are not native python controls. They are wraplists and panels.
But then the views can only be switched using the button? I would like to be able to set the view from within the script. The user should not be able to switch manually. Is that possible?

Nuka1195
2007-07-23, 04:15
I haven't tried.

1. If any of the controls with id's 50-59 are not type="list", then try wrapping the individual control in a group.
2. then either setVisible(True) the list you want or the group. obviously setVisble(False) the other one.
3. you could have control 51 <visible>!Control.IsVisible(50)</visible> then just set control 50 hidden or visible as long as 50 is a type="list" then 51 would not need to be in a group even if it was type="panel"

jc85
2007-07-23, 14:46
Hi everyone,

Is there any way of changing the imagepath property of a multiimage control from a script? There's no mention of the multiimage control in the updated xbmcgui docs donno posted (which includes the new WindowXML classes).

I've tried guessing a few method names (setPath, setImagePath, setImage etc.) but had no luck so far, and I've looked through the SVN on SourceForge to try & find the relevant C++ files (winxml.cpp or windowxml.cpp?) but not managed to find anything - SourceForge's search tool didn't return anything either. I know a bit of C++ but have trouble understanding something as complex as XBMC, so I'm probably just looking in the wrong place :p

Thanks in advance for any help you can give!
JC

Nuka1195
2007-07-23, 15:14
The multiimage control is not a native python control, so no methods are available for it.

I use a skin setting.

In the script:
xbmc.executebuiltin( "Skin.SetString(AMT-chooser-thumbfolder,%s)" % ( os.path.join( self.base_path, choice, "media", "thumbs" ), ) )

In the xml file:
<control type="multiimage">
<posx>200</posx>
<posy>40</posy>
<width>241</width>
<height>135</height>
<info>Skin.String(AMT-chooser-thumbfolder)</info>
<timeperimage>2000</timeperimage>
<fadetime>500</fadetime>
<visible>!Control.IsVisible(504)</visible>
<animation effect="fade" time="200">VisibleChange</animation>
<aspectratio>keep</aspectratio>
</control>

jc85
2007-07-23, 16:25
Thanks! That's got me a bit closer, but I'm still having trouble.

If I use SetString to change a skin setting, then try & create a window from the same script, the multiimage controls aren't displayed (or they're displayed with no images loaded).

I know the SetString function worked, as I can read the string using a label control. If I comment out the line that sets the string & run the script again, the multiimage displays as expected (using the string value set from running the script the first time).

I've tried setting the string from the class's OnInit and __init__ functions, and in the main script before the window object is created, but still can't get it to work.

Any thoughts? Thanks :)

Nuka1195
2007-07-23, 16:29
Did you use the <info> tag or the <imagePath> tag?

Look at my example, using the <imagePath> got me at first.

jc85
2007-07-23, 16:40
No, I used the <info> tag (tried <imagePath> as well just to be sure).

When I set the string directly before creating the window, the images don't show. If I exit the script, comment out the line that calls the SetString function, then run the script again, the images display using the path I set the first time.

I can display the value of the string using the <info> tag of a label control regardless of when/where I called the SetString function, so I'm pretty stuck as to where the problem is.

Nuka1195
2007-07-23, 17:12
how old is your XBMC build? I set it from onInit() the first time then change it after the window is open. I also did a quick test from init() and it worked.

Post the xml and the revelant python code.

jc85
2007-07-23, 17:12
Sorry, I made a mistake in my earlier posts. After setting the string, I have to completely restart XBMC before the multiimage control will show. Calling the SetString function (even to set the string to the same value it already had) results in the multiimages not being displayed.

I've tried the script with a few different skins & had the same problem with each. Is there something wrong with my XBMC build? I'm using T3CH 2007-07-16 rev9578.

I've been using the following files to try & isolate the problem (trying to keep them as simple as possible):

In multiimage_test.py:

import xbmc, xbmcgui

xbmc.executebuiltin("Skin.SetString(multiimage-test, Q:\\test)")

class win(xbmcgui.WindowXML):
pass

w = win("customTest.xml", "Q:\skin")
w.doModal()
del w


In customTest.xml:

<window id="5599">
<controls>
<control type="label" id="101">
<info>Skin.String(multiimage-test)</info>
</control>

<control type="multiimage" id="102">
<posx>60</posx>
<posy>200</posy>
<width>130</width>
<height>98</height>
<info>Skin.String(multiimage-test)</info>
</control>
</controls>
</window>


After running the script, the label text is set to the value of multiimage-test (Q:\test), but no images are displayed. If I comment out the xbmc.executebuiltin line in the script, then restart XBMC and run the script again, the label shows the value set before and the multiimage displays, showing the correct images.

The problem exists with the same XBMC build on my Xbox and using the XBMC_PC program.

Nuka1195
2007-07-23, 17:28
w = win("customTest.xml", "Q:\skin")

escape the backslash, not your problem since the label shows though.


Get rid of the space after the comma shoulod fix it.
xbmc.executebuiltin("Skin.SetString(multiimage-test, Q:\\test)")

jc85
2007-07-23, 17:42
Excellent! Thanks a lot for your help. The fallback path was escaped properly in the script I'm working on, I just missed it in the test script. The problem was the space in the built-in function call. All working fine now :)

Nuka1195
2007-07-23, 17:44
Good, what script are you working on?

Basje
2007-07-23, 20:02
I haven't tried.

1. If any of the controls with id's 50-59 are not type="list", then try wrapping the individual control in a group.
2. then either setVisible(True) the list you want or the group. obviously setVisble(False) the other one.
3. you could have control 51 <visible>!Control.IsVisible(50)</visible> then just set control 50 hidden or visible as long as 50 is a type="list" then 51 would not need to be in a group even if it was type="panel"

Well, I must be doing something wrong. I have to controls of type="list" and they have ID 50 and 51. I added the <visible>!Control.IsVisible(50)</visible> to the control 51, but doesn't work. When I hide 50, 51 won't show.

the code in the script is in the onInit:
if not self.initialised:
self.getControl(50).setVisible(False)


and the XML looks like this: http://pastebin.com/m3e7d8adf

So I am lost. I hope you can help me out?

Nuka1195
2007-07-23, 23:00
then I would say id's 50-59 can only be controlled by XBMC.

Maybe Donno can enlighten us.

jc85
2007-07-23, 23:39
I'm working on an alternative home screen/launcher menu. I might have to make a separate skin for it depending on how complex it gets. It probably won't be of any use for most people, so I doubt I'll make it public, but you never know :D It's still a very early work in progress, but I'm pleased with how it's going so far - WindowXML's made development so much easier, I haven't written an XBMC script for a while & the GUI situation has really improved!

I share a house with quite a few friends. We've got our combined DVD collection ripped & stored on a network server (almost 2TB of XviD-encoded movies & TV series) and a few live TV channels being streamed over the network too. Between us we've got 6 xboxes, and XBMC is the main way we watch TV. We've been using it over 3 years now & have a pretty good feel for which features we use the most - I'm aiming to make just those features quicker to access, which is why it'll probably be useless for most users.

The menu's been inspired by a few things - mostly by the simplicity of the Wii menu and the PM3 style/colour scheme. Everything's loaded from XML at runtime, so it's easy to add, remove or reorganise channels. Navigation works over a number of pages, each page displaying 12 channels at a time, which can be accessed by browsing through the menu or entering a 3-digit channel number using the Xbox remote control (with a bit of keymap.xml tweaking). Highlighting a channel changes the menu background & causes the selected channel button to cycle through a set of images (the result of my multiimage headaches!)

"Channels" can represent many different features of XBMC - a script, a direct file/stream link, access to a network share using the video/music browser, an XBMC window (e.g. weather) or an XBE file. I'm going to add buttons for Settings & the power menu to the bar at the bottom of the screen but haven't got round to it yet.

Like I said, it's not very mature yet - the UI still needs work & there's absolutely no error checking, but here's what it looks like so far:
http://img162.imageshack.us/img162/3729/previewqv4.th.jpg (http://img162.imageshack.us/my.php?image=previewqv4.jpg)

Freddo
2007-07-24, 04:05
I love that idea, and thinking about it a little if end users could customise channels through a context menu (maybe a dialog lets them chose what it points too and then a thumbnail) then anyone could use the skin and everyone could have it layed out however they liked.

to be honest I'm no coder (yet) so I'm unsure how difficult this would be, but the potential for this idea is massive I think.

jc85
2007-07-24, 04:50
Thanks :) glad you like it!

I'm actually quite suprised at how fast it's coming along - only got the idea a couple of days ago. The main menu window is working very well - there's a slight visual glitch when switching between pages, and the GUI needs cleaning up a bit. I need to add the settings & power menu buttons. I've already started a UI for enabling/disabling & reorganising channels. If there was interest in the channel menu idea I'd make the settings UI more fully featured.

Basically, there's a data directory which the script reads all the channel data from. Inside is an XML file containing the position of the channels within the menu and a subdirectory for each channel, each containing the images used & another XML file containing the channel name, type & action to take when it's selected, so each channel is an independant item.

I haven't tried this yet, but ideally I'd like to use a rar or zip archive to store the individual channel data, so adding a new channel is as simple as dropping the archive file into the data directory (or maybe downloading one straight from the web). I haven't looked into the support for archive files within Python yet - it's a pretty low priority since it wouldn't really affect how we'd use the menu here, but might be a useful feature if I ever released it.

If you've got any other ideas I'd welcome them! I've been developing small things for a while now (for XBMC, Windows, web etc) but only for use by myself & friends - I've never posted anything online. If people think this has potential I'll put more work into it :D

And many, many, many thanks to donno for creating WindowXML, without which this would've been very difficult, perhaps even impossible.

Freddo
2007-07-24, 04:59
It'd be especially awesome if channels could be defined per-user on the system for those of us with less xboxes than yourself :D

jc85
2007-07-24, 05:08
Good idea :) if anyone's got any pointers on how XBMC's profiles work (I've never had a use for them) and if the info can be accessed from a python script, then I'm willing to give it a go.

Basje
2007-07-25, 00:39
Well, I continued without the possibility to change the view from within Python. To do this, I added a normal list with ID 70 and made it hidden. Now I can switch from list 50 to 70 by toggling the visibility.

HOWEVER: I changed the list 50 to a panel instead of a list. Now the setVisible() methode gives me the error:

Exception: Unknown control type for python

When I change it back to List, all is fine again. Is this a bug in WindowXML?

Nuka1195
2007-07-25, 01:40
no, as i've stated before. the panel is not a native python control. Wrap it in a controlgroup and set the group visible. adjust your <visible> tags to match.

Basje
2007-07-25, 09:19
no, as i've stated before. the panel is not a native python control. Wrap it in a controlgroup and set the group visible. adjust your <visible> tags to match.

You're completely right. Forgot that :(. My bad.

chunk_1970
2007-08-10, 12:21
Hi,

Im in the progress of modifying my Torrent-X script to use WindowXml. All the code has been changed and is working but using the newer xml skin files when you have the item focused in a list is it possible to display extra info. Can i just add extra entries to the ListItem or is there another way.

I would like the ability to display all the other info I have on a list item when its focused..

Basje
2007-08-10, 12:25
Hi,

Im in the progress of modifying my Torrent-X script to use WindowXml. All the code has been changed and is working but using the newer xml skin files when you have the item focused in a list is it possible to display extra info. Can i just add extra entries to the ListItem or is there another way.

I would like the ability to display all the other info I have on a list item when its focused..
Well, I did this by catching the Up and Down actions in the OnAction methode of WindowXML. If those two actions occur, I fire a custom methode OnKeyUpDown which contains the code that displays info for the currently selected item.

See http://code.google.com/p/xot-uzg/ for my script. It is called Uitzendinggemist.v2 (it's dutch, but the coding comments are english). The part that I am referring to is in the libs\chn_class.py file.

chunk_1970
2007-08-10, 12:29
cheers...superfast response..

I'll have a look at your code..

chunk_1970
2007-08-10, 12:38
Thats nice but I was hoping for xbmc/python to do the work without any real additional coding..

Nuka1195
2007-08-10, 15:00
yes you can, sort of. I do this in AMT with the showtimes. JMarshall just added this ability.

I don't have any thumbs in that list. If you have just a thumb then use the icon.

Set the list item: listitem = xbmcgui("Label1", "label2", "Extra info1", "Thumb or extra info 2")

then for your label set it's info tag:
<info>ListItem.ActualIcon</info> <- returns Extra Info1
<info>ListItem.Thumb</info> <- returns Thumb or Extra Info2

Is this what you wanted?

chunk_1970
2007-08-10, 16:50
Yes that does sound alot less hassle. Would be nice if we could have more available labels in Listitem for future use..Saves the need to have threading on the record number to pick up extra info..

Lovely Jubbly..

Nuka1195
2007-08-10, 17:11
If anybody could point me in the direction of where listitem.* labels are set I could have a look at creating a new method, but I couldn't find it.

jmarshall
2007-08-11, 01:25
They're properties of the CFileItem class, which is derived from CGUIListItem.

The first thing that you'll need to do is change CGUIListItem -> CFileItem in the python functions.

You can then do things like:

item->GetMusicInfoTag()->SetArtist(artist) etc. For MusicInfoTag and PictureInfoTag you'll have to set the Loaded bool as well for the info to show up.

It might pay to have an "indexed" function where you pass a string for the index and the string to set.

That should give you another 20 or so strings to play with :p

Note that it is recommended that you only set one of the tag items (eg Music, Picture, or Video) and not all 3, though there will be no problems in doing so, other than some of the listitems refer to both music and video, so if you have the musicinfotag stuff set as loaded, but are wanting to refer to the videoinfotag the infomanager will pick the music one, even if it's empty (eg Ratings for instance). It also consumes more memory having both.

Cheers,
Jonathan

chunk_1970
2007-08-11, 16:08
The extra functionality would be sweet.

The listitem mod in the last xbmc release works really well being able to replace the second icon with additional text info..

bortoni
2007-08-20, 17:48
I have a small question. I'm looking at the WindowXMLExample that is in svn. I want to be able to have second label in a list but have it invisible. In the #xbmc-scripts channel I was given the suggestion that I could use the <visible> tag to do this. However, in the sample script above, I can't find anywhere in the XML file for it where list items are described.

Where could I make this change? As I mentioned, I'm learning with the example so if anyone can provide a response based on it I'd really appreciate it.

Thanks.

Nuka1195
2007-08-21, 03:59
@chunk1970, checkout the new setInfo() method added to the listitem

@bortoni, make label2 <visible>false<visible> that was taken from amt credits xml file, there should be plenty of examples in that script.


<control type="list" id="101">
<description>Team Credits List</description>
<posx>33</posx>
<posy>100</posy>
<width>360</width>
<height>60</height>
<scrolltime>200</scrolltime>
<itemlayout height="20">
<control type="label">
<posx>3</posx>
<posy>1</posy>
<width>200</width>
<height>18</height>
<font>font10</font>
<aligny>center</aligny>
<align>left</align>
<info>ListItem.Label</info>
</control>
<control type="label">
<posx>335</posx>
<posy>1</posy>
<width>150</width>
<height>18</height>
<font>font10</font>
<aligny>center</aligny>
<align>right</align>
<info>ListItem.Label2</info>
</control>
</itemlayout>
<focusedlayout height="20">
<control type="label">
<posx>3</posx>
<posy>1</posy>
<width>200</width>
<height>18</height>
<font>font10</font>
<aligny>center</aligny>
<align>left</align>
<info>ListItem.Label</info>
</control>
<control type="label">
<posx>335</posx>
<posy>1</posy>
<width>150</width>
<height>18</height>
<font>font10</font>
<aligny>center</aligny>
<align>right</align>
<info>ListItem.Label2</info>
</control>
</focusedlayout>
</control>

Nuka1195
2007-09-16, 20:22
<animation effect="rotate" center="128,128" start="0" end="-360" time="60000" loop="true" condition="Control.IsVisible(100)">Conditional</animation>

The above animation works with a WindowXML, but does not work with WindowXMLDialog. Can anything be done to fix this?

I know WindowClose animations won't work with dialogs, but this one would be helpful.

Thanks

Nuka1195
2007-09-17, 23:57
friendly bump for my previous question

jmarshall
2007-09-18, 00:23
Would you mind providing a script and/or xml files with it all setup?

/me is lazy :p

Nuka1195
2007-09-18, 16:27
Thanks for the fix JMarshall

BigBellyBilly
2008-02-29, 15:26
Somtime ago in this thread, Basje posted a question about the lookup order that's used to find an image, but I didn't see an answer in reply.

My question is simliar;

Can/Does/Could WindowXML fallback to lookup images in the Default media folder if
not in <current skin name>/media folder ?
That way there wouldn't be a need to include duplicate images that are common to several skins, in every skin media folder.

If there's a way to get it to behave like that, please tell me ?

Thanks
BBB

borick
2008-08-30, 00:26
Regarding the built in lists in WindowXML...

- When I use an icon image, and I specify path to the image, it works. When I delete the list item, and recreate the image file, then specify path to same image file, the image shown is same as last time, i.e. the image doens't refresh to the new image. At least, this behaviour occured in builds previous to 08-25 by T3CH. On the T3CH 08-25 build this behaviour was somewhat rectified. Can anyone confirm or deny this behavior?

- I get memory problems, out of buffer memory errors when using WindowXML in conjunction with a list container containing thumbnail images. I didn't receive the same errors using a list control under guibuilder.py. Confirm or deny?

Thanks!

Gamester17
2008-08-30, 00:34
*NOTICE* Code changes that affect all scripts:
http://xbmc.org/forum/showthread.php?t=35849

:rolleyes:

borick
2008-08-31, 00:02
Ok i discover the true source of the problem causing my memory errors. I had too much work being done in OnInit which shouldnt be there.

Do not put any cpu intensive code in onInit! Keep it fast!!!

Temhil
2008-12-18, 18:12
Hi Guys,

I am pretty new using WindowXML (I was using the old API before for doing script GUI, but WindowXML is 100 time more powerful!) and I have notice a weird thing at least on Window (and Mac too) platform when I use a mouse.

If with my mouse I click on a button, that works, nice!
BUT, if I try to do the same with a list item, nothing happens, I need to press Enter.
Selection of the item works, but not the mouse click.

I tried to capture the mouse event in the OnAction methose using code from key.h
ACTION_MOUSE 90
ACTION_MOUSE_CLICK 100
ACTION_MOUSE_LEFT_CLICK 100
ACTION_MOUSE_RIGHT_CLICK 101
ACTION_MOUSE_MIDDLE_CLICK 102

And the only one i can capture is 90 (mouse mouvement so), but Mouse click, nothing.

It is anoying since the user on windows can not click on an item on a list with only the mouse, he needs to use the keyboard.

Do you have any idea, why it is like that? Or what am I doing wrong?

Thanks in advance for your help.

jmarshall
2008-12-18, 23:32
Sounds like they're not being passed on from the XBMC side. Post a trac ticket about it including the exact actions you wish to be able to pick up and so on.

Basje
2008-12-18, 23:47
Sounds like they're not being passed on from the XBMC side. Post a trac ticket about it including the exact actions you wish to be able to pick up and so on.

If this could be done, it would be awsome!

Nuka1195
2008-12-19, 00:31
i posted one awhile ago. ignored as usual.

catalytic
2008-12-19, 05:36
Hi,

I have started playing with XBMC only a few days back. So, please excuse me if following seem too dumb a question ( I too have a feeling that I am missing something obvious here):

I did not find an API for adding listitems to a specific list. So, in a window that has more than one list with id outside 50-60 range, how is the "window list" determined?

Is there a way to update such lists in any way?

Any inputs would be much appreciated.

Thanks much in advance.

Nuka1195
2008-12-19, 16:17
use a different id and use self.getControl(id).addItem()

links to pydocs in my signature

catalytic
2008-12-20, 20:06
Thanks Nuka1195, for the quick response, . I did try this before posting the question, but wasn't sure - so didn't look deeper when it didn't work the first time.