xboxscene.org forums

Author Topic: Gui Builder  (Read 111 times)

nuka1195

  • Archived User
  • Sr. Member
  • *
  • Posts: 290
Gui Builder
« on: July 31, 2006, 10:24:00 PM »

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
Logged

nuka1195

  • Archived User
  • Sr. Member
  • *
  • Posts: 290
Gui Builder
« Reply #1 on: August 03, 2006, 11:50:00 AM »

Added: <resolution> optional tag, so now the skinner can have complete control. options are '1080i', '720p', '480p', '480p16x9', 'ntsc', 'ntsc16x9', 'pal', 'pal16x9', 'pal60', 'pal6016x9'

GetConditionalVisibility(), GetSkinPath(), LoadReferences(), LoadIncludes(), ResolveInclude()
The above functions were translated from Xbox Media Center's source, thanks Developers.

Edit: Also moved the getCondVisibilty() check to the end of the try block. Now it should'nt error even without a newer build, though <visible> tags won't work. Also changed the keyword arguments to be similar.

CODE
import  guibuilder
guibuilder.GUIBuilder(win, skinXML[, imagePath, title, line1, dlg, pct, fastMethod])

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.
dialog        : [opt] A current progress Dialog, If passed can be used
        as a continuation of your script intialization.
pct        : [opt] The percent already completed.
fastMethod    : [opt] No dialogs, No and
        doesn't use references.xml.


This post has been edited by nuka1195: Aug 3 2006, 06:51 PM
Logged