Re: [Gimp-developer] Finding the gimp icon path in Python....

On 14 August 2012 15:56, Ragnar Brynjúlfsson <ragtag ragtag net> wrote:
> How can I reliably find the path to where the Gimp icons are across
> all platforms?
> I'm basically doing:
>  self.set_icon_from_file("/usr/share/icons/hicolor/scalable/apps/gimp.svg")
> in a PyGtk plug-in, which will obviously break on Windows, OSX and
> even on some other Linux distros.

Again, there is no API for that -
The wya to proceed is to check the __file__ attribute of Python's
"gimp" module, and
infer the icons directory from that.

For example, here I have, on python-fu's console:

>>> import gimp
>>> gimp.__file__

So, if that string starts with either "/usr/lib" or "/usr/lib64",
"usr/share" is the way to go.
Possibly this could work for any gimp build which dos not specialize
the application prefixes:

icon_path = gimp.__file__.split("/lib")[0] +

> _______________________________________________
> gimp-developer-list mailing list
> gimp-developer-list gnome org

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