Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
Subclass - WindowXML

GUI xml window class. More...

Topics

 Subclass - WindowDialogXML
 GUI xml window dialog
 

Classes

class  XBMCAddon::xbmcgui::WindowXML
 

Functions

 XBMCAddon::xbmcgui::WindowXML::addItem (...)
 

Function: addItem(item[, position])


Add a new item to this Window List.
 
 XBMCAddon::xbmcgui::WindowXML::addItems (...)
 

Function: addItems(items)


Add a list of items to to the window list.
 
 XBMCAddon::xbmcgui::WindowXML::removeItem (...)
 

Function: removeItem(position)


Removes a specified item based on position, from the Window List.
 
 XBMCAddon::xbmcgui::WindowXML::getCurrentListPosition ()
 

Function: getCurrentListPosition()


Gets the current position in the Window List.
 
 XBMCAddon::xbmcgui::WindowXML::setCurrentListPosition (...)
 

Function: setCurrentListPosition(position)


Set the current position in the Window List.
 
 XBMCAddon::xbmcgui::WindowXML::getListItem (...)
 

Function: getListItem(position)


Returns a given ListItem in this Window List.
 
 XBMCAddon::xbmcgui::WindowXML::getListSize ()
 

Function: getListSize()


Returns the number of items in this Window List.
 
 XBMCAddon::xbmcgui::WindowXML::clearList ()
 

Function: clearList()


Clear the Window List.
 
 XBMCAddon::xbmcgui::WindowXML::setContainerProperty (...)
 

Function: setContainerProperty(key, value)


Sets a container property, similar to an infolabel.
 
 XBMCAddon::xbmcgui::WindowXML::setContent (...)
 

Function: setContent(value)


Sets the content type of the container.
 
 XBMCAddon::xbmcgui::WindowXML::getCurrentContainerId (...)
 

Function: getCurrentContainerId()


Get the id of the currently visible container.
 

Detailed Description

GUI xml window class.

Class: xbmcgui.WindowXML(xmlFilename, scriptPath[, defaultSkin, defaultRes])

Creates a new xml file based window class.

Note
This class include also all calls from Window.
Parameters
xmlFilenamestring - the name of the xml file to look for.
scriptPathstring - path to script. used to fallback to if the xml doesn't exist in the current skin. (eg xbmcaddon.Addon().getAddonInfo('path'))
defaultSkin[opt] string - name of the folder in the skins path to look in for the xml. (default='Default')
defaultRes[opt] string - default skins resolution. (1080i, 720p, ntsc16x9, ntsc, pal16x9 or pal. default='720p')
isMedia[opt] bool - if False, create a regular window. if True, create a mediawindow. (default=False)
Exceptions
Exceptionif more then 200 windows are created.
Remarks
Skin folder structure is e.g. resources/skins/Default/720p

Deleting this window will activate the old window that was active and resets (not delete) all controls that are associated with this window.


v18 Python API changes
New param added isMedia.

Example:

..
win = xbmcgui.WindowXML('script-Lyrics-main.xml', xbmcaddon.Addon().getAddonInfo('path'), 'default', '1080i', False)
win.doModal()
del win
..

On functions defined input variable controlId (GUI control identifier) is the on window.xml defined value behind type added with id="..." and used to identify for changes there and on callbacks.

<control type="label" id="31">
<description>Title Label</description>
...
</control>
<control type="progress" id="32">
<description>progress control</description>
...
</control>

Function Documentation

◆ addItem()

void XBMCAddon::xbmcgui::WindowXML::addItem ( ...)

Function: addItem(item[, position])


Add a new item to this Window List.

Parameters
itemstring, unicode or ListItem - item to add.
position[opt] integer - position of item to add. (NO Int = Adds to bottom,0 adds to top, 1 adds to one below from top,-1 adds to one above from bottom etc etc )
  • If integer positions are greater than list size, negative positions will add to top of list, positive positions will add to bottom of list

Example:

..
self.addItem('Reboot Kodi', 0)
..

◆ addItems()

void XBMCAddon::xbmcgui::WindowXML::addItems ( ...)

Function: addItems(items)


Add a list of items to to the window list.

Parameters
itemsList - list of strings, unicode objects or ListItems to add.

Example:

..
self.addItems(['Reboot Kodi', 'Restart Kodi'])
..

◆ clearList()

void XBMCAddon::xbmcgui::WindowXML::clearList ( )

Function: clearList()


Clear the Window List.


Example:

..
self.clearList()
..

◆ getCurrentContainerId()

int XBMCAddon::xbmcgui::WindowXML::getCurrentContainerId ( ...)

Function: getCurrentContainerId()


Get the id of the currently visible container.


v17 Python API changes
Added new function.

Example:

..
container_id = self.getCurrentContainerId()
..

◆ getCurrentListPosition()

int XBMCAddon::xbmcgui::WindowXML::getCurrentListPosition ( )

Function: getCurrentListPosition()


Gets the current position in the Window List.


Example:

..
pos = self.getCurrentListPosition()
..

◆ getListItem()

ListItem * XBMCAddon::xbmcgui::WindowXML::getListItem ( ...)

Function: getListItem(position)


Returns a given ListItem in this Window List.

Parameters
positioninteger - position of item to return.

Example:

..
listitem = self.getListItem(6)
..

◆ getListSize()

int XBMCAddon::xbmcgui::WindowXML::getListSize ( )

Function: getListSize()


Returns the number of items in this Window List.


Example:

..
listSize = self.getListSize()
..

◆ removeItem()

void XBMCAddon::xbmcgui::WindowXML::removeItem ( ...)

Function: removeItem(position)


Removes a specified item based on position, from the Window List.

Parameters
positioninteger - position of item to remove.

Example:

..
self.removeItem(5)
..

◆ setContainerProperty()

void XBMCAddon::xbmcgui::WindowXML::setContainerProperty ( ...)

Function: setContainerProperty(key, value)


Sets a container property, similar to an infolabel.

Parameters
keystring - property name.
valuestring or unicode - value of property.
Note
Key is NOT case sensitive.
You can use the above as keywords for arguments and skip certain optional arguments.
Once you use a keyword, all following arguments require the keyword.

v17 Python API changes
Changed function from setProperty to setContainerProperty.

Example:

..
self.setContainerProperty('Category', 'Newest')
..

◆ setContent()

void XBMCAddon::xbmcgui::WindowXML::setContent ( ...)

Function: setContent(value)


Sets the content type of the container.

Parameters
valuestring or unicode - content value.

Available content types

Name Media
actors Videos
addons Addons, Music, Pictures, Programs, Videos
albums Music, Videos
artists Music, Videos
countries Music, Videos
directors Videos
files Music, Videos
games Games
genres Music, Videos
images Pictures
mixed Music, Videos
movies Videos
Musicvideos Music, Videos
playlists Music, Videos
seasons Videos
sets Videos
songs Music
studios Music, Videos
tags Music, Videos
tvshows Videos
videos Videos
years Music, Videos

v18 Python API changes
Added new function.

Example:

..
self.setContent('movies')
..

◆ setCurrentListPosition()

void XBMCAddon::xbmcgui::WindowXML::setCurrentListPosition ( ...)

Function: setCurrentListPosition(position)


Set the current position in the Window List.

Parameters
positioninteger - position of item to set.

Example:

..
self.setCurrentListPosition(5)
..