Re: Finding the gimp icon path in Python....

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

 



On 14 August 2012 15:56, Ragnar Brynjúlfsson <ragtag@xxxxxxxxxx> 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@xxxxxxxxx
> https://mail.gnome.org/mailman/listinfo/gimp-developer-list
_______________________________________________
gimp-developer-list mailing list
gimp-developer-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gimp-developer-list



[Index of Archives]     [Video For Linux]     [Photo]     [Yosemite News]     [gtk]     [GIMP for Windows]     [KDE]     [GEGL]     [Gimp's Home]     [Gimp on GUI]     [Gimp on Windows]     [Steve's Art]

  Powered by Linux