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__
'/usr/lib64/gimp/2.0/python/gimp.so'

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] +
"/share/icons/hicolor/scalable/apps/gimp.svg"


> _______________________________________________
> gimp-developer-list mailing list
> gimp-developer-list gnome org
> https://mail.gnome.org/mailman/listinfo/gimp-developer-list


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