Change order of context menus
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
# noinspection PyUnresolvedReferences
|
||||
from gui.builtinContextMenus import ( # noqa: E402,F401
|
||||
# Various command and projected-related items which we want to have first,
|
||||
# before generic commands
|
||||
fitOpenNewTab,
|
||||
envEffectAdd,
|
||||
fitAddCurrentlyOpen,
|
||||
commandFitAdd,
|
||||
# Often-used item manipulations
|
||||
shipModeChange,
|
||||
moduleAmmoChange,
|
||||
moduleAmmoChangeAll,
|
||||
moduleSpool,
|
||||
boosterSideEffects,
|
||||
fighterAbilities,
|
||||
# Item info
|
||||
itemStats,
|
||||
itemMarketJump,
|
||||
shipJump,
|
||||
# Generic item manipulations
|
||||
itemRemove,
|
||||
moduleMutations,
|
||||
itemAmountChange,
|
||||
droneSplitStack,
|
||||
itemVariationChange,
|
||||
moduleFill,
|
||||
skillAffectors,
|
||||
# Market stuff
|
||||
droneAddStack,
|
||||
cargoAdd,
|
||||
cargoAddAmmo,
|
||||
itemProject,
|
||||
ammoToDmgPattern,
|
||||
implantSetAdd,
|
||||
# Price
|
||||
priceOptions,
|
||||
# Resistance panel
|
||||
damagePatternChange,
|
||||
# Firepower panel
|
||||
factorReload,
|
||||
targetResists,
|
||||
)
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import math
|
||||
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class DroneRemoveStack(ContextMenu):
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('droneRemoveStack'):
|
||||
return False
|
||||
if srcContext not in ('droneItem', 'projectedDrone'):
|
||||
return False
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
return "Remove {} Stack".format(itmContext)
|
||||
|
||||
def activate(self, fullContext, selection, i):
|
||||
drone = selection[0]
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
if 'droneItem' in fullContext:
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveLocalDroneCommand(
|
||||
fitID=fitID, position=Fit.getInstance().getFit(fitID).drones.index(drone), amount=math.inf))
|
||||
if 'projectedDrone' in fullContext:
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedDroneCommand(
|
||||
fitID=fitID, itemID=drone.itemID, amount=math.inf))
|
||||
|
||||
|
||||
DroneRemoveStack.register()
|
||||
@@ -1,3 +1,5 @@
|
||||
import math
|
||||
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
@@ -14,10 +16,9 @@ class RemoveItem(ContextMenu):
|
||||
if not self.settings.get('itemRemove'):
|
||||
return False
|
||||
|
||||
return srcContext in ("fittingModule", "fittingCharge",
|
||||
"droneItem", "implantItem",
|
||||
"boosterItem", "projectedModule",
|
||||
"projectedCharge", "cargoItem",
|
||||
return srcContext in ("fittingModule", "droneItem",
|
||||
"implantItem", "boosterItem",
|
||||
"projectedModule", "cargoItem",
|
||||
"projectedFit", "projectedDrone",
|
||||
"fighterItem", "projectedFighter",
|
||||
"commandFit")
|
||||
@@ -40,7 +41,7 @@ class RemoveItem(ContextMenu):
|
||||
fitID=fitID, modules=selection, chargeItemID=None))
|
||||
elif srcContext == "droneItem":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveLocalDroneCommand(
|
||||
fitID=fitID, position=fit.drones.index(selection[0]), amount=1))
|
||||
fitID=fitID, position=fit.drones.index(selection[0]), amount=math.inf))
|
||||
elif srcContext == "fighterItem":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveLocalFighterCommand(
|
||||
fitID=fitID, position=fit.fighters.index(selection[0])))
|
||||
@@ -61,13 +62,10 @@ class RemoveItem(ContextMenu):
|
||||
fitID=fitID, position=fit.projectedModules.index(selection[0])))
|
||||
elif srcContext == "projectedDrone":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedDroneCommand(
|
||||
fitID=fitID, itemID=selection[0].itemID, amount=1))
|
||||
fitID=fitID, itemID=selection[0].itemID, amount=math.inf))
|
||||
elif srcContext == "projectedFighter":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedFighterCommand(
|
||||
fitID=fitID, position=fit.projectedFighters.index(selection[0])))
|
||||
elif srcContext == "projectedCharge":
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeProjectedModuleChargesCommand(
|
||||
fitID=fitID, modules=[selection[0]], chargeItemID=None))
|
||||
elif srcContext == "commandFit":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveCommandFitCommand(
|
||||
fitID=fitID, commandFitID=selection[0].ID))
|
||||
|
||||
@@ -202,37 +202,4 @@ class ContextMenu(object):
|
||||
'''If menu item is enabled. Allows an item to display, but not be selected'''
|
||||
return True
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from gui.builtinContextMenus import ( # noqa: E402,F401
|
||||
fitOpenNewTab,
|
||||
moduleAmmoChangeAll,
|
||||
moduleAmmoChange,
|
||||
moduleSpool,
|
||||
itemStats,
|
||||
damagePatternChange,
|
||||
itemMarketJump,
|
||||
droneSplitStack,
|
||||
itemRemove,
|
||||
itemVariationChange,
|
||||
moduleFill,
|
||||
droneRemoveStack,
|
||||
ammoToDmgPattern,
|
||||
factorReload,
|
||||
droneAddStack,
|
||||
cargoAdd,
|
||||
cargoAddAmmo,
|
||||
itemProject,
|
||||
envEffectAdd,
|
||||
shipJump,
|
||||
skillAffectors,
|
||||
shipModeChange,
|
||||
targetResists,
|
||||
priceOptions,
|
||||
itemAmountChange,
|
||||
implantSetAdd,
|
||||
fighterAbilities,
|
||||
boosterSideEffects,
|
||||
commandFitAdd,
|
||||
fitAddCurrentlyOpen,
|
||||
moduleMutations,
|
||||
)
|
||||
import gui.builtinContextMenus
|
||||
|
||||
Reference in New Issue
Block a user