changeset 99:2b6626f417f2

Handle root containers where nothing is focussable
author Stefano Rivera <stefano@rivera.za.net>
date Sun, 11 Sep 2011 19:29:11 +0200
parents 7ce2d2d8381a
children 5a47a26f52c1
files mamba/widgets/base.py
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mamba/widgets/base.py	Sun Sep 11 19:25:11 2011 +0200
+++ b/mamba/widgets/base.py	Sun Sep 11 19:29:11 2011 +0200
@@ -94,12 +94,13 @@
                     return True
         else:
             if self.root:
-                # At the end, mark the last one as focussed, again
-                child = self.children[self.focussed_child]
-                if isinstance(child, Container):
-                    if child.adjust_focus(-direction):
-                        return True
-                child.focussed = True
+                if self.focussed_child:
+                    # At the end, mark the last one as focussed, again
+                    child = self.children[self.focussed_child]
+                    if isinstance(child, Container):
+                        if child.adjust_focus(-direction):
+                            return True
+                    child.focussed = True
             else:
                 self.focussed_child = None
             return False