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 <[EMAIL PROTECTED]>
GRAMPS OpenSource Genealogy
signature.asc
Description: This is a digitally signed message part
_______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
