thesamet / webilder

Wallpaper downloader and rotator that uses Flickr and Webshots.
http://www.webilder.org/
Other
30 stars 12 forks source link

Added "Info on Current" context menu item in Gnome applet #16

Closed xss closed 13 years ago

xss commented 13 years ago

Hello Nadav,

it was quite a bit harder than I expected it to be (well, at least for me), but I finally managed to modify webilder_gnome_applet.py to provide a new context menu item "Info on Current" as suggested in my feature request/issue #14: https://github.com/thesamet/webilder/issues#issue/14

I added a new function, basically by replicating and modifying some of your code, and complemented it to make the feature also work in some cases when self.image_file is not yet defined or not the current image (before first rotation after applet start, or when wallpaper was changed in Gnome between rotations). I only added the aforementioned function, and two items in init concerning the context menu item -- see the three ### notations in the code. I tried to keep the code as tidy as possible, and the applet resource friendly by importing necessary modules only when needed (don't know if that makes sense at all in Python...).

As I only have a very, very basic understanding of Python, I assume that there might be more sophisticated ways of implementing this, so please, revise the code.

It works beautifully in my local installation in all cases that I could think of. In case the current image is not from webilder's collection, only filename, size and date will be displayed in the Photo Properties window, and the other items which would normally come from the .inf file will be displayed as '--'. I thought this would be the line of least resistance, as it wouldn't make a new translation item necessary like "unknown" or "not available". ;-)

I'd be glad if you incorporated this feature into the official release.

Kind regards, xss

thesamet commented 13 years ago

Thanks for implementing this! I have a bit of a back log. I'll get to review the code later this week.

-Nadav

On Sun, Mar 13, 2011 at 6:05 PM, xss < reply@reply.github.com>wrote:

Hello Nadav,

it was quite a bit harder than I expected it to be (well, at least for me), but I finally managed to modify webilder_gnome_applet.py to provide a new context menu item "Info on Current" as suggested in my feature request/issue

14: https://github.com/thesamet/webilder/issues#issue/14

I added a new function, basically by replicating and modifying some of your code, and complemented it to make the feature also work in some cases when self.image_file is not yet defined or not the current image (before first rotation after applet start, or when wallpaper was changed in Gnome between rotations). I only added the aforementioned function, and two items in init concerning the context menu item -- see the three ### notations in the code. I tried to keep the code as tidy as possible, and the applet resource friendly by importing necessary modules only when needed (don't know if that makes sense at all in Python...).

As I only have a very, very basic understanding of Python, I assume that there might be more sophisticated ways of implementing this, so please, revise the code.

It works beautifully in my local installation in all cases that I could think of. In case the current image is not from webilder's collection, only filename, size and date will be displayed in the Photo Properties window, and the other items which would normally come from the .inf file will be displayed as '--'. I thought this would be the line of least resistance, as it wouldn't make a new translation item necessary like "unknown" or "not available". ;-)

I'd be glad if you incorporated this feature into the official release.

Kind regards, xss

https://github.com/thesamet/webilder/pull/16

Sincerely yours, Nadav