Update of /cvsroot/freevo/freevo/Docs/plugin_writing/code
In directory sc8-pr-cvs1:/tmp/cvs-serv3114

Added Files:
        menu_Item.py menu_Menu.py menu_MenuItem.py 
Log Message:
some new sample code for the menu section

--- NEW FILE: menu_Item.py ---
class CoolItem(Item):
    def __init__(self, command):
        Item.__init__(self)
        self.name = command
        self.image = util.getimage(self.cmd)

    def actions(self):
        """
        return a list of actions for this item
        """
        items = [ ( self.runMyCommand , _('Run Command') ) ]
        return items

    def runMyCommand(self, arg=None, menuw=None):
        # do some real cool stuff..


--- NEW FILE: menu_Menu.py ---

# make the command menu using the command_items array and when we call refresh with 
the reload arg we go back to the main menu.
command_menu = menu.Menu(_('Commands'), command_items, 
reload_func=menuwidget.goto_main_menu)

#make a basic menu with the string variable name for its name and items the array of 
choices.
mymenu = menu.Menu(name, items)

--- NEW FILE: menu_MenuItem.py ---
# you would then create a menu like normal and then push it onto the stack
command_items += [menu.MenuItem(_('No Commands found'), menuwidget.goto_prev_page, 0)]

# generic item use for things that are simple
# you would then create a menu like normal and then push it onto the stack
if item.info.has_key('audio'):
    items.append(menu.MenuItem(_('Audio selection'), audio_selection_menu, item))
if item.info.has_key('subtitles'):
    items.append(menu.MenuItem(_('Subtitle selection'), subtitle_selection_menu, item))
if item.info.has_key('chapters'):
    items.append(menu.MenuItem(_('Chapter selection'), chapter_selection_menu, item))  
                                                                              




-------------------------------------------------------
This SF.Net email sponsored by: ApacheCon 2003,
16-19 November in Las Vegas. Learn firsthand the latest
developments in Apache, PHP, Perl, XML, Java, MySQL,
WebDAV, and more! http://www.apachecon.com/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to