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

Modified Files:
        osd.py 
Log Message:
cleanup

Index: osd.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/osd.py,v
retrieving revision 1.160
retrieving revision 1.161
diff -C2 -d -r1.160 -r1.161
*** osd.py      9 Jun 2004 19:50:17 -0000       1.160
--- osd.py      10 Jun 2004 10:01:31 -0000      1.161
***************
*** 12,15 ****
--- 12,18 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.161  2004/06/10 10:01:31  dischi
+ # cleanup
+ #
  # Revision 1.160  2004/06/09 19:50:17  dischi
  # change thumbnail caching format to be much faster: do not use pickle and
***************
*** 19,43 ****
  # handle missing surfarray (Python Numeric)
  #
- # Revision 1.158  2004/06/06 06:32:33  dischi
- # check osd init before drawstringframed
- #
- # Revision 1.157  2004/05/31 10:41:44  dischi
- # remove sleep function, not needed anymore
- #
- # Revision 1.156  2004/05/13 12:33:42  dischi
- # animation damage patch from Viggo Fredriksen
- #
- # Revision 1.155  2004/05/09 14:17:44  dischi
- # do use a SynchronizedObject for the osd
- #
- # Revision 1.154  2004/05/02 11:46:12  dischi
- # make it possible to turn off image caching
- #
- # Revision 1.153  2004/05/02 09:20:55  dischi
- # better support for time==0
- #
- # Revision 1.152  2004/04/25 11:23:57  dischi
- # Added support for animations. Most of the code is from Viggo Fredriksen
- #
  # -----------------------------------------------------------------------
  # Freevo - A Home Theater PC framework
--- 22,25 ----
***************
*** 62,65 ****
--- 44,48 ----
  #endif
  
+ # Python modules
  import time
  import os
***************
*** 70,80 ****
  import threading, thread
  from types import *
- import util
- import md5
  from fcntl import ioctl
  
- # Configuration file. Determines where to look for AVI/MP3 files, etc
- import config, rc
- import plugin
  
  if __freevo_app__ == 'main':
--- 53,64 ----
  import threading, thread
  from types import *
  from fcntl import ioctl
+ import cStringIO
+ 
+ # Freevo modules
+ import config
+ import rc
+ import util
  
  
  if __freevo_app__ == 'main':
***************
*** 86,90 ****
      import animation
  
- import cStringIO
          
  
--- 70,73 ----
***************
*** 173,176 ****
--- 156,160 ----
  class Font:
      def __init__(self, filename='', ptsize=0, font=None):
+         print 'deprecated font object use'
          self.filename = filename
          self.ptsize   = ptsize
***************
*** 347,351 ****
          self.default_bg_color = self.COL_WHITE
  
!         self.width = config.CONF.width
          self.height = config.CONF.height
  
--- 331,335 ----
          self.default_bg_color = self.COL_WHITE
  
!         self.width  = config.CONF.width
          self.height = config.CONF.height
  
***************
*** 398,402 ****
              self.screen = pygame.display.set_mode((self.width, self.height))
  
!         self.depth = self.screen.get_bitsize()
          self.must_lock = self.screen.mustlock()
          
--- 382,386 ----
              self.screen = pygame.display.set_mode((self.width, self.height))
  
!         self.depth     = self.screen.get_bitsize()
          self.must_lock = self.screen.mustlock()
          
***************
*** 430,436 ****
          self.mousehidetime = time.time()
          
!         self._help = 0  # Is the helpscreen displayed or not
          self._help_saved = pygame.Surface((self.width, self.height))
!         self._help_last = 0
  
          # Remove old screenshots
--- 414,420 ----
          self.mousehidetime = time.time()
          
!         self._help       = 0  # Is the helpscreen displayed or not
          self._help_saved = pygame.Surface((self.width, self.height))
!         self._help_last  = 0
  
          # Remove old screenshots
***************
*** 604,621 ****
          
      
!     def loadbitmap(self, filename, cache=False):
          """
!         Loads a bitmap in the OSD without displaying it.
          """
!         if not cache:
!             return self._getbitmap(filename)
!         if cache == True:
!             cache = self.bitmapcache
!         s = cache[filename]
!         if s:
!             return s
!         s = self._getbitmap(filename)
!         cache[filename] = s
!         return s
  
      
--- 588,657 ----
          
      
!     def loadbitmap(self, url, cache=False):
          """
!         Load a bitmap and return the pygame image object.
          """
!         if cache:
!             if cache == True:
!                 cache = self.bitmapcache
!             s = cache[url]
!             if s:
!                 return s
! 
!         if not pygame.display.get_init():
!             return None
! 
!         try:
!             image = pygame.image.fromstring(url.tostring(), url.size, url.mode)
!         except:
! 
!             if url[:8] == 'thumb://':
!                 filename = os.path.abspath(url[8:])
!                 thumbnail = True
!             else:
!                 filename = os.path.abspath(url)
!                 thumbnail = False
!             
!             if not os.path.isfile(filename):
!                 filename = os.path.join(config.IMAGE_DIR, url[8:])
! 
!             if not os.path.isfile(filename):
!                 print 'osd.py: Bitmap file "%s" doesnt exist!' % filename
!                 return None
!             
!             try:
!                 if isstring(filename) and filename.endswith('.raw'):
!                     # load cache
!                     data  = util.read_thumbnail(filename)
!                     # convert to pygame image
!                     image = pygame.image.fromstring(data[0], data[1], data[2])
! 
!                 elif thumbnail:
!                     # load cache or create it
!                     data = util.cache_image(filename, use_exif=True)
!                     # convert to pygame image
!                     image = pygame.image.fromstring(data[0], data[1], data[2])
! 
!                 else:
!                     try:
!                         image = pygame.image.load(filename)
!                     except pygame.error, e:
!                         print 'SDL image load problem: %s - trying Imaging' % e
!                         i = Image.open(filename)
!                         image = pygame.image.fromstring(i.tostring(), i.size, i.mode)
!             
!             except:
!                 print 'Unknown Problem while loading image %s' % String(url)
!                 if config.DEBUG:
!                     traceback.print_exc()
!                     return None
! 
!         # convert the surface to speed up blitting later
!         if image and image.get_alpha():
!             image.set_alpha(image.get_alpha(), RLEACCEL)
! 
!         if cache:
!             cache[url] = image
!         return image
  
      
***************
*** 630,635 ****
          if not isinstance(image, pygame.Surface):
              image = self.loadbitmap(image, True)
!         self.drawsurface(image, x, y, scaling, bbx, bby, bbw,
!                          bbh, rotation, layer)
  
  
--- 666,670 ----
          if not isinstance(image, pygame.Surface):
              image = self.loadbitmap(image, True)
!         self.drawsurface(image, x, y, scaling, bbx, bby, bbw, bbh, rotation, layer)
  
  
***************
*** 641,647 ****
          if not pygame.display.get_init():
              return None
!         image = self.zoomsurface(image, scaling, bbx,
!                                  bby, bbw, bbh, rotation)
!         if not image: return
          if layer:
              layer.blit(image, (x, y))
--- 676,682 ----
          if not pygame.display.get_init():
              return None
!         image = self.zoomsurface(image, scaling, bbx, bby, bbw, bbh, rotation)
!         if not image:
!             return
          if layer:
              layer.blit(image, (x, y))
***************
*** 860,863 ****
--- 895,899 ----
              print e
  
+ 
      def drawstringframed(self, string, x, y, width, height, font, fgcolor=None,
                           bgcolor=None, align_h='left', align_v='top', mode='hard',
***************
*** 1290,1352 ****
          
  
-     def _getbitmap(self, url):
-         """
-         load the bitmap or thumbnail
-         """
-         if not pygame.display.get_init():
-             return None
- 
-         try:
-             image = pygame.image.fromstring(url.tostring(), url.size, url.mode)
-         except:
- 
-             if url[:8] == 'thumb://':
-                 filename = os.path.abspath(url[8:])
-                 thumbnail = True
-             else:
-                 filename = os.path.abspath(url)
-                 thumbnail = False
-             
-             if not os.path.isfile(filename):
-                 filename = os.path.join(config.IMAGE_DIR, url[8:])
  
-             if not os.path.isfile(filename):
-                 print 'osd.py: Bitmap file "%s" doesnt exist!' % filename
-                 return None
-             
-             try:
-                 if isstring(filename) and filename.endswith('.raw'):
-                     # load cache
-                     data  = util.read_thumbnail(filename)
-                     # convert to pygame image
-                     image = pygame.image.fromstring(data[0], data[1], data[2])
  
-                 elif thumbnail:
-                     # load cache or create it
-                     data = util.cache_image(filename, use_exif=True)
-                     # convert to pygame image
-                     image = pygame.image.fromstring(data[0], data[1], data[2])
- 
-                 else:
-                     try:
-                         image = pygame.image.load(filename)
-                     except pygame.error, e:
-                         print 'SDL image load problem: %s - trying Imaging' % e
-                         i = Image.open(filename)
-                         image = pygame.image.fromstring(i.tostring(), i.size, i.mode)
-             
-             except:
-                 print 'Unknown Problem while loading image %s' % String(url)
-                 if config.DEBUG:
-                     traceback.print_exc()
-                     return None
- 
-         # convert the surface to speed up blitting later
-         if image and image.get_alpha():
-             image.set_alpha(image.get_alpha(), RLEACCEL)
- 
-         return image
- 
-         
      def _helpscreen(self):
          if not pygame.display.get_init():
--- 1326,1331 ----



-------------------------------------------------------
This SF.Net email is sponsored by: GNOME Foundation
Hackers Unite!  GUADEC: The world's #1 Open Source Desktop Event.
GNOME Users and Developers European Conference, 28-30th June in Norway
http://2004/guadec.org
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to