Is there a better way to do this?

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Aenima99x Offline
Donor
Posts: 1,127
Joined: Aug 2007
Reputation: 8
Location: California
Post: #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>
find quote
Hitcher Offline
Skilled Skinner
Posts: 11,074
Joined: Aug 2007
Reputation: 103
Location: Eastleigh, UK
Post: #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>
(This post was last modified: 2012-05-03 20:41 by Hitcher.)
find quote
Aenima99x Offline
Donor
Posts: 1,127
Joined: Aug 2007
Reputation: 8
Location: California
Post: #3
Thanks Hitcher! It's been awhile since I've done much skinning, when did $VAR and variables.xml become available?
find quote
Martijn Offline
Team Kodi
Posts: 11,921
Joined: Jul 2011
Reputation: 170
Location: Dawn of time
Post: #4
Couple of months ago

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

For your mediacenter artwork go to
[Image: fanarttv.png]
find quote
Aenima99x Offline
Donor
Posts: 1,127
Joined: Aug 2007
Reputation: 8
Location: California
Post: #5
Awesome...thanks guys
find quote
Aenima99x Offline
Donor
Posts: 1,127
Joined: Aug 2007
Reputation: 8
Location: California
Post: #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
(This post was last modified: 2012-05-03 21:50 by Aenima99x.)
find quote
Aenima99x Offline
Donor
Posts: 1,127
Joined: Aug 2007
Reputation: 8
Location: California
Post: #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>
(This post was last modified: 2012-05-03 22:17 by Aenima99x.)
find quote
phil65 Offline
Skilled Skinner
Posts: 4,922
Joined: Mar 2009
Reputation: 68
Location: Cologne, Germany
Post: #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.
(This post was last modified: 2012-05-04 20:08 by phil65.)
find quote
Aenima99x Offline
Donor
Posts: 1,127
Joined: Aug 2007
Reputation: 8
Location: California
Post: #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.
find quote