This module allows you to skin your python scripts with a standard XBMC skinfile.xml.
You may pass a dialog and a percent finished as a continuation for your scripts initialization.
It creates a dictionary of your controls, with the controls <id> as the key (self.controls{id : control}).
It also creates a dictionary of visibilty conditions, with the controls <id> as the key
(self.visibility{id : condition}).
e.g. self.controls[300].setVisible(xbmc.getCondVisibility(self.visibility[300]))
It creates a dictionary of your controls positions in a tuple, with the controls <id> as the key
(self.positions{id : (x, y)}).
It also creates a list variable for a coordinates based window (self.coordinates[x, y]).
e.g. self.controls[300].setPosition(self.positions[300][0] + self.coordinates[0], self.positions[300][1] + self.coordinates[1])
The Includes & references functions were translated from Xbox media center's source, thanks Developers.
A special thanks to elupus for shaming me into doing it the right way. (IMG:
style_emoticons/default/smile.gif)
Nuka1195
Usage:
CODE
import guibuilder
guibuilder.GUIBuilder(win, SkinXML[, ImagePath, title, line1, dlg, pct])
win : Your window or windowdialog class. passed as self.
SkinXML : The xml file including path you want to use.
ImagePath : [opt] The path to any custom images. If you precede the
texture with a \ in the xml, it will use the ImagePath.
Do not include the ending \ in ImagePath.
\button.png will use ImagePath.
title : [opt] Title you want to use for the progress dialog.
line1 : [opt] The first line of the progress dialog.
dlg : [opt] A current progress Dialog, If passed can be used
as a continuation of your script intialization.
pct : [opt] The percent already completed.
get "guibuilder.py" module and an example "GUI Builder.zip"
http://xbmc.cvs.sourceforge.net/xbmc/XBMC/scripts/The zip contains examples of a Window and a WindowDialog.
This module requires a build with the xbmc.getCondVisibility() method added July 27th.
Animations are ignored. Not all conditional visibilty tags work with python. (e.g. Control.HasFocus(id) and Control.IsVisible(id))
It uses the location of the includes.xml file it finds as the source for setCoordinateResolution(), This may have to change.
Post at
http://www.xbmc.xbox-scene.com/forum/showthread.php?t=21315 with any suggestions or questions.
This post has been edited by nuka1195: Aug 1 2006, 05:29 AM