Add a menu entry that appears on right click in the firepower pane to
toggle reload factoring on and off (off by default)
This commit is contained in:
@@ -1,2 +1,2 @@
|
||||
__all__ = ["moduleAmmoPicker", "itemStats", "damagePattern", "marketJump", "droneSplit",
|
||||
"ammoPattern", "project"]
|
||||
"ammoPattern", "project", "factorReload"]
|
||||
|
||||
34
gui/builtinContextMenus/factorReload.py
Executable file
34
gui/builtinContextMenus/factorReload.py
Executable file
@@ -0,0 +1,34 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import service
|
||||
import gui.fittingView
|
||||
import wx
|
||||
from gui import bitmapLoader
|
||||
|
||||
class FactorReload(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, context, selection):
|
||||
return context in ("firepowerViewFull",) and self.mainFrame.getActiveFit() is not None
|
||||
|
||||
def getText(self, context, selection):
|
||||
return "Factor in Reload Time"
|
||||
|
||||
def activate(self, context, selection, i):
|
||||
sFit = service.Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
sFit.toggleFactorReload(fitID)
|
||||
wx.PostEvent(self.mainFrame, gui.fittingView.FitChanged(fitID=fitID))
|
||||
|
||||
def getBitmap(self, context, selection):
|
||||
sFit = service.Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
fit = sFit.getFit(fitID)
|
||||
if fit.factorReload:
|
||||
return bitmapLoader.getBitmap("state_active_small", "icons")
|
||||
else:
|
||||
return None
|
||||
|
||||
|
||||
FactorReload.register()
|
||||
@@ -86,6 +86,16 @@ class Fit(object):
|
||||
fit.clear()
|
||||
return fit
|
||||
|
||||
def toggleFactorReload(self, fitID):
|
||||
if fitID is None:
|
||||
return None
|
||||
|
||||
fit = eos.db.getFit(fitID)
|
||||
fit.factorReload = not fit.factorReload
|
||||
eos.db.commit()
|
||||
fit.clear()
|
||||
fit.calculateModifiedAttributes()
|
||||
|
||||
def getFit(self, fitID):
|
||||
if fitID is None:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user