[POS-commit] Kiwi/Kiwi Basic.py,1.37,1.38

kiko at async.com.br kiko at async.com.br
Fri May 16 22:43:17 BRST 2003


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

Modified Files:
	Basic.py 
Log Message:
Offer API for selecting an item to avoid the need to call set_text()
(which ends up requiring _block_entry too, btw).


Index: Basic.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/Basic.py,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- Basic.py	16 May 2003 15:12:55 -0000	1.37
+++ Basic.py	17 May 2003 01:43:15 -0000	1.38
@@ -253,6 +253,14 @@
         """Popup the list."""
         return gtkhacks.gtk_combo_popup_list(self._o, *args)
 
+    def select_item(self, item):
+        """Selects an item in the AutoCombo. Raises KeyError if item not valid"""
+        if item not in self._string_list:
+            raise KeyError, "Item %s not in list" % item
+        self._block_entry = TRUE
+        self.entry.set_text(item)
+        self._block_entry = FALSE
+
     def handle_key_press(self, window, event, *args):
         """
 Control the combo's behaviour according to the key pressed. It is connected to



More information about the POS-commit mailing list