Re: Alter status bar or thumbnail view from python plugin



On Fri, Dec 28, 2012 at 5:09 AM, Felix Riemann <friemann gnome org> wrote:
> Am Sonntag, den 23.12.2012, 16:03 +1100 schrieb Tim Cuthbertson:
>> Thanks Felix,
>
> Hi Tim,
>
>
>> 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.
>
> If you want to add some visualization you could also think about adding
> a new page to the sidebar.

Yeah, I thought about that too. Unfortunately the main thing I want to
add is ratings and tags on photos tat you *aren't* currently viewing,
which would probably mean reimplementing the thumbnail bar. For the
photo you are currently viewing, the information in the statusbar
seems sufficient.

>> >> 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.
>
> The Bugzilla link wasn't meant to turn you off, actually it should show
> that there is interest in such a plugin. ;)
>
> If you like we can try to include it into the eog-plugins package.
> Alternatively we could add a link on our wiki page.

Ahh, sorry I misinterpreted (I kinda assumed nodiscc's comment was
indicative of the project's view). That's good news then :)

I intend to distribute this plugin as a zeroinstall[0] feed, which
depends on getting [1] implemented at some point (I'm happy to try
coding that, if it would help). Once that works I'll add a pointer to
the bugzilla in case others come looking for it. It's not super
user-friendly, you need to use the command-line tool to search based
on metadata, but it's probably sufficient for many.

I wouldn't mind if someone wants to package the plugin in eog-plugins
(and keep it updated), but I'm afraid I wouldn't lend a hand to that
myself - I can't stand dealing with even the simplest of autotools
build systems.

[0] http://0install.net/
[1] https://bugzilla.gnome.org/show_bug.cgi?id=690282

>> < .. snip .. >
>> 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.
>
> I'll see if I can take a look at it.
> One thing I can see already is that you have a python file that loads
> the plugin from a subdirectory. You shouldn't need that file as we can
> load the plugin from the subdirectory directly. Just make sure that the
> Module key in the .plugin-file has the name of the subdirectory and move
> the import statement into the __init__.py file.

Ahh, well the thing is I'd potentially like to use the other
submodules (eog_rate.cmd specifically) without inadvertently depending
on gi.repository.* (since that's only really needed for the plugin).

This way I can to `from eog_rate import cmd`, and it will never import
eog_rate.plugin. If I imported the plugin from __init__, I couldn't
import anything under eog_rate without failing on an ImportError if
gobject introspection isn't installed.

> Oh, maybe you'd like to use a different icon too? Not sure how
> widespread Postr is nowadays. ;)

Ahh yep, thanks - I just inherited that from the "hello world"
example, I think. I've added a custom one now.

Cheers,
 - Tim.


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