Allow to edit target profiles via context menu
This commit is contained in:
@@ -13,6 +13,7 @@ from gui.builtinContextMenus import moduleSpool
|
||||
from gui.builtinContextMenus import boosterSideEffects
|
||||
from gui.builtinContextMenus import fighterAbilities
|
||||
from gui.builtinContextMenus import resistMode
|
||||
from gui.builtinContextMenus.targetProfile import editor
|
||||
# Item info
|
||||
from gui.builtinContextMenus import itemStats
|
||||
from gui.builtinContextMenus import itemMarketJump
|
||||
|
||||
31
gui/builtinContextMenus/targetProfile/editor.py
Normal file
31
gui/builtinContextMenus/targetProfile/editor.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import gui.mainFrame
|
||||
from eos.saveddata.targetProfile import TargetProfile
|
||||
from graphs.wrapper import TargetWrapper
|
||||
from gui.contextMenu import ContextMenuSingle
|
||||
from gui.targetProfileEditor import TargetProfileEditorDlg
|
||||
|
||||
|
||||
class TargetProfileEditor(ContextMenuSingle):
|
||||
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if srcContext != 'graphTgtList':
|
||||
return False
|
||||
if not isinstance(mainItem, TargetWrapper):
|
||||
return False
|
||||
if not mainItem.isProfile:
|
||||
return False
|
||||
if mainItem.item is TargetProfile.getIdeal():
|
||||
return False
|
||||
return True
|
||||
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return 'Edit Target Profile'
|
||||
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
TargetProfileEditorDlg(parent=callingWindow, selected=mainItem.item)
|
||||
|
||||
|
||||
TargetProfileEditor.register()
|
||||
@@ -36,7 +36,7 @@ class EntityEditor(wx.Panel):
|
||||
functions that get the list from the source, what to do when user does an action, and how to validate the input.
|
||||
"""
|
||||
|
||||
def __init__(self, parent, entityName):
|
||||
def __init__(self, parent, entityName, selected=None):
|
||||
wx.Panel.__init__(self, parent, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL)
|
||||
self.entityName = entityName
|
||||
self.validator = None
|
||||
@@ -70,7 +70,7 @@ class EntityEditor(wx.Panel):
|
||||
self.SetSizer(self.navSizer)
|
||||
self.Layout()
|
||||
|
||||
self.refreshEntityList()
|
||||
self.refreshEntityList(selected=selected)
|
||||
|
||||
def SetEditorValidator(self, validator=None):
|
||||
""" Sets validator class (not an instance of the class) """
|
||||
|
||||
@@ -80,8 +80,8 @@ class TargetProfileNameValidator(BaseValidator):
|
||||
|
||||
class TargetProfileEntityEditor(EntityEditor):
|
||||
|
||||
def __init__(self, parent):
|
||||
EntityEditor.__init__(self, parent, "Target Profile")
|
||||
def __init__(self, parent, selected=None):
|
||||
EntityEditor.__init__(self, parent=parent, entityName="Target Profile", selected=selected)
|
||||
self.SetEditorValidator(TargetProfileNameValidator)
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
@@ -122,7 +122,7 @@ class TargetProfileEditorDlg(wx.Dialog):
|
||||
('signatureRadius', ('Signature radius\nLeave blank for infinitely big value', 'm')),
|
||||
('radius', ('Radius', 'm'))])
|
||||
|
||||
def __init__(self, parent):
|
||||
def __init__(self, parent, selected=None):
|
||||
wx.Dialog.__init__(
|
||||
self, parent, id=wx.ID_ANY,
|
||||
title="Target Profile Editor",
|
||||
@@ -135,7 +135,7 @@ class TargetProfileEditorDlg(wx.Dialog):
|
||||
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
self.entityEditor = TargetProfileEntityEditor(self)
|
||||
self.entityEditor = TargetProfileEntityEditor(parent=self, selected=selected)
|
||||
mainSizer.Add(self.entityEditor, 0, wx.ALL | wx.EXPAND, 2)
|
||||
|
||||
self.sl = wx.StaticLine(self)
|
||||
|
||||
Reference in New Issue
Block a user