Rework projected GUI commands
This commit is contained in:
@@ -215,7 +215,7 @@ class DroneView(Display):
|
||||
event.Skip()
|
||||
return
|
||||
|
||||
if self.mainFrame.command.Submit(cmd.GuiAddDroneCommand(fitID, event.itemID)):
|
||||
if self.mainFrame.command.Submit(cmd.GuiAddLocalDroneCommand(fitID=fitID, itemID=event.itemID, amount=1)):
|
||||
self.mainFrame.additionsPane.select("Drones")
|
||||
|
||||
event.Skip()
|
||||
@@ -230,11 +230,11 @@ class DroneView(Display):
|
||||
|
||||
def removeDrone(self, drone):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveDroneCommand(fitID, self.original.index(drone), 1))
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveLocalDroneCommand(fitID, self.original.index(drone), 1))
|
||||
|
||||
def removeDroneStack(self, drone):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveDroneCommand(fitID, self.original.index(drone), math.inf))
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveLocalDroneCommand(fitID, self.original.index(drone), math.inf))
|
||||
|
||||
def click(self, event):
|
||||
event.Skip()
|
||||
@@ -244,7 +244,7 @@ class DroneView(Display):
|
||||
if col == self.getColIndex(State):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
drone = self.drones[row]
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleDroneStateCommand(fitID, self.original.index(drone)))
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleLocalDroneStateCommand(fitID, self.original.index(drone)))
|
||||
|
||||
def spawnMenu(self, event):
|
||||
sel = self.GetFirstSelected()
|
||||
|
||||
@@ -259,7 +259,7 @@ class FighterDisplay(d.Display):
|
||||
def addItem(self, event):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
if self.mainFrame.command.Submit(cmd.GuiAddFighterCommand(fitID, event.itemID)):
|
||||
if self.mainFrame.command.Submit(cmd.GuiAddLocalFighterCommand(fitID, event.itemID)):
|
||||
self.mainFrame.additionsPane.select("Fighters")
|
||||
|
||||
event.Skip()
|
||||
@@ -274,7 +274,7 @@ class FighterDisplay(d.Display):
|
||||
|
||||
def removeFighter(self, fighter):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveFighterCommand(fitID, self.original.index(fighter)))
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveLocalFighterCommand(fitID, self.original.index(fighter)))
|
||||
|
||||
def click(self, event):
|
||||
event.Skip()
|
||||
@@ -284,7 +284,7 @@ class FighterDisplay(d.Display):
|
||||
if col == self.getColIndex(State):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
fighter = self.fighters[row]
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleFighterCommand(fitID, self.original.index(fighter)))
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleLocalFighterStateCommand(fitID, self.original.index(fighter)))
|
||||
|
||||
def spawnMenu(self, event):
|
||||
sel = self.GetFirstSelected()
|
||||
|
||||
@@ -8,6 +8,7 @@ from gui.utils.helpers_wxPython import HandleCtrlBackspace
|
||||
|
||||
|
||||
class NotesView(wx.Panel):
|
||||
|
||||
def __init__(self, parent):
|
||||
wx.Panel.__init__(self, parent)
|
||||
self.lastFitId = None
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
# along with pyfa. If not, see <http://www.gnu.org/licenses/>.
|
||||
# =============================================================================
|
||||
|
||||
import math
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from logbook import Logger
|
||||
@@ -26,6 +28,7 @@ import gui.display as d
|
||||
import gui.globalEvents as GE
|
||||
from eos.saveddata.drone import Drone as es_Drone
|
||||
from eos.saveddata.fighter import Fighter as es_Fighter
|
||||
from eos.saveddata.fit import Fit as es_Fit
|
||||
from eos.saveddata.module import Module as es_Module
|
||||
from gui.builtinViewColumns.state import State
|
||||
from gui.contextMenu import ContextMenu
|
||||
@@ -96,40 +99,49 @@ class ProjectedView(d.Display):
|
||||
data[0] is hard-coded str of originating source
|
||||
data[1] is typeID or index of data we want to manipulate
|
||||
"""
|
||||
sFit = Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
fit = sFit.getFit(self.mainFrame.getActiveFit())
|
||||
|
||||
if data[0] == "projected":
|
||||
# if source is coming from projected, we are trying to combine drones.
|
||||
pass
|
||||
# removing merge functionality - if people complain about it, can add it back as a command
|
||||
# self.mergeDrones(x, y, int(data[1]))
|
||||
elif data[0] == "fitting":
|
||||
fit = Fit.getInstance().getFit(fitID)
|
||||
if data[0] == 'fitting':
|
||||
dstRow, _ = self.HitTest((x, y))
|
||||
# Gather module information to get position
|
||||
module = fit.modules[int(data[1])]
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedCommand(fitID, module.itemID, 'item'))
|
||||
elif data[0] == "market":
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedCommand(fitID, int(data[1]), 'item'))
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedModuleCommand(
|
||||
fitID=fitID, itemID=fit.modules[int(data[1])].itemID))
|
||||
elif data[0] == 'market':
|
||||
itemID = int(data[1])
|
||||
category = Market.getInstance().getItem(itemID, eager=("group.category")).category.name
|
||||
if category == 'Module':
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedModuleCommand(fitID=fitID, itemID=itemID))
|
||||
elif category == 'Drone':
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedDroneCommand(fitID=fitID, itemID=itemID))
|
||||
elif category == 'Fighter':
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedFighterCommand(fitID=fitID, itemID=itemID))
|
||||
|
||||
def kbEvent(self, event):
|
||||
keycode = event.GetKeyCode()
|
||||
if keycode == wx.WXK_DELETE or keycode == wx.WXK_NUMPAD_DELETE:
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
sFit = Fit.getInstance()
|
||||
if keycode in (wx.WXK_DELETE, wx.WXK_NUMPAD_DELETE):
|
||||
row = self.GetFirstSelected()
|
||||
if row != -1:
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
thing = self.get(row)
|
||||
if thing:
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedCommand(fitID, self.get(row)))
|
||||
if isinstance(thing, es_Fit):
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedFitCommand(
|
||||
fitID=fitID, projectedFitID=thing.ID))
|
||||
elif isinstance(thing, es_Module):
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedModuleCommand(
|
||||
fitID=fitID, position=Fit.getInstance().getFit(fitID).projectedModules.index(thing)))
|
||||
elif isinstance(thing, es_Drone):
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedDroneCommand(
|
||||
fitID=fitID, itemID=thing.itemID, amount=math.inf))
|
||||
elif isinstance(thing, es_Fighter):
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedFighterCommand(
|
||||
fitID=fitID, position=Fit.getInstance().getFit(fitID).projectedFighters.index(thing)))
|
||||
|
||||
def handleDrag(self, type, fitID):
|
||||
# Those are drags coming from pyfa sources, NOT builtin wx drags
|
||||
if type == "fit":
|
||||
activeFit = self.mainFrame.getActiveFit()
|
||||
if activeFit:
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedCommand(activeFit, fitID, 'fit'))
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedFitCommand(fitID=activeFit, projectedFitID=fitID))
|
||||
|
||||
def startDrag(self, event):
|
||||
row = event.GetIndex()
|
||||
@@ -194,20 +206,20 @@ class ProjectedView(d.Display):
|
||||
stuff = []
|
||||
if fit is not None:
|
||||
# pyfalog.debug(" Collecting list of stuff to display in ProjectedView")
|
||||
self.fits = fit.projectedFits[:]
|
||||
self.modules = fit.projectedModules[:]
|
||||
self.drones = fit.projectedDrones[:]
|
||||
self.fighters = fit.projectedFighters[:]
|
||||
self.fits = fit.projectedFits[:]
|
||||
|
||||
self.fits.sort(key=self.fitSort)
|
||||
self.modules.sort(key=self.moduleSort)
|
||||
self.drones.sort(key=self.droneSort)
|
||||
self.fighters.sort(key=self.fighterSort)
|
||||
self.fits.sort(key=self.fitSort)
|
||||
|
||||
stuff.extend(self.fits)
|
||||
stuff.extend(self.modules)
|
||||
stuff.extend(self.drones)
|
||||
stuff.extend(self.fighters)
|
||||
stuff.extend(self.fits)
|
||||
|
||||
if event.fitID != self.lastFitId:
|
||||
self.lastFitId = event.fitID
|
||||
@@ -230,22 +242,22 @@ class ProjectedView(d.Display):
|
||||
if row == -1:
|
||||
return None
|
||||
|
||||
numFits = len(self.fits)
|
||||
numMods = len(self.modules)
|
||||
numDrones = len(self.drones)
|
||||
numFighters = len(self.fighters)
|
||||
numFits = len(self.fits)
|
||||
|
||||
if (numMods + numDrones + numFighters + numFits) == 0:
|
||||
if (numFits + numMods + numDrones + numFighters) == 0:
|
||||
return None
|
||||
|
||||
if row < numMods:
|
||||
stuff = self.modules[row]
|
||||
elif row - numMods < numDrones:
|
||||
stuff = self.drones[row - numMods]
|
||||
elif row - numMods - numDrones < numFighters:
|
||||
stuff = self.fighters[row - numMods - numDrones]
|
||||
if row < numFits:
|
||||
stuff = self.fits[row]
|
||||
elif row - numFits < numMods:
|
||||
stuff = self.modules[row - numFits]
|
||||
elif row - numFits - numMods < numDrones:
|
||||
stuff = self.drones[row - numFits - numMods]
|
||||
else:
|
||||
stuff = self.fits[row - numMods - numDrones - numFighters]
|
||||
stuff = self.fighters[row - numFits - numMods - numDrones]
|
||||
|
||||
return stuff
|
||||
|
||||
@@ -253,13 +265,24 @@ class ProjectedView(d.Display):
|
||||
event.Skip()
|
||||
row, _ = self.HitTest(event.Position)
|
||||
if row != -1:
|
||||
item = self.get(row)
|
||||
col = self.getColumn(event.Position)
|
||||
if col == self.getColIndex(State):
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleProjectedCommand(
|
||||
fitID=self.mainFrame.getActiveFit(),
|
||||
thing=item,
|
||||
click="right" if event.Button == 3 else "left"))
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
thing = self.get(row)
|
||||
if isinstance(thing, es_Fit):
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleProjectedFitStateCommand(
|
||||
fitID=fitID, projectedFitID=thing.ID))
|
||||
elif isinstance(thing, es_Module):
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeProjectedModuleStateCommand(
|
||||
fitID=fitID,
|
||||
position=Fit.getInstance().getFit(fitID).projectedModules.index(thing),
|
||||
click='right' if event.Button == 3 else 'left'))
|
||||
elif isinstance(thing, es_Drone):
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleProjectedDroneStateCommand(
|
||||
fitID=fitID, itemID=thing.itemID))
|
||||
elif isinstance(thing, es_Fighter):
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleProjectedFighterStateCommand(
|
||||
fitID=fitID, position=Fit.getInstance().getFit(fitID).projectedFighters.index(thing)))
|
||||
|
||||
def spawnMenu(self, event):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
@@ -310,5 +333,15 @@ class ProjectedView(d.Display):
|
||||
if col != self.getColIndex(State):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
thing = self.get(row)
|
||||
if thing: # thing doesn't exist if it's the dummy value
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedCommand(fitID, thing))
|
||||
if isinstance(thing, es_Fit):
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedFitCommand(
|
||||
fitID=fitID, projectedFitID=thing.ID))
|
||||
elif isinstance(thing, es_Module):
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedModuleCommand(
|
||||
fitID=fitID, position=Fit.getInstance().getFit(fitID).projectedModules.index(thing)))
|
||||
elif isinstance(thing, es_Drone):
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedDroneCommand(
|
||||
fitID=fitID, itemID=thing.itemID, amount=1))
|
||||
elif isinstance(thing, es_Fighter):
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedFighterCommand(
|
||||
fitID=fitID, position=Fit.getInstance().getFit(fitID).projectedFighters.index(thing)))
|
||||
|
||||
@@ -1,16 +1,17 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
from eos.saveddata.fit import Fit as es_Fit
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
import re
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
import re
|
||||
from service.fit import Fit
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.cargo import Cargo as es_Cargo
|
||||
from eos.saveddata.fighter import Fighter as es_Fighter
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
from eos.saveddata.cargo import Cargo as es_Cargo
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.fighter import Fighter as es_Fighter
|
||||
from eos.saveddata.fit import Fit as es_Fit
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ChangeAmount(ContextMenu):
|
||||
@@ -39,7 +40,7 @@ class ChangeAmount(ContextMenu):
|
||||
else:
|
||||
value = thing.amount
|
||||
|
||||
dlg = AmountChanger(self.mainFrame, value)
|
||||
dlg = AmountChanger(self.mainFrame, value, (0, 20)) if isinstance(thing, es_Fit) else AmountChanger(self.mainFrame, value)
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
|
||||
if dlg.input.GetLineText(0).strip() == '':
|
||||
@@ -53,30 +54,31 @@ class ChangeAmount(ContextMenu):
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeCargoAmountCommand(fitID, thing.itemID, cleanInput))
|
||||
elif isinstance(thing, Drone):
|
||||
if srcContext == "projectedDrone":
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeProjectedDroneQtyCommand(fitID, thing.itemID, cleanInput))
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeProjectedDroneAmountCommand(fitID, thing.itemID, cleanInput))
|
||||
else:
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeDroneAmountCommand(fitID, fit.drones.index(thing), cleanInput))
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeLocalDroneAmountCommand(fitID, fit.drones.index(thing), cleanInput))
|
||||
elif isinstance(thing, es_Fit):
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeProjectedFitQtyCommand(fitID, thing.ID, cleanInput))
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeProjectedFitAmountCommand(fitID, thing.ID, cleanInput))
|
||||
elif isinstance(thing, es_Fighter):
|
||||
if srcContext == "projectedFighter":
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeProjectedFighterAmountCommand(fitID, fit.projectedFighters.index(thing), cleanInput))
|
||||
else:
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeFighterAmountCommand(fitID, fit.fighters.index(thing), cleanInput))
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeLocalFighterAmountCommand(fitID, fit.fighters.index(thing), cleanInput))
|
||||
|
||||
|
||||
ChangeAmount.register()
|
||||
|
||||
|
||||
class AmountChanger(wx.Dialog):
|
||||
def __init__(self, parent, value):
|
||||
|
||||
def __init__(self, parent, value, limits=None):
|
||||
wx.Dialog.__init__(self, parent, title="Change Amount")
|
||||
self.SetMinSize((346, 156))
|
||||
|
||||
bSizer1 = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
bSizer2 = wx.BoxSizer(wx.VERTICAL)
|
||||
text = wx.StaticText(self, wx.ID_ANY, "New Amount:")
|
||||
text = wx.StaticText(self, wx.ID_ANY, "New Amount:" if limits is None else "New Amount ({}-{})".format(*limits))
|
||||
bSizer2.Add(text, 0)
|
||||
|
||||
bSizer1.Add(bSizer2, 0, wx.ALL, 10)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
# noinspection PyPackageRequirements
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
@@ -28,7 +27,7 @@ class Cargo(ContextMenu):
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
return "Add {0} to Cargo".format(itmContext)
|
||||
return "Add {} to Cargo".format(itmContext)
|
||||
|
||||
def activate(self, fullContext, selection, i):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from eos.saveddata.character import Skill
|
||||
|
||||
import gui.globalEvents as GE
|
||||
from service.fit import Fit
|
||||
import gui.mainFrame
|
||||
from eos.saveddata.character import Skill
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.character import Character
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
from collections import OrderedDict
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from service.fit import Fit
|
||||
from service.damagePattern import DamagePattern as import_DamagePattern
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
from collections import OrderedDict
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.damagePattern import DamagePattern as import_DamagePattern
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class DamagePattern(ContextMenu):
|
||||
|
||||
@@ -3,7 +3,6 @@ import math
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
# noinspection PyPackageRequirements
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
@@ -16,19 +15,22 @@ class ItemRemove(ContextMenu):
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('droneRemoveStack'):
|
||||
return False
|
||||
|
||||
return srcContext == "droneItem"
|
||||
if srcContext not in ('droneItem', 'projectedDrone'):
|
||||
return False
|
||||
return True
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
return "Remove {0} Stack".format(itmContext)
|
||||
return "Remove {} Stack".format(itmContext)
|
||||
|
||||
def activate(self, fullContext, selection, i):
|
||||
sFit = Fit.getInstance()
|
||||
drone = selection[0]
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
fit = sFit.getFit(fitID)
|
||||
|
||||
position = fit.drones.index(selection[0])
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveDroneCommand(fitID, position, math.inf))
|
||||
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))
|
||||
|
||||
|
||||
ItemRemove.register()
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
from service.fit import Fit
|
||||
import re
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
import re
|
||||
|
||||
|
||||
class DroneSplit(ContextMenu):
|
||||
@@ -17,7 +19,7 @@ class DroneSplit(ContextMenu):
|
||||
if not self.settings.get('droneSplit'):
|
||||
return False
|
||||
|
||||
return srcContext in ("droneItem", "projectedDrone") and selection[0].amount > 1
|
||||
return srcContext == "droneItem" and selection[0].amount > 1
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
return "Split {0} Stack".format(itmContext)
|
||||
|
||||
@@ -1,12 +1,11 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
import wx
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.settings import ContextMenuSettings
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class DroneStack(ContextMenu):
|
||||
|
||||
def __init__(self):
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
self.settings = ContextMenuSettings.getInstance()
|
||||
@@ -15,7 +14,7 @@ class DroneStack(ContextMenu):
|
||||
if not self.settings.get('droneStack'):
|
||||
return False
|
||||
|
||||
if srcContext not in ("marketItemGroup", "marketItemMisc") or self.mainFrame.getActiveFit() is None:
|
||||
if srcContext not in ('marketItemGroup', 'marketItemMisc') or self.mainFrame.getActiveFit() is None:
|
||||
return False
|
||||
|
||||
for selected_item in selection:
|
||||
@@ -30,13 +29,9 @@ class DroneStack(ContextMenu):
|
||||
return "Add {0} to Drone Bay (x5)".format(itmContext)
|
||||
|
||||
def activate(self, fullContext, selection, i):
|
||||
sFit = Fit.getInstance()
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
typeID = int(selection[0].ID)
|
||||
sFit.addDrone(fitID, typeID, 5)
|
||||
self.mainFrame.additionsPane.select("Drones")
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
self.mainFrame.command.Submit(cmd.GuiAddLocalDroneCommand(
|
||||
fitID=self.mainFrame.getActiveFit(), itemID=int(selection[0].ID), amount=5))
|
||||
self.mainFrame.additionsPane.select('Drones')
|
||||
|
||||
|
||||
DroneStack.register()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
from gui import fitCommands as cmd
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
@@ -63,10 +61,12 @@ class FighterAbility(ContextMenu):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
fit = Fit.getInstance().getFit(fitID)
|
||||
if self.isProjected:
|
||||
index = fit.projectedFighters.index(self.fighter)
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleProjectedFighterAbilityStateCommand(
|
||||
fitID=fitID, position=fit.projectedFighters.index(self.fighter), effectID=ability.effectID))
|
||||
else:
|
||||
index = fit.fighters.index(self.fighter)
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleFighterAbilityCommand(fitID, index, ability.effectID))
|
||||
self.mainFrame.command.Submit(cmd.GuiToggleLocalFighterAbilityStateCommand(
|
||||
fitID=fitID, position=fit.fighters.index(self.fighter), effectID=ability.effectID))
|
||||
|
||||
|
||||
|
||||
FighterAbility.register()
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
import gui.globalEvents as GE
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
import gui.fitCommands as cmd
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class FillWithModule(ContextMenu):
|
||||
@@ -26,7 +27,7 @@ class FillWithModule(ContextMenu):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
|
||||
if srcContext == "fittingModule":
|
||||
self.mainFrame.command.Submit(cmd.GuiFillWithModulesCommand(fitID, selection[0].itemID))
|
||||
self.mainFrame.command.Submit(cmd.GuiFillWithLocalModulesCommand(fitID, selection[0].itemID))
|
||||
return # the command takes care of the PostEvent
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from service.implantSet import ImplantSets as s_ImplantSets
|
||||
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.character import Character
|
||||
from service.fit import Fit
|
||||
from service.implantSet import ImplantSets as s_ImplantSets
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
import gui.globalEvents as GE
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
import gui.fitCommands as cmd
|
||||
|
||||
|
||||
class ItemRemove(ContextMenu):
|
||||
@@ -36,34 +33,42 @@ class ItemRemove(ContextMenu):
|
||||
fit = sFit.getFit(fitID)
|
||||
|
||||
if srcContext == "fittingModule":
|
||||
modules = [module for module in selection if module is not None]
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveModuleCommand(fitID, modules))
|
||||
return # the command takes care of the PostEvent
|
||||
elif srcContext in ("fittingCharge", "projectedCharge"):
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeModuleChargesCommand(fitID, None, selection))
|
||||
return
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveLocalModuleCommand(
|
||||
fitID=fitID, modules=[module for module in selection if module is not None]))
|
||||
elif srcContext == "fittingCharge":
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeLocalModuleChargesCommand(
|
||||
fitID=fitID, modules=selection, chargeItemID=None))
|
||||
elif srcContext == "droneItem":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveDroneCommand(fitID, fit.drones.index(selection[0]), 1))
|
||||
return
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveLocalDroneCommand(
|
||||
fitID=fitID, position=fit.drones.index(selection[0]), amount=1))
|
||||
elif srcContext == "fighterItem":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveFighterCommand(fitID, fit.fighters.index(selection[0])))
|
||||
return # the command takes care of the PostEvent
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveLocalFighterCommand(
|
||||
fitID=fitID, position=fit.fighters.index(selection[0])))
|
||||
elif srcContext == "implantItem":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveImplantCommand(fitID, fit.implants.index(selection[0])))
|
||||
return # the command takes care of the PostEvent
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveImplantCommand(
|
||||
fitID=fitID, position=fit.implants.index(selection[0])))
|
||||
elif srcContext == "boosterItem":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveBoosterCommand(fitID, fit.boosters.index(selection[0])))
|
||||
return # the command takes care of the PostEvent
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveBoosterCommand(
|
||||
fitID=fitID, position=fit.boosters.index(selection[0])))
|
||||
elif srcContext == "cargoItem":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveCargoCommand(fitID, selection[0].itemID))
|
||||
return # the command takes care of the PostEvent
|
||||
elif srcContext in ("projectedFit", "projectedModule", "projectedDrone", "projectedFighter"):
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedCommand(fitID, selection[0]))
|
||||
return # the command takes care of the PostEvent
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveCargoCommand(
|
||||
fitID=fitID, itemID=selection[0].itemID))
|
||||
elif srcContext == "projectedFit":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedFitCommand(
|
||||
fitID=fitID, projectedFitID=selection[0].ID))
|
||||
elif srcContext == "projectedModule":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveProjectedModuleCommand(
|
||||
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))
|
||||
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, [selection[0]], None))
|
||||
elif srcContext == "commandFit":
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveCommandFitCommand(fitID, selection[0].ID))
|
||||
return # the command takes care of the PostEvent
|
||||
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
|
||||
|
||||
|
||||
ItemRemove.register()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
from gui.itemStats import ItemStatsDialog
|
||||
import gui.mainFrame
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
from gui.itemStats import ItemStatsDialog
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.market import Market
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
# coding: utf-8
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from service.market import Market
|
||||
from service.settings import ContextMenuSettings
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class MetaSwap(ContextMenu):
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# coding: utf-8
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
@@ -50,6 +48,7 @@ class ModuleAmmoPicker(ContextMenu):
|
||||
|
||||
self.modules = modules
|
||||
self.charges = list([charge for charge in validCharges if Market.getInstance().getPublicityByItem(charge)])
|
||||
self.context = srcContext
|
||||
return len(self.charges) > 0
|
||||
|
||||
def getText(self, itmContext, selection):
|
||||
@@ -228,7 +227,12 @@ class ModuleAmmoPicker(ContextMenu):
|
||||
return
|
||||
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeModuleChargesCommand(fitID, charge.ID if charge is not None else None, self.modules))
|
||||
if self.context == 'fittingModule':
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeLocalModuleChargesCommand(
|
||||
fitID=fitID, modules=self.modules, chargeItemID=charge.ID if charge is not None else None))
|
||||
elif self.context == 'projectedModule':
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeProjectedModuleChargesCommand(
|
||||
fitID=fitID, modules=self.modules, chargeItemID=charge.ID if charge is not None else None))
|
||||
|
||||
|
||||
ModuleAmmoPicker.register()
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
from eos.db.saveddata.queries import getFit as db_getFit
|
||||
# noinspection PyPackageRequirements
|
||||
from gui.builtinContextMenus.moduleAmmoPicker import ModuleAmmoPicker
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
class ModuleGlobalAmmoPicker(ModuleAmmoPicker):
|
||||
|
||||
def __init__(self):
|
||||
super(ModuleGlobalAmmoPicker, self).__init__()
|
||||
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
|
||||
@@ -27,18 +26,19 @@ class ModuleGlobalAmmoPicker(ModuleAmmoPicker):
|
||||
return
|
||||
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
fit = db_getFit(fitID)
|
||||
fit = Fit.getInstance().getFit(fitID)
|
||||
|
||||
selectedModule = self.modules[0]
|
||||
source = fit.modules if not selectedModule.isProjected else fit.projectedModules
|
||||
allModules = []
|
||||
for mod in source:
|
||||
if mod.itemID is None:
|
||||
continue
|
||||
if mod.itemID == selectedModule.itemID:
|
||||
allModules.append(mod)
|
||||
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeModuleChargesCommand(fitID, charge.ID if charge is not None else None, allModules))
|
||||
if self.context == 'fittingModule':
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeLocalModuleChargesCommand(
|
||||
fitID=fitID,
|
||||
modules=[m for m in fit.modules if m.itemID is not None and m.itemID == selectedModule.itemID],
|
||||
chargeItemID=charge.ID if charge is not None else None))
|
||||
elif self.context == 'projectedModule':
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeProjectedModuleChargesCommand(
|
||||
fitID=fitID,
|
||||
modules=[m for m in fit.projectedModules if m.itemID is not None and m.itemID == selectedModule.itemID],
|
||||
chargeItemID=charge.ID if charge is not None else None))
|
||||
|
||||
def display(self, srcContext, selection):
|
||||
if not self.settings.get('moduleGlobalAmmoPicker'):
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.fitCommands import GuiConvertMutatedModuleCommand, GuiRevertMutatedModuleCommand
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from gui.fitCommands import GuiConvertMutatedLocalModuleCommand, GuiRevertMutatedLocalModuleCommand
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
@@ -58,14 +56,14 @@ class MutaplasmidCM(ContextMenu):
|
||||
def handleMenu(self, event):
|
||||
mutaplasmid, mod = self.eventIDs[event.Id]
|
||||
|
||||
self.mainFrame.command.Submit(GuiConvertMutatedModuleCommand(
|
||||
self.mainFrame.command.Submit(GuiConvertMutatedLocalModuleCommand(
|
||||
fitID=self.mainFrame.getActiveFit(),
|
||||
position=mod.modPosition,
|
||||
mutaplasmid=mutaplasmid))
|
||||
|
||||
def activate(self, fullContext, selection, i):
|
||||
mod = selection[0]
|
||||
self.mainFrame.command.Submit(GuiRevertMutatedModuleCommand(
|
||||
self.mainFrame.command.Submit(GuiRevertMutatedLocalModuleCommand(
|
||||
fitID=self.mainFrame.getActiveFit(),
|
||||
position=mod.modPosition))
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui.builtinShipBrowser.events import FitSelected
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from abc import abstractmethod, ABCMeta
|
||||
from abc import ABCMeta, abstractmethod
|
||||
|
||||
import wx
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import gui.fitCommands as cmd
|
||||
import gui.mainFrame
|
||||
from gui.contextMenu import ContextMenu
|
||||
# noinspection PyPackageRequirements
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
@@ -33,8 +32,17 @@ class Project(ContextMenu):
|
||||
|
||||
def activate(self, fullContext, selection, i):
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
if self.mainFrame.command.Submit(cmd.GuiAddProjectedCommand(fitID, selection[0].ID, 'item')):
|
||||
self.mainFrame.additionsPane.select("Projected")
|
||||
category = selection[0].category.name
|
||||
if category == 'Module':
|
||||
success = self.mainFrame.command.Submit(cmd.GuiAddProjectedModuleCommand(fitID=fitID, itemID=selection[0].ID))
|
||||
elif category == 'Drone':
|
||||
success = self.mainFrame.command.Submit(cmd.GuiAddProjectedDroneCommand(fitID=fitID, itemID=selection[0].ID))
|
||||
elif category == 'Fighter':
|
||||
success = self.mainFrame.command.Submit(cmd.GuiAddProjectedFighterCommand(fitID=fitID, itemID=selection[0].ID))
|
||||
else:
|
||||
success = False
|
||||
if success:
|
||||
self.mainFrame.additionsPane.select('Projected')
|
||||
|
||||
|
||||
Project.register()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
from gui.contextMenu import ContextMenu
|
||||
|
||||
import gui.mainFrame
|
||||
from gui.builtinShipBrowser.events import Stage3Selected
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ class SpoolUp(ContextMenu):
|
||||
return False
|
||||
|
||||
self.mod = selection[0]
|
||||
# self.context = srcContext
|
||||
self.context = srcContext
|
||||
|
||||
return self.mod.item.group.name in ("Precursor Weapon", "Mutadaptive Remote Armor Repairer")
|
||||
|
||||
@@ -75,11 +75,18 @@ class SpoolUp(ContextMenu):
|
||||
spoolAmount = self.cycleMap[event.Id]
|
||||
else:
|
||||
return
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeModuleSpoolCommand(
|
||||
fitID=self.mainFrame.getActiveFit(),
|
||||
position=self.mod.modPosition,
|
||||
spoolType=spoolType,
|
||||
spoolAmount=spoolAmount))
|
||||
if self.context == 'fittingModule':
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeLocalModuleSpoolCommand(
|
||||
fitID=self.mainFrame.getActiveFit(),
|
||||
position=self.mod.modPosition,
|
||||
spoolType=spoolType,
|
||||
spoolAmount=spoolAmount))
|
||||
elif self.context == 'projectedModule':
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeProjectedModuleSpoolCommand(
|
||||
fitID=self.mainFrame.getActiveFit(),
|
||||
position=self.mod.modPosition,
|
||||
spoolType=spoolType,
|
||||
spoolAmount=spoolAmount))
|
||||
|
||||
|
||||
SpoolUp.register()
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
# coding: utf-8
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
@@ -56,9 +54,9 @@ class TabbedFits(ContextMenu):
|
||||
fit = self.fitLookup[event.Id]
|
||||
|
||||
if self.context == 'commandView':
|
||||
self.mainFrame.command.Submit(cmd.GuiAddCommandFitCommand(fitID, fit.ID))
|
||||
self.mainFrame.command.Submit(cmd.GuiAddCommandFitCommand(fitID=fitID, commandFitID=fit.ID))
|
||||
elif self.context == 'projected':
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedCommand(fitID, fit.ID, 'fit'))
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedFitCommand(fitID=fitID, projectedFitID=fit.ID))
|
||||
|
||||
|
||||
TabbedFits.register()
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
from gui.contextMenu import ContextMenu
|
||||
import gui.mainFrame
|
||||
import gui.globalEvents as GE
|
||||
from collections import OrderedDict
|
||||
|
||||
# noinspection PyPackageRequirements
|
||||
import wx
|
||||
|
||||
import gui.globalEvents as GE
|
||||
import gui.mainFrame
|
||||
from gui.bitmap_loader import BitmapLoader
|
||||
from service.targetResists import TargetResists as svc_TargetResists
|
||||
from gui.contextMenu import ContextMenu
|
||||
from service.fit import Fit
|
||||
from service.settings import ContextMenuSettings
|
||||
from collections import OrderedDict
|
||||
from service.targetResists import TargetResists as svc_TargetResists
|
||||
|
||||
|
||||
class TargetResists(ContextMenu):
|
||||
|
||||
@@ -89,7 +89,7 @@ class WhProjector(ContextMenu):
|
||||
return
|
||||
|
||||
fitID = self.mainFrame.getActiveFit()
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedCommand(fitID, swObj.ID, 'item'))
|
||||
self.mainFrame.command.Submit(cmd.GuiAddProjectedModuleCommand(fitID, swObj.ID))
|
||||
|
||||
def buildMenu(self, grouped_data, flat_data, local_menu, rootMenu, msw):
|
||||
|
||||
|
||||
@@ -369,9 +369,9 @@ class FittingView(d.Display):
|
||||
sel = self.GetNextSelected(sel)
|
||||
|
||||
if len(modules) > 0:
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeModuleChargesCommand(fitID, itemID, modules))
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeLocalModuleChargesCommand(fitID, modules, itemID))
|
||||
else:
|
||||
self.mainFrame.command.Submit(cmd.GuiAddModuleCommand(fitID, itemID))
|
||||
self.mainFrame.command.Submit(cmd.GuiAddLocalModuleCommand(fitID, itemID))
|
||||
|
||||
event.Skip()
|
||||
|
||||
@@ -393,7 +393,7 @@ class FittingView(d.Display):
|
||||
if not isinstance(modules, list):
|
||||
modules = [modules]
|
||||
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveModuleCommand(self.activeFitID, modules))
|
||||
self.mainFrame.command.Submit(cmd.GuiRemoveLocalModuleCommand(self.activeFitID, modules))
|
||||
|
||||
def addModule(self, x, y, itemID):
|
||||
"""Add a module from the market browser (from dragging it)"""
|
||||
@@ -405,7 +405,7 @@ class FittingView(d.Display):
|
||||
if not isinstance(mod, Module): # make sure we're not adding something to a T3D Mode
|
||||
return
|
||||
|
||||
self.mainFrame.command.Submit(cmd.GuiAddModuleCommand(fitID, itemID, self.mods[dstRow].modPosition))
|
||||
self.mainFrame.command.Submit(cmd.GuiAddLocalModuleCommand(fitID, itemID, self.mods[dstRow].modPosition))
|
||||
|
||||
def swapCargo(self, x, y, srcIdx):
|
||||
"""Swap a module from cargo to fitting window"""
|
||||
@@ -610,7 +610,7 @@ class FittingView(d.Display):
|
||||
ctrl = event.cmdDown or event.middleIsDown
|
||||
click = "ctrl" if ctrl is True else "right" if event.GetButton() == 3 else "left"
|
||||
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeModuleStatesCommand(
|
||||
self.mainFrame.command.Submit(cmd.GuiChangeLocalModuleStatesCommand(
|
||||
fitID=fitID,
|
||||
mainPosition=self.mods[self.GetItemData(row)].modPosition,
|
||||
positions=[mod.modPosition for mod in mods],
|
||||
|
||||
@@ -216,18 +216,18 @@ from gui.builtinContextMenus import ( # noqa: E402,F401
|
||||
fillWithModule,
|
||||
droneRemoveStack,
|
||||
ammoPattern,
|
||||
project,
|
||||
factorReload,
|
||||
whProjector,
|
||||
droneStack,
|
||||
cargo,
|
||||
cargoAmmo,
|
||||
project,
|
||||
whProjector,
|
||||
shipJump,
|
||||
changeAffectingSkills,
|
||||
tacticalMode,
|
||||
targetResists,
|
||||
priceOptions,
|
||||
amount,
|
||||
cargoAmmo,
|
||||
# droneStack,
|
||||
metaSwap,
|
||||
implantSets,
|
||||
fighterAbilities,
|
||||
|
||||
@@ -8,38 +8,50 @@ from .cargo.remove import GuiRemoveCargoCommand
|
||||
from .commandFit.add import GuiAddCommandFitCommand
|
||||
from .commandFit.remove import GuiRemoveCommandFitCommand
|
||||
from .commandFit.toggleState import GuiToggleCommandFitStateCommand
|
||||
from .drone.add import GuiAddDroneCommand
|
||||
from .drone.changeAmount import GuiChangeDroneAmountCommand
|
||||
from .drone.remove import GuiRemoveDroneCommand
|
||||
from .drone.toggleState import GuiToggleDroneStateCommand
|
||||
from .fighter.abilityToggleState import GuiToggleFighterAbilityCommand
|
||||
from .fighter.add import GuiAddFighterCommand
|
||||
from .fighter.changeAmount import GuiChangeFighterAmountCommand
|
||||
from .fighter.remove import GuiRemoveFighterCommand
|
||||
from .fighter.toggleState import GuiToggleFighterCommand
|
||||
from .guiAddProjected import GuiAddProjectedCommand
|
||||
from .localDrone.add import GuiAddLocalDroneCommand
|
||||
from .localDrone.changeAmount import GuiChangeLocalDroneAmountCommand
|
||||
from .localDrone.remove import GuiRemoveLocalDroneCommand
|
||||
from .localDrone.toggleState import GuiToggleLocalDroneStateCommand
|
||||
from .localFighter.abilityToggleState import GuiToggleLocalFighterAbilityStateCommand
|
||||
from .localFighter.add import GuiAddLocalFighterCommand
|
||||
from .localFighter.changeAmount import GuiChangeLocalFighterAmountCommand
|
||||
from .localFighter.remove import GuiRemoveLocalFighterCommand
|
||||
from .localFighter.toggleState import GuiToggleLocalFighterStateCommand
|
||||
from .guiCargoToModule import GuiCargoToModuleCommand
|
||||
from .guiChangeProjectedDroneQty import GuiChangeProjectedDroneQtyCommand
|
||||
from .guiChangeProjectedFighterAmount import GuiChangeProjectedFighterAmountCommand
|
||||
from .guiChangeProjectedFitQty import GuiChangeProjectedFitQtyCommand
|
||||
from .guiFitRename import GuiFitRenameCommand
|
||||
from .guiMetaSwap import GuiMetaSwapCommand
|
||||
from .guiModuleToCargo import GuiModuleToCargoCommand
|
||||
from .guiRebaseItems import GuiRebaseItemsCommand
|
||||
from .guiRemoveProjected import GuiRemoveProjectedCommand
|
||||
from .guiSetMode import GuiSetModeCommand
|
||||
from .guiSwapCloneModule import GuiModuleSwapOrCloneCommand
|
||||
from .guiToggleProjected import GuiToggleProjectedCommand
|
||||
from .implant.add import GuiAddImplantCommand
|
||||
from .implant.changeLocation import GuiChangeImplantLocationCommand
|
||||
from .implant.remove import GuiRemoveImplantCommand
|
||||
from .implant.toggleState import GuiToggleImplantStateCommand
|
||||
from .module.add import GuiAddModuleCommand
|
||||
from .module.changeCharges import GuiChangeModuleChargesCommand
|
||||
from .module.changeSpool import GuiChangeModuleSpoolCommand
|
||||
from .module.changeStates import GuiChangeModuleStatesCommand
|
||||
from .module.fill import GuiFillWithModulesCommand
|
||||
from .module.mutatedConvert import GuiConvertMutatedModuleCommand
|
||||
from .module.mutatedImport import GuiImportMutatedModuleCommand
|
||||
from .module.mutatedRevert import GuiRevertMutatedModuleCommand
|
||||
from .module.remove import GuiRemoveModuleCommand
|
||||
from .localModule.add import GuiAddLocalModuleCommand
|
||||
from .localModule.changeCharges import GuiChangeLocalModuleChargesCommand
|
||||
from .localModule.changeSpool import GuiChangeLocalModuleSpoolCommand
|
||||
from .localModule.changeStates import GuiChangeLocalModuleStatesCommand
|
||||
from .localModule.fill import GuiFillWithLocalModulesCommand
|
||||
from .localModule.mutatedConvert import GuiConvertMutatedLocalModuleCommand
|
||||
from .localModule.mutatedImport import GuiImportLocalMutatedModuleCommand
|
||||
from .localModule.mutatedRevert import GuiRevertMutatedLocalModuleCommand
|
||||
from .localModule.remove import GuiRemoveLocalModuleCommand
|
||||
from .projectedDrone.add import GuiAddProjectedDroneCommand
|
||||
from .projectedDrone.changeAmount import GuiChangeProjectedDroneAmountCommand
|
||||
from .projectedDrone.remove import GuiRemoveProjectedDroneCommand
|
||||
from .projectedDrone.toggleState import GuiToggleProjectedDroneStateCommand
|
||||
from .projectedFighter.abilityToggleState import GuiToggleProjectedFighterAbilityStateCommand
|
||||
from .projectedFighter.add import GuiAddProjectedFighterCommand
|
||||
from .projectedFighter.changeAmount import GuiChangeProjectedFighterAmountCommand
|
||||
from .projectedFighter.remove import GuiRemoveProjectedFighterCommand
|
||||
from .projectedFighter.toggleState import GuiToggleProjectedFighterStateCommand
|
||||
from .projectedFit.add import GuiAddProjectedFitCommand
|
||||
from .projectedFit.changeAmount import GuiChangeProjectedFitAmountCommand
|
||||
from .projectedFit.remove import GuiRemoveProjectedFitCommand
|
||||
from .projectedFit.toggleState import GuiToggleProjectedFitStateCommand
|
||||
from .projectedModule.add import GuiAddProjectedModuleCommand
|
||||
from .projectedModule.changeCharges import GuiChangeProjectedModuleChargesCommand
|
||||
from .projectedModule.changeSpool import GuiChangeProjectedModuleSpoolCommand
|
||||
from .projectedModule.changeState import GuiChangeProjectedModuleStateCommand
|
||||
from .projectedModule.remove import GuiRemoveProjectedModuleCommand
|
||||
|
||||
@@ -18,7 +18,7 @@ class CalcFitRenameCommand(wx.Command):
|
||||
|
||||
def Do(self):
|
||||
pyfalog.debug('Doing renaming of fit {} to {}'.format(self.fitID, self.name))
|
||||
fit = Fit.getInstance().getFit(self.fitID)
|
||||
fit = Fit.getInstance().getFit(self.fitID, basic=True)
|
||||
if fit.name == self.name:
|
||||
return False
|
||||
self.savedName = fit.name
|
||||
|
||||
@@ -10,7 +10,7 @@ pyfalog = Logger(__name__)
|
||||
|
||||
class CalcAddProjectedFitCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, projectedFitID, state):
|
||||
def __init__(self, fitID, projectedFitID, state=None):
|
||||
wx.Command.__init__(self, True, 'Add Projected Fit')
|
||||
self.fitID = fitID
|
||||
self.projectedFitID = projectedFitID
|
||||
@@ -20,7 +20,7 @@ class CalcAddProjectedFitCommand(wx.Command):
|
||||
pyfalog.debug('Doing addition of projected fit {} for fit {}'.format(self.projectedFitID, self.fitID))
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.fitID)
|
||||
projectedFit = sFit.getFit(self.projectedFitID)
|
||||
projectedFit = sFit.getFit(self.projectedFitID, projected=True)
|
||||
|
||||
# Projected fit could have been deleted if we are redoing
|
||||
if projectedFit is None:
|
||||
@@ -51,7 +51,7 @@ class CalcAddProjectedFitCommand(wx.Command):
|
||||
pyfalog.debug('Undoing addition of projected fit {} for fit {}'.format(self.projectedFitID, self.fitID))
|
||||
# Can't find the projected fit, it must have been deleted. Just skip, as deleted fit
|
||||
# means that someone else just did exactly what we wanted to do
|
||||
projectedFit = Fit.getInstance().getFit(self.projectedFitID)
|
||||
projectedFit = Fit.getInstance().getFit(self.projectedFitID, projected=True)
|
||||
if projectedFit is None:
|
||||
return True
|
||||
from .remove import CalcRemoveProjectedFitCommand
|
||||
|
||||
@@ -19,7 +19,7 @@ class CalcChangeProjectedFitAmountCommand(wx.Command):
|
||||
|
||||
def Do(self):
|
||||
pyfalog.debug('Doing change of projected fit {} amount to {} for fit {}'.format(self.projectedFitID, self.amount, self.fitID))
|
||||
projectedFit = Fit.getInstance().getFit(self.projectedFitID)
|
||||
projectedFit = Fit.getInstance().getFit(self.projectedFitID, projected=True)
|
||||
# Projected fit could have been deleted if we are redoing
|
||||
if projectedFit is None:
|
||||
pyfalog.debug('Projected fit is not available')
|
||||
|
||||
@@ -20,7 +20,7 @@ class CalcRemoveProjectedFitCommand(wx.Command):
|
||||
pyfalog.debug('Doing removal of projected fit {} for fit {}'.format(self.projectedFitID, self.fitID))
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.fitID)
|
||||
projectedFit = sFit.getFit(self.projectedFitID)
|
||||
projectedFit = sFit.getFit(self.projectedFitID, projected=True)
|
||||
|
||||
# Can be removed by the time we're redoing it
|
||||
if projectedFit is None:
|
||||
|
||||
@@ -19,7 +19,7 @@ class CalcToggleProjectedFitCommand(wx.Command):
|
||||
|
||||
def Do(self):
|
||||
pyfalog.debug('Doing toggling of projected fit {} state for fit {}'.format(self.projectedFitID, self.fitID))
|
||||
projectedFit = Fit.getInstance().getFit(self.projectedFitID)
|
||||
projectedFit = Fit.getInstance().getFit(self.projectedFitID, projected=True)
|
||||
# Projected fit could have been deleted if we are redoing
|
||||
if projectedFit is None:
|
||||
pyfalog.debug('Projected fit is not available')
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
import wx
|
||||
from service.fit import Fit
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.helpers import ModuleInfo, DroneInfo, FighterInfo
|
||||
from .calcCommands.module.projectedAdd import CalcAddProjectedModuleCommand
|
||||
from .calcCommands.projectedFit.add import CalcAddProjectedFitCommand
|
||||
from .calcCommands.fighter.projectedAdd import CalcAddProjectedFighterCommand
|
||||
from .calcCommands.drone.projectedAdd import CalcAddProjectedDroneCommand
|
||||
from logbook import Logger
|
||||
import eos.db
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class GuiAddProjectedCommand(wx.Command):
|
||||
def __init__(self, fitID, id, type='item'):
|
||||
wx.Command.__init__(self, True, "Projected Add")
|
||||
self.internalHistory = wx.CommandProcessor()
|
||||
self.fitID = fitID
|
||||
self.id = id
|
||||
self.type = type
|
||||
|
||||
def Do(self):
|
||||
result = False
|
||||
# since we can project various types, we need to switch of the fit command. We can't do this switch easily in
|
||||
# the fit command since each type might have a different kind of undo, easier to split it out
|
||||
if self.type == 'item':
|
||||
item = eos.db.getItem(self.id, eager=("attributes", "group.category"))
|
||||
|
||||
if item.category.name == "Drone":
|
||||
result = self.internalHistory.Submit(CalcAddProjectedDroneCommand(
|
||||
fitID=self.fitID,
|
||||
droneInfo=DroneInfo(itemID=self.id, amount=1, amountActive=1)))
|
||||
elif item.category.name == "Fighter":
|
||||
result = self.internalHistory.Submit(CalcAddProjectedFighterCommand(self.fitID, fighterInfo=FighterInfo(itemID=self.id)))
|
||||
else:
|
||||
result = self.internalHistory.Submit(CalcAddProjectedModuleCommand(
|
||||
fitID=self.fitID,
|
||||
modInfo=ModuleInfo(itemID=self.id)))
|
||||
elif self.type == 'fit':
|
||||
result = self.internalHistory.Submit(CalcAddProjectedFitCommand(self.fitID, self.id, None))
|
||||
|
||||
if result:
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
for _ in self.internalHistory.Commands:
|
||||
self.internalHistory.Undo()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
@@ -1,32 +0,0 @@
|
||||
import wx
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from .calcCommands.drone.projectedChangeAmount import CalcChangeProjectedDroneAmountCommand
|
||||
from service.fit import Fit
|
||||
from logbook import Logger
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class GuiChangeProjectedDroneQtyCommand(wx.Command):
|
||||
def __init__(self, fitID, itemID, amount=1):
|
||||
wx.Command.__init__(self, True, "")
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
self.amount = amount
|
||||
self.internalHistory = wx.CommandProcessor()
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcChangeProjectedDroneAmountCommand(self.fitID, self.itemID, self.amount)
|
||||
if self.internalHistory.Submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
pyfalog.debug("{} Undo()".format(self))
|
||||
for _ in self.internalHistory.Commands:
|
||||
self.internalHistory.Undo()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
@@ -1,33 +0,0 @@
|
||||
import wx
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from .calcCommands.fighter.changeAmount import CalcChangeFighterAmountCommand
|
||||
from service.fit import Fit
|
||||
from logbook import Logger
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class GuiChangeProjectedFighterAmountCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, amount):
|
||||
wx.Command.__init__(self, True, "")
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
self.amount = amount
|
||||
self.internalHistory = wx.CommandProcessor()
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcChangeFighterAmountCommand(self.fitID, True, self.position, self.amount)
|
||||
if self.internalHistory.Submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
pyfalog.debug("{} Undo()".format(self))
|
||||
for _ in self.internalHistory.Commands:
|
||||
self.internalHistory.Undo()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
@@ -1,32 +0,0 @@
|
||||
import wx
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from .calcCommands.projectedFit.changeAmount import CalcChangeProjectedFitAmountCommand
|
||||
from service.fit import Fit
|
||||
from logbook import Logger
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class GuiChangeProjectedFitQtyCommand(wx.Command):
|
||||
def __init__(self, fitID, pfitID, amount=1):
|
||||
wx.Command.__init__(self, True, "")
|
||||
self.fitID = fitID
|
||||
self.pfitID = pfitID
|
||||
self.amount = amount
|
||||
self.internalHistory = wx.CommandProcessor()
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcChangeProjectedFitAmountCommand(self.fitID, self.pfitID, self.amount)
|
||||
if self.internalHistory.Submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
pyfalog.debug("{} Undo()".format(self))
|
||||
for _ in self.internalHistory.Commands:
|
||||
self.internalHistory.Undo()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
@@ -1,69 +0,0 @@
|
||||
import wx
|
||||
from service.fit import Fit
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from .calcCommands.module.projectedRemove import CalcRemoveProjectedModuleCommand
|
||||
from .calcCommands.projectedFit.remove import CalcRemoveProjectedFitCommand
|
||||
from .calcCommands.fighter.projectedRemove import CalcRemoveProjectedFighterCommand
|
||||
from logbook import Logger
|
||||
from .calcCommands.drone.projectedRemove import CalcRemoveProjectedDroneCommand
|
||||
|
||||
from gui.fitCommands.helpers import DroneInfo
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.module import Module
|
||||
from eos.saveddata.fighter import Fighter
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
|
||||
|
||||
class GuiRemoveProjectedCommand(wx.Command):
|
||||
mapping = {
|
||||
'fit': CalcRemoveProjectedFitCommand,
|
||||
'module': CalcRemoveProjectedModuleCommand,
|
||||
'fighter': CalcRemoveProjectedFighterCommand,
|
||||
'drone': CalcRemoveProjectedDroneCommand
|
||||
}
|
||||
|
||||
def __init__(self, fitID, thing):
|
||||
wx.Command.__init__(self, True, "Projected Remove")
|
||||
self.internalHistory = wx.CommandProcessor()
|
||||
self.fitID = fitID
|
||||
fit = Fit.getInstance().getFit(fitID)
|
||||
|
||||
if isinstance(thing, Drone):
|
||||
self.data = DroneInfo(itemID=thing.itemID, amount=1, amountActive=1)
|
||||
self.type = 'drone'
|
||||
elif isinstance(thing, Module):
|
||||
self.type = 'module'
|
||||
self.data = fit.projectedModules.index(thing)
|
||||
elif isinstance(thing, Fighter):
|
||||
self.data = fit.projectedFighters.index(thing)
|
||||
self.type = 'fighter'
|
||||
else:
|
||||
# todo: fix!
|
||||
self.data = thing.ID
|
||||
self.type = 'fit'
|
||||
|
||||
def Do(self):
|
||||
result = False
|
||||
# since we can project various types, we need to switch of the fit command. We can't do this switch easily in
|
||||
# the fit command since each type might have a different kind of undo, easier to split it out
|
||||
|
||||
cls = self.mapping.get(self.type, None)
|
||||
if cls:
|
||||
cmd = cls(self.fitID, self.data)
|
||||
result = self.internalHistory.Submit(cmd)
|
||||
|
||||
if result:
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
for _ in self.internalHistory.Commands:
|
||||
self.internalHistory.Undo()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
@@ -1,55 +0,0 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from eos.saveddata.drone import Drone as DroneType
|
||||
from eos.saveddata.fighter import Fighter as FighterType
|
||||
from eos.saveddata.fit import Fit as FitType
|
||||
from eos.saveddata.module import Module as ModuleType
|
||||
from gui import globalEvents as GE
|
||||
from service.fit import Fit
|
||||
from .calcCommands.drone.projectedToggleState import CalcToggleProjectedDroneStateCommand
|
||||
from .calcCommands.fighter.toggleState import CalcToggleFighterStateCommand
|
||||
from .calcCommands.projectedFit.toggleState import CalcToggleProjectedFitCommand
|
||||
from .calcCommands.module.projectedChangeState import CalcChangeProjectedModuleStateCommand
|
||||
|
||||
|
||||
class GuiToggleProjectedCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, thing, click):
|
||||
wx.Command.__init__(self, True, "Toggle Projected Item")
|
||||
self.internalHistory = wx.CommandProcessor()
|
||||
self.fitID = fitID
|
||||
fit = Fit.getInstance().getFit(self.fitID)
|
||||
if isinstance(thing, FitType):
|
||||
self.commandType = CalcToggleProjectedFitCommand
|
||||
self.args = (self.fitID, thing.ID)
|
||||
elif isinstance(thing, ModuleType):
|
||||
position = fit.projectedModules.index(thing)
|
||||
self.commandType = CalcChangeProjectedModuleStateCommand
|
||||
self.args = (self.fitID, position, click)
|
||||
elif isinstance(thing, DroneType):
|
||||
self.commandType = CalcToggleProjectedDroneStateCommand
|
||||
self.args = (self.fitID, thing.itemID)
|
||||
elif isinstance(thing, FighterType):
|
||||
position = fit.projectedFighters.index(thing)
|
||||
self.commandType = CalcToggleFighterStateCommand
|
||||
self.args = (self.fitID, True, position)
|
||||
else:
|
||||
self.commandType = None
|
||||
self.args = ()
|
||||
|
||||
def Do(self):
|
||||
if self.commandType is None:
|
||||
return False
|
||||
if not self.internalHistory.Submit(self.commandType(*self.args)):
|
||||
return False
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
|
||||
def Undo(self):
|
||||
for _ in self.internalHistory.Commands:
|
||||
self.internalHistory.Undo()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
@@ -7,16 +7,17 @@ from gui.fitCommands.helpers import DroneInfo, InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiAddDroneCommand(wx.Command):
|
||||
class GuiAddLocalDroneCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID):
|
||||
wx.Command.__init__(self, True, 'Add Drone')
|
||||
def __init__(self, fitID, itemID, amount):
|
||||
wx.Command.__init__(self, True, 'Add Local Drone')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
self.amount = amount
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcAddLocalDroneCommand(fitID=self.fitID, droneInfo=DroneInfo(itemID=self.itemID, amount=1, amountActive=0))
|
||||
cmd = CalcAddLocalDroneCommand(fitID=self.fitID, droneInfo=DroneInfo(itemID=self.itemID, amount=self.amount, amountActive=0))
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
@@ -10,10 +10,10 @@ from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeDroneAmountCommand(wx.Command):
|
||||
class GuiChangeLocalDroneAmountCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, amount):
|
||||
wx.Command.__init__(self, True, 'Change Drone Amount')
|
||||
wx.Command.__init__(self, True, 'Change Local Drone Amount')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiRemoveDroneCommand(wx.Command):
|
||||
class GuiRemoveLocalDroneCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, amount):
|
||||
wx.Command.__init__(self, True, 'Remove Drone')
|
||||
wx.Command.__init__(self, True, 'Remove Local Drone')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiToggleDroneStateCommand(wx.Command):
|
||||
class GuiToggleLocalDroneStateCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position):
|
||||
wx.Command.__init__(self, True, 'Toggle Drone State')
|
||||
wx.Command.__init__(self, True, 'Toggle Local Drone State')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiToggleFighterAbilityCommand(wx.Command):
|
||||
class GuiToggleLocalFighterAbilityStateCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, effectID):
|
||||
wx.Command.__init__(self, True, 'Toggle Fighter Ability State')
|
||||
wx.Command.__init__(self, True, 'Toggle Local Fighter Ability State')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import FighterInfo, InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiAddFighterCommand(wx.Command):
|
||||
class GuiAddLocalFighterCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID):
|
||||
wx.Command.__init__(self, True, 'Add Fighter')
|
||||
wx.Command.__init__(self, True, 'Add Local Fighter')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
@@ -8,10 +8,10 @@ from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeFighterAmountCommand(wx.Command):
|
||||
class GuiChangeLocalFighterAmountCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, amount):
|
||||
wx.Command.__init__(self, True, 'Change Fighter Amount')
|
||||
wx.Command.__init__(self, True, 'Change Local Fighter Amount')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiRemoveFighterCommand(wx.Command):
|
||||
class GuiRemoveLocalFighterCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position):
|
||||
wx.Command.__init__(self, True, 'Remove Fighter')
|
||||
wx.Command.__init__(self, True, 'Remove Local Fighter')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiToggleFighterCommand(wx.Command):
|
||||
class GuiToggleLocalFighterStateCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position):
|
||||
wx.Command.__init__(self, True, 'Toggle Fighter State')
|
||||
wx.Command.__init__(self, True, 'Toggle Local Fighter State')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
@@ -10,10 +10,10 @@ from service.fit import Fit
|
||||
from service.market import Market
|
||||
|
||||
|
||||
class GuiAddModuleCommand(wx.Command):
|
||||
class GuiAddLocalModuleCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID, position=None):
|
||||
wx.Command.__init__(self, True, 'Add Module')
|
||||
wx.Command.__init__(self, True, 'Add Local Module')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
@@ -7,17 +7,17 @@ from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeModuleChargesCommand(wx.Command):
|
||||
class GuiChangeLocalModuleChargesCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID, modules):
|
||||
wx.Command.__init__(self, True, 'Change Module Charges')
|
||||
def __init__(self, fitID, modules, chargeItemID):
|
||||
wx.Command.__init__(self, True, 'Change Local Module Charges')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
self.positions = [mod.modPosition for mod in modules]
|
||||
self.chargeItemID = chargeItemID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcChangeModuleChargesCommand(fitID=self.fitID, projected=False, chargeMap={p: self.itemID for p in self.positions})
|
||||
cmd = CalcChangeModuleChargesCommand(fitID=self.fitID, projected=False, chargeMap={p: self.chargeItemID for p in self.positions})
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeModuleSpoolCommand(wx.Command):
|
||||
class GuiChangeLocalModuleSpoolCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, spoolType, spoolAmount):
|
||||
wx.Command.__init__(self, True, 'Change Module Spool')
|
||||
wx.Command.__init__(self, True, 'Change Local Module Spool')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeModuleStatesCommand(wx.Command):
|
||||
class GuiChangeLocalModuleStatesCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, mainPosition, positions, click):
|
||||
wx.Command.__init__(self, True, 'Change Module States')
|
||||
wx.Command.__init__(self, True, 'Change Local Module States')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.mainPosition = mainPosition
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory, ModuleInfo
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiFillWithModulesCommand(wx.Command):
|
||||
class GuiFillWithLocalModulesCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID):
|
||||
wx.Command.__init__(self, True, 'Fill with Modules')
|
||||
wx.Command.__init__(self, True, 'Fill with Local Modules')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory, ModuleInfo
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiConvertMutatedModuleCommand(wx.Command):
|
||||
class GuiConvertMutatedLocalModuleCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, mutaplasmid):
|
||||
wx.Command.__init__(self, True, 'Convert Module to Mutated')
|
||||
wx.Command.__init__(self, True, 'Convert Local Module to Mutated')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory, ModuleInfo
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiImportMutatedModuleCommand(wx.Command):
|
||||
class GuiImportLocalMutatedModuleCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, baseItem, mutaplasmid, mutations):
|
||||
wx.Command.__init__(self, True, 'Import Mutated Module')
|
||||
wx.Command.__init__(self, True, 'Import Local Mutated Module')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.newModInfo = ModuleInfo(
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory, ModuleInfo
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiRevertMutatedModuleCommand(wx.Command):
|
||||
class GuiRevertMutatedLocalModuleCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position):
|
||||
wx.Command.__init__(self, True, 'Revert Module from Mutated')
|
||||
wx.Command.__init__(self, True, 'Revert Local Module from Mutated')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
@@ -7,10 +7,10 @@ from gui.fitCommands.helpers import InternalCommandHistory, ModuleInfo
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiRemoveModuleCommand(wx.Command):
|
||||
class GuiRemoveLocalModuleCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, modules):
|
||||
wx.Command.__init__(self, True, 'Remove Module')
|
||||
wx.Command.__init__(self, True, 'Remove Local Module')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.modCache = {mod.modPosition: ModuleInfo.fromModule(mod) for mod in modules if not mod.isEmpty}
|
||||
0
gui/fitCommands/projectedDrone/__init__.py
Normal file
0
gui/fitCommands/projectedDrone/__init__.py
Normal file
30
gui/fitCommands/projectedDrone/add.py
Normal file
30
gui/fitCommands/projectedDrone/add.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.drone.projectedAdd import CalcAddProjectedDroneCommand
|
||||
from gui.fitCommands.helpers import DroneInfo, InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiAddProjectedDroneCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID):
|
||||
wx.Command.__init__(self, True, 'Add Projected Drone')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcAddProjectedDroneCommand(fitID=self.fitID, droneInfo=DroneInfo(itemID=self.itemID, amount=1, amountActive=1))
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
41
gui/fitCommands/projectedDrone/changeAmount.py
Normal file
41
gui/fitCommands/projectedDrone/changeAmount.py
Normal file
@@ -0,0 +1,41 @@
|
||||
import math
|
||||
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.drone.projectedChangeAmount import CalcChangeProjectedDroneAmountCommand
|
||||
from gui.fitCommands.calcCommands.drone.projectedRemove import CalcRemoveProjectedDroneCommand
|
||||
from gui.fitCommands.helpers import DroneInfo, InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeProjectedDroneAmountCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID, amount):
|
||||
wx.Command.__init__(self, True, 'Change Projected Drone Amount')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
self.amount = amount
|
||||
|
||||
def Do(self):
|
||||
if self.amount > 0:
|
||||
cmd = CalcChangeProjectedDroneAmountCommand(fitID=self.fitID, itemID=self.itemID, amount=self.amount)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
else:
|
||||
cmd = CalcRemoveProjectedDroneCommand(fitID=self.fitID, droneInfo=DroneInfo(itemID=self.itemID, amount=math.inf, amountActive=math.inf))
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
31
gui/fitCommands/projectedDrone/remove.py
Normal file
31
gui/fitCommands/projectedDrone/remove.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.drone.projectedRemove import CalcRemoveProjectedDroneCommand
|
||||
from gui.fitCommands.helpers import DroneInfo, InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiRemoveProjectedDroneCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID, amount):
|
||||
wx.Command.__init__(self, True, 'Remove Projected Drone')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
self.amount = amount
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcRemoveProjectedDroneCommand(fitID=self.fitID, droneInfo=DroneInfo(itemID=self.itemID, amount=self.amount, amountActive=self.amount))
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
30
gui/fitCommands/projectedDrone/toggleState.py
Normal file
30
gui/fitCommands/projectedDrone/toggleState.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.drone.projectedToggleState import CalcToggleProjectedDroneStateCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiToggleProjectedDroneStateCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID):
|
||||
wx.Command.__init__(self, True, 'Toggle Projected Drone State')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcToggleProjectedDroneStateCommand(fitID=self.fitID, itemID=self.itemID)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
0
gui/fitCommands/projectedFighter/__init__.py
Normal file
0
gui/fitCommands/projectedFighter/__init__.py
Normal file
31
gui/fitCommands/projectedFighter/abilityToggleState.py
Normal file
31
gui/fitCommands/projectedFighter/abilityToggleState.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.fighter.abilityToggleState import CalcToggleFighterAbilityStateCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiToggleProjectedFighterAbilityStateCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, effectID):
|
||||
wx.Command.__init__(self, True, 'Toggle Projected Fighter Ability State')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
self.effectID = effectID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcToggleFighterAbilityStateCommand(fitID=self.fitID, projected=True, position=self.position, effectID=self.effectID)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
30
gui/fitCommands/projectedFighter/add.py
Normal file
30
gui/fitCommands/projectedFighter/add.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.fighter.projectedAdd import CalcAddProjectedFighterCommand
|
||||
from gui.fitCommands.helpers import FighterInfo, InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiAddProjectedFighterCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID):
|
||||
wx.Command.__init__(self, True, 'Add Projected Fighter')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcAddProjectedFighterCommand(fitID=self.fitID, fighterInfo=FighterInfo(itemID=self.itemID))
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
39
gui/fitCommands/projectedFighter/changeAmount.py
Normal file
39
gui/fitCommands/projectedFighter/changeAmount.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.fighter.changeAmount import CalcChangeFighterAmountCommand
|
||||
from gui.fitCommands.calcCommands.fighter.projectedRemove import CalcRemoveProjectedFighterCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeProjectedFighterAmountCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, amount):
|
||||
wx.Command.__init__(self, True, 'Change Projected Fighter Amount')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
self.amount = amount
|
||||
|
||||
def Do(self):
|
||||
if self.amount > 0:
|
||||
cmd = CalcChangeFighterAmountCommand(fitID=self.fitID, projected=True, position=self.position, amount=self.amount)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
else:
|
||||
cmd = CalcRemoveProjectedFighterCommand(fitID=self.fitID, position=self.position)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
30
gui/fitCommands/projectedFighter/remove.py
Normal file
30
gui/fitCommands/projectedFighter/remove.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.fighter.projectedRemove import CalcRemoveProjectedFighterCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiRemoveProjectedFighterCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position):
|
||||
wx.Command.__init__(self, True, 'Remove Projected Fighter')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcRemoveProjectedFighterCommand(fitID=self.fitID, position=self.position)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
30
gui/fitCommands/projectedFighter/toggleState.py
Normal file
30
gui/fitCommands/projectedFighter/toggleState.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.fighter.toggleState import CalcToggleFighterStateCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiToggleProjectedFighterStateCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position):
|
||||
wx.Command.__init__(self, True, 'Toggle Projected Fighter State')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcToggleFighterStateCommand(fitID=self.fitID, projected=True, position=self.position)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
0
gui/fitCommands/projectedFit/__init__.py
Normal file
0
gui/fitCommands/projectedFit/__init__.py
Normal file
30
gui/fitCommands/projectedFit/add.py
Normal file
30
gui/fitCommands/projectedFit/add.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.projectedFit.add import CalcAddProjectedFitCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiAddProjectedFitCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, projectedFitID):
|
||||
wx.Command.__init__(self, True, 'Add Projected Fit')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.projectedFitID = projectedFitID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcAddProjectedFitCommand(fitID=self.fitID, projectedFitID=self.projectedFitID)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
39
gui/fitCommands/projectedFit/changeAmount.py
Normal file
39
gui/fitCommands/projectedFit/changeAmount.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.projectedFit.changeAmount import CalcChangeProjectedFitAmountCommand
|
||||
from gui.fitCommands.calcCommands.projectedFit.remove import CalcRemoveProjectedFitCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeProjectedFitAmountCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, projectedFitID, amount):
|
||||
wx.Command.__init__(self, True, 'Change Projected Fit Amount')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.projectedFitID = projectedFitID
|
||||
self.amount = amount
|
||||
|
||||
def Do(self):
|
||||
if self.amount > 0:
|
||||
cmd = CalcChangeProjectedFitAmountCommand(fitID=self.fitID, projectedFitID=self.projectedFitID, amount=self.amount)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
else:
|
||||
cmd = CalcRemoveProjectedFitCommand(fitID=self.fitID, projectedFitID=self.projectedFitID)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
30
gui/fitCommands/projectedFit/remove.py
Normal file
30
gui/fitCommands/projectedFit/remove.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.projectedFit.remove import CalcRemoveProjectedFitCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiRemoveProjectedFitCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, projectedFitID):
|
||||
wx.Command.__init__(self, True, 'Remove Projected Fit')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.projectedFitID = projectedFitID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcRemoveProjectedFitCommand(fitID=self.fitID, projectedFitID=self.projectedFitID)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
30
gui/fitCommands/projectedFit/toggleState.py
Normal file
30
gui/fitCommands/projectedFit/toggleState.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.projectedFit.toggleState import CalcToggleProjectedFitCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiToggleProjectedFitStateCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, projectedFitID):
|
||||
wx.Command.__init__(self, True, 'Toggle Projected Fit State')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.projectedFitID = projectedFitID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcToggleProjectedFitCommand(fitID=self.fitID, projectedFitID=self.projectedFitID)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
0
gui/fitCommands/projectedModule/__init__.py
Normal file
0
gui/fitCommands/projectedModule/__init__.py
Normal file
30
gui/fitCommands/projectedModule/add.py
Normal file
30
gui/fitCommands/projectedModule/add.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.module.projectedAdd import CalcAddProjectedModuleCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory, ModuleInfo
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiAddProjectedModuleCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, itemID):
|
||||
wx.Command.__init__(self, True, 'Add Projected Module')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.itemID = itemID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcAddProjectedModuleCommand(fitID=self.fitID, modInfo=ModuleInfo(itemID=self.itemID))
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
31
gui/fitCommands/projectedModule/changeCharges.py
Normal file
31
gui/fitCommands/projectedModule/changeCharges.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.module.changeCharges import CalcChangeModuleChargesCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeProjectedModuleChargesCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, modules, chargeItemID):
|
||||
wx.Command.__init__(self, True, 'Change Projected Module Charges')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.positions = [mod.modPosition for mod in modules]
|
||||
self.chargeItemID = chargeItemID
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcChangeModuleChargesCommand(fitID=self.fitID, projected=True, chargeMap={p: self.chargeItemID for p in self.positions})
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
37
gui/fitCommands/projectedModule/changeSpool.py
Normal file
37
gui/fitCommands/projectedModule/changeSpool.py
Normal file
@@ -0,0 +1,37 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.module.changeSpool import CalcChangeModuleSpoolCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeProjectedModuleSpoolCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, spoolType, spoolAmount):
|
||||
wx.Command.__init__(self, True, 'Change Projected Module Spool')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
self.spoolType = spoolType
|
||||
self.spoolAmount = spoolAmount
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcChangeModuleSpoolCommand(
|
||||
fitID=self.fitID,
|
||||
projected=True,
|
||||
position=self.position,
|
||||
spoolType=self.spoolType,
|
||||
spoolAmount=self.spoolAmount)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
31
gui/fitCommands/projectedModule/changeState.py
Normal file
31
gui/fitCommands/projectedModule/changeState.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.module.projectedChangeState import CalcChangeProjectedModuleStateCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiChangeProjectedModuleStateCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position, click):
|
||||
wx.Command.__init__(self, True, 'Change Projected Module State')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
self.click = click
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcChangeProjectedModuleStateCommand(fitID=self.fitID, position=self.position, click=self.click)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
30
gui/fitCommands/projectedModule/remove.py
Normal file
30
gui/fitCommands/projectedModule/remove.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import wx
|
||||
|
||||
import gui.mainFrame
|
||||
from gui import globalEvents as GE
|
||||
from gui.fitCommands.calcCommands.module.projectedRemove import CalcRemoveProjectedModuleCommand
|
||||
from gui.fitCommands.helpers import InternalCommandHistory
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
class GuiRemoveProjectedModuleCommand(wx.Command):
|
||||
|
||||
def __init__(self, fitID, position):
|
||||
wx.Command.__init__(self, True, 'Remove Projected Module')
|
||||
self.internalHistory = InternalCommandHistory()
|
||||
self.fitID = fitID
|
||||
self.position = position
|
||||
|
||||
def Do(self):
|
||||
cmd = CalcRemoveProjectedModuleCommand(fitID=self.fitID, position=self.position)
|
||||
if self.internalHistory.submit(cmd):
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return True
|
||||
return False
|
||||
|
||||
def Undo(self):
|
||||
success = self.internalHistory.undoAll()
|
||||
Fit.getInstance().recalc(self.fitID)
|
||||
wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
|
||||
return success
|
||||
@@ -704,7 +704,7 @@ class MainFrame(wx.Frame):
|
||||
# If it's mutated item - make sure there's at least base item specified
|
||||
if importType == "MutatedItem":
|
||||
# we've imported an Abyssal module, need to fire off the command to add it to the fit
|
||||
self.command.Submit(cmd.GuiImportMutatedModuleCommand(activeFit, *importData[0]))
|
||||
self.command.Submit(cmd.GuiImportLocalMutatedModuleCommand(activeFit, *importData[0]))
|
||||
return # no need to do anything else
|
||||
except:
|
||||
pyfalog.error("Attempt to import failed:\n{0}", clipboard)
|
||||
|
||||
Reference in New Issue
Block a user