Update of /cvsroot/freevo/freevo/src/gui
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1897

Modified Files:
        imagelib.py 
Log Message:
create image thumbnails on-the-fly

Index: imagelib.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/imagelib.py,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** imagelib.py 22 Jan 2005 12:34:57 -0000      1.11
--- imagelib.py 10 Apr 2005 18:00:19 -0000      1.12
***************
*** 178,182 ****
  
  
! def item_image(item, size, icon_dir, force=False, cache=True):
      """
      Return the image for an item. This function uses internal caches and
--- 178,182 ----
  
  
! def item_image(item, size, icon_dir, force=False, cache=True, bg=False):
      """
      Return the image for an item. This function uses internal caches and
***************
*** 190,202 ****
          type = item.display_type
      except:
!         try:
!             type = item.info['mime'].replace('/', '_')
!         except:
!             type = item.type
  
!     if isinstance(item.image, (str, unicode)):
          key = '%s-%s-%s-%s-%s-%s-%s-%s' \
!               % (icon_dir, item.image, type, item.type, width, height, force,
!                  os.stat(item.image)[stat.ST_MTIME])
  
          if item['rotation']:
--- 190,202 ----
          type = item.display_type
      except:
!         type = item.type
  
!     try:
!         mtime = os.stat(item.image)[stat.ST_MTIME]
!     except:
!         item.image = ''
!     if isinstance(item.image, (str, unicode)) and item.image:
          key = '%s-%s-%s-%s-%s-%s-%s-%s' \
!               % (icon_dir, item.image, type, item.type, width, height, force, 
mtime)
  
          if item['rotation']:
***************
*** 217,221 ****
          try:
              # load the thumbnail
!             image = util.thumbnail.load(item.image)
          except:
              # maybe image is something else (like already an image object)
--- 217,221 ----
          try:
              # load the thumbnail
!             image = util.thumbnail.load(item.image, bg)
          except:
              # maybe image is something else (like already an image object)
***************
*** 229,232 ****
--- 229,234 ----
              return None
  
+         item.image = None
+         
          if hasattr(item, 'media') and item.media and \
                 item.media.item == item and \
***************
*** 253,264 ****
                  imagefile = '%s/mimetypes/playlist.png' % icon_dir
  
!         elif os.path.isfile('%s/mimetypes/%s.png' % (icon_dir, type)):
!             imagefile = '%s/mimetypes/%s.png' % (icon_dir, type)
  
!         elif os.path.isfile('%s/mimetypes/%s.png' % (icon_dir, item.type)):
!             imagefile = '%s/mimetypes/%s.png' % (icon_dir, item.type)
  
!         elif os.path.isfile('%s/mimetypes/unknown.png' % icon_dir):
!             imagefile = '%s/mimetypes/unknown.png' % icon_dir
  
          if not imagefile:
--- 255,272 ----
                  imagefile = '%s/mimetypes/playlist.png' % icon_dir
  
!         else:
!             try:
!                 type = item.info['mime'].replace('/', '_')
!             except:
!                 pass
!             
!             if os.path.isfile('%s/mimetypes/%s.png' % (icon_dir, type)):
!                 imagefile = '%s/mimetypes/%s.png' % (icon_dir, type)
  
!             elif os.path.isfile('%s/mimetypes/%s.png' % (icon_dir, 
item.type)):
!                 imagefile = '%s/mimetypes/%s.png' % (icon_dir, item.type)
  
!             elif os.path.isfile('%s/mimetypes/unknown.png' % icon_dir):
!                 imagefile = '%s/mimetypes/unknown.png' % icon_dir
  
          if not imagefile:
***************
*** 295,299 ****
  
      image.scale((width, height))
!     if isinstance(item.image, (str, unicode)):
          cache[key] = image
      return image
--- 303,307 ----
  
      image.scale((width, height))
!     if isinstance(item.image, (str, unicode)) and item.image:
          cache[key] = image
      return image



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to