Dynamic Image Dimensions using ListItem property
#1
Question 
Hello,

Not too long ago I started skinning so be forgiving if this is an obvious question. Wink I'm trying to set an image width dynamically. The actual width I'm obtaining from a property called duration, which I'd like to apply to my image, possibly with additionally multiplying it. What I tried is the following:
Code:
<control type="image">
    <description>Border MIDDLE</description>
    <width>ListItem.Property(duration)</width>
    <height>37</height>
    <posx>0</posx>
    <posy>0</posy>
    <texture>pvr-epg-border.png</texture>
</control>
The <width> tag seems to be ignored completely. The property is set and available, I tested it using a label control and setting the <info> tag to ListItem.Property(duration).

Is it even possible to pass dynamic values to <width>? If not, any way to solve my problem?
Running XBMC on my HTPC, tablet, phone and pinball machine.
Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. For troubleshooting and bug reporting, make sure you read this first.
Reply
#2
Not possible, and unlikely to be added for quite some time.
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
Well I'm on the EPG grid of the TV guide, and each programme is drawn as a box in a timeline. Obviously not every programme has the same duration, so the boxes vary in width. In order to skin this seriously, a dynamic width parameter is indispensable. Maybe there is another solution?
Running XBMC on my HTPC, tablet, phone and pinball machine.
Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. For troubleshooting and bug reporting, make sure you read this first.
Reply
#4
OK I had a look on the code how it's done now for the EPG of alcoheca's branch. The dynamic resizing takes place here. This is a function which increases the width of all elements of a group control that have the id set to 1 or 2. Additionally there is the part which hides the text in case it's too small. So width of an EPG box is updated by code, where id=2 must be the label and id=1 the background image of the programme box. Note that this is a method of the generic GUI list group class, which does very specific things only used by the EPG. I think we can agree that this can be considered as a hack and should be implemented properly.

I see that my request is kind of exotic, seen the vast amount of impressive skins making use of the engine as it is. But IMO the EPG is a different beast, where time spans of non-predictable length are visualized.

I'm willing to write a patch, but I'm still looking for the logic which parses and processes the visibility tag. This would be a good example to start the same thing for width, I guess. Any pointers welcome.
Running XBMC on my HTPC, tablet, phone and pinball machine.
Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. For troubleshooting and bug reporting, make sure you read this first.
Reply
#5
if it worked it would be:

<width>$INFO[ListItem.Property(duration)]</width>

there would be advantages to running everything thru the function that converts $INFO[].

not sure if it's even possible.

disadvantages would be speed?
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#6
Why do you need anything additional to what the EPG control currently supplies? This seems to be able to do most things that one would wish an EPG to do.

I'm sure alcoheca is open to modifications to the code if it's deemed necessary though!

The info parsing is done by:

1. Storing an integer which is generated from g_infoManager.TranslateString().
2. At "use" time (ideally a maximum of one time per frame), using that integer to lookup a label from g_infoManager.GetLabel(). If you're within a GUIListItemLayout, then the info is pushed, so you just update it in UpdateInfo().

And yes, the reason that everything isn't INFO-izable is speed.

We almost certainly need to switch to a fully push based information system if we go to that extent, and that is non-trivial to achieve (a parameter could be both a data "sink" or a data "source" for instance - infinite loop fun and games).

Cheers,
Jonathan
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
#7
Hey Jonathan,

thanks for the explanations. The thing with the current EPG is that it's really just one image per programme box. That means you can't really add decent borders or anything without the x-axis being stretched. I'm playing with a dark glow around each box in order to achieve a slight 3D effect, because just a flat color (or gradient) without anything around doesn't look so good.

So the ideal solution would be using three slices (left border, right border and middle, where only the middle slice can be stretched). I had partial success using several image controls with the same ID. Where I'm stuck now is that my right slice has the same width as the middle slice, though it should not stretch due to "<aspectratio align="right">keep</aspectratio>" usage. Just that this tag seems to be ignored (or too late applied due to resize by code) and it still stretches.

But I'm in contact with alcoheca, he just wasn't around yesterday. He's actually very forthcoming.
Running XBMC on my HTPC, tablet, phone and pinball machine.
Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. For troubleshooting and bug reporting, make sure you read this first.
Reply
#8
how about running <include> thru GetLabel()?

that may be enough for some things.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#9
Nuka1195 Wrote:how about running <include> thru GetLabel()?

that may be enough for some things.

Care to elaborate? I'm pretty new to XBMC skinning and I'm obviously not aware of all tricks yet. Wink
Running XBMC on my HTPC, tablet, phone and pinball machine.
Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. For troubleshooting and bug reporting, make sure you read this first.
Reply
#10
Use the border attribute of the texture to stop it stretching in the border region.

Cheers,
Jonathan
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
#11
jmarshall Wrote:Use the border attribute of the texture to stop it stretching in the border region.

Cheers,
Jonathan

I already wondered what this attribute was all about. I even had a clue that it might do exactly that. I fiddled around with it but it didn't do what I expected. Now I just tried it again and it did exactly what I expected. Guess I was somewhat confused the first time. Wink

Cheers and thanks for the hint! That's what I was looking for!
Running XBMC on my HTPC, tablet, phone and pinball machine.
Always read the XBMC online-manual, FAQ and search the forums before posting. Do NOT e-mail Team-XBMC members asking for support. For troubleshooting and bug reporting, make sure you read this first.
Reply
#12
freezy;316244Now I just tried it again and it did [i Wrote:exactly[/i] what I expected. Guess I was somewhat confused the first time. Wink

Cheers and thanks for the hint! That's what I was looking for!

Can you elaborate or possibly show an example of the code you are using? I am also trying to create an image with dynamic scaling but haven't found a solution so far.
Reply

Logout Mark Read Team Forum Stats Members Help
Dynamic Image Dimensions using ListItem property0