On Nov 28, 3:52 pm, "Wout Clymans" <
woutclym...@gmail.com> wrote:
> These are the locations where i found the icon on my system:
> /usr/share/icons/Human/48x48/status/dialog-information.png
> /usr/share/icons/Human/16x16/status/dialog-information.png
> /usr/share/icons/Human/22x22/status/dialog-information.png
> /usr/share/icons/Human/24x24/status/dialog-information.png
> /usr/share/icons/gnome/32x32/status/dialog-information.png
> /usr/share/icons/gnome/16x16/status/dialog-information.png
> /usr/share/icons/gnome/22x22/status/dialog-information.png
> /usr/share/icons/gnome/24x24/status/dialog-information.png
> /usr/share/icons/Neu/128x128/status/dialog-information.png
> /usr/share/icons/Neu/48x48/status/dialog-information.png
> /usr/share/icons/Neu/22x22/status/dialog-information.png
> /usr/share/icons/Neu/24x24/status/dialog-information.png
>
> So it seems you have to install a gnome theme. (Human/Neu are themes)
>
> Wout
>
I think it's more difficult than that. Its one thing to get the icons
installed, but another to find them. I'm not certain but I dont think
gtk.icon_theme_get_default() will find Gnome icons on KDE.
Anyway, I submit this as a hack. It's not my work. I stole it from
http://code.google.com/p/pychess/issues/detail?id=302. It's not quite
perfect but it's enough to get us beleagured KDE users going.
--- ../main.py 2007-07-01 13:11:43.000000000 +0100
+++ spectlib/main.py 2008-11-28 17:48:56.000000000 +0000
@@ -96,6 +96,50 @@
if GTK:
self.tray = Tray(self)
self.icon_theme = gtk.icon_theme_get_default()
+ import re, os
+ if not self.icon_theme.lookup_icon("dialog-information",
64, gtk.ICON_LOOKUP_USE_BUILTIN):
+ class SimpleIconTheme:
+ def __init__ (self):
+ self.sizeDirReg = re.compile("(\d+)x(\d+)")
+ folders = ("/usr/share/icons/", "/usr/local/
share/icons/")
+ self.icons = {}
+ for folder in folders:
+ if os.path.isdir(folder):
+ self.loadIcons(folder, self.icons)
+
+ def loadIcons (self, folder, dic, size=None):
+ for file in os.listdir(folder):
+ joined = os.path.join(folder, file)
+ if os.path.isdir(joined):
+ if not size:
+ match = self.sizeDirReg.match(file)
+ if match:
+ subsize = int(match.groups()
[0])
+ self.loadIcons(joined, dic,
subsize)
+ continue
+ self.loadIcons(joined, dic, size)
+ elif size and file.endswith(".png"):
+ name = file[:-4]
+ if not name in dic:
+ dic[name] = {}
+ dic[name][size] = joined
+
+ def load_icon(self, name, size, *args):
+ if name in self.icons:
+ if size in self.icons[name]:
+ filename = self.icons[name][size]
+ else:
+ sizes = self.icons[name].keys()
+ sizes = [(abs(s-size),s) for s in
sizes]
+ sizes.sort()
+ filename = self.icons[name][sizes[0]
[1]]
+ return gtk.gdk.pixbuf_new_from_file
(filename)
+ else:
+ self.logger.log.error("Unable to load icon:
%s at size: %d\n" % (name, size))
+ return gtk.gdk.Pixbuf
(gtk.gdk.COLORSPACE_RGB, True, 8, size, size)
+
+ gtk.icon_theme_get_default = lambda: SimpleIconTheme()
+ self.icon_theme = gtk.icon_theme_get_default()
self.watch_db = {}
self.watch_io = Watch_io()
watch_value_db = self.watch_io.read_options()