Re: Alter status bar or thumbnail view from python plugin



Thanks Felix,

On Sun, Dec 23, 2012 at 2:20 AM, Felix Riemann <friemann gnome org> wrote:
> Hey Tim,
>
> Am Donnerstag, den 20.12.2012, 12:44 +1100 schrieb Tim Cuthbertson:
>> Is there any way for a (python) plugin to alter the status bar and/or
>> thumbnail view?
>
> Changing the thumbnail view is probably pretty hard, as you'd have to
> extend both it's data model as well as the used CellRenderer.

Ok, sounds like that's probably too tricky. I'd settle for a text
label instead of changing the icon, but I peeked at the relevant code
and it sounds like I'd still need to alter eog itself (or create a
duplicate model) to actually implement that - so I'll probably just do
without this feature.

>> I've written a plugin to rate photos, which sets a user-level xattr on
>> the file to the number of stars a user has given the image. I'd love
>> to display this as an overlay on the thumbnail bar, or at least in the
>> status bar. I see other plugins modify the status bar, but they're all
>> in C and I can't figure out how to do this from python.
>
> Regarding the rating see also
> https://bugzilla.gnome.org/show_bug.cgi?id=589198

Thanks for the pointer, although I don't think it will put me off -
I've tried every photo "manager" (as opposed to viewer) for linux that
I've heard of, and almost all of them are completely useless to me
because they do one (or both) of the following:

 - store metadata in their own store, which doesn't persist if you
move / copy / rearrange files (and isn't easy to access externally).
 - make you import photos into their system manually, rather than just
using the on-disk arrangement (gthumb is a notable exception here).

I could write the plugin for gthumb I suppose, although I prefer eog,
and gthumb has zero documentation on how to write a plugin. I don't
intend to contort eog too far, it's really just for setting this data
- I've got a completely-unrelated-to-eog command line tool to actually
query and do useful things with the metadata.

>> By looking at the .gir it doesn't seem possible, do I need to add GI
>> annotations to eog itself before I can make use of these functions? Is
>> there any reason not to do that, or has it just not been done yet?
>
> Working with eog's statusbar is easier than it looks.
> The trick is not to use the EogStatusbar members but use the interfaces
> of it's parent classes GtkStatusbar and GtkBox to alter it.
>
> The included statusbar-date plugin for example simply injects another
> newly created GtkStatusbar inside eog's statusbar using the GtkBox
> functions (GtkBox.pack_end).
>
> I'm not that much into Python though, so it could be that there might be
> API limitations here preventing that. Although that's hard to think of
> as GtkBox is a widely used interface in GNOME.

You're right, it works just fine. Thanks for the tip to use the
superclass, I hadn't noticed that. I've now got my extension
more-or-less working, and the code up on github:

https://github.com/gfxmonk/eog-rate/blob/master/src/eog_rate/plugin.py

Feedback welcome, this is my first eog plugin so hopefully I'm doing
anything too daft.

Cheers,
 - Tim.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]