Add WH support to pyfa
This commit is contained in:
2
eos
2
eos
Submodule eos updated: 3870eeedfe...e087b36c3f
@@ -1,2 +1,2 @@
|
||||
__all__ = ["moduleAmmoPicker", "itemStats", "damagePattern", "marketJump", "droneSplit",
|
||||
"ammoPattern", "project", "factorReload"]
|
||||
"ammoPattern", "project", "factorReload", "whProjector"]
|
||||
|
||||
47
gui/builtinContextMenus/whProjector.py
Normal file
47
gui/builtinContextMenus/whProjector.py
Normal file
@@ -0,0 +1,47 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
import service
|
||||
import wx
|
||||
|
||||
class WhProjector(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
return srcContext in ("projectedDrone", "projectedModule", "projectedCharge", "projectedFit", "projectedNone")
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
return "System effects"
|
||||
|
||||
def activate(self, fullContext, selection, i):
|
||||
pass
|
||||
|
||||
def getSubMenu(self, context, selection, menu, i):
|
||||
self.idmap = {}
|
||||
m = wx.Menu()
|
||||
sMkt = service.Market.getInstance()
|
||||
effdata = sMkt.getSystemWideEffects()
|
||||
for swType in sorted(effdata):
|
||||
item = wx.MenuItem(m, wx.ID_ANY, swType)
|
||||
sub = wx.Menu()
|
||||
sub.Bind(wx.EVT_MENU, self.handleSelection)
|
||||
item.SetSubMenu(sub)
|
||||
m.AppendItem(item)
|
||||
for swData in sorted(effdata[swType], key=lambda tpl: tpl[2]):
|
||||
wxid = wx.NewId()
|
||||
swObj, swName, swClass = swData
|
||||
self.idmap[wxid] = (swObj, swName)
|
||||
subitem = wx.MenuItem(sub, wxid, swClass)
|
||||
sub.AppendItem(subitem)
|
||||
return m
|
||||
|
||||
|
||||
def handleSelection(self, event):
|
||||
swObj, swName = self.idmap[event.Id]
|
||||
sFit = service.Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
sFit.project(fitID, swObj)
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
|
||||
WhProjector.register()
|
||||
@@ -200,11 +200,18 @@ class ProjectedView(d.Display):
|
||||
else:
|
||||
context = (modFullContext,)
|
||||
else:
|
||||
context = ("projectedFit",)
|
||||
|
||||
context = (("projectedFit",),)
|
||||
menu = ContextMenu.getMenu((item,), *context)
|
||||
if menu is not None:
|
||||
self.PopupMenu(menu)
|
||||
elif row == -1 and event.Button == 3:
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
if fitID is None:
|
||||
return
|
||||
context = (("projectedNone",),)
|
||||
menu = ContextMenu.getMenu([], *context)
|
||||
if menu is not None:
|
||||
self.PopupMenu(menu)
|
||||
|
||||
def remove(self, event):
|
||||
row, _ = self.HitTest(event.Position)
|
||||
|
||||
@@ -258,6 +258,10 @@ class Fit(object):
|
||||
fit.projectedDrones.append(drone)
|
||||
|
||||
drone.amount += 1
|
||||
elif thing.group.name == "Effect Beacon":
|
||||
module = eos.types.Module(thing)
|
||||
module.state = State.ONLINE
|
||||
fit.projectedModules.append(module)
|
||||
else:
|
||||
module = eos.types.Module(thing)
|
||||
module.state = State.ACTIVE
|
||||
|
||||
Reference in New Issue
Block a user