Author: dmeyer
Date: Sat Feb 10 19:34:15 2007
New Revision: 9193

Modified:
   trunk/ui/src/mainmenu.py
   trunk/ui/src/plugins/mediamenu.py
   trunk/ui/src/plugins/shutdown.py
   trunk/ui/src/tv/__init__.py
   trunk/ui/src/tv/plugins/genre.py

Log:
MainMenuItem cleanup

Modified: trunk/ui/src/mainmenu.py
==============================================================================
--- trunk/ui/src/mainmenu.py    (original)
+++ trunk/ui/src/mainmenu.py    Sat Feb 10 19:34:15 2007
@@ -52,20 +52,21 @@
     This class is a main menu item. Items of this type can be returned by
     a MainMenuPlugin.
     """
-    def __init__( self, name=u'', action=None, arg=None, type=None, image=None,
-                  icon=None, parent=None, skin_type=None):
+    def __init__( self, parent=None, name=u'', type=None, image=None,
+                  icon=None, skin_type=None):
 
         Item.__init__(self, parent)
         self.name = name
         self.icon = icon
         self.image = image
         self.type = type
-        self.function = action, arg
 
         if not type and not parent.parent:
             # this is the first page, force type to 'main'
             self.type = 'main'
 
+        if not skin_type and hasattr(self, 'skin_type'):
+            skin_type = self.skin_type
         if not skin_type:
             return
 
@@ -89,9 +90,17 @@
         """
         Actions for this item.
         """
-        return [ Action(self.name, self.function[0]) ]
+        return [ Action(self.name, self.select) ]
 
 
+    def select(self):
+        """
+        Select the item (default action). Need to be overloaded by the
+        inherting item or actions() need to be overloaded.
+        """
+        raise RuntimeError("no action defined for %s", self)
+    
+
 class MainMenuPlugin(plugin.Plugin):
     """
     Plugin class for plugins to add something to the main menu

Modified: trunk/ui/src/plugins/mediamenu.py
==============================================================================
--- trunk/ui/src/plugins/mediamenu.py   (original)
+++ trunk/ui/src/plugins/mediamenu.py   Sat Feb 10 19:34:15 2007
@@ -81,8 +81,7 @@
     """
 
     def __init__(self, parent, title, type, items):
-        MainMenuItem.__init__(self, '', self.main_menu, type='main',
-                              parent=parent, skin_type=type)
+        MainMenuItem.__init__(self, parent, skin_type=type)
         self.force_text_view = False
         self.display_type = type
         self.item_menu = None
@@ -193,7 +192,7 @@
         return items
 
 
-    def main_menu(self):
+    def select(self):
         """
         display the (IMAGE|VIDEO|AUDIO|GAMES) main menu
         """

Modified: trunk/ui/src/plugins/shutdown.py
==============================================================================
--- trunk/ui/src/plugins/shutdown.py    (original)
+++ trunk/ui/src/plugins/shutdown.py    Sat Feb 10 19:34:15 2007
@@ -52,9 +52,7 @@
     """
     Item for shutdown
     """
-    def __init__(self, parent=None):
-        MainMenuItem.__init__(self, parent=parent, skin_type='shutdown')
-
+    skin_type = 'shutdown'
 
     def actions(self):
         """

Modified: trunk/ui/src/tv/__init__.py
==============================================================================
--- trunk/ui/src/tv/__init__.py (original)
+++ trunk/ui/src/tv/__init__.py Sat Feb 10 19:34:15 2007
@@ -58,11 +58,9 @@
     """
     The TV main menu.
     """
-    def __init__(self, parent):
-        MainMenuItem.__init__(self, '', self.show, parent=parent, skin_type = 
'tv')
+    skin_type = 'tv'
 
-
-    def show(self):
+    def select(self):
         items = []
         plugins_list = MainMenuPlugin.plugins('tv')
         for p in plugins_list:

Modified: trunk/ui/src/tv/plugins/genre.py
==============================================================================
--- trunk/ui/src/tv/plugins/genre.py    (original)
+++ trunk/ui/src/tv/plugins/genre.py    Sat Feb 10 19:34:15 2007
@@ -39,7 +39,7 @@
 import kaa.epg
 
 # freevo imports
-from freevo.ui.mainmenu import MainMenuItem, MainMenuPlugin
+from freevo.ui.mainmenu import MainMenuPlugin
 from freevo.ui.menu import Item, Action, ActionItem, Menu
 from freevo.ui.tv.program import ProgramItem
 

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to