Update of /cvsroot/freevo/freevo/src
In directory sc8-pr-cvs1:/tmp/cvs-serv15413

Modified Files:
        menu.py 
Log Message:
Load skin singleton only when needed and make events global


Index: menu.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/menu.py,v
retrieving revision 1.52
retrieving revision 1.53
diff -C2 -d -r1.52 -r1.53
*** menu.py     1 Jul 2003 02:58:17 -0000       1.52
--- menu.py     12 Jul 2003 10:05:04 -0000      1.53
***************
*** 10,64 ****
  # -----------------------------------------------------------------------
  # $Log$
  # Revision 1.52  2003/07/01 02:58:17  outlyer
  # Added lame/cdparanoia and defaults for the cdbackup plugin
  # Removed some messages from src/main and src/menu
  #
- # Revision 1.51  2003/06/29 19:52:58  dischi
- # small fix
- #
  # Revision 1.50  2003/06/07 11:30:27  dischi
  # support for MENU_CALL_ITEM_ACTION
  #
- # Revision 1.49  2003/06/07 04:36:18  outlyer
- # Prevent a crash.
- #
- # Revision 1.48  2003/05/30 00:53:19  rshortt
- # Various event bugfixes.
- #
- # Revision 1.47  2003/05/27 17:53:33  dischi
- # Added new event handler module
- #
- # Revision 1.46  2003/04/28 18:07:45  dischi
- # restore the correct item
- #
- # Revision 1.45  2003/04/26 15:08:51  dischi
- # o better mount/umount, also for directories who are no rom drive.
- # o added list_usb_devices to util
- #
- # Revision 1.44  2003/04/24 19:55:48  dischi
- # comment cleanup for 1.3.2-pre4
- #
- # Revision 1.43  2003/04/24 19:13:27  dischi
- # bugfix
- #
- # Revision 1.42  2003/04/21 12:59:35  dischi
- # better plugin event handling
- #
- # Revision 1.41  2003/04/20 12:43:32  dischi
- # make the rc events global in rc.py to avoid get_singleton. There is now
- # a function app() to get/set the app. Also the events should be passed to
- # the daemon plugins when there is no handler for them before. Please test
- # it, especialy the mixer functions.
- #
- # Revision 1.40  2003/04/20 11:44:45  dischi
- # add item plugins
- #
- # Revision 1.39  2003/04/20 10:55:40  dischi
- # mixer is now a plugin, too
- #
- # Revision 1.38  2003/04/19 21:28:39  dischi
- # identifymedia.py is now a plugin and handles everything related to
- # rom drives (init, autostarter, items in menus)
- #
  # -----------------------------------------------------------------------
  # Freevo - A Home Theater PC framework
--- 10,23 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.53  2003/07/12 10:05:04  dischi
+ # Load skin singleton only when needed and make events global
+ #
  # Revision 1.52  2003/07/01 02:58:17  outlyer
  # Added lame/cdparanoia and defaults for the cdbackup plugin
  # Removed some messages from src/main and src/menu
  #
  # Revision 1.50  2003/06/07 11:30:27  dischi
  # support for MENU_CALL_ITEM_ACTION
  #
  # -----------------------------------------------------------------------
  # Freevo - A Home Theater PC framework
***************
*** 81,91 ****
  #
  
- import traceback
- 
- # Configuration file. Determines where to look for AVI/MP3 files, etc
- import config
- 
  import plugin
- 
  from item import Item
  
--- 40,44 ----
***************
*** 96,107 ****
  import skin
  
! import event as em
  
  from gui.GUIObject import *
  from gui.AlertBox import AlertBox
- TRUE  = 1
- FALSE = 0
  
! skin = skin.get_singleton() # Crate the skin object.
  
  # Module variable that contains an initialized MenuWidget() object
--- 49,58 ----
  import skin
  
! from event import *
  
  from gui.GUIObject import *
  from gui.AlertBox import AlertBox
  
! 
  
  # Module variable that contains an initialized MenuWidget() object
***************
*** 162,168 ****
          self.previous_page_start.append(0)
          self.umount_all = umount_all    # umount all ROM drives on display?
! 
          if xml_file:
!             self.skin_settings = skin.LoadSettings(xml_file)
          else:
              self.skin_settings = None
--- 113,119 ----
          self.previous_page_start.append(0)
          self.umount_all = umount_all    # umount all ROM drives on display?
!         self.skin = skin.get_singleton()
          if xml_file:
!             self.skin_settings = self.skin.LoadSettings(xml_file)
          else:
              self.skin_settings = None
***************
*** 178,182 ****
          self.item_types = item_types
          self.force_skin_layout = force_skin_layout
!         self.display_style = skin.GetDisplayStyle(self)
  
  
--- 129,133 ----
          self.item_types = item_types
          self.force_skin_layout = force_skin_layout
!         self.display_style = self.skin.GetDisplayStyle(self)
  
  
***************
*** 197,201 ****
  
      def items_per_page(self):
!         return skin.items_per_page(('menu', self))
      
  
--- 148,152 ----
  
      def items_per_page(self):
!         return self.skin.items_per_page(('menu', self))
      
  
***************
*** 229,232 ****
--- 180,184 ----
          self.eventhandler_plugins = None
          self.event_context = 'menu'
+         self.skin = skin.get_singleton()
          
      def show(self):
***************
*** 238,242 ****
          if self.visible:
              self.visible = 0
!             skin.clear()
          
      def delete_menu(self, arg=None, menuw=None):
--- 190,194 ----
          if self.visible:
              self.visible = 0
!             self.skin.clear()
          
      def delete_menu(self, arg=None, menuw=None):
***************
*** 264,268 ****
                  return TRUE
              
!             if skin.GetDisplayStyle(menu) != menu.display_style:
                  self.rebuild_page()
                  
--- 216,220 ----
                  return TRUE
              
!             if self.skin.GetDisplayStyle(menu) != menu.display_style:
                  self.rebuild_page()
                  
***************
*** 345,349 ****
  
          if not isinstance(menu, Menu):
!             return skin.draw((menu.type, menu))
  
          if self.menustack[-1].umount_all == 1:
--- 297,301 ----
  
          if not isinstance(menu, Menu):
!             return self.skin.draw((menu.type, menu))
  
          if self.menustack[-1].umount_all == 1:
***************
*** 357,361 ****
              self.init_page()
  
!         skin.draw(('menu', self))
  
          # Draw any child UI objects
--- 309,313 ----
              self.init_page()
  
!         self.skin.draw(('menu', self))
  
          # Draw any child UI objects
***************
*** 379,387 ****
          menu = self.menustack[-1]
  
!         if event == em.MENU_GOTO_MAINMENU:
              self.goto_main_menu()
              return
          
!         if event == em.MENU_BACK_ONE_MENU:
              self.back_one_menu()
              return
--- 331,339 ----
          menu = self.menustack[-1]
  
!         if event == MENU_GOTO_MAINMENU:
              self.goto_main_menu()
              return
          
!         if event == MENU_BACK_ONE_MENU:
              self.back_one_menu()
              return
***************
*** 400,404 ****
          
          if not self.menu_items:
!             if event in ( em.MENU_SELECT, em.MENU_SUBMENU, em.MENU_PLAY_ITEM):
                  self.back_one_menu()
              return
--- 352,356 ----
          
          if not self.menu_items:
!             if event in ( MENU_SELECT, MENU_SUBMENU, MENU_PLAY_ITEM):
                  self.back_one_menu()
              return
***************
*** 415,419 ****
              return
  
!         if event == em.MENU_UP:
              curr_selected = self.all_items.index(menu.selected)
              if curr_selected-self.cols < 0 and \
--- 367,371 ----
              return
  
!         if event == MENU_UP:
              curr_selected = self.all_items.index(menu.selected)
              if curr_selected-self.cols < 0 and \
***************
*** 435,439 ****
  
  
!         elif event == em.MENU_DOWN:
              curr_selected = self.all_items.index(menu.selected)
              if curr_selected+self.cols > len(self.all_items)-1 and \
--- 387,391 ----
  
  
!         elif event == MENU_DOWN:
              curr_selected = self.all_items.index(menu.selected)
              if curr_selected+self.cols > len(self.all_items)-1 and \
***************
*** 456,465 ****
  
  
!         elif event == em.MENU_LEFT or event == em.MENU_PAGEUP:
              # Do nothing for an empty file list
              if not len(self.menu_items):
                  return
              
!             if event == em.MENU_LEFT and self.cols > 1:
                  curr_selected = self.all_items.index(menu.selected)
                  if curr_selected == 0:
--- 408,417 ----
  
  
!         elif event == MENU_LEFT or event == MENU_PAGEUP:
              # Do nothing for an empty file list
              if not len(self.menu_items):
                  return
              
!             if event == MENU_LEFT and self.cols > 1:
                  curr_selected = self.all_items.index(menu.selected)
                  if curr_selected == 0:
***************
*** 488,492 ****
              return
  
!         elif event == em.MENU_RIGHT or event == em.MENU_PAGEDOWN:
              # Do nothing for an empty file list
              if not len(self.menu_items):
--- 440,444 ----
              return
  
!         elif event == MENU_RIGHT or event == MENU_PAGEDOWN:
              # Do nothing for an empty file list
              if not len(self.menu_items):
***************
*** 496,500 ****
                  return
              
!             if event == em.MENU_RIGHT and self.cols > 1:
                  curr_selected = self.all_items.index(menu.selected)
                  if curr_selected == len(self.all_items)-1:
--- 448,452 ----
                  return
              
!             if event == MENU_RIGHT and self.cols > 1:
                  curr_selected = self.all_items.index(menu.selected)
                  if curr_selected == len(self.all_items)-1:
***************
*** 526,533 ****
  
  
!         elif event == em.MENU_PLAY_ITEM and hasattr(menu.selected, 'play'):
              menu.selected.play(menuw=self)
              
!         elif event == em.MENU_SELECT or event == em.MENU_PLAY_ITEM:
              try:
                  action = menu.selected.action
--- 478,485 ----
  
  
!         elif event == MENU_PLAY_ITEM and hasattr(menu.selected, 'play'):
              menu.selected.play(menuw=self)
              
!         elif event == MENU_SELECT or event == MENU_PLAY_ITEM:
              try:
                  action = menu.selected.action
***************
*** 546,550 ****
  
  
!         elif event == em.MENU_SUBMENU:
              actions = menu.selected.actions()
  
--- 498,502 ----
  
  
!         elif event == MENU_SUBMENU:
              actions = menu.selected.actions()
  
***************
*** 566,570 ****
              
  
!         elif event == em.MENU_CALL_ITEM_ACTION:
              print 'calling action %s', event.arg
              if hasattr(menu.selected, 'display_type'):
--- 518,522 ----
              
  
!         elif event == MENU_CALL_ITEM_ACTION:
              print 'calling action %s', event.arg
              if hasattr(menu.selected, 'display_type'):
***************
*** 584,590 ****
  
                      
!         elif event == em.MENU_CHANGE_STYLE and len(self.menustack) > 1:
              # did the menu change?
!             if skin.ToggleDisplayStyle(menu):
                  self.rebuild_page()
                  self.refresh()
--- 536,542 ----
  
                      
!         elif event == MENU_CHANGE_STYLE and len(self.menustack) > 1:
              # did the menu change?
!             if self.skin.ToggleDisplayStyle(menu):
                  self.rebuild_page()
                  self.refresh()
***************
*** 630,634 ****
          menu.selected = current
          self.init_page()
!         menu.display_style = skin.GetDisplayStyle(menu)
          
  
--- 582,586 ----
          menu.selected = current
          self.init_page()
!         menu.display_style = self.skin.GetDisplayStyle(menu)
          
  




-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to