how to fill list
#1
hi!

I have a grouplist defined in a windowxml file like this:
Code:
<control type="grouplist" id="1210">
  <description>Categories</description>
  <posx>80</posx>
  <posy>60</posy>
  <width>250</width>
  <height>300</height>
  <itemgap>10</itemgap>
  <pagecontrol>25</pagecontrol>
  <orientation>vertical</orientation>
  <usecontrolcoords>false</usecontrolcoords>
  <visible>true</visible>
  <onup>1210</onup>
  <ondown>1210</ondown>
  <onleft>1210</onleft>
  <onright>1210</onright>
</control>

I have tried to dynamically fill this control from a script like this:
Code:
self.list = self.getControl(1210)
for curItem in itemlist:
  item = xbmcgui.ListItem(curItem['name'])
  self.list.addItem(item)

It does not work, my xbox just stops responding.

When I dynamically create a "normal list" inside the script, the code from above works:
Code:
self.list = xbmcgui.ControlList(200, 150, 300, 400)
self.addControl(self.list)

But I do not want to have to create the list inside the script because I want to have a grouplist.

So my question is: how can I dynamically fill a list which is already defined in a xml?
Or, alternatively, how can I create a grouplist from a script? I only can find ControlList in the pythonLib dir but nothing like a ControlGroupList...

Thanks in advance for your help!!!
Reply
#2
grouplist's take controls not listitems. probably why it fails.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#3
hm, did not work. here's my code:
Code:
def onInit(self):
        # Put your List Populating code/ and GUI startup stuff here
        print 'NewsOverview::onInit()'

        self.list = self.getControl(1510)
        self.addControl(self.list)
        self.setFocus(self.list)

        y=50
        for comp in comps:
          print str(comp['id']) + ': ' + comp['title']
          item = xbmcgui.ControlButton(100, y, 250, 20, comp['title'])
          item.setProperty("id", str(comp['id']))
          y+=50
          self.list.addItem(item)

anything wrong here? could it be that I have to use something different than 'self.list'?

Thanks!!!
Reply
#4
until grouplists are added to python natively and an addControl() method for it, you can't.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#5
(2008-11-24, 18:29)Nuka1195 Wrote: until grouplists are added to python natively and an addControl() method for it, you can't.

Hi,

I'm sorry to dig out an old thread, but I'm facing the same problem.

Is there any improvements in groupList API for python?

Otherwise, I try to generate an xml file I include in the groupList, but in also doesn't work:

So I do something like that in my addons/my_addon/resources/skins/default/1080i/WindowXML file:
Code:
        <control type="grouplist" id="206">
            <description>PID Name and Value List</description>
            <posx>10</posx>
            <posy>100</posy>
            <width>850</width>
            <height>800</height>
            <itemgap>10</itemgap>
            <pagecontrol>205</pagecontrol>
            <scrolltime tween="sine" easing="out">200</scrolltime>
            <orientation>vertical</orientation>
            <usecontrolcoords>false</usecontrolcoords>
            <visible>true</visible>
            <include>PidTextList</include>
        </control>

with addons/my_addon/resources/skins/default/1080i/PIDinclude.xml generated by program:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<includes>
    <include name="PidTextList">
        <control type="label" id="10000">
            <width>850</width>
            <height>50</height>
            <label>Label 0</label>
        </control>
        <!-- lots of other controls -->
    </include>
</includes>

and addons/my_addon/resources/skins/default/1080i/includes.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<includes>
    <include file="PIDinclude.xml">PIDinclude.xml</include>
</includes>

That gives me a very nice
Code:
14:47:35 T:7236 WARNING: Skin has invalid include: PidTextList

I'm doing something wrong, but what ?

PS: I know I could use an itemList instead, but I plan to add some progresscontrol in the grouplist.
Reply

Logout Mark Read Team Forum Stats Members Help
how to fill list0