Author: duncan
Date: Tue Jan 30 20:10:19 2007
New Revision: 9107

Modified:
   branches/rel-1/freevo/src/plugins/buttonbar.py

Log:
[ 1647474 ] Crash in button bar on TV Program Info screen
Patch from Adam Charrett applied


Modified: branches/rel-1/freevo/src/plugins/buttonbar.py
==============================================================================
--- branches/rel-1/freevo/src/plugins/buttonbar.py      (original)
+++ branches/rel-1/freevo/src/plugins/buttonbar.py      Tue Jan 30 20:10:19 2007
@@ -201,6 +201,7 @@
         actions = self.get_actions(menu)
 
         if actions is None: # No actions, don't draw the bar.
+            self.actions = [None, None, None, None]
             return
 
         # draw Button bar
@@ -258,7 +259,7 @@
         """
         Handle color button events.
         """
-        action = None
+        action = None  
         result = False
 
         if event == BUTTONBAR_RED:
@@ -293,6 +294,16 @@
         None is returned if no actions are available and the bar should not
         be drawn.
         """
+        result = [None, None, None, None]
+        found_color_actions = False
+
+        for index in range(0, len(self.colors)):
+            if hasattr(menu, self.colors[index] + '_action'):
+                found_color_actions = True
+                result[index] = eval('menu.' + color + '_action')
+
+        if found_color_actions:
+            return result
 
         if ((isinstance(menu, Menu) and (menu.item_types == 'main')) or
              isinstance(menu, MenuItem)):
@@ -317,17 +328,6 @@
             if hasattr(menu, 'is_submenu') or (not hasattr(menu, 'selected')):
                     return None
 
-            result = [None, None, None, None]
-            found_color_actions = False
-
-            for index in range(0, len(self.colors)):
-                if hasattr(menu, self.colors[index] + '_action'):
-                    found_color_actions = True
-                    result[index] = eval('menu.' + color + '_action')
-
-            if found_color_actions:
-                return result
-
             actions = menu.selected.actions()
             if not actions:
                actions = []
@@ -346,10 +346,10 @@
                     elif len(a) == 2 or a[2] != 'MENU_SUBMENU':
                         actions.append(a[:2])
 
-            if len(actions) == 0:
+            if len(actions) <= 1:
                 result = None
 
-            if len(actions) >= 1:
+            if len(actions) > 1:
                 result[0] = actions[0]
             if len(actions) >= 2:
                 result[1] = actions[1]

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to