I was having trouble with the TextEditMixin; it would not open an
editor for any row other than the first. I eventually figured out
that it had bound wx.EVT_LIST_ITEM_SELECTED to self.OnItemSelected(),
and I had done exactly the same thing in my class, which means that
their self.OnItemSelected() never got called.
For mixins, shouldn't the names of the callback be called something
offbeat, so as to not collide with names that developers would
commonly use?
For example, I just edited wx/lib/listctrl.py and changed the name of
OnItemSelected to TextEditMixin_OnItemSelected, and everything worked
fine.
I would guess that other mixins suffer from this as well, or am I not
thinking about this correctly?
Yes, name clashes are always a possibility. If you want to give new names to the event handlers in that module, and test each of the classes afterwards, then I'll apply a patch. What I usually do for things like this is to use a leading underscore and a lower case o. For example, OnItemSelected --> _onItemSelected.
···
On 8/26/11 5:03 AM, dhyams wrote:
I was having trouble with the TextEditMixin; it would not open an
editor for any row other than the first. I eventually figured out
that it had bound wx.EVT_LIST_ITEM_SELECTED to self.OnItemSelected(),
and I had done exactly the same thing in my class, which means that
their self.OnItemSelected() never got called.
For mixins, shouldn't the names of the callback be called something
offbeat, so as to not collide with names that developers would
commonly use?
For example, I just edited wx/lib/listctrl.py and changed the name of
OnItemSelected to TextEditMixin_OnItemSelected, and everything worked
fine.
I would guess that other mixins suffer from this as well, or am I not
thinking about this correctly?