Posts: 204
Joined: Oct 2012
Reputation:
1
powlo
Senior Member
Posts: 204
Hi,
I've noticed that I don't seem to be able to access Window.Properties while building list contents (ie in <itemlayout> or <focusedlayout>.
Instead I have to tag the same property onto each item in the list.
Is this a deliberate feature or am I doing it wrong?
Posts: 26,215
Joined: Oct 2003
Reputation:
187
Deliberate: The only context listitem's have is themselves. i.e. you can access ListItem.* and that's it.
Posts: 204
Joined: Oct 2012
Reputation:
1
powlo
Senior Member
Posts: 204
Fair enough, it's mildly frustrating but can be worked around once it's known. Is there a reason for this?
Posts: 26,215
Joined: Oct 2003
Reputation:
187
If it's deliberate, there's a reason. The reason is simple: The listitem's pull their information from the listitem object, as this allows a far more efficient generation of the information in the list. There's no particular reason that they should be querying something from outside the list anyway, right?
(Note that for static content, you CAN get them to pull stuff from outside by defining the content. But from within the UI layout, it pulls it from the items (which are filled from the <content>))
Posts: 26,215
Joined: Oct 2003
Reputation:
187
I'm not really sure what you're trying to achieve. Perhaps if you posted the code you have and what you want (pictures are always good) then some suggestions could be made?
(Probably by other skinners rather than me - those guys know all the tricks).
Cheers,
Jonathan
Posts: 204
Joined: Oct 2012
Reputation:
1
powlo
Senior Member
Posts: 204
That looks like a robust bit of code!
But I'm in two minds about this. The normal mechanism in weather plugins seems to be to add a raft of window properties and then build the list in xml using <content>. You have to make a few assumptions about how many items there will be in the list and you have to do a little fudging, as my ealier posts in this thread show.
But if I do start manipulating the list from within python then I have to assume that that control with that id exists (and it's the right one). Essentially I'm coding skin dependence into something that perhaps shouldn't be.
Anyway its an option on the table. Cheers.
Posts: 2,441
Joined: Apr 2009
Reputation:
73
`Black
Team-Kodi Member
Posts: 2,441
I'm pretty sure my code from above does work only if you create your own window xml dialog in python, you can't grab a control from e.g. home.xml and fill it. However with the new method introduced in Gotham you can, so I would recommend reading about it.
Posts: 204
Joined: Oct 2012
Reputation:
1
powlo
Senior Member
Posts: 204
Won't getControl() allow you to grab the control?