Add drone options to context menus
This commit is contained in:
@@ -41,5 +41,6 @@ from gui.builtinContextMenus import ( # noqa: E402,F401
|
||||
factorReload,
|
||||
targetResists,
|
||||
# Graph extra options
|
||||
graphDmgIgnoreResists
|
||||
graphDmgIgnoreResists,
|
||||
graphDmgDroneMode
|
||||
)
|
||||
|
||||
45
gui/builtinContextMenus/graphDmgDroneMode.py
Normal file
45
gui/builtinContextMenus/graphDmgDroneMode.py
Normal file
@@ -0,0 +1,45 @@
|
||||
from collections import OrderedDict
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenuUnconditional
|
||||
from service.settings import GraphSettings
|
||||
|
||||
|
||||
class TargetResists(ContextMenuUnconditional):
|
||||
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = GraphSettings.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
return srcContext == 'dmgStatsGraph'
|
||||
|
||||
def getText(self, itmContext):
|
||||
return 'Drone Mode'
|
||||
|
||||
def handleModeSwitch(self, event):
|
||||
optionName = self.idOptionMap[event.Id]
|
||||
self.settings.set('mobileDroneMode', optionName)
|
||||
|
||||
def getSubMenu(self, context, rootMenu, i, pitem):
|
||||
m = wx.Menu()
|
||||
if "wxMSW" in wx.PlatformInfo:
|
||||
bindmenu = rootMenu
|
||||
else:
|
||||
bindmenu = m
|
||||
self.idOptionMap = {}
|
||||
optionMap = OrderedDict([('auto', 'Auto'), ('followSelf', 'Stick to attacker'), ('followTgt', 'Stick to target')])
|
||||
for optionName, label in optionMap.items():
|
||||
menuId = ContextMenuUnconditional.nextID()
|
||||
item = wx.MenuItem(m, menuId, label, kind=wx.ITEM_CHECK)
|
||||
bindmenu.Bind(wx.EVT_MENU, self.handleModeSwitch, item)
|
||||
m.Append(item)
|
||||
item.Check(optionName == self.settings.get('mobileDroneMode'))
|
||||
self.idOptionMap[menuId] = optionName
|
||||
return m
|
||||
|
||||
|
||||
TargetResists.register()
|
||||
@@ -17,7 +17,6 @@ class ChangeModuleSpool(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
self.cycleMap = {}
|
||||
self.resetId = None
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
@@ -75,6 +74,7 @@ class ChangeModuleSpool(ContextMenuSingle):
|
||||
val2 -= minStep
|
||||
return cycles
|
||||
|
||||
self.cycleMap = {}
|
||||
cyclesToShow = findCycles(cycleMin, cycleMax)
|
||||
for cycle in range(cycleTotalMin, cycleTotalMax + 1):
|
||||
menuId = ContextMenuSingle.nextID()
|
||||
|
||||
@@ -514,7 +514,7 @@ class GraphSettings:
|
||||
|
||||
def __init__(self):
|
||||
defaults = {
|
||||
'mobileDroneMode': 0,
|
||||
'mobileDroneMode': 'auto',
|
||||
'ignoreResists': True}
|
||||
self.settings = SettingsProvider.getInstance().getSettings('graphSettings', defaults)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user