[POS-commit] Kiwi/Kiwi Menu.py,1.38,1.39

Christian Robottom Reis kiko at async.com.br
Sat Oct 25 02:46:23 BRDT 2003


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

Modified Files:
	Menu.py 
Log Message:
Update some comments and fix an odd bug that will probably never be
exercised related to the bug that update_label_text() fixes -- a list
too short would have bombed out.


Index: Menu.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/Menu.py,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -d -r1.38 -r1.39
--- Menu.py	26 Sep 2003 16:02:52 -0000	1.38
+++ Menu.py	25 Oct 2003 01:46:21 -0000	1.39
@@ -208,8 +208,8 @@
 
     def set_item_label(self, item, text):
         """Sets label for a menuitem. This method works around a bug in
-the OptionMenu where it fails to update the current item's text when it
-is changed.
+the OptionMenu where it fails to update the label when the currently
+selected item's text is changed.
         - item: position (int) or GtkMenuItem you'd like to set text to
         - text: string to substitute
         """
@@ -225,10 +225,11 @@
         if item == self.get_selected_menuitem():
             update_pos = TRUE
 
-        if update_pos:
             pos = self.get_selected_position()
+            # If the selected item is the first one, use the last one as
+            # temporary.
             if pos == 0:
-                tmp = len(optionmenu) - 1 # Index starts at 0
+                tmp = len(self) - 1 # Index starts at 0
                 if tmp < 2:
                     _warn("Could not make optionmenu render updated label")
             else:
@@ -378,7 +379,7 @@
         real_items = []
         for item in itemdata:
             if not item:
-                sep = self.append_separator()
+                self.append_separator()
             elif type(item) == StringType:
                 real_item = self.append_item(item, item)
                 real_items.append((real_item, item, item))



More information about the POS-commit mailing list