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

Modified Files:
        menu.py main.py 
Log Message:
use new AreaHandler

Index: main.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/main.py,v
retrieving revision 1.137
retrieving revision 1.138
diff -C2 -d -r1.137 -r1.138
*** main.py     5 Aug 2004 17:37:55 -0000       1.137
--- main.py     14 Aug 2004 15:09:54 -0000      1.138
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.138  2004/08/14 15:09:54  dischi
+ # use new AreaHandler
+ #
  # Revision 1.137  2004/08/05 17:37:55  dischi
  # remove a bad skin hack
***************
*** 154,162 ****
  import util    # Various utilities
  import menu    # The menu widget class
- import skin    # The skin class
  
  from item import Item
  from event import *
  from plugins.shutdown import shutdown
  
  
--- 157,165 ----
  import util    # Various utilities
  import menu    # The menu widget class
  
  from item import Item
  from event import *
  from plugins.shutdown import shutdown
+ from gui.areas import Area
  
  
***************
*** 261,296 ****
      
  
! 
! class Splashscreen(skin.Area):
      """
      A simple splash screen for osd startup
      """
      def __init__(self, text):
!         skin.Area.__init__(self, 'content')
! 
          self.pos          = 0
!         self.bar_border   = skin.Rectange(bgcolor=0xff000000L, size=2)
!         self.bar_position = skin.Rectange(bgcolor=0xa0000000L)
          self.text         = text
  
! 
!     def update_content(self):
          """
!         there is no content in this area
          """
!         layout    = self.layout
!         area      = self.area_val
!         content   = self.calc_geometry(layout.content, copy_object=True)
! 
!         self.drawstring(self.text, content.font, content, height=-1, 
align_h='center')
  
-         pos = 0
          x0, x1 = content.x, content.x + content.width
          y = content.y + content.font.font.height + content.spacing
          if self.pos:
              pos = round(float((x1 - x0 - 4)) / (float(100) / self.pos))
!         self.drawbox(x0, y, x1-x0, 20, self.bar_border)
!         self.drawbox(x0+2, y+2, pos, 16, self.bar_position)
! 
  
      def progress(self, pos):
--- 264,315 ----
      
  
! class Splashscreen(Area):
      """
      A simple splash screen for osd startup
      """
      def __init__(self, text):
!         Area.__init__(self, 'content')
          self.pos          = 0
!         self.bar_border   = self.Rectangle(bgcolor=0xff000000L, size=2)
!         self.bar_position = self.Rectangle(bgcolor=0xa0000000L)
          self.text         = text
+         self.content      = []
+         self.bar          = None
+         self.engine       = gui.AreaHandler('splashscreen', ('screen', self))
  
!         
!     def clear(self):
          """
!         clear all content objects
          """
!         for c in self.content:
!             self.screen.remove(c)
!         self.content = []
!         if self.bar:
!             self.screen.remove(self.bar)
!             self.bar = None
!             
!         
!     def update(self):
!         """
!         update the splashscreen
!         """
!         content   = self.calc_geometry(self.layout.content, copy_object=True)
  
          x0, x1 = content.x, content.x + content.width
          y = content.y + content.font.font.height + content.spacing
+ 
+         if not self.content:
+             self.content.append(self.drawstring(self.text, content.font,
+                                                 content, height=-1, 
align_h='center'))
+             self.content.append(self.drawbox(x0, y, x1-x0, 20, self.bar_border))
+ 
+         pos = 0
          if self.pos:
              pos = round(float((x1 - x0 - 4)) / (float(100) / self.pos))
!         if self.bar:
!             self.screen.remove(self.bar)
!         self.bar = self.drawbox(x0+2, y+2, pos, 16, self.bar_position)
!         
  
      def progress(self, pos):
***************
*** 299,305 ****
          """
          self.pos = pos
!         skin.draw('splashscreen', None)
  
  
  
  
--- 318,328 ----
          """
          self.pos = pos
!         if self.engine:
!             self.engine.draw(None)
  
  
+     def destroy(self):
+         del self.engine
+ 
  
  
***************
*** 404,411 ****
      # Fire up splashscreen and load the plugins
      splash = Splashscreen(_('Starting Freevo, please wait ...'))
-     skin.register('splashscreen', ('screen', splash))
      plugin.init(splash.progress)
!     skin.delete('splashscreen')
! 
      # Fire up splashscreen and load the cache
      if config.MEDIAINFO_USE_MEMORY == 2:
--- 427,434 ----
      # Fire up splashscreen and load the plugins
      splash = Splashscreen(_('Starting Freevo, please wait ...'))
      plugin.init(splash.progress)
!     splash.destroy()
!     del splash
!     
      # Fire up splashscreen and load the cache
      if config.MEDIAINFO_USE_MEMORY == 2:
***************
*** 413,417 ****
  
          splash = Splashscreen(_('Reading cache, please wait ...'))
-         skin.register('splashscreen', ('screen', splash))
  
          cachefiles = []
--- 436,439 ----
***************
*** 430,434 ****
              splash.progress(int((float((cachefiles.index(f)+1)) / len(cachefiles)) * 
100))
              util.mediainfo.load_cache(f)
!         skin.delete('splashscreen')
  
      # prepare again, now that all plugins are loaded
--- 452,457 ----
              splash.progress(int((float((cachefiles.index(f)+1)) / len(cachefiles)) * 
100))
              util.mediainfo.load_cache(f)
!         splash.destroy()
!         del splash
  
      # prepare again, now that all plugins are loaded

Index: menu.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/menu.py,v
retrieving revision 1.101
retrieving revision 1.102
diff -C2 -d -r1.101 -r1.102
*** menu.py     5 Aug 2004 17:36:13 -0000       1.101
--- menu.py     14 Aug 2004 15:09:54 -0000      1.102
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.102  2004/08/14 15:09:54  dischi
+ # use new AreaHandler
+ #
  # Revision 1.101  2004/08/05 17:36:13  dischi
  # remove "page" code, the skin takes care of that now
***************
*** 221,228 ****
          self.eventhandler_plugins = None
          if not engine:
!             engine = gui.get_areas()
!             # register menu to the skin
!             engine.register('menu', ('screen', 'title', 'subtitle', 'view',
!                                      'listing', 'info'))
          self.engine = engine
          
--- 224,229 ----
          self.eventhandler_plugins = None
          if not engine:
!             engine = gui.AreaHandler('menu', ('screen', 'title', 'subtitle', 'view',
!                                               'listing', 'info'))
          self.engine = engine
          
***************
*** 250,254 ****
          """
          Application.hide(self)
!         self.engine.clear('menu')
              
          
--- 251,255 ----
          """
          Application.hide(self)
!         self.engine.clear()
              
          
***************
*** 258,262 ****
          """
          if len(self.menustack) > 1:
!             self.menustack = self.menustack[:-1]
              menu = self.menustack[-1]
  
--- 259,265 ----
          """
          if len(self.menustack) > 1:
!             if hasattr(self.menustack[-1], 'hide'):
!                 self.menustack[-1].hide()
!             del self.menustack[-1]
              menu = self.menustack[-1]
  
***************
*** 291,299 ****
          if len(self.menustack) > 1:
              try:
!                 count = -self.menustack[-1].back_one_menu
              except:
!                 count = -1
  
!             self.menustack = self.menustack[:count]
              menu = self.menustack[-1]
  
--- 294,303 ----
          if len(self.menustack) > 1:
              try:
!                 count = self.menustack[-1].back_one_menu
              except:
!                 count = 1
  
!             for i in range(count):
!                 del self.menustack[-1]
              menu = self.menustack[-1]
  
***************
*** 314,318 ****
  
      def goto_main_menu(self, arg=None, menuw=None):
!         self.menustack = [self.menustack[0]]
          menu = self.menustack[0]
          self.refresh()
--- 318,323 ----
  
      def goto_main_menu(self, arg=None, menuw=None):
!         while len(self.menustack) > 1:
!             del self.menustack[-1]
          menu = self.menustack[0]
          self.refresh()
***************
*** 347,351 ****
  
          if self.visible:
!             self.engine.draw('menu', self.menustack[-1])
  
  
--- 352,356 ----
  
          if self.visible:
!             self.engine.draw(self.menustack[-1])
  
  



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to