Kodi Community Forum
How to use contents property? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+--- Thread: How to use contents property? (/showthread.php?tid=354369)



How to use contents property? - kenmoon - 2020-05-12

Hello

I am using yahoo weather widget on my Kodi. I am creating my own skin for weather.
My question is..

I have contents as below

<content>
           <item id="1">
              <label>$INFO[Window(weather).Property(Daily.1.LongDay)], $INFO[Window(weather).Property(Daily.1.LongDate)]</label>
              <icon>$VAR[VarWeatherHomeIcon]$INFO[Window(Weather).Property(Current.OutlookIcon)]</icon>
              <thumb></thumb>
              <property name="Temperature">$LOCALIZE[143] $INFO[Window(Weather).Property(Current.Temperature)]°</property>
              <property name="Humidity">$LOCALIZE[406]: $INFO[Window(Weather).Property(Current.Humidity)]</property> 
              <property name="FeelsLike">$LOCALIZE[402]: $INFO[Window(Weather).Property(Current.FeelsLike)]°</property>
              <property name="HighTemperature">$INFO[Window(weather).Property(Current.HighTemperature)]</property>     
              <property name="LowTemperature">$INFO[Window(weather).Property(Current.LowTemperature)]</property>    
              <property name="DayOutlook">$INFO[Window(Weather).Property(Current.Condition)]</property>
              <property name="Wind">$LOCALIZE[383]: $INFO[Window(Weather).Property(Current.Wind)]</property>
              <property name="Location">$INFO[Window(Weather).Property(Current.Location)]</property>
              <property name="Provider">$INFO[Window(Weather).Property(WeatherProvider)]</property>
              <property name="ProviderLogo">$INFO[Window(Weather).Property(WeatherProviderLogo)]</property>
              <property name="Background">resource://resource.images.weatherfanart.multi/$INFO[Window(Weather).Property(Current.FanartCode)]</property>
           </item>
          
              <item id="2">
              <label>$INFO[Window(weather).Property(Daily.2.LongDay)], $INFO[Window(weather).Property(Daily.2.LongDate)]</label>
              <icon>$VAR[VarWeatherHomeIcon]$INFO[Window(Weather).Property(Daily.2.OutlookIcon)]</icon>
              <thumb></thumb>
              <property name="Humidity">$LOCALIZE[406]: $INFO[Window(Weather).Property(Daily.2.Humidity)]</property> 
              <property name="FeelsLike">$LOCALIZE[402]: $INFO[Window(Weather).Property(Daily.2.FeelsLike)]</property>
              <property name="HighTemperature">$INFO[Window(weather).Property(Daily.2.HighTemperature)]</property>
              <property name="LowTemperature">$INFO[Window(weather).Property(Daily.2.LowTemperature)]</property>    
              <property name="DayOutlook">$INFO[Window(weather).Property(Day1.Outlook)]</property>
              <property name="Background">special://skin/backgrounds/WETTERDEFAULT.jpg</property>
           </item>
...
</content>

then I want to display "Humidity" value today( item id="1") and day2( item id="2") each of them.
How to use control label?

For example
<control type="label">
              <left>50</left>
              <top>280</top>
              <width>420</width>
              <height>36</height>
              <font>primal_15</font>
              <label>$INFO[ListItem.Property(Humidity)]</label>
              <textcolor>$VAR[ColorFontNormal]</textcolor>
              <shadowcolor>$VAR[ColorFontShadow]</shadowcolor>
              <align>left</align>
              <aligny>center</aligny>      
            </control>

BUT, I did not get it.

Please advise me how to get "property"?


RE: How to use contents property? - ronie - 2020-05-12

every item needs to have an onclick defined.
so add <onclick>noop</onclick> to each of them.


RE: How to use contents property? - kenmoon - 2020-05-13

(2020-05-12, 18:26)ronie Wrote: every item needs to have an onclick defined.
so add <onclick>noop</onclick> to each of them.

Thank you for answer.
But, I did not get resolve my issue yet.

Please look my code as below. I added "  <onclick>noop</onclick> ".

myweather.xml
....
<content>    
              <item id="1">
              <label>$INFO[Window(weather).Property(Daily.1.LongDay)], $INFO[Window(weather).Property(Daily.1.LongDate)]</label>
              <onclick>noop</onclick>
              <icon>$VAR[VarWeatherHomeIcon]$INFO[Window(Weather).Property(Current.OutlookIcon)]</icon>
              <thumb></thumb>
              <property name="Temperature">$LOCALIZE[143] $INFO[Window(Weather).Property(Current.Temperature)]°</property>
              <property name="Humidity">$LOCALIZE[406]: $INFO[Window(Weather).Property(Current.Humidity)]</property> 
              <property name="FeelsLike">$LOCALIZE[402]: $INFO[Window(Weather).Property(Current.FeelsLike)]°</property>
              <property name="HighTemperature">$INFO[Window(weather).Property(Current.HighTemperature)]</property>     
              <property name="LowTemperature">$INFO[Window(weather).Property(Current.LowTemperature)]</property>    
              <property name="DayOutlook">$INFO[Window(Weather).Property(Current.Condition)]</property>
              <property name="Wind">$LOCALIZE[383]: $INFO[Window(Weather).Property(Current.Wind)]</property>
              <property name="Location">$INFO[Window(Weather).Property(Current.Location)]</property>
              <property name="Provider">$INFO[Window(Weather).Property(WeatherProvider)]</property>
              <property name="ProviderLogo">$INFO[Window(Weather).Property(WeatherProviderLogo)]</property>
              <property name="Background">resource://resource.images.weatherfanart.multi/$INFO[Window(Weather).Property(Current.FanartCode)]</property>
              </item>
                
</content>    

<control type="label">
              <left>1000</left>
              <top>280</top>
              <width>420</width>
              <height>36</height>
              <font>primal_15</font>
              <label>$INFO[Window(Weather).Property(Current.Humidity)]</label>
              <textcolor>$VAR[ColorFontNormal]</textcolor>
              <shadowcolor>$VAR[ColorFontShadow]</shadowcolor>
              <align>left</align>
              <aligny>center</aligny>      
</control>            
---> This is works which means I can see Current.Humidity value correctly on the screen.

<control type="label">
              <left>1000</left>
              <top>280</top>
              <width>800</width>
              <height>36</height>
              <font>primal_15</font>
              <label>$INFO[ListItem.Property(Temperature)]</label>
              <textcolor>$VAR[ColorFontNormal]</textcolor>
              <shadowcolor>$VAR[ColorFontShadow]</shadowcolor>
              <align>left</align>
              <aligny>center</aligny>    
</control>        
It does not work, There is nothing display.

I expect
 
<label>$INFO[ListItem.Property(Humidity)]</label>

then it will call Property(Humidity) as below
 <property name="Humidity">$LOCALIZE[406]: $INFO[Window(Weather).Property(Current.Humidity)]</property> 

Am I incorrect? Please correct me. Thank you.


RE: How to use contents property? - kenmoon - 2020-05-13

I found solution by myself but it is not nice I think.
Do Hard coding as belows..Anyway it works with Yahoo weather.

<control type="label">
                    <left>1000</left>
                    <top>280</top>
                    <width>420</width>
                    <height>36</height>
                    <font>primal_20</font>
                    <label>$INFO[Window.Property(Daily.2.LongDay)]</label>
                    <textcolor>$VAR[ColorFontNormal]</textcolor>
                    <shadowcolor>$VAR[ColorFontShadow]</shadowcolor>
                    <align>left</align>
                    <aligny>center</aligny>      
                </control>

<control type="image">
                    <description>current weather icon</description>
                    <left>965</left>
                    <top>320</top>
                    <width>150</width>
                    <height>150</height>
                    <texture>$VAR[VarWeatherHomeIcon]$INFO[Window.Property(Daily.1.OutlookIcon)]</texture>
                    <aspectratio>keep</aspectratio>
                </control>


RE: How to use contents property? - ronie - 2020-05-13

hmm.. i'm starting to wonder if you're using it all correctly...
<content> is supposed to be used inside a container, and those properties are only available to the listitems inside the container.

too obvious perhaps, but just trying to make sure you've got the basics right.

please upload the full code somewhere if you need more help.


RE: How to use contents property? - kenmoon - 2020-05-14

(2020-05-13, 12:36)ronie Wrote: hmm.. i'm starting to wonder if you're using it all correctly...
<content> is supposed to be used inside a container, and those properties are only available to the listitems inside the container.

too obvious perhaps, but just trying to make sure you've got the basics right.

please upload the full code somewhere if you need more help.
Thank you
I will do upload my full code if I need more help.