|
example - fetching icon from gnome theme: msg#00168gnome.gtk+.python
This is derived from some code I wrote for GRAMPS. It attempts to find the icon associated with a type within the specified theme. ---------------------------------------- _nautdir = "/usr/share/pixmaps/nautilus" _pixdir = "/usr/share/pixmaps" import gconf import os def nautilus_icon(theme,type): if type == "x-directory/": if theme: newicon = "%s/%s/i-directory.png" % (_nautdir,theme) else: newicon = "%s/gnome-folder.png" % _pixdir if os.path.isfile(newicon): return newicon return None else: icontmp = type.replace('/','-') if theme: newicon = "%s/%s/gnome-%s.png" % (_nautdir,theme,icontmp) if os.path.isfile(newicon): return newicon else: newicon = "%s/document-icons/gnome-%s.png" % (_nautdir,icontmp) if os.path.isfile(newicon): return newicon return None if __name__ == "__main__": client = gconf.client_get_default() theme = client.get_string("/desktop/gnome/file_views/icon_theme") print nautilus_icon(theme,"image/jpeg") print nautilus_icon(theme,"x-directory/") -- Don Allingham <dallingham@xxxxxxxxxxxxxxxxxxxxx> GRAMPS OpenSource Genealogy
pygtk mailing list pygtk@xxxxxxxxxx http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | ANNOUNCE: PyGtkGLExt 0.99.1 released: 00168, Naofumi Yasufuku |
|---|---|
| Next by Date: | Help with passing parameteres to a callback routine (newbie): 00168, Peter Stokes |
| Previous by Thread: | ANNOUNCE: PyGtkGLExt 0.99.1 releasedi: 00168, Naofumi Yasufuku |
| Next by Thread: | Help with passing parameteres to a callback routine (newbie): 00168, Peter Stokes |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |