Fixes incorrect setting of draggedFitID when selecting booster from menu

This commit is contained in:
blitzmann
2014-02-26 00:32:07 -05:00
parent 5aa34caca6
commit 035e6cea41
2 changed files with 4 additions and 3 deletions

View File

@@ -352,7 +352,7 @@ class GangView ( ScrolledPanel ):
choice.SetSelection(1)
def handleDrag(self, type, fitID):
''' Handle dragging of fit to fleet interface. This is also fired when right-clicking fit if there's an active one '''
''' Handle dragging of fit to fleet interface '''
#Those are drags coming from pyfa sources, NOT builtin wx drags
self.draggedFitID = None
if type == "fit":
@@ -368,7 +368,6 @@ class GangView ( ScrolledPanel ):
def OnPopupItemSelected(self, event):
''' Fired when booster popup item is selected '''
# Get menu selection ID via self.options
menuItem = self.FitDNDPopupMenu.FindItemById(event.GetId())
type = self.options.index(menuItem.GetText())
@@ -387,6 +386,7 @@ class GangView ( ScrolledPanel ):
# set type via choice box used
chFit = event.GetEventObject()
fitID = chFit.GetClientData(chFit.GetSelection())
type = -1
for id in self.fleet:
if chFit == self.fleet[id]['chFit']: type = id

View File

@@ -1367,7 +1367,6 @@ class FitItem(SFItem.SFBrowserItem):
self.fitMenu.AppendSeparator()
boosterMenu = self.mainFrame.additionsPane.gangPage.FitDNDPopupMenu
self.fitMenu.AppendMenu(wx.ID_ANY, 'Set Booster', boosterMenu)
self.mainFrame.additionsPane.gangPage.draggedFitID = self.fitID
self.boosterBmp = bitmapLoader.getBitmap("fleet_fc_small", "icons")
self.copyBmp = bitmapLoader.getBitmap("fit_add_small", "icons")
@@ -1460,6 +1459,8 @@ class FitItem(SFItem.SFBrowserItem):
''' Handles context menu for fit. Dragging is handled by MouseLeftUp() '''
pos = wx.GetMousePosition()
pos = self.ScreenToClient(pos)
# Even though we may not select a booster, automatically set this so that the fleet pane knows which fit we're applying
self.mainFrame.additionsPane.gangPage.draggedFitID = self.fitID
self.PopupMenu(self.fitMenu, pos)
event.Skip()