Update of /cvsroot/freevo/freevo/skins/dischi1
In directory sc8-pr-cvs1:/tmp/cvs-serv24468

Modified Files:
        skin_dischi1.py 
Log Message:
added xml skin cache

Index: skin_dischi1.py
===================================================================
RCS file: /cvsroot/freevo/freevo/skins/dischi1/skin_dischi1.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** skin_dischi1.py     30 Mar 2003 18:05:25 -0000      1.46
--- skin_dischi1.py     31 Mar 2003 20:38:07 -0000      1.47
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.47  2003/03/31 20:38:07  dischi
+ # added xml skin cache
+ #
  # Revision 1.46  2003/03/30 18:05:25  dischi
  # give correct skin information to the gui object
***************
*** 175,178 ****
--- 178,185 ----
  import rc
  
+ import stat
+ import os
+ import objectcache
+ 
  # XML parser for skin informations
  sys.path.append('skins/dischi1')
***************
*** 316,319 ****
--- 323,328 ----
          self.last_draw = None
          self.screen = Screen()
+         self.xml_cache = objectcache.ObjectCache(3, desc='xmlskin')
+ 
          self.area_names = ( 'screen', 'title', 'subtitle', 'listing', 'view', 'info')
          for a in self.area_names:
***************
*** 345,362 ****
          return an object with new skin settings
          """
-         if copy_content:
-             settings = copy.copy(self.settings)
-         else:
-             settings = xml_skin.XMLSkin()
              
          if dir and os.path.isfile(os.path.join(dir, 'folder.fxd')):
!             settings.load(os.path.join(dir, 'folder.fxd'), copy_content, clear=TRUE)
!             return settings
  
          elif dir and os.path.isfile(dir):
!             settings.load(dir, copy_content, clear=TRUE)
!             return settings
!         return None
  
  
  
--- 354,383 ----
          return an object with new skin settings
          """
              
          if dir and os.path.isfile(os.path.join(dir, 'folder.fxd')):
!             file = os.path.join(dir, 'folder.fxd')
  
          elif dir and os.path.isfile(dir):
!             file = dir
!         else:
!             return None
  
+         if copy_content:
+             cname = '%s%s%s' % (str(self.settings), file, 
os.stat(file)[stat.ST_MTIME])
+             settings = self.xml_cache[cname]
+             if not settings:
+                 settings = copy.copy(self.settings)
+                 settings.load(file, copy_content, clear=TRUE)
+                 self.xml_cache[cname] = settings
+         else:
+             cname = '%s%s' % (file, os.stat(file)[stat.ST_MTIME])
+             settings = self.xml_cache[cname]
+             if not settings:
+                 settings = xml_skin.XMLSkin()
+                 settings.load(file, copy_content, clear=TRUE)
+                 self.xml_cache[cname] = settings
+ 
+         return settings
+     
  
  




-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb: 
Dedicated Hosting for just $79/mo with 500 GB of bandwidth! 
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to