[wxpython-dev] Patch for wx.lib.combotreebox.py
Frank Niessink
frank at niessink.com
Fri May 2 12:01:27 PDT 2008
Hi Robin,
I fixed a bug in wx.lib.combotreebox.py. The bug occurred if the tree
contained items with the same item text; if the user would click the
second item, the first would be erroneously selected. Attached patch
fixes this issue.
Cheers, Frank
-------------- next part --------------
*** combotreebox.orig.py 2008-05-02 20:53:35.000000000 +0200
--- combotreebox.py 2008-05-02 20:54:28.000000000 +0200
***************
*** 35,44 ****
workaround.
=
Author: Frank Niessink <frank at niessink.com>
! Copyright 2006, Frank Niessink
License: wxWidgets license
! Version: 0.9
! Date: September 6, 2006
"""
=
import wx
--- 35,44 ----
workaround.
=
Author: Frank Niessink <frank at niessink.com>
! Copyright 2006, 2008, Frank Niessink
License: wxWidgets license
! Version: 1.0
! Date: May 2, 2008
"""
=
import wx
***************
*** 362,373 ****
=
def OnText(self, event):
event.Skip()
! item =3D self.FindString(self._text.GetValue())
! if item:
! if self._tree.GetSelection() !=3D item:
self._tree.SelectItem(item)
! else:
! self._tree.Unselect()
=
# Methods called by the PopupFrame, to let the ComboTreeBox know
# about what the user did.
--- 362,377 ----
=
def OnText(self, event):
event.Skip()
! textValue =3D self._text.GetValue()
! selection =3D self._tree.GetSelection()
! if not selection or self._tree.GetItemText(selection) !=3D textVa=
lue:
! # We need to change the selection because it doesn't match the
! # text just entered
! item =3D self.FindString(textValue)
! if item:
self._tree.SelectItem(item)
! else:
! self._tree.Unselect()
=
# Methods called by the PopupFrame, to let the ComboTreeBox know
# about what the user did.
More information about the wxpython-dev
mailing list