Also forgot to mention I'm using the latest CustomTreeCtrl from SVN
(51460) and using MSW XP, wxpython 2.8.7.1 and python 2.5. Also attached
is a runnable sample.
-Kyle Rickey
customtreectrl rename.py (2.03 KB)
···
-----Original Message-----
From: Rickey, Kyle W
Sent: Wednesday, April 30, 2008 4:31 PM
To: 'wxpython-users@lists.wxwidgets.org'
Subject: CustomTreeCtrl _renameTimer
Some users of my application are occasionally getting this traceback,
but I've been unable to reproduce it.
Traceback (most recent call last):
File "C:\Program Files\WellExplorer\_customtreectrl.py", line 5226, in
OnMouse
not self._isDragging and (not self._renameTimer or not
self._renameTimer.IsRunning()):
AttributeError: 'CustomTreeCtrl' object has no attribute '_renameTimer'
Basically I've got a binding to wx.EVT_TREE_KEY_DOWN that detects if F2
was pressed while an item is selected. If this happens the code calls:
self.tree.EditLabel(item)
self.tree.GetEditControl().SetSelection(-1, -1)
self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
The binding to wx.EVT_ACTIVATE is so I can handle when my application
loses focus.
I also have the following:
def OnBeginLabelEdit(self, event):
if self.F2_pressed:
event.Skip()
else:
event.Veto()
self.F2_pressed = False
this is to prevent renaming when clicking on items in the tree. The
traceback above only seems to happen after F2 is pressed, but nobody can
seem to reproduce it. Any ideas of what to look for in my code? I looked
at the OnDestroy method of CustomTreeCtrl and that's the only place I
see
del self._renameTimer
So I guess that somehow self._renameTimer isn't getting created
properly. Any help would be greatly appreciated.
-Kyle Rickey