[POS-commit] Kiwi/Kiwi Basic.py,1.46,1.47
kiko at async.com.br
kiko at async.com.br
Fri May 30 20:46:02 BRST 2003
Update of /cvs/Kiwi/Kiwi
In directory anthem:/tmp/cvs-serv21227
Modified Files:
Basic.py
Log Message:
Fix bug 677: problems with popping up a list with a previously selected
item. Let's hope this stays fixed.
Index: Basic.py
===================================================================
RCS file: /cvs/Kiwi/Kiwi/Basic.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- Basic.py 27 May 2003 02:56:38 -0000 1.46
+++ Basic.py 30 May 2003 23:45:59 -0000 1.47
@@ -175,8 +175,7 @@
# TODO/Laundry list
#
-# - popping up list with mouse doesn't allow keyboard nav. Popping up list
-# with keyboard doesn't allow mouse nav. Isn't life fun?
+# - popping up list with mouse doesn't allow keyboard nav.
# - prefill() needs to be fixed up or forbidden. To do this correct will
# require us to return data when data is set on prefill, which means
# making the string list a bit smarter about what is stored in the
@@ -282,6 +281,7 @@
self.list.set_selection_mode(gtk.SELECTION_BROWSE)
# Be nice and send the text in since we have it already
text = self.entry.get_text()
+ # XXX: check if text is in _string_list and return None if not?
self._callback(text)
def _attach_keypress(self):
@@ -493,11 +493,17 @@
# the fact that GtkCombo is too braindead for its own good.
def _on_button_pressed(self, button, *args):
+ # Called when the combo's arrow button is pressed. Note that if
+ # the popwin has been opened by clicking on the button, it has
+ # key/mouse grab and focus; clicking on the button (to close it)
+ # in that case does *not* trigger this callback -- it's treated
+ # the same as a click anywhere outside the popwin, which causes
+ # it to close.
popwin = self.get_popwin()
if popwin['visible']:
- # By default, the button press handler doesn't check if the
- # popwin is visible or not; if it is, the show was triggered
- # by autocomplete, and should be now hidden.
+ # In this case, the popwin was opened because the user typed
+ # into the entry. Clicking on the button in that case does
+ # work (I think we don't add pointer grab).
popwin.hide()
button.emit_stop_by_name("button_press_event")
return TRUE
@@ -507,6 +513,14 @@
self._block_list = TRUE
gtk.GtkCombo.set_popdown_strings(self, self._string_list)
self._block_list = FALSE
+ if popwin.focus_widget and self.list.children():
+ # If we have a focus widget, it's a weird leftover from a
+ # previously selected list item. I've tracked it down and it
+ # seems that the following call seems to clear focus
+ # correctly. Note that leaving out self.list.children()
+ # produces evil GTK warnings.
+ self.list.set_focus_child(None)
+ self._ensure_no_blank_item()
# Make selection mode single so we are sure mouse clicks trigger
# activate; otherwise, the currently active item is not
# selectable!
More information about the POS-commit
mailing list