FixedList Dynamically populated !
#1
Question 
Hello,
I'm still starting with XBMC development with WindowXML and Python, since i wanted to create a heavy GUI application/script (not an addon).. i was suggested to use WindowXML.

But the connection/relation between the XML skin file and the python script file is not yet clear.
I have managed so far to create a basic xml (skin) file and open it with python in XBMC and practice some of the WindowXML controls on the wiki but i have stumbled upon the FixedList Control since i wanted to create a list of items that scrolls this control seemed to be the perfect one but i can't add items to it dynamically from the python file,
for example if i gave the "fixedlist" control an id of "50" in the xml skin file, and in the python i did the following:

Code:
def onInit(self):
        scroller = self.getControl(50)
        scroller.addItem("Item added from pytohn")

The change doesn't take effect inside XBMC when i enter my skin, although there was no error generated in xbmc.log

So i guess my question can be warped in "how to dynamically populate a fixedlist control or any other control that scrolls an list of items from the python file" since i want to connect that list to a back end db or something.

Thanks in advance.
I wrote a program to program my program ! - programception.
Reply
#2
With WindowXML you can add items without referring to the list. Essentially it works like a media window in XBMC: you add items to the window and XBMC handles the list(s) for you.
Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


Image
Reply
#3
Xive Wrote:Hello,
I'm still starting with XBMC development with WindowXML and Python, since i wanted to create a heavy GUI application/script (not an addon).. i was suggested to use WindowXML.

But the connection/relation between the XML skin file and the python script file is not yet clear.
I have managed so far to create a basic xml (skin) file and open it with python in XBMC and practice some of the WindowXML controls on the wiki but i have stumbled upon the FixedList Control since i wanted to create a list of items that scrolls this control seemed to be the perfect one but i can't add items to it dynamically from the python file,
for example if i gave the "fixedlist" control an id of "50" in the xml skin file, and in the python i did the following:

Code:
def onInit(self):
        scroller = self.getControl(50)
        scroller.addItem("Item added from pytohn")

The change doesn't take effect inside XBMC when i enter my skin, although there was no error generated in xbmc.log

So i guess my question can be warped in "how to dynamically populate a fixedlist control or any other control that scrolls an list of items from the python file" since i want to connect that list to a back end db or something.

Thanks in advance.

Here is some code from cdART Manager to build a list:

skin side:
PHP Code:
<control type="list" id="120">
                    <
description>Artist List</description>
                    <
posx>0</posx>
                    <
posy>25</posy>
                    <
width>606</width>
                    <
height>670</height>
                    <
onleft>9000</onleft>
                    <
onright>121</onright>
                    <
onup>120</onup>
                    <
ondown>120</ondown>
                    <
viewtype label="Artist List">list</viewtype>
                    <
pagecontrol>121</pagecontrol>
                    <
scrolltime>200</scrolltime>
                    <
itemlayout width="606" height="36">
                        <
control type="image">
                            <
posx>30</posx>
                            <
posy>36</posy>
                            <
width>606</width>
                            <
height>38</height>
                            <
texture>cdman-default-list-nofocus.png</texture>
                        </
control>
                        <
control type="label">
                            <
posx>40</posx>
                            <
posy>0</posy>
                            <
width>560</width>
                            <
height>38</height>
                            <
font>font13</font>
                            <
aligny>center</aligny>
                            <
textcolor>FFFFFFFF</textcolor>
                            <
focusedcolor>FFFFFFFF</focusedcolor>
                            <
selectedcolor>green</selectedcolor>
                            <
align>left</align>
                            <
info>ListItem.Label</info>
                        </
control>
                    </
itemlayout>
                    <
focusedlayout width="670" height="36">
                        <
control type="image">
                            <
posx>30</posx>
                            <
posy>36</posy>
                            <
width>670</width>
                            <
height>38</height>
                            <
texture>cdman-default-list-nofocus.png</texture>
                        </
control>
                        <
control type="image">
                            <
posx>30</posx>
                            <
posy>0</posy>
                            <
width>670</width>
                            <
height>38</height>
                            <
texture>cdman-button-focus.png</texture>
                            <
visible>Control.HasFocus(120)</visible>
                        </
control>
                        <
control type="label">
                            <
posx>40</posx>
                            <
posy>0</posy>
                            <
width>660</width>
                            <
height>38</height>
                            <
font>font13</font>
                            <
aligny>center</aligny>
                            <
textcolor>FFFFFFFF</textcolor>
                            <
focusedcolor>FFFFFFFF</focusedcolor>
                            <
selectedcolor>green</selectedcolor>
                            <
align>left</align>
                            <
info>ListItem.Label</info>
                        </
control>
                    </
focusedlayout

script side:

Code:
listitem = xbmcgui.ListItem( label = artist["name"] )
self.getControl( 120 ).addItem( listitem )
listitem.setLabel( artist["name"] )
Reply
#4
@jmarshall: thanks for the reply but i don't know how a "media window in XBMC" would work either still new to this but appreciate the help.

@giftie: Thanks alot, that worked great you made my day Smile .. just need to tweak that list to scroll nicely.

Thanks again.
I wrote a program to program my program ! - programception.
Reply

Logout Mark Read Team Forum Stats Members Help
FixedList Dynamically populated !0