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

Modified Files:
        imagelib.py 
Log Message:
move thumbnail support to extra file

Index: imagelib.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/gui/imagelib.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** imagelib.py 24 Aug 2004 19:23:37 -0000      1.2
--- imagelib.py 7 Sep 2004 18:51:06 -0000       1.3
***************
*** 67,77 ****
          image = mevas.imagelib.new(url.size, url.tostring(), url.mode)
      except:
! 
!         if url[:8] == 'thumb://':
!             filename = os.path.abspath(url[8:])
!             thumbnail = True
!         else:
!             filename = os.path.abspath(url)
!             thumbnail = False
  
          if vfs_save:
--- 67,71 ----
          image = mevas.imagelib.new(url.size, url.tostring(), url.mode)
      except:
!         filename = os.path.abspath(url)
  
          if vfs_save:
***************
*** 97,127 ****
  
          try:
!             if isstring(filename) and filename.endswith('.raw'):
!                 # load cache
!                 data  = util.read_thumbnail(filename)
!                 # convert to image
!                 image = mevas.imagelib.new(data[1], data[0], data[2])
! 
!             elif thumbnail:
!                 # load cache or create it
!                 data = util.cache_image(filename)
!                 # convert to image
!                 try:
!                     image = mevas.imagelib.new(data[1], data[0], data[2])
!                     #image = mevas.imagelib.new(data[1], data[0], 'FIXME')
!                 except:
!                     try:
!                         data = util.create_thumbnail(filename)
!                         image = mevas.imagelib.new(data[1], data[0], data[2])
!                         #image = mevas.imagelib.new(data[1], data[0], 'FIXME')
!                     except ValueError:
!                         image = mevas.imagelib.open(filename)
!             else:
!                 try:
!                     image = mevas.imagelib.open(filename)
!                 except Exception, e:
!                     print 'imagelib load problem: %s - trying Imaging' % e
!                     i = Image.open(filename)
!                     image = mevas.imagelib.new(i.tostring(), i.size, i.mode)
  
          except:
--- 91,100 ----
  
          try:
!             try:
!                 image = mevas.imagelib.open(filename)
!             except Exception, e:
!                 print 'imagelib load problem: %s - trying Imaging' % e
!                 i = Image.open(filename)
!                 image = mevas.imagelib.new(i.tostring(), i.size, i.mode)
  
          except:
***************
*** 147,151 ****
  
  item_imagecache = util.objectcache.ObjectCache(30, desc='item_image')
- load_imagecache = util.objectcache.ObjectCache(20, desc='load_image')
  
  def item_image(item, size, icon_dir, force=False):
--- 120,123 ----
***************
*** 181,193 ****
      
      if item.image:
!         if isinstance(item.image, ImageFile.ImageFile):
              image = load(item.image)
-         else:
-             image = load('thumb://%s' % item.image, None, load_imagecache)
  
!         if image and item['rotation']:
!             image = mevas.imagelib.rotate(image, item['rotation'])
!             
!     if not image:
          if not force:
              return None
--- 153,167 ----
      
      if item.image:
!         try:
!             # load the thumbnail
!             image = util.thumbnail.load(item.image)
!         except:
!             # maybe image is something else (like already an image object)
              image = load(item.image)
  
!     if image:
!         if item['rotation']:
!             image.rotate(item['rotation'])
!     else:
          if not force:
              return None
***************
*** 226,242 ****
              return None
  
!         image = load('thumb://%s' % imagefile, None, load_imagecache)
! 
          if not image:
              return None
  
-     else:
-         force = 0
- 
      if type and len(type) > 4:
          type = type[:5]
          
!     i_w   = image.width
!     i_h   = image.height
      aspect = float(i_h)/i_w
  
--- 200,214 ----
              return None
  
!         # load the thumbnail
!         image = util.thumbnail.load(imagefile)
!             
          if not image:
              return None
  
      if type and len(type) > 4:
          type = type[:5]
          
!     i_w = image.width
!     i_h = image.height
      aspect = float(i_h)/i_w
  
***************
*** 253,262 ****
          
      if int(float(width * i_h) / i_w) > height:
!         width =  int(float(height * i_w) / i_h)
      else:
          height = int(float(width * i_h) / i_w)
  
!     image = mevas.imagelib.scale(image, (width, height))
! 
      item_imagecache[key] = image
      return image
--- 225,233 ----
          
      if int(float(width * i_h) / i_w) > height:
!         width = int(float(height * i_w) / i_h)
      else:
          height = int(float(width * i_h) / i_w)
  
!     image.scale((width, height))
      item_imagecache[key] = image
      return image



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to