Add context menu item which controls if webs/TPs are applied to the target
This commit is contained in:
@@ -42,5 +42,6 @@ from gui.builtinContextMenus import ( # noqa: E402,F401
|
||||
targetResists,
|
||||
# Graph extra options
|
||||
graphDmgIgnoreResists,
|
||||
graphDmgDroneMode
|
||||
graphDmgApplyProjected,
|
||||
graphDmgDroneMode,
|
||||
)
|
||||
|
||||
31
gui/builtinContextMenus/graphDmgApplyProjected.py
Normal file
31
gui/builtinContextMenus/graphDmgApplyProjected.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenuUnconditional
|
||||
from service.settings import GraphSettings
|
||||
|
||||
|
||||
class GraphDmgApplyProjectedMenu(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 'Apply Attacker Webs and TPs'
|
||||
|
||||
def activate(self, fullContext, i):
|
||||
self.settings.set('applyProjected', not self.settings.get('applyProjected'))
|
||||
wx.PostEvent(self.mainFrame, GE.GraphOptionChanged())
|
||||
|
||||
@property
|
||||
def checked(self):
|
||||
return self.settings.get('applyProjected')
|
||||
|
||||
|
||||
GraphDmgApplyProjectedMenu.register()
|
||||
@@ -10,7 +10,7 @@ from service.const import GraphDpsDroneMode
|
||||
from service.settings import GraphSettings
|
||||
|
||||
|
||||
class TargetResists(ContextMenuUnconditional):
|
||||
class GraphDmgDroneModeMenu(ContextMenuUnconditional):
|
||||
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
@@ -38,8 +38,8 @@ class TargetResists(ContextMenuUnconditional):
|
||||
self.idOptionMap = {}
|
||||
optionMap = OrderedDict([
|
||||
(GraphDpsDroneMode.auto, 'Auto'),
|
||||
(GraphDpsDroneMode.followAttacker, 'Stick to attacker'),
|
||||
(GraphDpsDroneMode.followTarget, 'Stick to target')])
|
||||
(GraphDpsDroneMode.followAttacker, 'Stick to Attacker'),
|
||||
(GraphDpsDroneMode.followTarget, 'Stick to Target')])
|
||||
for option, label in optionMap.items():
|
||||
menuId = ContextMenuUnconditional.nextID()
|
||||
item = wx.MenuItem(m, menuId, label, kind=wx.ITEM_CHECK)
|
||||
@@ -50,4 +50,4 @@ class TargetResists(ContextMenuUnconditional):
|
||||
return m
|
||||
|
||||
|
||||
TargetResists.register()
|
||||
GraphDmgDroneModeMenu.register()
|
||||
|
||||
@@ -7,7 +7,7 @@ from gui.contextMenu import ContextMenuUnconditional
|
||||
from service.settings import GraphSettings
|
||||
|
||||
|
||||
class GraphDmgIgnoreResists(ContextMenuUnconditional):
|
||||
class GraphDmgIgnoreResistsMenu(ContextMenuUnconditional):
|
||||
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
@@ -17,7 +17,7 @@ class GraphDmgIgnoreResists(ContextMenuUnconditional):
|
||||
return srcContext == 'dmgStatsGraph'
|
||||
|
||||
def getText(self, itmContext):
|
||||
return "Ignore Target Resists"
|
||||
return 'Ignore Target Resists'
|
||||
|
||||
def activate(self, fullContext, i):
|
||||
self.settings.set('ignoreResists', not self.settings.get('ignoreResists'))
|
||||
@@ -28,4 +28,4 @@ class GraphDmgIgnoreResists(ContextMenuUnconditional):
|
||||
return self.settings.get('ignoreResists')
|
||||
|
||||
|
||||
GraphDmgIgnoreResists.register()
|
||||
GraphDmgIgnoreResistsMenu.register()
|
||||
|
||||
@@ -518,7 +518,8 @@ class GraphSettings:
|
||||
def __init__(self):
|
||||
defaults = {
|
||||
'mobileDroneMode': GraphDpsDroneMode.auto,
|
||||
'ignoreResists': True}
|
||||
'ignoreResists': True,
|
||||
'applyProjected': True}
|
||||
self.settings = SettingsProvider.getInstance().getSettings('graphSettings', defaults)
|
||||
|
||||
def get(self, type):
|
||||
|
||||
Reference in New Issue
Block a user