Is there a better way to do this?
#1
I'm going to set the weather icons folder based on a setting toggle. So if the settings option is not checked, it will use the default icons in the weather_icons folder, but if it is checked then it will use the real style weather icons in weather_icons2. I'm just not sure if there is a better way of doing this than having two image controls with visibility conditions.

Code:
                <control type="image">
                    <width>140</width>
                    <height>140</height>
                    <posx>30</posx>
                    <posy>10</posy>
                    <texture>$INFO[Window.Property(Day0.FanartCode),special://skin/extras/weather_icons/,.png]</texture>
                    <visible>!Skin.HasSetting(WeatherIcons2)</visible>
                </control>
                <control type="image">
                    <width>140</width>
                    <height>140</height>
                    <posx>30</posx>
                    <posy>10</posy>
                    <texture>$INFO[Window.Property(Day0.FanartCode),special://skin/extras/weather_icons/,.png]</texture>
                    <visible>Skin.HasSetting(WeatherIcons2)</visible>
                </control>
Reply
#2
This is how I'd do it.

Code:
    <control type="image">
        <width>140</width>
        <height>140</height>
        <posx>30</posx>
        <posy>10</posy>
        <texture>$VAR[Weather_Icons]</texture>
    </control>

Then in your Variables.xml

Code:
<variable name="Weather_Icons">
    <value condition="Skin.HasSetting(WeatherIcons2)">$INFO[Window.Property(Day0.FanartCode),special://skin/extras/weather_icons/,.png]</value>
    <value>$INFO[Window.Property(Day0.FanartCode),special://skin/extras/weather_icons/,.png]</value>
</variable>
Reply
#3
Thanks Hitcher! It's been awhile since I've done much skinning, when did $VAR and variables.xml become available?
Reply
#4
Couple of months ago
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#5
Awesome...thanks guys
Reply
#6
I've created a variables.xml and put in the code for the variable name and added the changes to the MyWeather.xml, but I keep getting this error
Quote:Label Formating: $VAR[Weather_Icons] is not defined
Any ideas what I'm doing wrong?

Edit - Apprently it helps to add variables.xml to the includes.xml and then put the <includes> tags in the variables.xml
Reply
#7
Ok one last question - How do I set the variable to detect what day I want the image to be? Do I need to hardcode all of the day0, day1, etc or is there some wildcard I can use? I see that the readme says Day%i.FanartCode, but that doesn't seem to work.
<value>$INFO[Window.Property(Day0.FanartCode),special://skin/extras/weather_icons/,.png]</value>
Reply
#8
(2012-05-03, 22:17)Aenima99x Wrote: Ok one last question - How do I set the variable to detect what day I want the image to be? Do I need to hardcode all of the day0, day1, etc or is there some wildcard I can use? I see that the readme says Day%i.FanartCode, but that doesn't seem to work.
<value>$INFO[Window.Property(Day0.FanartCode),special://skin/extras/weather_icons/,.png]</value>

you have to hardcode them. jmarshall is workin on a new way of parsing the xml tags (which makes it possible to use $INFO[] inside $INFO[] for example afaik), but atm you have to create every single item.
(2012-05-03, 21:37)Aenima99x Wrote: I've created a variables.xml and put in the code for the variable name and added the changes to the MyWeather.xml, but I keep getting this error
Quote:Label Formating: $VAR[Weather_Icons] is not defined
Any ideas what I'm doing wrong?

Edit - Apprently it helps to add variables.xml to the includes.xml and then put the <includes> tags in the variables.xml

you´re doing something wrong then. look at the implementation in other skins, no need to put variables in includes.
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#9
(2012-05-04, 20:05)phil65 Wrote:
(2012-05-03, 22:17)Aenima99x Wrote: Ok one last question - How do I set the variable to detect what day I want the image to be? Do I need to hardcode all of the day0, day1, etc or is there some wildcard I can use? I see that the readme says Day%i.FanartCode, but that doesn't seem to work.
<value>$INFO[Window.Property(Day0.FanartCode),special://skin/extras/weather_icons/,.png]</value>

you have to hardcode them. jmarshall is workin on a new way of parsing the xml tags (which makes it possible to use $INFO[] inside $INFO[] for example afaik), but atm you have to create every single item.

Yeah I figured as much and went ahead and hardcoded them all.

(2012-05-03, 21:37)Aenima99x Wrote: I've created a variables.xml and put in the code for the variable name and added the changes to the MyWeather.xml, but I keep getting this error
Quote:Label Formating: $VAR[Weather_Icons] is not defined
Any ideas what I'm doing wrong?

Edit - Apprently it helps to add variables.xml to the includes.xml and then put the <includes> tags in the variables.xml

you´re doing something wrong then. look at the implementation in other skins, no need to put variables in includes.

Yup I was doing it wrong, got it sorted out.
Reply

Logout Mark Read Team Forum Stats Members Help
Is there a better way to do this?0