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

Modified Files:
        menu.py 
Log Message:
make it possible to return MenuItems in the list of actions()


Index: menu.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/menu.py,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** menu.py     18 Jul 2003 19:46:54 -0000      1.54
--- menu.py     2 Aug 2003 10:08:46 -0000       1.55
***************
*** 10,13 ****
--- 10,16 ----
  # -----------------------------------------------------------------------
  # $Log$
+ # Revision 1.55  2003/08/02 10:08:46  dischi
+ # make it possible to return MenuItems in the list of actions()
+ #
  # Revision 1.54  2003/07/18 19:46:54  dischi
  # better error handling
***************
*** 326,335 ****
      def make_submenu(self, menu_name, actions, item):
          items = []
!         for function, title in actions:
!             items += [ MenuItem(title, function) ]
          xml_file = None
          if hasattr(item, 'xml_file'):
              xml_file = item.xml_file
  
          s = Menu(menu_name, items, xml_file=xml_file)
          self.pushmenu(s)
--- 329,349 ----
      def make_submenu(self, menu_name, actions, item):
          items = []
!         for a in actions:
!             if isinstance(a, MenuItem):
!                 items.append(a)
!             else:
!                 items.append(MenuItem(a[1], a[0]))
          xml_file = None
          if hasattr(item, 'xml_file'):
              xml_file = item.xml_file
  
+         for i in items:
+             if not i.image:
+                 i.image = item.image
+             if hasattr(item, 'display_type'):
+                 i.display_type = item.display_type
+             elif hasattr(item, 'type'):
+                 i.display_type = item.type
+                 
          s = Menu(menu_name, items, xml_file=xml_file)
          self.pushmenu(s)
***************
*** 490,500 ****
              
          elif event == MENU_SELECT or event == MENU_PLAY_ITEM:
              try:
                  action = menu.selected.action
              except AttributeError:
                  if menu.selected.actions():
!                     action = menu.selected.actions()[0][0]
!                 else:
!                     action = None
                      
              if action == None:
--- 504,519 ----
              
          elif event == MENU_SELECT or event == MENU_PLAY_ITEM:
+             action = None
+             arg    = None
              try:
                  action = menu.selected.action
              except AttributeError:
                  if menu.selected.actions():
!                     action = menu.selected.actions()[0]
!                     if isinstance(action, MenuItem):
!                         action = action.function
!                         arg = action.arg
!                     else:
!                         action = action[0]
                      
              if action == None:
***************
*** 502,506 ****
                  AlertBox(text='No action defined for this choice!').show()
              else:
!                 action( menuw=self )
              return
  
--- 521,525 ----
                  AlertBox(text='No action defined for this choice!').show()
              else:
!                 action( arg=arg, menuw=self )
              return
  
***************
*** 519,523 ****
              for p in plugin.get('item%s' % actions_plugins):
                  for a in p.actions(menu.selected):
!                     actions.append(a[:2])
  
              if actions and len(actions) > 1:
--- 538,545 ----
              for p in plugin.get('item%s' % actions_plugins):
                  for a in p.actions(menu.selected):
!                     if isinstance(a, MenuItem):
!                         actions.append(a)
!                     else:
!                         actions.append(a[:2])
  
              if actions and len(actions) > 1:
***************
*** 538,542 ****
              for p in plugin.get('item%s' % actions_plugins):
                  for a in p.actions(menu.selected):
!                     if len(a) > 2 and a[2] == event.arg:
                          a[0](arg=None, menuw=self)
                          return
--- 560,564 ----
              for p in plugin.get('item%s' % actions_plugins):
                  for a in p.actions(menu.selected):
!                     if not isinstance(a, MenuItem) and len(a) > 2 and a[2] == 
event.arg:
                          a[0](arg=None, menuw=self)
                          return




-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to