Fix some bugs and add forgotten files
This commit is contained in:
@@ -8,11 +8,16 @@ class ItemStats(ContextMenu):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, context, selection):
|
||||
return context in ("item", "ship", "module", "ammo", "skill", "itemSearch", "drone", "implant", "booster")
|
||||
return context in ("item", "ship", "module", "ammo", "skill",
|
||||
"itemSearch", "drone", "implant", "booster",
|
||||
"projectedModule", "projectedDrone")
|
||||
|
||||
def getText(self, context, selection):
|
||||
return "%s stats" % (context.capitalize() if context != "itemSearch" else "Item")
|
||||
return "%s stats" % (context.capitalize() if context not in self.REPLACES else self.REPLACES[context])
|
||||
|
||||
REPLACES = {"itemSearch": "Item",
|
||||
"projectedModule": "Module",
|
||||
"projectedDrone": "Drone"}
|
||||
def activate(self, context, selection, i):
|
||||
if context == "ship":
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
@@ -24,6 +29,6 @@ class ItemStats(ContextMenu):
|
||||
if context == "module" and stuff.isEmpty:
|
||||
return
|
||||
|
||||
dlg=ItemStatsDialog(stuff, context if context != "itemSearch" else "Item")
|
||||
dlg=ItemStatsDialog(stuff, context.capitalize() if context not in self.REPLACES else self.REPLACES[context])
|
||||
|
||||
ItemStats.register()
|
||||
|
||||
27
gui/builtinContextMenus/project.py
Executable file
27
gui/builtinContextMenus/project.py
Executable file
@@ -0,0 +1,27 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import service
|
||||
import gui.fittingView
|
||||
import wx
|
||||
|
||||
class Project(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, context, selection):
|
||||
if context not in ("item", "itemSearch") or self.mainFrame.getActiveFit() is None:
|
||||
return False
|
||||
|
||||
item = selection[0]
|
||||
return item.isType("projected")
|
||||
|
||||
def getText(self, context, selection):
|
||||
return "Project onto Fit"
|
||||
|
||||
def activate(self, context, selection, i):
|
||||
sFit = service.Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
sFit.project(fitID, selection[0])
|
||||
wx.PostEvent(self.mainFrame, gui.fittingView.FitChanged(fitID=fitID))
|
||||
|
||||
Project.register()
|
||||
Reference in New Issue
Block a user