Posts: 240
Joined: Mar 2014
Reputation:
6
Does anyone know where I can find a basic windowxml tutorial for xbmc? I've found a couple but are to outdated and any existing add ons are a bit to large to work backwards from.
Posts: 3,447
Joined: Jan 2011
Reputation:
362
pkscout
Team-Kodi Member
Posts: 3,447
I don't think I ever found a great WindowXML example. I started by looking at the TV Rage Addon. That one isn't too complication. Or you can check iin SpeedFanInfo. (the one I wrote).
Posts: 240
Joined: Mar 2014
Reputation:
6
Thanks I'll take a look at them I've managed to get some stuff working going off the TV Guide addon.
The main issue I'm getting atm is when doModal() is called I get the loading icon in confluence which doesn't disappear until esc/backspace is pressed. This happens regardless of if my WindowXML based class had any controls added through the XML/Code or has no controls added at all.
One question I do have is how best to handle dynamic elements. I'm adding rows of buttons that may contain any amount of buttons. Ideally these would be moved around as an entire group.
Atm i'm just creating the controls via code and adding them to the window individually. Ideally I wanted to create some form of group container (via XML or code) to add buttons to and shift them around. However I couldn't find any method on the ControlGroup for adding controls to it.
Any advice on this would be appreciated as the XBMC control's with windowXML seems a bit peculiar compared to other frameworks I've used.
Posts: 3,447
Joined: Jan 2011
Reputation:
362
pkscout
Team-Kodi Member
Posts: 3,447
I *think* what you might need to do in the XML is have a whole bunch of buttons predefined with ids and then set their visibility (and label) as needed. It's not truly dynamic, but it wouldn't be that hard to copy and paste a basic button.
The other thing to try is a ListItem. You're not going to have as much control over layout, but you can have an arbitrary number of things in it.
windowXML is definitely better than the alternative of drawing all the screens programmatically, but I too have struggled with it. I'm skinning an add-on for another developer now, and it's only in the last couple of days of banging my head against my desk that I've started to get a better handle on how the XML and python code interact.
Posts: 240
Joined: Mar 2014
Reputation:
6
I think for the buttons I'll definitely have to create them programmatically as they are all variable width's and can be 1000's total per row. Even if I cached and reused them there could be 100's on the screen at once :p. Will see if I can define a single button in the WindowXML and read it's properties to apply to new buttons I create for re-skinning purposes though.
I feel like i'm missing a trick with the ControlGroup classes as it seems with the XML you can group components within each ControlGroup. But when creating a ControlGroup programmatically there doesn't seem to be any methods to add other control's to it.