Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.

Code based skin access. More...

Modules

 Subclass - ControlSpin
 Used for cycling up/down controls.
 
 Subclass - ControlLabel
 Used to show some lines of text.
 
 Subclass - ControlEdit
 
 Subclass - ControlList
 Used for a scrolling lists of items. Replaces the list control.
 
 Subclass - ControlFadeLabel
 Used to show multiple pieces of text in the same position, by fading from one to the other.
 
 Subclass - ControlTextBox
 Used to show a multi-page piece of text.
 
 Subclass - ControlImage
 Used to show an image.
 
 Subclass - ControlProgress
 Used to show the progress of a particular operation.
 
 Subclass - ControlButton
 A standard push button control.
 
 Subclass - ControlGroup
 Used to group controls together..
 
 Subclass - ControlRadioButton
 For control a radio button (as used for on/off settings).
 
 Subclass - ControlSlider
 Used for a volume slider.
 

Classes

class  XBMCAddon::xbmcgui::Control
 

Functions

 XBMCAddon::xbmcgui::Control::getId () inline bool operator
 
 XBMCAddon::xbmcgui::Control::getX ()
 
 XBMCAddon::xbmcgui::Control::getY ()
 
 XBMCAddon::xbmcgui::Control::getHeight ()
 
 XBMCAddon::xbmcgui::Control::getWidth ()
 
 XBMCAddon::xbmcgui::Control::setEnabled (...)
 
 XBMCAddon::xbmcgui::Control::setVisible (...)
 
 XBMCAddon::xbmcgui::Control::isVisible (...)
 
 XBMCAddon::xbmcgui::Control::setVisibleCondition (...)
 
 XBMCAddon::xbmcgui::Control::setEnableCondition (...)
 
 XBMCAddon::xbmcgui::Control::setAnimations (...)
 
 XBMCAddon::xbmcgui::Control::setPosition (...)
 
 XBMCAddon::xbmcgui::Control::setWidth (...)
 
 XBMCAddon::xbmcgui::Control::setHeight (...)
 
 XBMCAddon::xbmcgui::Control::setNavigation (...)
 
 XBMCAddon::xbmcgui::Control::controlUp (...)
 
 XBMCAddon::xbmcgui::Control::controlDown (...)
 
 XBMCAddon::xbmcgui::Control::controlLeft (...)
 
 XBMCAddon::xbmcgui::Control::controlRight (...)
 

Detailed Description

Code based skin access.

Offers classes and functions that manipulate the add-on gui controls.


Class: Control()

Code based skin access.

Kodi is noted as having a very flexible and robust framework for its GUI, making theme-skinning and personal customization very accessible. Users can create their own skin (or modify an existing skin) and share it with others.

Kodi includes a new GUI library written from scratch. This library allows you to skin/change everything you see in Kodi, from the images, the sizes and positions of all controls, colours, fonts, and text, through to altering navigation and even adding new functionality. The skin system is quite complex, and this portion of the manual is dedicated to providing in depth information on how it all works, along with tips to make the experience a little more pleasant.


Function Documentation

◆ controlDown()

void XBMCAddon::xbmcgui::Control::controlDown (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> controlDown(control) </big></font></span></code></h4> \endhtmlonly

Set's the controls down navigation.

Parameters
controlcontrol object - control to navigate to on down.
Exceptions
TypeErrorif one of the supplied arguments is not a control type.
ReferenceErrorif one of the controls is not added to a window.
Note
You can also use setNavigation(). Set to self to disable navigation.

Example:

...
self.button.controlDown(self.button1)
...

◆ controlLeft()

void XBMCAddon::xbmcgui::Control::controlLeft (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> controlLeft(control) </big></font></span></code></h4> \endhtmlonly

Set's the controls left navigation.

Parameters
controlcontrol object - control to navigate to on left.
Exceptions
TypeErrorif one of the supplied arguments is not a control type.
ReferenceErrorif one of the controls is not added to a window.
Note
You can also use setNavigation(). Set to self to disable navigation.

Example:

...
self.button.controlLeft(self.button1)
...

◆ controlRight()

void XBMCAddon::xbmcgui::Control::controlRight (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> controlRight(control) </big></font></span></code></h4> \endhtmlonly

Set's the controls right navigation.

Parameters
controlcontrol object - control to navigate to on right.
Exceptions
TypeErrorif one of the supplied arguments is not a control type.
ReferenceErrorif one of the controls is not added to a window.
Note
You can also use setNavigation(). Set to self to disable navigation.

Example:

...
self.button.controlRight(self.button1)
...

◆ controlUp()

void XBMCAddon::xbmcgui::Control::controlUp (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> controlUp(control) </big></font></span></code></h4> \endhtmlonly

Set's the controls up navigation.

Parameters
controlcontrol object - control to navigate to on up.
Exceptions
TypeErrorif one of the supplied arguments is not a control type.
ReferenceErrorif one of the controls is not added to a window.
Note
You can also use setNavigation(). Set to self to disable navigation.

Example:

...
self.button.controlUp(self.button1)
...

◆ getHeight()

XBMCAddon::xbmcgui::Control::getHeight ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getHeight() </big></font></span></code></h4> \endhtmlonly

Returns the control's current height as an integer.

Returns
int - Current height

Example:

...
height = self.button.getHeight()
...

◆ getId()

XBMCAddon::xbmcgui::Control::getId ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getId() </big></font></span></code></h4> \endhtmlonly

Returns the control's current id as an integer.

Returns
int - Current id

Example:

...
id = self.button.getId()
...

◆ getWidth()

XBMCAddon::xbmcgui::Control::getWidth ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getWidth() </big></font></span></code></h4> \endhtmlonly

Returns the control's current width as an integer.

Returns
int - Current width

Example:

...
width = self.button.getWidth()
...

◆ getX()

XBMCAddon::xbmcgui::Control::getX ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getX() </big></font></span></code></h4> \endhtmlonly

Returns the control's current X position.

Returns
int - Current X position

Example:

...
posX = self.button.getX()
...

◆ getY()

XBMCAddon::xbmcgui::Control::getY ( )

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> getY() </big></font></span></code></h4> \endhtmlonly

Returns the control's current Y position.

Returns
int - Current Y position

Example:

...
posY = self.button.getY()
...

◆ isVisible()

bool XBMCAddon::xbmcgui::Control::isVisible (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> isVisible() </big></font></span></code></h4> \endhtmlonly

Get the control's visible/hidden state.


v18 Python API changes:
New function added.

Example:

...
if self.button.isVisible():
...

◆ setAnimations()

void XBMCAddon::xbmcgui::Control::setAnimations (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setAnimations([(event, attr,)*]) </big></font></span></code></h4> \endhtmlonly

Set's the control's animations.

[(event,attr,)*]: list - A list of tuples consisting of event and attributes pairs.

Animating your skin

Parameters
eventstring - The event to animate.
attrstring - The whole attribute string separated by spaces.

Example:

...
# setAnimations([(event, attr,)*])
self.button.setAnimations([('focus', 'effect=zoom end=90,247,220,56 time=0',)])
...

◆ setEnableCondition()

void XBMCAddon::xbmcgui::Control::setEnableCondition (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setEnableCondition(enable) </big></font></span></code></h4> \endhtmlonly

Set's the control's enabled condition.

Allows Kodi to control the enabled status of the control.

List of Conditions

Parameters
enablestring - Enable condition.

Example:

...
# setEnableCondition(enable)
self.button.setEnableCondition('System.InternetState')
...

◆ setEnabled()

void XBMCAddon::xbmcgui::Control::setEnabled (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setEnabled(enabled) </big></font></span></code></h4> \endhtmlonly

Set's the control's enabled/disabled state.

Parameters
enabledbool - True=enabled / False=disabled.

Example:

...
self.button.setEnabled(False)
...

◆ setHeight()

void XBMCAddon::xbmcgui::Control::setHeight (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setHeight(height) </big></font></span></code></h4> \endhtmlonly

Set's the controls height.

Parameters
heightinteger - height of control.

Example:

...
self.image.setHeight(100)
...

◆ setNavigation()

void XBMCAddon::xbmcgui::Control::setNavigation (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setNavigation(up, down, left, right) </big></font></span></code></h4> \endhtmlonly

Set's the controls navigation.

Parameters
upcontrol object - control to navigate to on up.
downcontrol object - control to navigate to on down.
leftcontrol object - control to navigate to on left.
rightcontrol object - control to navigate to on right.
Exceptions
TypeErrorif one of the supplied arguments is not a control type.
ReferenceErrorif one of the controls is not added to a window.
Note
Same as controlUp(), controlDown(), controlLeft(), controlRight(). Set to self to disable navigation for that direction.

Example:

...
self.button.setNavigation(self.button1, self.button2, self.button3, self.button4)
...

◆ setPosition()

void XBMCAddon::xbmcgui::Control::setPosition (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setPosition(x, y) </big></font></span></code></h4> \endhtmlonly

Set's the controls position.

Parameters
xinteger - x coordinate of control.
yinteger - y coordinate of control.
Note
You may use negative integers. (e.g sliding a control into view)

Example:

...
self.button.setPosition(100, 250)
...

◆ setVisible()

void XBMCAddon::xbmcgui::Control::setVisible (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setVisible(visible) </big></font></span></code></h4> \endhtmlonly

Set's the control's visible/hidden state.

Parameters
visiblebool - True=visible / False=hidden.

Example:

...
self.button.setVisible(False)
...

◆ setVisibleCondition()

void XBMCAddon::xbmcgui::Control::setVisibleCondition (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setVisibleCondition(visible[,allowHiddenFocus]) </big></font></span></code></h4> \endhtmlonly

Set's the control's visible condition.

Allows Kodi to control the visible status of the control.

List of Conditions

Parameters
visiblestring - Visible condition
allowHiddenFocus[opt] bool - True=gains focus even if hidden

Example:

...
# setVisibleCondition(visible[,allowHiddenFocus])
self.button.setVisibleCondition('[Control.IsVisible(41) + !Control.IsVisible(12)]', True)
...

◆ setWidth()

void XBMCAddon::xbmcgui::Control::setWidth (   ...)

@brief \htmlonly <h4><code><span style="font-style: italic;">Function: </span><span style="font-style: bold;"><font color=31363b><big> setWidth(width) </big></font></span></code></h4> \endhtmlonly

Set's the controls width.

Parameters
widthinteger - width of control.

Example:

...
self.image.setWidth(100)
...