Enable "open in new tab" menu
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from graphs.wrapper import BaseWrapper
|
||||
from gui.builtinShipBrowser.events import FitSelected
|
||||
from gui.contextMenu import ContextMenuSingle
|
||||
|
||||
@@ -12,12 +13,17 @@ class OpenFitInNewTab(ContextMenuSingle):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if srcContext not in ("projectedFit", "commandFit"):
|
||||
if srcContext not in ("projectedFit", "commandFit", "graphFitListMisc", "graphTgtListMisc"):
|
||||
return False
|
||||
|
||||
if mainItem is None:
|
||||
return False
|
||||
|
||||
if isinstance(mainItem, BaseWrapper):
|
||||
if not mainItem.isFit:
|
||||
return False
|
||||
mainItem = mainItem.item
|
||||
|
||||
currentFitID = self.mainFrame.getActiveFit()
|
||||
selectedFitID = mainItem.ID
|
||||
if currentFitID == selectedFitID:
|
||||
@@ -28,6 +34,8 @@ class OpenFitInNewTab(ContextMenuSingle):
|
||||
return "Open Fit in New Tab"
|
||||
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
if isinstance(mainItem, BaseWrapper):
|
||||
mainItem = mainItem.item
|
||||
wx.PostEvent(self.mainFrame, FitSelected(fitID=mainItem.ID, startup=2))
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user