(2019-11-26, 20:28)black_eagle Wrote: I don't think you can do it like that. You need to add the items to the list container, then show that.
python:
self.container = self.getControl(6)
self.listitems = []
my_sample_list = ['item number 1', 'item number 2', 'item number 3' ]
for i in my_sample_list:
self.listitems.append(i)
self.container.addItems(self.listitems)
Definition of the list container
xml:
<control type="list" id="6">
<viewtype label="list_1">list</viewtype>
<left>180</left>
<top>180</top>
<width>700</width>
<height>361</height>
<pagecontrol>17</pagecontrol>
<onleft>5</onleft>
<onright>5</onright>
<onup>6</onup>
<ondown>6</ondown>
<orientation>vertical</orientation>
<scrolltime tween="Quadratic" easing="Out">1000</scrolltime>
<autoscroll>false</autoscroll>
<preloaditems>2</preloaditems>
<animation effect="fade" start="100" end="50" time="200" >Conditional</animation>
<itemlayout height="30">
<control type="label">
<left>68</left>
<top>0</top>
<width>650</width>
<height>28</height>
<font>font10</font>
<aligny>center</aligny>
<label>$INFO[ListItem.Label]</label>
</control>
</itemlayout>
<focusedlayout height="30">
<control type="label">
<left>68</left>
<top>0</top>
<width>650</width>
<height>28</height>
<font>font10</font>
<aligny>center</aligny>
<label>$INFO[ListItem.Label]</label>
</control>
</focusedlayout>
</control>
Add items to List containers was my first approach. In fact, I found all the information in this tutorial:
https://kodi.wiki/view/HOW-TO:Script_addon
I´ll try to explain clearly my real problem. Firstly I show you my python code:
python:
# define temporary lists where we are going to add listitems
foto_slider = []
titular_slider = []
description_slider = []
foto_card = []
titulo_card = []
description_card = []
# for loop python iterate through dictionary
for items in json_response['level1_nodes']['featured']:
foto_slider.append(items['icon'])
for items in json_response['level1_nodes']['featured']:
titular_slider.append(items['translatableName']['en_gb'])
for items in json_response['level1_nodes']['featured']:
description_slider.append(items['translatableDescription']['en_gb'])
for items in json_response['level1_nodes']['children']:
foto_card.append(items['icon'])
for items in json_response['level1_nodes']['children']:
titulo_card.append(items['translatableName']['en_gb'])
for items in json_response['level1_nodes']['children']:
description_card.append(items['translatableDescription']['en_gb'])
# now define containers, the id's refer to the container id's you use in the xml file
self.cont1 = self.getControl(100)
self.cont2 = self.getControl(200)
self.cont4 = self.getControl(400)
self.cont3 = self.getControl(300)
self.cont5 = self.getControl(500)
self.cont6 = self.getControl(600)
# adding items
self.cont1.addItems(titular_slider)
self.cont2.addItems(description_slider)
self.cont4.addItems(foto_slider)
self.cont3.addItems(foto_card)
self.cont5.addItems(titulo_card)
self.cont6.addItems(description_card)
And in the xml there are different containers as you can see in this snippet:
xml:
<control type="group" description="Pictures">
<include>ContentFade</include>
<posx>80</posx>
<posy>526,2</posy>
<width>436</width>
<onright>63</onright>
<onup>53</onup>
<ondown>53</ondown>
<preloaditems>12</preloaditems>
<pagecontrol>63</pagecontrol>
<control type="list" id="300" description="Grid">
<orientation>vertical</orientation>
<itemlayout height="246" width="436">
<control type="image">
<top>0</top>
<width>436</width>
<height>246</height>
<texture border="15,0,0,15" colordiffuse="Transparent">img/WhiteRoundedST.png</texture>
</control>
<control type="image">
<include>servicethumb</include>
<texture>$INFO[ListItem.Label]</texture>
</control>
</itemlayout>
<focusedlayout height="246" width="436">
<control type="image">
<top>0</top>
<width>436</width>
<height>246</height>
<texture border="15,0,0,15" colordiffuse="Highlight">img/WhiteRoundedST2.png</texture>
</control>
<control type="image">
<include>servicethumb</include>
<texture>$INFO[ListItem.Label]</texture>
</control>
</focusedlayout>
</control>
</control>
<control type="group" description="single service">
<include>ContentFade</include>
<posy>530</posy>
<posx>520</posx>
<width>1287</width>
<height>500</height>
<control type="list" id="500">
<posy>10</posy>
<itemlayout>
<control type="label">
<posx>25</posx>
<font>font12_title</font>
<wrapmultiline>false</wrapmultiline>
<textcolor>White2</textcolor>
<scroll>false</scroll>
<label>$INFO[ListItem.Label]</label>
</control>
</itemlayout>
<focusedlayout>
<control type="label">
<posx>25</posx>
<font>font12_title</font>
<wrapmultiline>false</wrapmultiline>
<textcolor>White2</textcolor>
<scroll>false</scroll>
<label>$INFO[ListItem.Label]</label>
</control>
</focusedlayout>
</control>
<control type="list" id="600">
<posy>65</posy>
<itemlayout>
<control type="textbox">
<posx>25</posx>
<width max="1200">auto</width>
<height>430</height>
<font>fontService</font>
<wrapmultiline>true</wrapmultiline>
<textcolor>White2</textcolor>
<scroll>false</scroll>
<label>$INFO[ListItem.Label]</label>
</control>
</itemlayout>
<focusedlayout>
<control type="textbox">
<posx>25</posx>
<width max="1200">auto</width>
<height>430</height>
<font>fontService</font>
<wrapmultiline>true</wrapmultiline>
<textcolor>White2</textcolor>
<scroll>false</scroll>
<label>$INFO[ListItem.Label]</label>
</control>
</focusedlayout>
</control>
</control>
So what´s my problem if everything looks like ok? Well, I need that when a user selects (focus on) a picture from the first group list control, the same window shows the text information from the second group list control related to that picture.
I appreciate your help.