Skin Variables / Conditional Labels
#61
i'm getting some interesting results with labels:

Code:
<variable name="foo">
    <value condition="Control.HasFocus(1)">$LOCALIZE[31106]</value>
    <value condition="Control.HasFocus(2)">$LOCALIZE[1]</value>
    <value condition="Control.HasFocus(3)">0</value>
</variable>

<label>$VAR[foo]</label>


1) string from skin language file -> does not show up ( will show after ReloadSkin() )
2) string from xbmc language file -> works ok
3) displays '0' instead of 'Programs'
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#62
ronie Wrote:i'm getting some interesting results with labels:

Code:
<variable name="foo">
    <value condition="Control.HasFocus(1)">$LOCALIZE[31106]</value>
    <value condition="Control.HasFocus(2)">$LOCALIZE[1]</value>
    <value condition="Control.HasFocus(3)">0</value>
</variable>

<label>$VAR[foo]</label>


1) string from skin language file -> does not show up ( will show after ReloadSkin() )
2) string from xbmc language file -> works ok
3) displays '0' instead of 'Programs'

1) need fixing - on it ... EDIT: fixed in 43f00d26
3) I wouldn't consider this as bug - skin variable returns text so if there is 0 so we assume it means string "0" (if You want it - we can add some additional processing there but I would rather not do it in case someone want to simply display number)
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#63
pieh Wrote:3) I wouldn't consider this as bug - skin variable returns text so if there is 0 so we assume it means string "0" (if You want it - we can add some additional processing there but I would rather not do it in case someone want to simply display number)

+1

I would maybe even remove it from labels so you always have to use $LOCALIZE if you want to use a localized string.
Image
Reply
#64
pieh Wrote:3) I wouldn't consider this as bug - skin variable returns text so if there is 0 so we assume it means string "0" (if You want it - we can add some additional processing there but I would rather not do it in case someone want to simply display number)

not needed as far as i'm concerned.

it was just something i noticed so mentioned it since it could've been an undesired side-effect.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#65
Thought this was rather odd. In DialogAlbumInfo I was using:

PHP Code:
<control type="image">
    <
width>400</width>
    <
height>400</height>
    <
texture background="true">$VAR[thumb_Square.Condition]</texture>
    <
bordertexture border="31">frames/frame_Square.png</bordertexture>
    <
bordersize>22</bordersize>
    <
aspectratio>scale</aspectratio>
</
control

variable:

PHP Code:
<variable name="thumb_Square.Condition">
    <
value condition="Container.Content(albums) + IsEmpty(ListItem.Thumb)">thumbs/album.png</value>
    <
value condition="Container.Content(artists) + IsEmpty(ListItem.Thumb)">thumbs/artist.png</value>
    <
value>$INFO[ListItem.Thumb]</value>
</
variable

Resulted in the artist fallback image to show, however not the album fallback image.

Using IsEmpty(ListItem.Property(ArtistThumb)) also worked. So I tried IsEmpty(ListItem.Property(AlbumThumb)) even though it's not mentioned in the wiki, and that did work.

So, not a big deal as I got it doing what I want, but I thought I'd mention it.
Reply
#66
Another thing.

Right now for certain viewtypes I'm using different includes to load the actual viewtype layout, depending on what content type is being listed. I did this so I can use different infolabels for specific content types without having to resort to countless visibility conditions.

Now that skin variables are here I could also those for this purpose and bring down the amount of code for the entire viewtype.

What I'm wondering about though, are there any performance advantages or disadvantages for one or the other method?

As includes are only checked on window load, my guess would be using includes is the faster way. Am I correct in this assumption?
Reply
#67
Jeroen Wrote:What I'm wondering about though, are there any performance advantages or disadvantages for one or the other

I'm really curious about this too.
Reply
#68
I have also a performance question... I always thought

Code:
<control type="group">
    <visible>Container.Content(Movies)</visible>
    [...]
</control>
<control type="group">
    <visible>Container.Content(TVShows)</visible>
    [...]
</control>
<control type="group">
    <visible>Container.Content(Episodes)</visible>
    [...]
</control>

is quicker than add a condition to every control so I use it instead of having the same condition for every control. In this example I now could save 1/3 of the code by adding a variable like this to every control inside the group:

Code:
<variable name="Variable1">
    <value condition="Container.Content(TVShows)">[...]</value>
    <value condition="Container.Content(Episodes)">[...]</value>
    <value>[...]</value>
</control>

But with this there are more conditions to evaluate every time so I don't know if the performance is maybe worse?
Image
Reply
#69
sorry guys for delay with answers here - was busy with moving in to new place

@Jeroen:
Includes will always be faster because their condition is evaluated only when skin is loading and then it basicly replace <include>include_name</include> in xml with proper "text" and then we translate xml to actual windows / controls / whatever. Skin Variables and visible/enable condition on the other hand are checked every frame so this cause some extra cpu load.

@Black:
If we are talking about boolean conditions - we have mechanism that stores value of boolean expression and if given condition was evaluated already in given frame - we will just use stored value instead of evaluating it again. This mean that if You used several "Container.Content(TvShows)" only first one will really be evaluated and stored, rest will use that stored value. So if using skin variables will allow You to get rid of some controls - this will be slightly faster.

@all
It's hard to talk about performance here - skin vars are generally slightly faster than using seperate controls with different visible conditions because we don't need to process several controls (we always check if any property of control changed to know if we need to redraw it). It won't be really noticeable difference - main purpose of this is simplify xmls.
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#70
Thanks that's what I wanted to hear (read). Smile

EDit: I almost forgot, could you maybe take a look at the problem I described few posts earlier? http://forum.xbmc.org/showpost.php?p=901...stcount=49 & http://forum.xbmc.org/showpost.php?p=901...stcount=51. Thanks Smile

2 Screens to make it clearer... this is how it looks with visible conditions and this how it's with skin variables.
Image
Reply
#71
Black:
Do I need any special version of tvshow next aired addon or xperience1080 skin (I have next aired from official xbmc addon repo and Your skin cloned from https://github.com/Black09/Xperience1080/)? If I enter tv guide from tvshow submenu in xperience1080 home screen it currently opens generic (confluence based) window (http://dl.dropbox.com/u/28792047/xbmc/screenshot045.png). I'm so out of loop right now when it comes to new stuff in xbmc ;(
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#72
You need the latest next aired script from svn and 2 skin files, I uploaded them here.
Image
Reply
#73
that's a little weird - neither logos nor fanarts are displayed (doesn't matter if skin vars or old style) even if I don't have any dialog on top of tv guide window - do I need some special setup for this?

--edit: nvm, had to wipe addon database after updating
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#74
`Black Wrote:Thanks that's what I wanted to hear (read). Smile

EDit: I almost forgot, could you maybe take a look at the problem I described few posts earlier? http://forum.xbmc.org/showpost.php?p=901...stcount=49 & http://forum.xbmc.org/showpost.php?p=901...stcount=51. Thanks Smile

2 Screens to make it clearer... this is how it looks with visible conditions and this how it's with skin variables.
found problem, just need to figure out proper solution
Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

My previous forum/trac nickname: grajen3
Reply
#75
Thanks
Image
Reply

Logout Mark Read Team Forum Stats Members Help
Skin Variables / Conditional Labels0