Kodi Community Forum

Full Version: How to define a basic list item
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am very new to Kodi and I am struggling with something very basic. I'm starting to get the hang of the skinner, but i am unsure how I define a list item within the <info> tags:

Code:
<control type="list" id="50">
      <description>My first list container</description>
      <left>80</left>
      <top>60</top>
      <width>250</width>
      <height>200</height>
      <visible>true</visible>
      <onup>2</onup>
      <ondown>3</ondown>
      <onleft>1</onleft>
      <onright>1</onright>
      <viewtype label="3D list">list</viewtype>
      <orientation>vertical</orientation>
      <pagecontrol>25</pagecontrol>
      <autoscroll>true</autoscroll>
      <scrolltime tween="sine" easing="out">200</scrolltime>
      <itemlayout width="250" height="29">
                <control type="image">
                        <left>5</left>
                        <top>3</top>
                        <width>22</width>
                        <height>22</height>
                        <info>ListItem.Icon</info>
                </control>
                <control type="label">
                        <left>30</left>
                        <top>3</top>
                        <width>430</width>
                        <height>22</height>
                        <font>font13</font>
                        <aligny>center</aligny>
                        <selectedcolor>green</selectedcolor>
                        <align>left</align>
                        <info>ListItem.Label</info>
                </control>
                <control type="label">
                        <left>475</left>
                        <top>3</top>
                        <width>300</width>
                        <height>22</height>
                        <font>font13</font>
                        <aligny>center</aligny>
                        <selectedcolor>green</selectedcolor>
                        <textcolor>grey</textcolor>
                        <align>right</align>
                        <info>ListItem.Label2</info>
                </control>
      </itemlayout>
      <focusedlayout height="29" width="250">
                <control type="image">
                        <width>485</width>
                        <height>29</height>
                        <left>0</left>
                        <top>0</top>
                        <visible>Control.HasFocus(50)</visible>
                        <texture>list-focus.png</texture>
                </control>
                <control type="image">
                        <left>5</left>
                        <top>3</top>
                        <width>22</width>
                        <height>22</height>
                        <info>ListItem.Icon</info>
                </control>
                <control type="label">
                        <left>30</left>
                        <top>3</top>
                        <width>430</width>
                        <height>22</height>
                        <font>font13</font>
                        <aligny>center</aligny>
                        <selectedcolor>green</selectedcolor>
                        <align>left</align>
                        <info>ListItem.Label</info>
                </control>
                <control type="label">
                        <left>475</left>
                        <top>3</top>
                        <width>300</width>
                        <height>22</height>
                        <font>font13</font>
                        <aligny>center</aligny>
                        <selectedcolor>green</selectedcolor>
                        <textcolor>grey</textcolor>
                        <align>right</align>
                        <info>ListItem.Label2</info>
                </control>
      </focusedlayout>
</control>

...my expectation here is that I write some python that will define a list, that the skinner then picks up. As I say I am really at the beginner/tinkering around stage and I am only looking for create a simple list of some text items to populate the list control. Could someone please post an example of what I need to code?
What you're asking about is making a custom gui skin for a plugin.
That is an intermediate topic.

you want to use $INFO not <info>

the kodi skinning manual was very helpful for me

Code:
<control type="image">
                        <left>5</left>
                        <top>3</top>
                        <width>22</width>
                        <height>22</height>
                        <texture>$INFO[ListItem.Art(thumb)]</texture>
                </control>
                <control type="label">
                        <left>30</left>
                        <top>3</top>
                        <width>430</width>
                        <height>22</height>
                        <font>font13</font>
                        <aligny>center</aligny>
                        <align>left</align>
                        <label>$INFO[ListItem.Label]</label>
                </control>

sample xml from my github
(2017-07-26, 07:09)gedisony Wrote: [ -> ]What you're asking about is making a custom gui skin for a plugin.
That is an intermediate topic.

you want to use $INFO not <info>

the kodi skinning manual was very helpful for me

Code:
<control type="image">
                        <left>5</left>
                        <top>3</top>
                        <width>22</width>
                        <height>22</height>
                        <texture>$INFO[ListItem.Art(thumb)]</texture>
                </control>
                <control type="label">
                        <left>30</left>
                        <top>3</top>
                        <width>430</width>
                        <height>22</height>
                        <font>font13</font>
                        <aligny>center</aligny>
                        <align>left</align>
                        <label>$INFO[ListItem.Label]</label>
                </control>

sample xml from my github

Hi, thanks for replying. I am still new to Kodi development and my question is much more basic than that on your github. I've read the skinning manual before and I get what the purpose of listitem.label is doing. What I don't get though is that presumably this is a list or dictionary defined in a python script somewhere. I am unsure of:

1. What the syntax for that would look like.
2. Which script this would need to be in. Would it be defaul.py or one of the other scripts stored in the 'lib' folder. If you could point me in the right direction it would be appreciated.
For just starting out with kodi development, start with the howto/tutorials.
do the video plugin first.

listitems is created by addons or by kodi itself.
individual listitems are created and added into a directory list item before being presented to the user.
the tutorial covers most of this stuff.

for addons, the listitems are created in the addon code of which default.py is part of.
This depends on the developer, there is no rule as to where those pieces of code are located.