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

Modified Files:
        main.py 
Log Message:
Reload main menu on skin change, too


Index: main.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/main.py,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** main.py     2 Mar 2003 21:33:17 -0000       1.25
--- main.py     2 Mar 2003 22:09:19 -0000       1.26
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.26  2003/03/02 22:09:19  dischi
+ # Reload main menu on skin change, too
+ #
  # Revision 1.25  2003/03/02 21:33:17  dischi
  # The main menu is a class of its own, all items in the main menu inherit
***************
*** 202,205 ****
--- 205,239 ----
  
  
+ def get_main_menu(parent):
+     """
+     function to get the items on the main menu based on the settings
+     in the skin
+     """
+ 
+     items = []
+     menu_items = skin.settings.mainmenu.items
+ 
+     for i in menu_items:
+         if menu_items[i].visible:
+ 
+             # if it's has actions() it is an item already
+             if hasattr(eval(menu_items[i].action), 'actions'):
+                 item = eval(menu_items[i].action)(None)
+                 if menu_items[i].icon:
+                     item.icon = menu_items[i].icon
+                 if menu_items[i].name:
+                     item.name = menu_items[i].name
+                 item.parent = parent
+                 items += [ item ]
+ 
+             else:
+                 items += [ MainMenuItem(parent, menu_items[i].name,
+                                         menu_items[i].icon,
+                                         menu_items[i].image,
+                                         eval(menu_items[i].action),
+                                         menu_items[i].arg) ]
+     return items
+     
+ 
  class ShutdownItem(Item):
      """
***************
*** 265,269 ****
--- 299,309 ----
  
      def select(self, arg=None, menuw=None):
+         """
+         Load the new skin and rebuild the main menu
+         """
          skin.settings = skin.LoadSettings(self.skin, copy_content = FALSE)
+         pos = menuw.menustack[0].choices.index(menuw.menustack[0].selected)
+         menuw.menustack[0].choices = get_main_menu(self.parent)
+         menuw.menustack[0].selected = menuw.menustack[0].choices[pos]
          menuw.back_one_menu()
  
***************
*** 279,307 ****
          """
          
!         items = []
! 
!         # Load the main menu items from the skin
!         menu_items = skin.settings.mainmenu.items
! 
!         for i in menu_items:
!             if menu_items[i].visible:
! 
!                 # if it's has actions() it is an item already
!                 if hasattr(eval(menu_items[i].action), 'actions'):
!                     item = eval(menu_items[i].action)(None)
!                     if menu_items[i].icon:
!                         item.icon = menu_items[i].icon
!                     if menu_items[i].name:
!                         item.name = menu_items[i].name
!                     item.parent = self
!                     items += [ item ]
! 
!                 else:
!                     items += [ MainMenuItem(self, menu_items[i].name,
!                                             menu_items[i].icon,
!                                             menu_items[i].image,
!                                             eval(menu_items[i].action),
!                                             menu_items[i].arg) ]
!                                             
  
          mainmenu = menu.Menu('FREEVO MAIN MENU', items, packrows=0, umount_all = 1)
--- 319,323 ----
          """
          
!         items = get_main_menu(self)
  
          mainmenu = menu.Menu('FREEVO MAIN MENU', items, packrows=0, umount_all = 1)




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to