Compare commits
9 Commits
v2.9.3dev1
...
v2.9.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5f9bf4a861 | ||
|
|
321b939d3a | ||
|
|
bb9b3780ae | ||
|
|
4c976d9f35 | ||
|
|
a5475eb244 | ||
|
|
e9f3453b04 | ||
|
|
c950592b5b | ||
|
|
2b24f14122 | ||
|
|
cfffa1d99d |
@@ -17,10 +17,8 @@
|
||||
# along with eos. If not, see <http://www.gnu.org/licenses/>.
|
||||
# ===============================================================================
|
||||
|
||||
from logbook import Logger
|
||||
|
||||
from eos.exception import HandledListActionError
|
||||
from utils.deprecated import deprecated
|
||||
from logbook import Logger
|
||||
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
@@ -137,27 +135,23 @@ class HandledModuleList(HandledList):
|
||||
self.__toModule(emptyPosition, mod)
|
||||
if mod.isInvalid:
|
||||
self.__toDummy(mod.position)
|
||||
raise HandledListActionError(mod)
|
||||
return
|
||||
|
||||
self.appendIgnoreEmpty(mod)
|
||||
else:
|
||||
self.appendIgnoreEmpty(mod)
|
||||
|
||||
def appendIgnoreEmpty(self, mod):
|
||||
mod.position = len(self)
|
||||
HandledList.append(self, mod)
|
||||
if mod.isInvalid:
|
||||
self.remove(mod)
|
||||
raise HandledListActionError(mod)
|
||||
|
||||
def replace(self, idx, mod):
|
||||
try:
|
||||
oldMod = self[idx]
|
||||
except IndexError:
|
||||
raise HandledListActionError(mod)
|
||||
return
|
||||
self.__toModule(idx, mod)
|
||||
if mod.isInvalid:
|
||||
self.__toModule(idx, oldMod)
|
||||
raise HandledListActionError(mod)
|
||||
|
||||
def replaceRackPosition(self, rackPosition, mod):
|
||||
listPositions = []
|
||||
@@ -182,7 +176,6 @@ class HandledModuleList(HandledList):
|
||||
self.__toDummy(modListPosition)
|
||||
else:
|
||||
self.__toModule(modListPosition, oldMod)
|
||||
raise HandledListActionError(mod)
|
||||
|
||||
def insert(self, idx, mod):
|
||||
mod.position = idx
|
||||
@@ -193,8 +186,6 @@ class HandledModuleList(HandledList):
|
||||
HandledList.insert(self, idx, mod)
|
||||
if mod.isInvalid:
|
||||
self.remove(mod)
|
||||
raise HandledListActionError(mod)
|
||||
|
||||
|
||||
def remove(self, mod):
|
||||
HandledList.remove(self, mod)
|
||||
@@ -236,13 +227,11 @@ class HandledDroneCargoList(HandledList):
|
||||
HandledList.append(self, thing)
|
||||
if thing.isInvalid:
|
||||
self.remove(thing)
|
||||
raise HandledListActionError(thing)
|
||||
|
||||
def insert(self, idx, thing):
|
||||
HandledList.insert(self, idx, thing)
|
||||
if thing.isInvalid:
|
||||
self.remove(thing)
|
||||
raise HandledListActionError(thing)
|
||||
|
||||
|
||||
class HandledImplantList(HandledList):
|
||||
@@ -251,22 +240,22 @@ class HandledImplantList(HandledList):
|
||||
if implant.isInvalid:
|
||||
HandledList.append(self, implant)
|
||||
self.remove(implant)
|
||||
raise HandledListActionError(implant)
|
||||
return
|
||||
if self.__slotCheck(implant):
|
||||
HandledList.append(self, implant)
|
||||
self.remove(implant)
|
||||
raise HandledListActionError(implant)
|
||||
return
|
||||
HandledList.append(self, implant)
|
||||
|
||||
def insert(self, idx, implant):
|
||||
if implant.isInvalid:
|
||||
HandledList.insert(self, idx, implant)
|
||||
self.remove(implant)
|
||||
raise HandledListActionError(implant)
|
||||
return
|
||||
if self.__slotCheck(implant):
|
||||
HandledList.insert(self, idx, implant)
|
||||
self.remove(implant)
|
||||
raise HandledListActionError(implant)
|
||||
return
|
||||
HandledList.insert(self, idx, implant)
|
||||
|
||||
def makeRoom(self, implant):
|
||||
@@ -292,22 +281,22 @@ class HandledBoosterList(HandledList):
|
||||
if booster.isInvalid:
|
||||
HandledList.append(self, booster)
|
||||
self.remove(booster)
|
||||
raise HandledListActionError(booster)
|
||||
return
|
||||
if self.__slotCheck(booster):
|
||||
HandledList.append(self, booster)
|
||||
self.remove(booster)
|
||||
raise HandledListActionError(booster)
|
||||
return
|
||||
HandledList.append(self, booster)
|
||||
|
||||
def insert(self, idx, booster):
|
||||
if booster.isInvalid:
|
||||
HandledList.insert(self, idx, booster)
|
||||
self.remove(booster)
|
||||
raise HandledListActionError(booster)
|
||||
return
|
||||
if self.__slotCheck(booster):
|
||||
HandledList.insert(self, idx, booster)
|
||||
self.remove(booster)
|
||||
raise HandledListActionError(booster)
|
||||
return
|
||||
HandledList.insert(self, idx, booster)
|
||||
|
||||
def makeRoom(self, booster):
|
||||
@@ -346,16 +335,12 @@ class HandledProjectedModList(HandledList):
|
||||
# rows and relationships in database are removed as well
|
||||
HandledList.append(self, proj)
|
||||
self.remove(proj)
|
||||
raise HandledListActionError(proj)
|
||||
|
||||
return
|
||||
proj.projected = True
|
||||
|
||||
HandledList.append(self, proj)
|
||||
|
||||
# Remove non-projectable modules
|
||||
if not proj.item.isType("projected") and not proj.isExclusiveSystemEffect:
|
||||
self.remove(proj)
|
||||
raise HandledListActionError(proj)
|
||||
|
||||
def insert(self, idx, proj):
|
||||
if proj.isInvalid:
|
||||
@@ -363,16 +348,12 @@ class HandledProjectedModList(HandledList):
|
||||
# rows and relationships in database are removed as well
|
||||
HandledList.insert(self, idx, proj)
|
||||
self.remove(proj)
|
||||
raise HandledListActionError(proj)
|
||||
|
||||
return
|
||||
proj.projected = True
|
||||
|
||||
HandledList.insert(self, idx, proj)
|
||||
|
||||
# Remove non-projectable modules
|
||||
if not proj.item.isType("projected") and not proj.isExclusiveSystemEffect:
|
||||
self.remove(proj)
|
||||
raise HandledListActionError(proj)
|
||||
|
||||
@property
|
||||
def currentSystemEffect(self):
|
||||
@@ -399,24 +380,18 @@ class HandledProjectedDroneList(HandledDroneCargoList):
|
||||
def append(self, proj):
|
||||
proj.projected = True
|
||||
HandledList.append(self, proj)
|
||||
|
||||
# Remove invalid or non-projectable drones
|
||||
if proj.isInvalid or not proj.item.isType("projected"):
|
||||
self.remove(proj)
|
||||
proj.projected = False
|
||||
raise HandledListActionError(proj)
|
||||
return True
|
||||
|
||||
def insert(self, idx, proj):
|
||||
proj.projected = True
|
||||
HandledList.insert(self, idx, proj)
|
||||
|
||||
# Remove invalid or non-projectable drones
|
||||
if proj.isInvalid or not proj.item.isType("projected"):
|
||||
self.remove(proj)
|
||||
proj.projected = False
|
||||
raise HandledListActionError(proj)
|
||||
return True
|
||||
|
||||
|
||||
class HandledItem(object):
|
||||
|
||||
102
eos/effects.py
102
eos/effects.py
@@ -15232,96 +15232,57 @@ class Effect4575(BaseEffect):
|
||||
|
||||
# Remote Shield Repper Bonuses
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Capital Shield Emission Systems'),
|
||||
'duration',
|
||||
src.getModifiedItemAttr('industrialCoreRemoteLogisticsDurationBonus'),
|
||||
)
|
||||
'duration', src.getModifiedItemAttr('industrialCoreRemoteLogisticsDurationBonus'))
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Capital Shield Emission Systems'),
|
||||
'maxRange',
|
||||
src.getModifiedItemAttr('industrialCoreRemoteLogisticsRangeBonus'),
|
||||
stackingPenalties=True
|
||||
)
|
||||
'maxRange', src.getModifiedItemAttr('industrialCoreRemoteLogisticsRangeBonus'),
|
||||
stackingPenalties=True)
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Capital Shield Emission Systems'),
|
||||
'capacitorNeed',
|
||||
src.getModifiedItemAttr('industrialCoreRemoteLogisticsDurationBonus')
|
||||
)
|
||||
'capacitorNeed', src.getModifiedItemAttr('industrialCoreRemoteLogisticsDurationBonus'))
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Capital Shield Emission Systems'),
|
||||
'falloffEffectiveness',
|
||||
src.getModifiedItemAttr('industrialCoreRemoteLogisticsRangeBonus'),
|
||||
stackingPenalties=True
|
||||
)
|
||||
'falloffEffectiveness', src.getModifiedItemAttr('industrialCoreRemoteLogisticsRangeBonus'),
|
||||
stackingPenalties=True)
|
||||
|
||||
# Local Shield Repper Bonuses
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Capital Shield Operation'),
|
||||
'duration',
|
||||
src.getModifiedItemAttr('industrialCoreLocalLogisticsDurationBonus'),
|
||||
)
|
||||
'duration', src.getModifiedItemAttr('industrialCoreLocalLogisticsDurationBonus'))
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Capital Shield Operation'),
|
||||
'shieldBonus',
|
||||
src.getModifiedItemAttr('industrialCoreLocalLogisticsAmountBonus'),
|
||||
stackingPenalties=True
|
||||
)
|
||||
'shieldBonus', src.getModifiedItemAttr('industrialCoreLocalLogisticsAmountBonus'),
|
||||
stackingPenalties=True)
|
||||
|
||||
# Mining Burst Bonuses
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Mining Foreman'),
|
||||
'warfareBuff1Value',
|
||||
src.getModifiedItemAttr('industrialCoreBonusMiningBurstStrength'),
|
||||
)
|
||||
|
||||
'warfareBuff1Value', src.getModifiedItemAttr('industrialCoreBonusMiningBurstStrength'))
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Mining Foreman'),
|
||||
'warfareBuff2Value',
|
||||
src.getModifiedItemAttr('industrialCoreBonusMiningBurstStrength'),
|
||||
)
|
||||
|
||||
'warfareBuff2Value', src.getModifiedItemAttr('industrialCoreBonusMiningBurstStrength'))
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Mining Foreman'),
|
||||
'warfareBuff3Value',
|
||||
src.getModifiedItemAttr('industrialCoreBonusMiningBurstStrength'),
|
||||
)
|
||||
|
||||
'warfareBuff3Value', src.getModifiedItemAttr('industrialCoreBonusMiningBurstStrength'))
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Mining Foreman'),
|
||||
'warfareBuff4Value',
|
||||
src.getModifiedItemAttr('industrialCoreBonusMiningBurstStrength'),
|
||||
)
|
||||
'warfareBuff4Value', src.getModifiedItemAttr('industrialCoreBonusMiningBurstStrength'))
|
||||
|
||||
# Command Burst Range Bonus
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill('Leadership'),
|
||||
'maxRange',
|
||||
src.getModifiedItemAttr('industrialCoreBonusCommandBurstRange'),
|
||||
stackingPenalties=True
|
||||
)
|
||||
'maxRange', src.getModifiedItemAttr('industrialCoreBonusCommandBurstRange'),
|
||||
stackingPenalties=True)
|
||||
|
||||
# Drone Bonuses
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Ice Harvesting Drone Operation'),
|
||||
'duration',
|
||||
src.getModifiedItemAttr('industrialCoreBonusDroneIceHarvesting'),
|
||||
)
|
||||
'duration', src.getModifiedItemAttr('industrialCoreBonusDroneIceHarvesting'))
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Mining Drone Operation'),
|
||||
'miningAmount',
|
||||
src.getModifiedItemAttr('industrialCoreBonusDroneMining'),
|
||||
)
|
||||
'miningAmount', src.getModifiedItemAttr('industrialCoreBonusDroneMining'))
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Drones'),
|
||||
'maxVelocity',
|
||||
src.getModifiedItemAttr('industrialCoreBonusDroneVelocity'),
|
||||
)
|
||||
'maxVelocity', src.getModifiedItemAttr('industrialCoreBonusDroneVelocity'),
|
||||
stackingPenalties=True)
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Drones'),
|
||||
'damageMultiplier', src.getModifiedItemAttr('industrialCoreBonusDroneDamageHP'),
|
||||
stackingPenalties=True)
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Drones'),
|
||||
'shieldCapacity', src.getModifiedItemAttr('industrialCoreBonusDroneDamageHP'))
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Drones'),
|
||||
'armorHP', src.getModifiedItemAttr('industrialCoreBonusDroneDamageHP'))
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Drones'),
|
||||
'hp', src.getModifiedItemAttr('industrialCoreBonusDroneDamageHP'))
|
||||
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Drones'),
|
||||
'damageMultiplier',
|
||||
src.getModifiedItemAttr('industrialCoreBonusDroneDamageHP'),
|
||||
stackingPenalties=True
|
||||
)
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Drones'),
|
||||
'shieldCapacity',
|
||||
src.getModifiedItemAttr('industrialCoreBonusDroneDamageHP'),
|
||||
)
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Drones'),
|
||||
'armorHP',
|
||||
src.getModifiedItemAttr('industrialCoreBonusDroneDamageHP'),
|
||||
)
|
||||
fit.drones.filteredItemBoost(lambda drone: drone.item.requiresSkill('Drones'),
|
||||
'hp',
|
||||
src.getModifiedItemAttr('industrialCoreBonusDroneDamageHP'),
|
||||
)
|
||||
|
||||
# Todo: remote impedance (no reps, etc)
|
||||
# Remote impedance (no reps, etc)
|
||||
fit.ship.increaseItemAttr('warpScrambleStatus', src.getModifiedItemAttr('siegeModeWarpStatus'))
|
||||
fit.ship.boostItemAttr('remoteRepairImpedance', src.getModifiedItemAttr('remoteRepairImpedanceBonus'))
|
||||
fit.ship.increaseItemAttr('disallowTethering', src.getModifiedItemAttr('disallowTethering'))
|
||||
@@ -35571,8 +35532,9 @@ class Effect7183(BaseEffect):
|
||||
|
||||
@staticmethod
|
||||
def handler(fit, src, context):
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == 'Warp Scrambler', 'maxRange',
|
||||
src.getModifiedItemAttr('warpScrambleRangeBonus'), stackingPenalties=False)
|
||||
fit.modules.filteredItemBoost(lambda mod: mod.item.group.name == 'Warp Scrambler',
|
||||
'maxRange', src.getModifiedItemAttr('warpScrambleRangeBonus'),
|
||||
stackingPenalties=False)
|
||||
|
||||
|
||||
class Effect7184(BaseEffect):
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
class HandledListActionError(Exception):
|
||||
...
|
||||
@@ -96,8 +96,10 @@ class AttributeSlider(wx.Panel):
|
||||
self.ctrl = wx.SpinCtrlDouble(self, min=minValue, max=maxValue, inc=getStep(maxValue - minValue))
|
||||
self.ctrl.SetDigits(getDigitPlaces(minValue, maxValue))
|
||||
|
||||
|
||||
self.ctrl.Bind(wx.EVT_SPINCTRLDOUBLE, self.UpdateValue)
|
||||
# GTK scrolls spinboxes with mousewheel, others do not
|
||||
if "wxGTK" not in wx.PlatformInfo:
|
||||
self.ctrl.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
|
||||
|
||||
self.slider = AttributeGauge(self, size=(-1, 8))
|
||||
|
||||
@@ -124,6 +126,16 @@ class AttributeSlider(wx.Panel):
|
||||
if post_event:
|
||||
wx.PostEvent(self, ValueChanged(self, None, value, None, slider_percentage))
|
||||
|
||||
def OnMouseWheel(self, evt):
|
||||
if evt.GetWheelRotation() > 0 and evt.GetWheelAxis() == wx.MOUSE_WHEEL_VERTICAL:
|
||||
self.ctrl.Value = self.ctrl.Value + self.ctrl.Increment
|
||||
self.SetValue(self.ctrl.GetValue())
|
||||
elif evt.GetWheelRotation() < 0 and evt.GetWheelAxis() == wx.MOUSE_WHEEL_VERTICAL:
|
||||
self.ctrl.Value = self.ctrl.Value - self.ctrl.Increment
|
||||
self.SetValue(self.ctrl.GetValue())
|
||||
else:
|
||||
evt.Skip()
|
||||
|
||||
|
||||
class TestAttributeSlider(wx.Frame):
|
||||
|
||||
|
||||
@@ -67,8 +67,8 @@ class ContextMenu(metaclass=ABCMeta):
|
||||
(('marketItemGroup', 'Implant'),)
|
||||
(('fittingShip', 'Ship'),)
|
||||
"""
|
||||
cls._idxid = -1
|
||||
debug_start = len(cls._ids)
|
||||
ContextMenu._idxid = -1
|
||||
debug_start = len(ContextMenu._ids)
|
||||
|
||||
rootMenu = wx.Menu()
|
||||
rootMenu.info = {}
|
||||
@@ -95,7 +95,7 @@ class ContextMenu(metaclass=ABCMeta):
|
||||
bitmap = m._baseGetBitmap(srcContext, mainItem, selection)
|
||||
multiple = not isinstance(bitmap, wx.Bitmap)
|
||||
for it, text in enumerate(texts):
|
||||
id = cls.nextID()
|
||||
id = ContextMenu.nextID()
|
||||
check = m.checked
|
||||
rootItem = wx.MenuItem(rootMenu, id, text, kind=wx.ITEM_NORMAL if m.checked is None else wx.ITEM_CHECK)
|
||||
rootMenu.info[id] = (m, fullContext, it)
|
||||
@@ -104,7 +104,7 @@ class ContextMenu(metaclass=ABCMeta):
|
||||
|
||||
if sub is None:
|
||||
# if there is no sub menu, bind the handler to the rootItem
|
||||
rootMenu.Bind(wx.EVT_MENU, cls.handler, rootItem)
|
||||
rootMenu.Bind(wx.EVT_MENU, ContextMenu.handler, rootItem)
|
||||
elif sub:
|
||||
# If sub exists and is not False, set submenu.
|
||||
# Sub might return False when we have a mix of
|
||||
@@ -141,14 +141,14 @@ class ContextMenu(metaclass=ABCMeta):
|
||||
if display_amount > 0 and i != len(fullContexts) - 1:
|
||||
rootMenu.AppendSeparator()
|
||||
|
||||
debug_end = len(cls._ids)
|
||||
debug_end = len(ContextMenu._ids)
|
||||
if debug_end - debug_start:
|
||||
pyfalog.debug("{} new IDs created for this menu".format(debug_end - debug_start))
|
||||
|
||||
return rootMenu if empty is False else None
|
||||
|
||||
@classmethod
|
||||
def handler(cls, event):
|
||||
@staticmethod
|
||||
def handler(event):
|
||||
menu = event.EventObject
|
||||
stuff = menu.info.get(event.Id)
|
||||
if stuff is not None:
|
||||
@@ -162,21 +162,22 @@ class ContextMenu(metaclass=ABCMeta):
|
||||
else:
|
||||
event.Skip()
|
||||
|
||||
@classmethod
|
||||
def nextID(cls):
|
||||
@staticmethod
|
||||
def nextID():
|
||||
"""
|
||||
Fetches an ID from the pool of IDs allocated to Context Menu.
|
||||
If we don't have enough ID's to fulfill request, create new
|
||||
ID and add it to the pool.
|
||||
|
||||
See GH Issue #589
|
||||
See GH Issue #589.
|
||||
Has to be static method to properly handle modifications of primitives from subclasses (_idxid).
|
||||
"""
|
||||
cls._idxid += 1
|
||||
ContextMenu._idxid += 1
|
||||
|
||||
if cls._idxid >= len(cls._ids): # We don't ahve an ID for this index, create one
|
||||
cls._ids.append(wx.NewId())
|
||||
if ContextMenu._idxid >= len(ContextMenu._ids): # We don't ahve an ID for this index, create one
|
||||
ContextMenu._ids.append(wx.NewId())
|
||||
|
||||
return cls._ids[cls._idxid]
|
||||
return ContextMenu._ids[ContextMenu._idxid]
|
||||
|
||||
@property
|
||||
def checked(self):
|
||||
|
||||
@@ -2,7 +2,6 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
@@ -35,9 +34,8 @@ class CalcAddBoosterCommand(wx.Command):
|
||||
self.oldPosition, self.oldBoosterInfo = fit.boosters.makeRoom(newBooster)
|
||||
|
||||
if self.newPosition is not None:
|
||||
try:
|
||||
fit.boosters.insert(self.newPosition, newBooster)
|
||||
except HandledListActionError:
|
||||
fit.boosters.insert(self.newPosition, newBooster)
|
||||
if newBooster not in fit.boosters:
|
||||
pyfalog.warning('Failed to insert to list')
|
||||
cmd = CalcAddBoosterCommand(
|
||||
fitID=self.fitID,
|
||||
@@ -47,9 +45,8 @@ class CalcAddBoosterCommand(wx.Command):
|
||||
cmd.Do()
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
fit.boosters.append(newBooster)
|
||||
except HandledListActionError:
|
||||
fit.boosters.append(newBooster)
|
||||
if newBooster not in fit.boosters:
|
||||
pyfalog.warning('Failed to append to list')
|
||||
cmd = CalcAddBoosterCommand(
|
||||
fitID=self.fitID,
|
||||
|
||||
@@ -2,7 +2,6 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
@@ -25,9 +24,8 @@ class CalcAddCargoCommand(wx.Command):
|
||||
cargo.amount += self.cargoInfo.amount
|
||||
else:
|
||||
cargo = self.cargoInfo.toCargo()
|
||||
try:
|
||||
fit.cargo.append(cargo)
|
||||
except HandledListActionError:
|
||||
fit.cargo.append(cargo)
|
||||
if cargo not in fit.cargo:
|
||||
pyfalog.warning('Failed to append to list')
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
|
||||
@@ -3,7 +3,6 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from gui.fitCommands.helpers import DroneInfo, droneStackLimit
|
||||
from service.fit import Fit
|
||||
from service.market import Market
|
||||
@@ -50,9 +49,8 @@ class CalcAddLocalDroneCommand(wx.Command):
|
||||
if not self.ignoreRestrictions and not drone.fits(fit):
|
||||
pyfalog.warning('Drone does not fit')
|
||||
return False
|
||||
try:
|
||||
fit.drones.append(drone)
|
||||
except HandledListActionError:
|
||||
fit.drones.append(drone)
|
||||
if drone not in fit.drones:
|
||||
pyfalog.warning('Failed to append to list')
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
|
||||
@@ -2,7 +2,6 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from gui.fitCommands.helpers import DroneInfo
|
||||
from service.fit import Fit
|
||||
|
||||
@@ -48,9 +47,8 @@ class CalcRemoveLocalDroneCommand(wx.Command):
|
||||
drone = self.savedDroneInfo.toDrone()
|
||||
if drone is None:
|
||||
return False
|
||||
try:
|
||||
fit.drones.insert(self.position, drone)
|
||||
except HandledListActionError:
|
||||
fit.drones.insert(self.position, drone)
|
||||
if drone not in fit.drones:
|
||||
pyfalog.warning('Failed to insert to list')
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
|
||||
@@ -4,7 +4,6 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from gui.fitCommands.helpers import DroneInfo
|
||||
from service.fit import Fit
|
||||
|
||||
@@ -43,9 +42,8 @@ class CalcAddProjectedDroneCommand(wx.Command):
|
||||
if not drone.item.isType('projected'):
|
||||
pyfalog.debug('Drone is not projectable')
|
||||
return False
|
||||
try:
|
||||
fit.projectedDrones.append(drone)
|
||||
except HandledListActionError:
|
||||
fit.projectedDrones.append(drone)
|
||||
if drone not in fit.projectedDrones:
|
||||
pyfalog.warning('Failed to append to list')
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
|
||||
@@ -2,7 +2,6 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
@@ -41,18 +40,16 @@ class CalcAddLocalFighterCommand(wx.Command):
|
||||
fighter.active = True
|
||||
|
||||
if self.position is None:
|
||||
try:
|
||||
fit.fighters.append(fighter)
|
||||
except HandledListActionError:
|
||||
fit.fighters.append(fighter)
|
||||
if fighter not in fit.fighters:
|
||||
pyfalog.warning('Failed to append to list')
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
return False
|
||||
self.position = fit.fighters.index(fighter)
|
||||
else:
|
||||
try:
|
||||
fit.fighters.insert(self.position, fighter)
|
||||
except HandledListActionError:
|
||||
fit.fighters.insert(self.position, fighter)
|
||||
if fighter not in fit.fighters:
|
||||
pyfalog.warning('Failed to insert to list')
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
|
||||
@@ -2,7 +2,6 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
@@ -25,16 +24,14 @@ class CalcAddProjectedFighterCommand(wx.Command):
|
||||
return False
|
||||
fit = Fit.getInstance().getFit(self.fitID)
|
||||
if self.position is not None:
|
||||
try:
|
||||
fit.projectedFighters.insert(self.position, fighter)
|
||||
except HandledListActionError:
|
||||
fit.projectedFighters.insert(self.position, fighter)
|
||||
if fighter not in fit.projectedFighters:
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
fit.projectedFighters.append(fighter)
|
||||
except HandledListActionError:
|
||||
fit.projectedFighters.append(fighter)
|
||||
if fighter not in fit.projectedFighters:
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
return False
|
||||
|
||||
@@ -2,7 +2,6 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
@@ -35,9 +34,8 @@ class CalcAddImplantCommand(wx.Command):
|
||||
self.oldPosition, self.oldImplantInfo = fit.implants.makeRoom(newImplant)
|
||||
|
||||
if self.newPosition is not None:
|
||||
try:
|
||||
fit.implants.insert(self.newPosition, newImplant)
|
||||
except HandledListActionError:
|
||||
fit.implants.insert(self.newPosition, newImplant)
|
||||
if newImplant not in fit.implants:
|
||||
pyfalog.warning('Failed to insert to list')
|
||||
cmd = CalcAddImplantCommand(
|
||||
fitID=self.fitID,
|
||||
@@ -47,9 +45,8 @@ class CalcAddImplantCommand(wx.Command):
|
||||
cmd.Do()
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
fit.implants.append(newImplant)
|
||||
except HandledListActionError:
|
||||
fit.implants.append(newImplant)
|
||||
if newImplant not in fit.implants:
|
||||
pyfalog.warning('Failed to append to list')
|
||||
cmd = CalcAddImplantCommand(
|
||||
fitID=self.fitID,
|
||||
|
||||
@@ -2,8 +2,7 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from gui.fitCommands.helpers import restoreCheckedStates, stateLimit
|
||||
from gui.fitCommands.helpers import restoreCheckedStates, activeStateLimit
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
@@ -26,7 +25,7 @@ class CalcAddLocalModuleCommand(wx.Command):
|
||||
sFit = Fit.getInstance()
|
||||
fit = sFit.getFit(self.fitID)
|
||||
|
||||
newMod = self.newModInfo.toModule(fallbackState=stateLimit(self.newModInfo.itemID))
|
||||
newMod = self.newModInfo.toModule(fallbackState=activeStateLimit(self.newModInfo.itemID))
|
||||
if newMod is None:
|
||||
return False
|
||||
|
||||
@@ -55,9 +54,8 @@ class CalcAddLocalModuleCommand(wx.Command):
|
||||
if not newMod.fits(fit):
|
||||
pyfalog.warning('Module does not fit')
|
||||
return False
|
||||
try:
|
||||
fit.modules.append(newMod)
|
||||
except HandledListActionError:
|
||||
fit.modules.append(newMod)
|
||||
if newMod not in fit.modules:
|
||||
pyfalog.warning('Failed to append to list')
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
|
||||
@@ -4,7 +4,6 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from gui.fitCommands.helpers import restoreCheckedStates
|
||||
from service.fit import Fit
|
||||
|
||||
@@ -31,9 +30,8 @@ class CalcCloneLocalModuleCommand(wx.Command):
|
||||
return False
|
||||
if not fit.modules[self.dstPosition].isEmpty:
|
||||
return False
|
||||
try:
|
||||
fit.modules.replace(self.dstPosition, copyMod)
|
||||
except HandledListActionError:
|
||||
fit.modules.replace(self.dstPosition, copyMod)
|
||||
if copyMod not in fit.modules:
|
||||
pyfalog.warning('Failed to replace module')
|
||||
eos.db.commit()
|
||||
return False
|
||||
|
||||
@@ -2,8 +2,7 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from gui.fitCommands.helpers import ModuleInfo, restoreCheckedStates, stateLimit
|
||||
from gui.fitCommands.helpers import ModuleInfo, restoreCheckedStates, activeStateLimit
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
@@ -34,7 +33,7 @@ class CalcReplaceLocalModuleCommand(wx.Command):
|
||||
self.oldModInfo = ModuleInfo.fromModule(oldMod)
|
||||
if self.newModInfo == self.oldModInfo:
|
||||
return False
|
||||
newMod = self.newModInfo.toModule(fallbackState=stateLimit(self.newModInfo.itemID))
|
||||
newMod = self.newModInfo.toModule(fallbackState=activeStateLimit(self.newModInfo.itemID))
|
||||
if newMod is None:
|
||||
return False
|
||||
if newMod.slot != oldMod.slot:
|
||||
@@ -53,9 +52,8 @@ class CalcReplaceLocalModuleCommand(wx.Command):
|
||||
pyfalog.warning('Invalid charge')
|
||||
self.Undo()
|
||||
return False
|
||||
try:
|
||||
fit.modules.replace(self.position, newMod)
|
||||
except HandledListActionError:
|
||||
fit.modules.replace(self.position, newMod)
|
||||
if newMod not in fit.modules:
|
||||
pyfalog.warning('Failed to replace in list')
|
||||
self.Undo()
|
||||
return False
|
||||
@@ -87,9 +85,8 @@ class CalcReplaceLocalModuleCommand(wx.Command):
|
||||
if oldMod is None:
|
||||
return False
|
||||
fit.modules.free(self.position)
|
||||
try:
|
||||
fit.modules.replace(self.position, oldMod)
|
||||
except HandledListActionError:
|
||||
fit.modules.replace(self.position, oldMod)
|
||||
if oldMod not in fit.modules:
|
||||
pyfalog.warning('Failed to replace in list')
|
||||
self.Do()
|
||||
return False
|
||||
|
||||
@@ -2,7 +2,6 @@ import wx
|
||||
from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.exception import HandledListActionError
|
||||
from service.fit import Fit
|
||||
|
||||
|
||||
@@ -33,16 +32,14 @@ class CalcSwapLocalModuleCommand(wx.Command):
|
||||
mod2 = fit.modules[position2]
|
||||
fit.modules.free(position1)
|
||||
fit.modules.free(position2)
|
||||
try:
|
||||
fit.modules.replace(position2, mod1)
|
||||
except HandledListActionError:
|
||||
fit.modules.replace(position2, mod1)
|
||||
if len(fit.modules) <= position2 or fit.modules[position2] is not mod1:
|
||||
fit.modules.replace(position1, mod1)
|
||||
fit.modules.replace(position2, mod2)
|
||||
eos.db.commit()
|
||||
return False
|
||||
try:
|
||||
fit.modules.replace(position1, mod2)
|
||||
except HandledListActionError:
|
||||
fit.modules.replace(position1, mod2)
|
||||
if len(fit.modules) <= position1 or fit.modules[position1] is not mod2:
|
||||
fit.modules.free(position2)
|
||||
fit.modules.replace(position1, mod1)
|
||||
fit.modules.replace(position2, mod2)
|
||||
|
||||
@@ -3,7 +3,6 @@ from logbook import Logger
|
||||
|
||||
import eos.db
|
||||
from eos.const import FittingModuleState
|
||||
from eos.exception import HandledListActionError
|
||||
from gui.fitCommands.helpers import restoreCheckedStates
|
||||
from service.fit import Fit
|
||||
|
||||
@@ -39,16 +38,14 @@ class CalcAddProjectedModuleCommand(wx.Command):
|
||||
self.oldPosition, self.oldModInfo = fit.projectedModules.makeRoom(newMod)
|
||||
|
||||
if self.newPosition is not None:
|
||||
try:
|
||||
fit.projectedModules.insert(self.newPosition, newMod)
|
||||
except HandledListActionError:
|
||||
fit.projectedModules.insert(self.newPosition, newMod)
|
||||
if newMod not in fit.projectedModules:
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
return False
|
||||
else:
|
||||
try:
|
||||
fit.projectedModules.append(newMod)
|
||||
except HandledListActionError:
|
||||
fit.projectedModules.append(newMod)
|
||||
if newMod not in fit.projectedModules:
|
||||
if self.commit:
|
||||
eos.db.commit()
|
||||
return False
|
||||
|
||||
@@ -317,7 +317,7 @@ class CargoInfo:
|
||||
return makeReprStr(self, ['itemID', 'amount'])
|
||||
|
||||
|
||||
def stateLimit(itemIdentity):
|
||||
def activeStateLimit(itemIdentity):
|
||||
item = Market.getInstance().getItem(itemIdentity)
|
||||
if {'moduleBonusAssaultDamageControl', 'moduleBonusIndustrialInvulnerability'}.intersection(item.effects):
|
||||
return FittingModuleState.ONLINE
|
||||
|
||||
@@ -146,8 +146,8 @@ class ItemStatsDialog(wx.Dialog):
|
||||
event.Skip()
|
||||
|
||||
def closeEvent(self, event):
|
||||
self.closeWindow()
|
||||
self.container.onParentClose()
|
||||
self.closeWindow()
|
||||
event.Skip()
|
||||
|
||||
def closeWindow(self):
|
||||
|
||||
@@ -134,7 +134,7 @@ class MarketBrowser(wx.Panel):
|
||||
@mode.setter
|
||||
def mode(self, newMode):
|
||||
oldMode = self.__mode
|
||||
if newMode == oldMode:
|
||||
if newMode == oldMode != 'search':
|
||||
return
|
||||
# Store meta button states when switching from normal
|
||||
if oldMode == 'normal':
|
||||
|
||||
@@ -23,6 +23,7 @@ from collections import OrderedDict
|
||||
|
||||
from logbook import Logger
|
||||
|
||||
from eos.const import FittingModuleState, FittingSlot
|
||||
from eos.saveddata.cargo import Cargo
|
||||
from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.drone import Drone
|
||||
@@ -30,7 +31,7 @@ from eos.saveddata.fighter import Fighter
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.saveddata.module import Module
|
||||
from eos.saveddata.ship import Ship
|
||||
from eos.const import FittingSlot, FittingModuleState
|
||||
from gui.fitCommands.helpers import activeStateLimit
|
||||
from service.fit import Fit as svcFit
|
||||
from service.market import Market
|
||||
|
||||
@@ -111,7 +112,7 @@ def importDna(string, fitName=None):
|
||||
else:
|
||||
m.owner = f
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
m.state = activeStateLimit(m.item)
|
||||
moduleList.append(m)
|
||||
|
||||
# Recalc to get slot numbers correct for T3 cruisers
|
||||
@@ -123,7 +124,7 @@ def importDna(string, fitName=None):
|
||||
if module.fits(f):
|
||||
module.owner = f
|
||||
if module.isValidState(FittingModuleState.ACTIVE):
|
||||
module.state = FittingModuleState.ACTIVE
|
||||
module.state = activeStateLimit(module.item)
|
||||
f.modules.append(module)
|
||||
|
||||
return f
|
||||
|
||||
@@ -22,18 +22,19 @@ import re
|
||||
|
||||
from logbook import Logger
|
||||
|
||||
from eos.const import FittingModuleState, FittingSlot
|
||||
from eos.db.gamedata.queries import getDynamicItem
|
||||
from eos.saveddata.booster import Booster
|
||||
from eos.saveddata.cargo import Cargo
|
||||
from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.booster import Booster
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.fighter import Fighter
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.saveddata.implant import Implant
|
||||
from eos.saveddata.module import Module
|
||||
from eos.saveddata.ship import Ship
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.const import FittingSlot, FittingModuleState
|
||||
from service.const import PortEftOptions, PortEftRigSize
|
||||
from gui.fitCommands.helpers import activeStateLimit
|
||||
from service.const import PortEftOptions
|
||||
from service.fit import Fit as svcFit
|
||||
from service.market import Market
|
||||
from service.port.muta import parseMutant, renderMutant
|
||||
@@ -443,7 +444,7 @@ def importEftCfg(shipname, lines, iportuser):
|
||||
m.owner = fitobj
|
||||
# Activate mod if it is activable
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
m.state = activeStateLimit(m.item)
|
||||
# Add charge to mod if applicable, on any errors just don't add anything
|
||||
if chargeName:
|
||||
try:
|
||||
@@ -804,7 +805,7 @@ class AbstractFit:
|
||||
if itemSpec.offline and m.isValidState(FittingModuleState.OFFLINE):
|
||||
m.state = FittingModuleState.OFFLINE
|
||||
elif m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
m.state = activeStateLimit(m.item)
|
||||
return m
|
||||
|
||||
def addImplant(self, itemSpec):
|
||||
|
||||
@@ -23,14 +23,15 @@ import json
|
||||
|
||||
from logbook import Logger
|
||||
|
||||
from eos.const import FittingModuleState, FittingSlot
|
||||
from eos.saveddata.cargo import Cargo
|
||||
from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.drone import Drone
|
||||
from eos.saveddata.fighter import Fighter
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.saveddata.module import Module
|
||||
from eos.const import FittingSlot, FittingModuleState
|
||||
from eos.saveddata.ship import Ship
|
||||
from gui.fitCommands.helpers import activeStateLimit
|
||||
from service.fit import Fit as svcFit
|
||||
from service.market import Market
|
||||
|
||||
@@ -196,7 +197,7 @@ def importESI(string):
|
||||
fitobj.modules.append(m)
|
||||
else:
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
m.state = activeStateLimit(m.item)
|
||||
|
||||
moduleList.append(m)
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@ import xml.parsers.expat
|
||||
|
||||
from logbook import Logger
|
||||
|
||||
from eos.const import FittingModuleState, FittingSlot
|
||||
from eos.saveddata.cargo import Cargo
|
||||
from eos.saveddata.citadel import Citadel
|
||||
from eos.saveddata.drone import Drone
|
||||
@@ -30,12 +31,11 @@ from eos.saveddata.fighter import Fighter
|
||||
from eos.saveddata.fit import Fit
|
||||
from eos.saveddata.module import Module
|
||||
from eos.saveddata.ship import Ship
|
||||
from eos.const import FittingSlot, FittingModuleState
|
||||
from gui.fitCommands.helpers import activeStateLimit
|
||||
from service.fit import Fit as svcFit
|
||||
from service.market import Market
|
||||
from utils.strfunctions import sequential_rep, replace_ltgt
|
||||
|
||||
from service.port.shared import IPortUser, processing_notify
|
||||
from utils.strfunctions import replace_ltgt, sequential_rep
|
||||
|
||||
|
||||
pyfalog = Logger(__name__)
|
||||
@@ -200,7 +200,7 @@ def importXml(text, iportuser):
|
||||
fitobj.modules.append(m)
|
||||
else:
|
||||
if m.isValidState(FittingModuleState.ACTIVE):
|
||||
m.state = FittingModuleState.ACTIVE
|
||||
m.state = activeStateLimit(m.item)
|
||||
|
||||
moduleList.append(m)
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
version: v2.9.2
|
||||
version: v2.9.3
|
||||
|
||||
Reference in New Issue
Block a user