Loads an animated icon by doing a lookup on the icon theme.
00138 : """Loads an animated icon by doing a lookup on the icon theme.""" # If user do not choose a icon_name, use the default one if icon_name == None: icon_name = self.default_animated_icon_name # Even the default one (now on icon_name) might not be available if icon_name == None: raise AnimatedIconNotFound # Try to lookup the icon icon_info = self.icon_theme.lookup_icon(icon_name, -1, 0) # Even if icon_name exists, it might not be found by lookup if icon_info == None: raise AnimatedIconNotFound # Base size is, according to PyGTK docs: # "a size for the icon that was specified by the icon theme creator, # This may be different than the actual size of image." # Ouch! We are acting on blind faith here... size = icon_info.get_base_size() # NOTE: If the icon is a builtin, it will not have a filename, see: # http://www.pygtk.org/pygtk2reference/class-gtkicontheme.html # But, we are not using the gtk.ICON_LOOKUP_USE_BUILTIN flag, nor does # GTK+ has a builtin animation, so we are safe ;-) filename = icon_info.get_filename() # Now that we have a filename, call load_animated_from_filename() self.load_animated_from_filename(filename, size) def load_animated_from_filename(self, filename, size):