Author: dmeyer
Date: Sun Apr 29 09:06:29 2007
New Revision: 9517
Modified:
trunk/ui/src/application/menuw.py
trunk/ui/src/event.py
trunk/ui/src/menu/stack.py
Log:
add event MENU_GOTO_MENU
Modified: trunk/ui/src/application/menuw.py
==============================================================================
--- trunk/ui/src/application/menuw.py (original)
+++ trunk/ui/src/application/menuw.py Sun Apr 29 09:06:29 2007
@@ -52,6 +52,8 @@
def refresh(self, reload=False):
+ if self.is_locked():
+ return
MenuStack.refresh(self, reload)
self.engine.update(self.menustack[-1])
Modified: trunk/ui/src/event.py
==============================================================================
--- trunk/ui/src/event.py (original)
+++ trunk/ui/src/event.py Sun Apr 29 09:06:29 2007
@@ -99,6 +99,7 @@
MENU_GOTO_MAINMENU = Event('MENU_GOTO_MAINMENU')
MENU_GOTO_MEDIA = Event('MENU_GOTO_MEDIA')
+MENU_GOTO_MENU = Event('MENU_GOTO_MENU')
MENU_BACK_ONE_MENU = Event('MENU_BACK_ONE_MENU')
MENU_SELECT = Event('MENU_SELECT')
Modified: trunk/ui/src/menu/stack.py
==============================================================================
--- trunk/ui/src/menu/stack.py (original)
+++ trunk/ui/src/menu/stack.py Sun Apr 29 09:06:29 2007
@@ -58,6 +58,7 @@
"""
def __init__(self):
self.menustack = []
+ self._lock = False
def back_to_menu(self, menu, refresh=True):
@@ -123,6 +124,9 @@
"""
Refresh the stack and redraw it.
"""
+ if self._lock:
+ return
+
menu = self.menustack[-1]
if menu.autoselect and len(menu.choices) == 1:
@@ -171,6 +175,14 @@
return self.menustack[-1]
+ def is_locked(self):
+ """
+ Return if the menu stack is locked because it is re-building
+ itself. This should prevent wrong redraws.
+ """
+ return self._lock
+
+
def eventhandler(self, event):
"""
Eventhandler for menu control
@@ -214,6 +226,25 @@
return True
return True
+ if event == MENU_GOTO_MENU:
+ # TODO: add some doc, example:
+ # input.eventmap[menu][5] = MENU_GOTO_MENU /Watch a Movie/My Home
Videos
+ path = ' '.join(event.arg)
+ self.menustack = [ self.menustack[0] ]
+ self._lock = True
+ for name in path.split(path[0])[1:]:
+ menu = self.get_menu()
+ for item in menu.choices:
+ if item.name == name:
+ menu.select(item)
+ item.actions()[0]()
+ break
+ else:
+ break
+ self._lock = False
+ self.refresh()
+
+
# handle empty menus
if not menu.choices:
if event in ( MENU_SELECT, MENU_SUBMENU, MENU_PLAY_ITEM):
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog