Files
pyfa/gui/builtinContextMenus/itemStats.py

30 lines
854 B
Python
Executable File

from gui.contextMenu import ContextMenu
from gui.itemStats import ItemStatsDialog
import gui.mainFrame
import service
class ItemStats(ContextMenu):
def __init__(self):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
def display(self, context, selection):
return context in ("ship", "module")
def getText(self, context, selection):
return "%s stats" % context.capitalize()
def activate(self, context, selection):
if context == "ship":
fitID = self.mainFrame.getActiveFit()
cFit = service.Fit.getInstance()
stuff = cFit.getFit(fitID).ship
else:
stuff = selection[0]
if context == "module" and stuff.isEmpty:
return
dlg=ItemStatsDialog(stuff)
dlg.Show()
ItemStats.register()