Added the ability to remove charges and projected items using the itemRemove built in context menu. In this commit I fixed a minor bug in the projected view that caused the right clicked item not to be SHOWN as selected until after the context menu had been spawned and closed. I also removed all parent references from the ContextMenu class and sub classes. I am instead using the fit service to do all the work of removing the items in the itemRemove class.
28 lines
879 B
Python
28 lines
879 B
Python
from gui.contextMenu import ContextMenu
|
|
import gui.mainFrame
|
|
import service
|
|
import gui.globalEvents as GE
|
|
import wx
|
|
|
|
class Project(ContextMenu):
|
|
def __init__(self):
|
|
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
|
|
|
def display(self, srcContext, selection):
|
|
if srcContext not in ("marketItemGroup", "marketItemMisc") or self.mainFrame.getActiveFit() is None:
|
|
return False
|
|
|
|
item = selection[0]
|
|
return item.isType("projected")
|
|
|
|
def getText(self, itmContext, selection):
|
|
return "Project {0} onto Fit".format(itmContext)
|
|
|
|
def activate(self, fullContext, selection, i):
|
|
sFit = service.Fit.getInstance()
|
|
fitID = self.mainFrame.getActiveFit()
|
|
sFit.project(fitID, selection[0])
|
|
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
|
|
|
Project.register()
|