Added Wind Chill

19 views
Skip to first unread message

Scott Geiger

unread,
Jan 7, 2014, 8:27:42 AM1/7/14
to cinnamon...@googlegroups.com
Hi, first thanks, great applet. 

Being that I live in the North-Eastern US we often times get Wind Chill values (when the temp is below 40F and their is wind it can feel colder).  So I wanted to add that in to the current weather.  Here is a diff of the code.  Feel free to adapt it as you wish.

--- applet.js.orig    2014-01-07 07:57:50.539014296 -0500
+++ applet.js    2014-01-07 08:16:43.199610176 -0500
@@ -371,6 +371,7 @@
         let temperature
= weather_c.get_string_member('temp')
 
         let wind
= weather.get_object_member('wind').get_string_member('speed')
+    let wind_chill = weather.get_object_member('wind').get_string_member('chill')
         let wind_direction
= this.compassDirection(weather.get_object_member('wind').get_string_member('direction'))
         let wind_unit
= weather.get_object_member('units').get_string_member('speed')
 
@@ -433,6 +434,7 @@
             
break
         
}
         
this._currentWeatherWind.text = (wind_direction ? wind_direction + ' ' : '') + wind + ' ' + wind_unit
+    this._currentWeatherWindChill.text = wind_chill  + ' ' + this.unitToUnicode()
 
         
// location is a button
         
this._currentWeatherLocation.style_class = STYLE_LOCATION_LINK
@@ -562,6 +564,7 @@
     
this._currentWeatherHumidity = new St.Label(textOb)
     
this._currentWeatherPressure = new St.Label(textOb)
     
this._currentWeatherWind = new St.Label(textOb)
+    this._currentWeatherWindChill = new St.Label(textOb)
 
     let rb
= new St.BoxLayout({
       style_class
: STYLE_DATABOX
@@ -585,6 +588,8 @@
     rb_values
.add_actor(this._currentWeatherPressure)
     rb_captions
.add_actor(new St.Label({text: _('Wind:')}))
     rb_values
.add_actor(this._currentWeatherWind)
+    rb_captions.add_actor(new St.Label({text: _('Wind Chill:')}))
+    rb_values.add_actor(this._currentWeatherWindChill)
 
     let xb
= new St.BoxLayout()
     xb
.add_actor(bb)


Here's a screen shot of the output (yes, it really is that cold here today!)




Scott Geiger

unread,
Jan 7, 2014, 8:30:15 AM1/7/14
to cinnamon...@googlegroups.com

Sorry forgot to attach the image.  And yes, it is that cold.


TM

unread,
Jan 7, 2014, 2:57:29 PM1/7/14
to cinnamon...@googlegroups.com
Thanks!

On 01/07/2014 08:27 AM, Scott Geiger wrote:
> Hi, first thanks, great applet.
>
> Being that I live in the North-Eastern US we often times get Wind Chill
> values (when the temp is below 40F and their is wind it can feel
> colder). So I wanted to add that in to the current weather. Here is a
> diff of the code. Feel free to adapt it as you wish.
>
> |
> ---applet.js.orig 2014-01-0707:57:50.539014296-0500
> +++applet.js 2014-01-0708:16:43.199610176-0500
> @@-371,6+371,7@@
> let temperature =weather_c.get_string_member('temp')
>
> let wind
> =weather.get_object_member('wind').get_string_member('speed')
> + let wind_chill
> =weather.get_object_member('wind').get_string_member('chill')
> let wind_direction
> =this.compassDirection(weather.get_object_member('wind').get_string_member('direction'))
> let wind_unit
> =weather.get_object_member('units').get_string_member('speed')
>
> @@-433,6+434,7@@
> break
> }
> this._currentWeatherWind.text =(wind_direction ?wind_direction
> +' ':'')+wind +' '+wind_unit
> + this._currentWeatherWindChill.text =wind_chill +'
> '+this.unitToUnicode()
>
> // location is a button
> this._currentWeatherLocation.style_class =STYLE_LOCATION_LINK
> @@-562,6+564,7@@
> this._currentWeatherHumidity =newSt.Label(textOb)
> this._currentWeatherPressure =newSt.Label(textOb)
> this._currentWeatherWind =newSt.Label(textOb)
> + this._currentWeatherWindChill =newSt.Label(textOb)
>
> let rb =newSt.BoxLayout({
> style_class:STYLE_DATABOX
> @@-585,6+588,8@@
> rb_values.add_actor(this._currentWeatherPressure)
> rb_captions.add_actor(newSt.Label({text:_('Wind:')}))
> rb_values.add_actor(this._currentWeatherWind)
> + rb_captions.add_actor(newSt.Label({text:_('Wind Chill:')}))
> + rb_values.add_actor(this._currentWeatherWindChill)
>
> let xb =newSt.BoxLayout()
> xb.add_actor(bb)
>
> |
>
> Here's a screen shot of the output (yes, it really is that cold here today!)
>
>
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Cinnamon Weather" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to cinnamon-weath...@googlegroups.com.
> To post to this group, send email to cinnamon...@googlegroups.com.
> Visit this group at http://groups.google.com/group/cinnamon-weather.
> For more options, visit https://groups.google.com/groups/opt_out.

Scott Geiger

unread,
Jan 8, 2014, 8:50:08 AM1/8/14
to cinnamon...@googlegroups.com
I may play around with it a little more.  Not sure what happens when the temp gets above wind chill values, if that parameter is still in the JSON string or not.  Also on the opposite end of the scale; heat index when the temp gets above 80F.  May need to add an IF block on the wind chill.  I'll post new diffs as I make changes.

Scott

TM

unread,
Jan 8, 2014, 10:12:24 PM1/8/14
to cinnamon...@googlegroups.com
Great. I'm having some trouble uploading a new release to the Spices
website, but it's available from github:

https://github.com/mockturtl/cinnamon-weather/releases

Updating via the applets manager in cinnamon-settings is currently broken.

http://forums.linuxmint.com/viewtopic.php?f=47&t=153062&p=796579#p806977

I'm told the dev team is aware of the problem.
> > an email to cinnamon-weath...@googlegroups.com <javascript:>.
> > To post to this group, send email to cinnamon...@googlegroups.com
> <javascript:>.
> <http://groups.google.com/group/cinnamon-weather>.
> > For more options, visit https://groups.google.com/groups/opt_out
> <https://groups.google.com/groups/opt_out>.
Reply all
Reply to author
Forward
0 new messages