use TREE_ITEM_ACTIVATED instead of doubleclick event, it handles but enter and doubleclicks.

Remove doubleclick rename
Activating a tree element will now put it into the active tab
This commit is contained in:
cncfanatics
2010-08-26 01:04:49 +02:00
parent 6462e1a588
commit 87c24f0082
2 changed files with 14 additions and 2 deletions

View File

@@ -55,6 +55,7 @@ class ShipBrowser(wx.Panel):
tree.Bind(wx.EVT_TREE_ITEM_EXPANDING, self.expandLookup)
tree.Bind(wx.EVT_TREE_SEL_CHANGED, self.toggleButtons)
tree.Bind(wx.EVT_TREE_END_LABEL_EDIT, self.changeFitName)
tree.Bind(wx.EVT_TREE_ITEM_ACTIVATED, self.triggerFitSelect)
#Bind buttons
self.shipMenu.new.Bind(wx.EVT_BUTTON, self.newFit)
@@ -93,6 +94,16 @@ class ShipBrowser(wx.Panel):
else:
return self.shipView
def triggerFitSelect(self, event):
selection = event.Item
if selection.IsOk():
tree = self.getActiveTree()
data = tree.GetPyData(selection)
if data is not None:
type, fitID = data
if type == "fit":
wx.PostEvent(self, FitSelected(fitID=fitID))
def toggleButtons(self, event):
tree = self.getActiveTree()
root = tree.GetSelection()
@@ -110,8 +121,6 @@ class ShipBrowser(wx.Panel):
for btn in btns:
btn.Enable()
wx.PostEvent(self, FitSelected(fitID=fitID))
elif type == "ship":
for btn in btns:
btn.Enable(btn == self.shipMenu.new)