Pass calling window to context menu
This commit is contained in:
@@ -14,7 +14,7 @@ class AmmoToDmgPattern(ContextMenuSingle):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if not self.settings.get('ammoPattern'):
|
||||
return False
|
||||
|
||||
@@ -30,15 +30,15 @@ class AmmoToDmgPattern(ContextMenuSingle):
|
||||
|
||||
return False
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Set {} as Damage Pattern".format(itmContext if itmContext is not None else "Item")
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
Fit.getInstance().setAsPattern(fitID, mainItem)
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,)))
|
||||
|
||||
def getBitmap(self, context, mainItem):
|
||||
def getBitmap(self, callingWindow, context, mainItem):
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class BoosterSideEffects(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if self.mainFrame.getActiveFit() is None or srcContext not in "boosterItem":
|
||||
return False
|
||||
|
||||
@@ -27,7 +27,7 @@ class BoosterSideEffects(ContextMenuSingle):
|
||||
|
||||
return False
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Side Effects"
|
||||
|
||||
def addEffect(self, menu, ability):
|
||||
@@ -39,7 +39,7 @@ class BoosterSideEffects(ContextMenuSingle):
|
||||
menu.Bind(wx.EVT_MENU, self.handleMode, menuItem)
|
||||
return menuItem
|
||||
|
||||
def getSubMenu(self, context, mainItem, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, mainItem, rootMenu, i, pitem):
|
||||
msw = True if "wxMSW" in wx.PlatformInfo else False
|
||||
self.context = context
|
||||
self.effectIds = {}
|
||||
|
||||
@@ -9,7 +9,7 @@ class AddToCargo(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if srcContext not in ("marketItemGroup", "marketItemMisc"):
|
||||
return False
|
||||
|
||||
@@ -25,10 +25,10 @@ class AddToCargo(ContextMenuSingle):
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Add {} to Cargo".format(itmContext)
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
typeID = int(mainItem.ID)
|
||||
command = cmd.GuiAddCargoCommand(fitID=fitID, itemID=typeID, amount=1)
|
||||
|
||||
@@ -8,7 +8,7 @@ class AddToCargoAmmo(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if srcContext not in ("marketItemGroup", "marketItemMisc") or self.mainFrame.getActiveFit() is None:
|
||||
return False
|
||||
|
||||
@@ -20,10 +20,10 @@ class AddToCargoAmmo(ContextMenuSingle):
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Add {0} to Cargo (x1000)".format(itmContext)
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
typeID = int(mainItem.ID)
|
||||
command = cmd.GuiAddCargoCommand(fitID=fitID, itemID=typeID, amount=1000)
|
||||
|
||||
@@ -40,13 +40,13 @@ class AddCommandFit(ContextMenuUnconditional):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
if self.mainFrame.getActiveFit() is None or len(self.__class__.commandFits) == 0 or srcContext != "commandView":
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return "Command Fits"
|
||||
|
||||
def addFit(self, menu, fit, includeShip=False):
|
||||
@@ -57,7 +57,7 @@ class AddCommandFit(ContextMenuUnconditional):
|
||||
menu.Bind(wx.EVT_MENU, self.handleSelection, menuItem)
|
||||
return menuItem
|
||||
|
||||
def getSubMenu(self, context, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
|
||||
msw = True if "wxMSW" in wx.PlatformInfo else False
|
||||
self.context = context
|
||||
self.fitMenuItemIds = {}
|
||||
|
||||
@@ -16,14 +16,14 @@ class ChangeDamagePattern(ContextMenuUnconditional):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
return srcContext == "resistancesViewFull"
|
||||
|
||||
@property
|
||||
def enabled(self):
|
||||
return self.mainFrame.getActiveFit() is not None
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
sDP = import_DamagePattern.getInstance()
|
||||
sFit = Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
@@ -75,7 +75,7 @@ class ChangeDamagePattern(ContextMenuUnconditional):
|
||||
menuItem.SetBitmap(bitmap)
|
||||
return menuItem
|
||||
|
||||
def getSubMenu(self, context, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
|
||||
msw = True if "wxMSW" in wx.PlatformInfo else False
|
||||
|
||||
if self.m[i] not in self.subMenus:
|
||||
|
||||
@@ -10,7 +10,7 @@ class DroneAddStack(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if srcContext not in ('marketItemGroup', 'marketItemMisc'):
|
||||
return False
|
||||
|
||||
@@ -32,11 +32,11 @@ class DroneAddStack(ContextMenuSingle):
|
||||
self.amount = amount
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return 'Add {} to Drone Bay{}'.format(
|
||||
itmContext, '' if self.amount == 1 else ' (x{})'.format(self.amount))
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
command = cmd.GuiAddLocalDroneCommand(
|
||||
fitID=self.mainFrame.getActiveFit(),
|
||||
itemID=int(mainItem.ID),
|
||||
|
||||
@@ -14,7 +14,7 @@ class DroneSplitStack(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if srcContext != "droneItem":
|
||||
return False
|
||||
|
||||
@@ -23,10 +23,10 @@ class DroneSplitStack(ContextMenuSingle):
|
||||
|
||||
return mainItem.amount > 1
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Split {} Stack".format(itmContext)
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
dlg = DroneStackSplit(self.mainFrame, mainItem.amount)
|
||||
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
|
||||
@@ -26,13 +26,13 @@ class AddEnvironmentEffect(ContextMenuUnconditional):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
return srcContext == "projected"
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return "Add Environmental Effect"
|
||||
|
||||
def getSubMenu(self, context, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
|
||||
msw = True if "wxMSW" in wx.PlatformInfo else False
|
||||
|
||||
# Wormholes
|
||||
|
||||
@@ -12,17 +12,17 @@ class FactorReload(ContextMenuUnconditional):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
return srcContext == "firepowerViewFull"
|
||||
|
||||
@property
|
||||
def enabled(self):
|
||||
return self.mainFrame.getActiveFit() is not None
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return "Factor in Reload Time"
|
||||
|
||||
def activate(self, fullContext, i):
|
||||
def activate(self, callingWindow, fullContext, i):
|
||||
fitIDs = Fit.getInstance().toggleFactorReload()
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=tuple(fitIDs)))
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class FighterAbilities(ContextMenuCombined):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.isProjected = None
|
||||
|
||||
def display(self, srcContext, mainItem, selection):
|
||||
def display(self, callingWindow, srcContext, mainItem, selection):
|
||||
if self.mainFrame.getActiveFit() is None or srcContext not in ("fighterItem", "projectedFighter"):
|
||||
return False
|
||||
|
||||
@@ -26,7 +26,7 @@ class FighterAbilities(ContextMenuCombined):
|
||||
self.isProjected = True if srcContext == "projectedFighter" else False
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem, selection):
|
||||
def getText(self, callingWindow, itmContext, mainItem, selection):
|
||||
return "Abilities"
|
||||
|
||||
def addAbility(self, menu, ability):
|
||||
@@ -37,7 +37,7 @@ class FighterAbilities(ContextMenuCombined):
|
||||
menu.Bind(wx.EVT_MENU, self.handleMode, menuItem)
|
||||
return menuItem
|
||||
|
||||
def getSubMenu(self, context, mainItem, selection, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, mainItem, selection, rootMenu, i, pitem):
|
||||
msw = True if "wxMSW" in wx.PlatformInfo else False
|
||||
self.context = context
|
||||
self.abilityIds = {}
|
||||
|
||||
@@ -13,17 +13,17 @@ class AddCurrentlyOpenFit(ContextMenuUnconditional):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
|
||||
if self.mainFrame.getActiveFit() is None or srcContext not in ('projected', 'commandView'):
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return 'Add Currently Open Fit'
|
||||
|
||||
def getSubMenu(self, context, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
|
||||
self.fitLookup = {}
|
||||
self.context = context
|
||||
sFit = Fit.getInstance()
|
||||
|
||||
@@ -11,7 +11,7 @@ class OpenFitInNewTab(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if srcContext not in ("projectedFit", "commandFit"):
|
||||
return False
|
||||
|
||||
@@ -24,10 +24,10 @@ class OpenFitInNewTab(ContextMenuSingle):
|
||||
return False
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Open Fit in New Tab"
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
wx.PostEvent(self.mainFrame, FitSelected(fitID=mainItem.ID, startup=2))
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class FitSystemSecurityMenu(ContextMenuUnconditional):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
if srcContext != "fittingShip":
|
||||
return False
|
||||
|
||||
@@ -33,7 +33,7 @@ class FitSystemSecurityMenu(ContextMenuUnconditional):
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return "Citadel System Security"
|
||||
|
||||
def addOption(self, menu, optionLabel):
|
||||
@@ -43,7 +43,7 @@ class FitSystemSecurityMenu(ContextMenuUnconditional):
|
||||
menu.Bind(wx.EVT_MENU, self.handleMode, menuItem)
|
||||
return menuItem
|
||||
|
||||
def getSubMenu(self, context, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
fit = Fit.getInstance().getFit(fitID)
|
||||
msw = True if "wxMSW" in wx.PlatformInfo else False
|
||||
|
||||
@@ -13,13 +13,13 @@ class GraphDmgApplyProjectedMenu(ContextMenuUnconditional):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = GraphSettings.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
return srcContext == 'dmgStatsGraph'
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return 'Apply Attacker Webs and TPs'
|
||||
|
||||
def activate(self, fullContext, i):
|
||||
def activate(self, callingWindow, fullContext, i):
|
||||
self.settings.set('applyProjected', not self.settings.get('applyProjected'))
|
||||
wx.PostEvent(self.mainFrame, GE.GraphOptionChanged())
|
||||
|
||||
|
||||
@@ -16,10 +16,10 @@ class GraphDmgDroneModeMenu(ContextMenuUnconditional):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = GraphSettings.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
return srcContext == 'dmgStatsGraph'
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return 'Drone Mode'
|
||||
|
||||
def handleModeSwitch(self, event):
|
||||
@@ -29,7 +29,7 @@ class GraphDmgDroneModeMenu(ContextMenuUnconditional):
|
||||
self.settings.set('mobileDroneMode', option)
|
||||
wx.PostEvent(self.mainFrame, GE.GraphOptionChanged())
|
||||
|
||||
def getSubMenu(self, context, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
|
||||
m = wx.Menu()
|
||||
if "wxMSW" in wx.PlatformInfo:
|
||||
bindmenu = rootMenu
|
||||
|
||||
@@ -13,13 +13,13 @@ class GraphDmgIgnoreResistsMenu(ContextMenuUnconditional):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = GraphSettings.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
return srcContext == 'dmgStatsGraph'
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return 'Ignore Target Resists'
|
||||
|
||||
def activate(self, fullContext, i):
|
||||
def activate(self, callingWindow, fullContext, i):
|
||||
self.settings.set('ignoreResists', not self.settings.get('ignoreResists'))
|
||||
wx.PostEvent(self.mainFrame, GE.GraphOptionChanged())
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class AddImplantSet(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
|
||||
sIS = s_ImplantSets.getInstance()
|
||||
implantSets = sIS.getImplantSetList()
|
||||
@@ -23,10 +23,10 @@ class AddImplantSet(ContextMenuSingle):
|
||||
return False
|
||||
return srcContext in ("implantView", "implantEditor")
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Add Implant Set"
|
||||
|
||||
def getSubMenu(self, context, mainItem, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, mainItem, rootMenu, i, pitem):
|
||||
"""
|
||||
A note on the mainItem here: Most context menus act on a fit, so it's easy enough to get the active fit from
|
||||
the MainFrame instance. There's never been a reason to get info from another window, so there's not common
|
||||
|
||||
@@ -18,7 +18,7 @@ class ChangeItemAmount(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if srcContext not in ("droneItem", "projectedDrone", "cargoItem", "projectedFit", "fighterItem", "projectedFighter"):
|
||||
return False
|
||||
|
||||
@@ -27,10 +27,10 @@ class ChangeItemAmount(ContextMenuSingle):
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Change {0} Quantity".format(itmContext)
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
srcContext = fullContext[0]
|
||||
if isinstance(mainItem, es_Fit):
|
||||
|
||||
@@ -10,7 +10,7 @@ class FillWithItem(ContextMenuSingle):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if not self.settings.get('moduleFill'):
|
||||
return False
|
||||
|
||||
@@ -28,10 +28,10 @@ class FillWithItem(ContextMenuSingle):
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Fill With Module"
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
self.mainFrame.command.Submit(cmd.GuiFillWithNewLocalModulesCommand(
|
||||
fitID=self.mainFrame.getActiveFit(),
|
||||
itemID=int(mainItem.ID)))
|
||||
|
||||
@@ -7,7 +7,7 @@ class JumpToMarketItem(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
validContexts = ("marketItemMisc", "fittingModule",
|
||||
"fittingCharge", "droneItem",
|
||||
"implantItem", "boosterItem",
|
||||
@@ -36,10 +36,10 @@ class JumpToMarketItem(ContextMenuSingle):
|
||||
doit = not mainItem.isEmpty if srcContext == "fittingModule" else True
|
||||
return doit
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "{0} Market Group".format(itmContext if itmContext is not None else "Item")
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
srcContext = fullContext[0]
|
||||
if srcContext in ("fittingCharge", "projectedCharge"):
|
||||
item = mainItem.charge
|
||||
|
||||
@@ -11,7 +11,7 @@ class ProjectItem(ContextMenuSingle):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if not self.settings.get('project'):
|
||||
return False
|
||||
|
||||
@@ -30,10 +30,10 @@ class ProjectItem(ContextMenuSingle):
|
||||
|
||||
return mainItem.isType("projected")
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Project {0} onto Fit".format(itmContext)
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
if mainItem.isModule:
|
||||
success = self.mainFrame.command.Submit(cmd.GuiAddProjectedModuleCommand(fitID=fitID, itemID=mainItem.ID))
|
||||
|
||||
@@ -18,7 +18,7 @@ class RemoveItem(ContextMenuCombined):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem, selection):
|
||||
def display(self, callingWindow, srcContext, mainItem, selection):
|
||||
if srcContext not in (
|
||||
"fittingModule", "droneItem",
|
||||
"implantItem", "boosterItem",
|
||||
@@ -35,12 +35,12 @@ class RemoveItem(ContextMenuCombined):
|
||||
self.srcContext = srcContext
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem, selection):
|
||||
def getText(self, callingWindow, itmContext, mainItem, selection):
|
||||
return 'Remove {}{}'.format(
|
||||
itmContext if itmContext is not None else 'Item',
|
||||
' Stack' if self.srcContext in ('droneItem', 'projectedDrone', 'cargoItem', 'projectedFit') else '')
|
||||
|
||||
def activate(self, fullContext, mainItem, selection, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, selection, i):
|
||||
handlerMap = {
|
||||
'fittingModule': self.__handleModule,
|
||||
'droneItem': self.__handleDrone,
|
||||
|
||||
@@ -11,7 +11,7 @@ class ItemStats(ContextMenuSingle):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if srcContext not in (
|
||||
"marketItemGroup", "marketItemMisc",
|
||||
"fittingModule", "fittingCharge",
|
||||
@@ -31,10 +31,10 @@ class ItemStats(ContextMenuSingle):
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "{} Stats".format(itmContext if itmContext is not None else "Item")
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
srcContext = fullContext[0]
|
||||
if srcContext == "fittingShip":
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
@@ -16,7 +16,7 @@ class ChangeItemToVariation(ContextMenuCombined):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem, selection):
|
||||
def display(self, callingWindow, srcContext, mainItem, selection):
|
||||
if not self.settings.get('metaSwap'):
|
||||
return False
|
||||
|
||||
@@ -45,10 +45,10 @@ class ChangeItemToVariation(ContextMenuCombined):
|
||||
self.selection = selection
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem, selection):
|
||||
def getText(self, callingWindow, itmContext, mainItem, selection):
|
||||
return 'Variations'
|
||||
|
||||
def getSubMenu(self, context, mainItem, selection, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, mainItem, selection, rootMenu, i, pitem):
|
||||
self.moduleLookup = {}
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.mainFrame.getActiveFit())
|
||||
|
||||
@@ -22,7 +22,7 @@ class ChangeModuleAmmo(ContextMenuCombined):
|
||||
# Format: {type ID: set(loadable, charges)}
|
||||
self.loadableCharges = {}
|
||||
|
||||
def display(self, srcContext, mainItem, selection):
|
||||
def display(self, callingWindow, srcContext, mainItem, selection):
|
||||
if srcContext not in ("fittingModule", "projectedModule"):
|
||||
return False
|
||||
|
||||
@@ -38,7 +38,7 @@ class ChangeModuleAmmo(ContextMenuCombined):
|
||||
self.srcContext = srcContext
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem, selection):
|
||||
def getText(self, callingWindow, itmContext, mainItem, selection):
|
||||
return "Charge"
|
||||
|
||||
def getChargesForMod(self, mod):
|
||||
@@ -130,7 +130,7 @@ class ChangeModuleAmmo(ContextMenuCombined):
|
||||
m.Append(id_, '─ %s ─' % text)
|
||||
m.Enable(id_, False)
|
||||
|
||||
def getSubMenu(self, context, mainItem, selection, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, mainItem, selection, rootMenu, i, pitem):
|
||||
msw = True if "wxMSW" in wx.PlatformInfo else False
|
||||
m = wx.Menu()
|
||||
self.chargeIds = {}
|
||||
|
||||
@@ -11,7 +11,7 @@ class FillWithModule(ContextMenuSingle):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
|
||||
if not self.settings.get('moduleFill'):
|
||||
return False
|
||||
@@ -21,10 +21,10 @@ class FillWithModule(ContextMenuSingle):
|
||||
|
||||
return srcContext == "fittingModule"
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Fill With {0}".format(itmContext if itmContext is not None else "Module")
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
|
||||
srcContext = fullContext[0]
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
@@ -13,7 +13,7 @@ class ChangeModuleMutation(ContextMenuSingle):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.eventIDs = {}
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
|
||||
if srcContext != "fittingModule" or self.mainFrame.getActiveFit() is None:
|
||||
return False
|
||||
@@ -26,10 +26,10 @@ class ChangeModuleMutation(ContextMenuSingle):
|
||||
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Apply Mutaplasmid" if not mainItem.isMutated else "Revert to {}".format(mainItem.baseItem.name)
|
||||
|
||||
def getSubMenu(self, context, mainItem, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, mainItem, rootMenu, i, pitem):
|
||||
if mainItem.isMutated:
|
||||
return None
|
||||
|
||||
@@ -58,7 +58,7 @@ class ChangeModuleMutation(ContextMenuSingle):
|
||||
self.mainFrame.command.Submit(GuiConvertMutatedLocalModuleCommand(
|
||||
fitID=fitID, position=position, mutaplasmid=mutaplasmid))
|
||||
|
||||
def activate(self, fullContext, mainItem, i):
|
||||
def activate(self, callingWindow, fullContext, mainItem, i):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
fit = Fit.getInstance().getFit(fitID)
|
||||
if mainItem in fit.modules:
|
||||
@@ -66,7 +66,7 @@ class ChangeModuleMutation(ContextMenuSingle):
|
||||
self.mainFrame.command.Submit(GuiRevertMutatedLocalModuleCommand(
|
||||
fitID=fitID, position=position))
|
||||
|
||||
def getBitmap(self, context, mainItem):
|
||||
def getBitmap(self, callingWindow, context, mainItem):
|
||||
return None
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class ChangeModuleSpool(ContextMenuSingle):
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
self.resetId = None
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if not self.settings.get('spoolup'):
|
||||
return False
|
||||
|
||||
@@ -34,10 +34,10 @@ class ChangeModuleSpool(ContextMenuSingle):
|
||||
|
||||
return self.mod.item.group.name in ("Precursor Weapon", "Mutadaptive Remote Armor Repairer")
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Spoolup Cycles"
|
||||
|
||||
def getSubMenu(self, context, mainItem, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, mainItem, rootMenu, i, pitem):
|
||||
m = wx.Menu()
|
||||
if "wxMSW" in wx.PlatformInfo:
|
||||
bindmenu = rootMenu
|
||||
|
||||
@@ -24,13 +24,13 @@ class ItemGroupPrice(ContextMenuUnconditional, metaclass=ABCMeta):
|
||||
def optionName(self):
|
||||
raise NotImplementedError()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
return srcContext in ("priceViewFull", "priceViewMinimal")
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return self.label
|
||||
|
||||
def activate(self, fullContext, i):
|
||||
def activate(self, callingWindow, fullContext, i):
|
||||
self.settings.set(self.optionName, not self.settings.get(self.optionName))
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitIDs=(fitID,)))
|
||||
|
||||
@@ -12,7 +12,7 @@ class JumpToShip(ContextMenuUnconditional):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
if srcContext != "fittingShip":
|
||||
return False
|
||||
fitTabSelected = self.mainFrame.notebookBrowsers.GetSelection() == 1
|
||||
@@ -28,10 +28,10 @@ class JumpToShip(ContextMenuUnconditional):
|
||||
return True
|
||||
return False
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return "Open in Fitting Browser"
|
||||
|
||||
def activate(self, fullContext, i):
|
||||
def activate(self, callingWindow, fullContext, i):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
ship = Fit.getInstance().getFit(fitID).ship
|
||||
self.mainFrame.notebookBrowsers.SetSelection(1)
|
||||
|
||||
@@ -12,7 +12,7 @@ class ChangeShipTacticalMode(ContextMenuUnconditional):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
if self.mainFrame.getActiveFit() is None or srcContext != "fittingShip":
|
||||
return False
|
||||
|
||||
@@ -25,7 +25,7 @@ class ChangeShipTacticalMode(ContextMenuUnconditional):
|
||||
|
||||
return srcContext == "fittingShip" and self.modes is not None
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
return "Tactical Mode"
|
||||
|
||||
def addMode(self, menu, mode):
|
||||
@@ -36,7 +36,7 @@ class ChangeShipTacticalMode(ContextMenuUnconditional):
|
||||
menu.Bind(wx.EVT_MENU, self.handleMode, menuItem)
|
||||
return menuItem
|
||||
|
||||
def getSubMenu(self, context, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
|
||||
msw = True if "wxMSW" in wx.PlatformInfo else False
|
||||
self.context = context
|
||||
self.modeIds = {}
|
||||
|
||||
@@ -17,7 +17,7 @@ class ChangeAffectingSkills(ContextMenuSingle):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, mainItem):
|
||||
def display(self, callingWindow, srcContext, mainItem):
|
||||
if not self.settings.get('changeAffectingSkills'):
|
||||
return False
|
||||
|
||||
@@ -70,7 +70,7 @@ class ChangeAffectingSkills(ContextMenuSingle):
|
||||
self.skills = sorted(skills, key=lambda x: x.item.name)
|
||||
return len(self.skills) > 0
|
||||
|
||||
def getText(self, itmContext, mainItem):
|
||||
def getText(self, callingWindow, itmContext, mainItem):
|
||||
return "Change %s Skills" % itmContext
|
||||
|
||||
def addSkill(self, rootMenu, skill, i):
|
||||
@@ -85,7 +85,7 @@ class ChangeAffectingSkills(ContextMenuSingle):
|
||||
rootMenu.Bind(wx.EVT_MENU, self.handleSkillChange, menuItem)
|
||||
return menuItem
|
||||
|
||||
def getSubMenu(self, context, mainItem, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, mainItem, rootMenu, i, pitem):
|
||||
msw = True if "wxMSW" in wx.PlatformInfo else False
|
||||
self.skillIds = {}
|
||||
sub = wx.Menu()
|
||||
|
||||
@@ -16,7 +16,7 @@ class TargetProfile(ContextMenuUnconditional):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
|
||||
def display(self, srcContext):
|
||||
def display(self, callingWindow, srcContext):
|
||||
if self.mainFrame.getActiveFit() is None or srcContext != "firepowerViewFull":
|
||||
return False
|
||||
|
||||
@@ -26,7 +26,7 @@ class TargetProfile(ContextMenuUnconditional):
|
||||
|
||||
return len(self.patterns) > 0
|
||||
|
||||
def getText(self, itmContext):
|
||||
def getText(self, callingWindow, itmContext):
|
||||
# We take into consideration just target resists, so call menu item accordingly
|
||||
return "Target Resists"
|
||||
|
||||
@@ -63,7 +63,7 @@ class TargetProfile(ContextMenuUnconditional):
|
||||
item.SetBitmap(bitmap)
|
||||
return item
|
||||
|
||||
def getSubMenu(self, context, rootMenu, i, pitem):
|
||||
def getSubMenu(self, callingWindow, context, rootMenu, i, pitem):
|
||||
msw = True if "wxMSW" in wx.PlatformInfo else False
|
||||
self.patternIds = {}
|
||||
self.subMenus = OrderedDict()
|
||||
|
||||
Reference in New Issue
Block a user