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

@@ -64,6 +64,7 @@ class FittingView(wx.ListCtrl):
self.imageListBase = self.imageList.ImageCount
self.activeFitID = None
self.Hide() #Don't show ourselves at start
def addColumn(self, i, col):
self.activeColumns.append(col)
@@ -81,3 +82,5 @@ class FittingView(wx.ListCtrl):
#Gets called from the fitMultiSwitch when it decides its time
def changeFit(self, fitID):
self.activeFitID = fitID
if fitID == None:
self.Hide()

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)