[POS-commit] Kiwi/Kiwi Basic.py,1.48,1.49

Christian Robottom Reis kiko at async.com.br
Fri Oct 10 23:07:42 BRST 2003


Update of /cvs/Kiwi/Kiwi
In directory anthem:/tmp/cvs-serv4641/Kiwi

Modified Files:
	Basic.py 
Log Message:
Fix an exception that shows up when there are no children in the list:
it makes sense to display the list, but any keypress should hide it
immediately.


Index: Basic.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/Basic.py,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -d -r1.48 -r1.49
--- Basic.py	8 Oct 2003 18:52:41 -0000	1.48
+++ Basic.py	10 Oct 2003 23:07:40 -0000	1.49
@@ -345,6 +345,20 @@
             selection = self.list.get_selection()
             children = self.list.children()
 
+            # If no elements are in the list, we just hide it and avoid
+            # the main keyhandler handling the keypress, which in the
+            # case of arrows may trigger a focus change.
+            #
+            # It could be argued that the list shouldn't display at all;
+            # however, it is my opinion that the list should be
+            # displayed in this case because popping up is familiar to
+            # the user, and to provide feedback that in fact there is
+            # nothing in the list.
+            if not children:
+                self.get_popwin().hide()
+                window.emit_stop_by_name('key_press_event')
+                return TRUE
+
             if keyval in self.DOWN + [GDK.Tab]: # Tab is just like down
                 # If there is no item selected in the list then focus the
                 # first one.



More information about the POS-commit mailing list