miracle2k
miracle2k

Reputation: 32047

GTK Named Icons: Load while running from source, during development

I have written a GTK app in Python (using PyGObject). I'm confused about how to handle deployment, specifically icons.

I understand that in most cases, I would be able to load my images from a specific path; however, the recommended way seems to be to register icons as named icons with the system, so they can be themed. In some cases, like Ubuntu's app indicators, it seems like using named icons is the only thing that is supported.

I have all this working; expect I'd like my app to work when just run from the source directory, without installing it system-wide. Surely this is possible somehow?

Upvotes: 2

Views: 295

Answers (2)

Kai
Kai

Reputation: 5330

If you're going to support running from the source directory, then your executable is already going to have to deal with a range of path-based issues. Fixing icon theme lookups is just another step in this process.

If you already have a subdirectory structured as required by the icon theme spec, then all you should need to add to your launcher is:

icon_path = os.path.abspath('icons')
gtk.IconTheme.append_search_path(icon_path)

where icons contains your icon-theme-spec compliant directory (i.e., hicolor) or directories.

Upvotes: 3

user626998
user626998

Reputation:

I know this isn't 100% what you're looking for but Gnome will also recognize icons installed at ~/.local/share/icons/. When the program is run from the source directory, the icons could be copied there.

Upvotes: 0

Related Questions