Logo Search packages:      
Sourcecode: catfish version File versions  Download package

def catfish::catfish::get_file_icon (   self,
  path,
  icon_size = 0,
  mime_type = None 
)
Retrieve the file icon.

Definition at line 723 of file catfish.py.

                                                              :
        """Retrieve the file icon."""

        try:
            is_folder = stat.S_ISDIR(os.stat(path).st_mode)
        except:
            is_folder = 0
        if is_folder:
            icon_name = gtk.STOCK_DIRECTORY
        else:
            if mime_type <> None:
                try:
                    # Get icon from mimetype
                    media, subtype = mime_type
                    icon_name = 'gnome-mime-%s-%s' % (media, subtype)
                    return self.get_icon_pixbuf(icon_name, icon_size)
                except:
                    try:
                        # Then try generic icon
                        icon_name = 'gnome-mime-%s' % media
                        return self.get_icon_pixbuf(icon_name, icon_size)
                    except:
                        # Use default icon
                        icon_name = gtk.STOCK_FILE
            else:
                icon_name = gtk.STOCK_FILE
        return self.get_icon_pixbuf(icon_name, icon_size)

# -- events --


Generated by  Doxygen 1.6.0   Back to index