You are not logged in.

#1 2011-09-26 20:58:17

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Weatherboy - small weather script for GTK tray

Migrating again from heavy GNOME3 to the Openbox desktop, I was looking for a lightweight tray application with current weather report. Search through AUR gives me nothing and I rapidly wrote a small script on Python2 and GTK which displays the current weather condition. It retrieves data from Yahoo!Weather and uses gtk-stock icons for display.
weatherboy_screenshot.png

Here it is. and AUR

UPD 20120606: left click on icon opens the weather site (http://weather.yahoo.com/ will be opened in the default browser). This small improvement uses standard webbrowser python module (+4 lines to the applet code).
UPD 20111002: '-a/--advanced' key for advanced tooltip (like on screenshot above). 'Quit' menu on right click.

Thank you for every comment and remark!

Last edited by decay_of_mind (2012-06-06 13:39:42)

Offline

#2 2011-09-30 19:06:16

bernarcher
Forum Fellow
From: Germany
Registered: 2009-02-17
Posts: 2,281

Re: Weatherboy - small weather script for GTK tray

Moving to Community Contributions.


To know or not to know ...
... the questions remain forever.

Offline

#3 2011-09-30 19:49:46

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: Weatherboy - small weather script for GTK tray

Maybe I got my WOEID wrong, but all I'm getting is a blank tray icon, and a whole lot of

Traceback (most recent call last):
  File "./weatherboy", line 173, in on_tooltip_verbose
    now_image.set_from_icon_name(weather['current_icon'],48)
TypeError: Gtk.Image.set_from_icon_name() argument 1 must be string, not None

whenever I hover over it.

It's certainly a great idea though.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2011-09-30 20:18:01

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

WorMzy wrote:

Maybe I got my WOEID wrong, but all I'm getting is a blank tray icon, and a whole lot of

Traceback (most recent call last):
  File "./weatherboy", line 173, in on_tooltip_verbose
    now_image.set_from_icon_name(weather['current_icon'],48)
TypeError: Gtk.Image.set_from_icon_name() argument 1 must be string, not None

whenever I hover over it.

It's certainly a great idea though.

Please, post your params of weatherboy.

Offline

#5 2011-09-30 20:52:20

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: Weatherboy - small weather script for GTK tray

Of course.

./weatherboy -l 41415 -u c -v

WOEID extracted from this, for York, England: http://where.yahooapis.com/geocode?q=York+England

Last edited by WorMzy (2011-09-30 20:53:28)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#6 2011-09-30 21:16:02

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

WorMzy wrote:

Of course.

./weatherboy -l 41415 -u c -v

WOEID extracted from this, for York, England: http://where.yahooapis.com/geocode?q=York+England

Yes, you unfortunately have 'Unknown' weather condition now in York, which has no icon in weatherboy. I'll fix it soon. Thx.
UPD: Fix it but till you have 'Unknown' condition you'll get an ugly unknown icon. I recommend you to change your location sad

Last edited by decay_of_mind (2011-09-30 21:32:46)

Offline

#7 2011-09-30 21:26:06

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: Weatherboy - small weather script for GTK tray

Oh, is that all? Glad I could help. big_smile

Hopefully that's not an indication that Yahoo Weather doesn't cover my area.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#8 2011-09-30 22:05:55

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: Weatherboy - small weather script for GTK tray

I have modified my location to something more specific, which does have weather, so hopefully that "unknown" icon won't get seen too often.

I also voted your package up on the AUR, works great now.

I have a couple of suggestions though. "Verbose" seems to be required for a detailed tooltip? I can see the logic behind that, but I'd expect verbose to mean you get more output on stdout. You might want to either change that, or make it clear what -v does on -h's output.

Also, a right-click context menu with an "exit" option would be great. Currently, the only way to kill weatherboy is to ascertain the process' PID (using ps + grep), then issue a sigterm to the process (or use a process manager like htop to do something similar).

And, a config file would be great, so you can just run "weatherboy" and have it use preset values.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#9 2011-10-01 13:36:23

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

WorMzy wrote:

I have modified my location to something more specific, which does have weather, so hopefully that "unknown" icon won't get seen too often.

I also voted your package up on the AUR, works great now.

I have a couple of suggestions though. "Verbose" seems to be required for a detailed tooltip? I can see the logic behind that, but I'd expect verbose to mean you get more output on stdout. You might want to either change that, or make it clear what -v does on -h's output.

Also, a right-click context menu with an "exit" option would be great. Currently, the only way to kill weatherboy is to ascertain the process' PID (using ps + grep), then issue a sigterm to the process (or use a process manager like htop to do something similar).

And, a config file would be great, so you can just run "weatherboy" and have it use preset values.

I've noticed all your ideas, but what about configuration file. I'll not do that because main idea of weatherboy is to be run on startup and there are only three options (woeid, timeout and units). It's too little for config file.

Offline

#10 2011-10-01 13:39:05

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: Weatherboy - small weather script for GTK tray

Yeah, I guess you're right about that.

EDIT: Didn't realise you already added the changes. Great work.

Unfortunately though, it seems to default to Moscow, Russia, and any arguments you pass to the script are silently ignored.

Last edited by WorMzy (2011-10-01 13:48:57)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#11 2011-10-01 17:09:51

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

WorMzy wrote:

Yeah, I guess you're right about that.

EDIT: Didn't realise you already added the changes. Great work.

Unfortunately though, it seems to default to Moscow, Russia, and any arguments you pass to the script are silently ignored.

You can reinstall it from AUR. Sorry I was in a hurry doing modifications.

Offline

#12 2011-10-01 17:34:15

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,787
Website

Re: Weatherboy - small weather script for GTK tray

Yeah, I figured you'd have just forgotten to remove the developmental parameters. Works again now.

Just FYI, you should bump up the pkgrel number every time you edit the PKGBUILD for the same version. Or at least before you resubmit it to the AUR. Otherwise pacman -U/AUR helpers think that the installed package is already up-to-date.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#13 2011-10-12 13:51:59

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

UPD 20111012: Right from Sheremetyevo airport smile
New option "Refresh" in right-click menu for manual update weather data. It will useful in case of lost internet connection or boot up with no internet.

Offline

#14 2011-10-28 17:36:44

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

UPD 20111028: Arrow signs in wind direction info added.

Offline

#15 2011-10-28 18:21:01

timttmy
Member
From: UK
Registered: 2008-12-01
Posts: 53

Re: Weatherboy - small weather script for GTK tray

Just found weatherboy in the AUR. It works great for Port Isaac, UK.
Thankyou very much!


This Is My Truth, Tell Me Yours

Offline

#16 2011-10-29 23:13:50

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

Can someone help me to fix an error with urlopen() call after internet connection  establish  when weatherboy was started without an internet connection?

Offline

#17 2012-05-28 13:30:19

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

Small hint! UPD!!! (fixed after wake up after suspend)
If you want weatherboy to be run only after successful Internet connection, for Wicd just make a file called  weatherboy.sh (for example) looking like this:

#!/bin/bash

script="$(basename "$0")"
script_name="${script/.sh/}"

echo "Running ${script}" >"/var/log/wicd/${script_name}.log"
exec 2>>"/var/log/wicd/${script_name}.log"
exec 1>&2
export DISPLAY=:0.0
if pgrep weatherboy  > /dev/null 2>&1 ; then
	echo "Already started. do nothing"
	exit 0
else
	echo "Starting program"
	sleep 3 &&
	sudo -u zengeist weatherboy -l 796597 -u c -d 10 -a &
fi

... and put this script into /etc/wicd/scripts/postconnect/ directory

Last edited by decay_of_mind (2012-05-28 22:40:39)

Offline

#18 2012-06-03 09:42:52

JohnDVD
Member
Registered: 2011-11-29
Posts: 39

Re: Weatherboy - small weather script for GTK tray

Is is minutes or seconds meant with -d [delta] option?

Offline

#19 2012-06-03 23:18:00

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

JohnDVD wrote:

Is is minutes or seconds meant with -d [delta] option?

Minutes

Offline

#20 2012-06-06 13:39:50

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

UPD 20120606: left click on icon opens the weather site (http://weather.yahoo.com/ will be opened in the default browser). This small improvement uses standard webbrowser python module (+4 lines to the applet code).

Offline

#21 2012-06-07 09:03:46

JohnDVD
Member
Registered: 2011-11-29
Posts: 39

Re: Weatherboy - small weather script for GTK tray

cool, I already thought there could be any function on icon leftclick. smile

I translated the version before into german via a workaround / patch. I don't know if it's complete, because the conditions list in yahoo weather api doc is partly not valid anymore.
Are you interested in extending the weatherboy for supporting other languages e.g. by loading a certain language file?

Offline

#22 2012-06-07 23:30:04

decay_of_mind
Member
Registered: 2009-11-01
Posts: 37

Re: Weatherboy - small weather script for GTK tray

Of course, I can extend this app to !morethanonefilebigapp!, but I don't think I should do this.

Offline

#23 2012-06-21 22:47:05

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,914
Website

Re: Weatherboy - small weather script for GTK tray

page is 403. Please fix


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#24 2012-09-20 18:31:12

David López
Member
Registered: 2012-08-26
Posts: 98

Re: Weatherboy - small weather script for GTK tray

decay_of_mind wrote:

Migrating again from heavy GNOME3 to the Openbox desktop, I was looking for a lightweight tray application with current weather report.

You are describing my situation. I was looking for something as weatherboy, thanks a lot.

I really don't care, but the left click doesn't do anaything for me. I'm using lxde and chromium.

I have a suggestion. Can weatherboy icon display the temperature just like weather-indicator (cloudy)? I think it' a nice feature

WeatherIndicator?action=AttachFile&do=get&target=foggy_beta.png
https://wiki.ubuntu.com/WeatherIndicato … y_beta.png

Last edited by David López (2012-09-20 18:31:44)

Offline

#25 2013-03-31 18:20:17

HarD
Member
From: Russia
Registered: 2011-08-11
Posts: 30

Re: Weatherboy - small weather script for GTK tray

Hi

Thanks for cool apps, but can you add support - when programm start and internet down and then up, weather cann't update and manual too.

Last edited by HarD (2013-03-31 20:43:40)

Offline

Board footer

Powered by FluxBB