This commit is contained in:
blitzmann
2018-07-15 02:38:08 -04:00
7 changed files with 45 additions and 15 deletions

View File

@@ -73,4 +73,7 @@ exe = EXE(pyz,
app = BUNDLE(exe,
name='pyfa.app',
icon=icon,
bundle_identifier=None)
bundle_identifier=None,
info_plist={
'NSHighResolutionCapable': 'True'
})

View File

@@ -56,7 +56,7 @@ fits_table = Table("fits", saveddata_meta,
Column("booster", Boolean, nullable=False, index=True, default=0),
Column("targetResistsID", ForeignKey("targetResists.ID"), nullable=True),
Column("modeID", Integer, nullable=True),
Column("implantLocation", Integer, nullable=False, default=ImplantLocation.FIT),
Column("implantLocation", Integer, nullable=False),
Column("notes", String, nullable=True),
Column("ignoreRestrictions", Boolean, default=0),
Column("created", DateTime, nullable=True, default=datetime.datetime.now),

View File

@@ -142,14 +142,8 @@ class Booster(HandledItem, ItemAttrShortcut):
copy = Booster(self.item)
copy.active = self.active
# Legacy booster side effect code, disabling as not currently implemented
'''
origSideEffects = list(self.iterSideEffects())
copySideEffects = list(copy.iterSideEffects())
i = 0
while i < len(origSideEffects):
copySideEffects[i].active = origSideEffects[i].active
i += 1
'''
for sideEffect in self.sideEffects:
copyEffect = next(filter(lambda eff: eff.effectID == sideEffect.effectID, copy.sideEffects))
copyEffect.active = sideEffect.active
return copy

View File

@@ -291,6 +291,10 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def __deepcopy__(self, memo):
copy = Fighter(self.item)
copy.amount = self.amount
copy.active = self.active
for ability in self.abilities:
copyAbility = next(filter(lambda a: a.effectID == ability.effectID, copy.abilities))
copyAbility.active = ability.active
return copy
def fits(self, fit):

View File

@@ -1580,6 +1580,7 @@ class Fit(object):
copy_ship.name = "%s copy" % self.name
copy_ship.damagePattern = self.damagePattern
copy_ship.targetResists = self.targetResists
copy_ship.implantLocation = self.implantLocation
copy_ship.notes = self.notes
toCopy = (
@@ -1598,12 +1599,27 @@ class Fit(object):
for i in orig:
c.append(deepcopy(i))
for fit in self.projectedFits:
copy_ship.__projectedFits[fit.ID] = fit
# this bit is required -- see GH issue # 83
# this bit is required -- see GH issue # 83
def forceUpdateSavedata(fit):
eos.db.saveddata_session.flush()
eos.db.saveddata_session.refresh(fit)
for fit in self.commandFits:
copy_ship.__commandFits[fit.ID] = fit
forceUpdateSavedata(fit)
copyCommandInfo = fit.getCommandInfo(copy_ship.ID)
originalCommandInfo = fit.getCommandInfo(self.ID)
copyCommandInfo.active = originalCommandInfo.active
forceUpdateSavedata(fit)
for fit in self.projectedFits:
copy_ship.__projectedFits[fit.ID] = fit
forceUpdateSavedata(fit)
copyProjectionInfo = fit.getProjectionInfo(copy_ship.ID)
originalProjectionInfo = fit.getProjectionInfo(self.ID)
copyProjectionInfo.active = originalProjectionInfo.active
forceUpdateSavedata(fit)
return copy_ship
def __repr__(self):

View File

@@ -38,6 +38,10 @@ class PFGeneralPref(PreferenceView):
0)
mainSizer.Add(self.cbGlobalChar, 0, wx.ALL | wx.EXPAND, 5)
self.cbDefaultCharImplants = wx.CheckBox(panel, wx.ID_ANY, "Use character implants by default for new fits",
wx.DefaultPosition, wx.DefaultSize, 0)
mainSizer.Add(self.cbDefaultCharImplants, 0, wx.ALL | wx.EXPAND, 5)
self.cbGlobalDmgPattern = wx.CheckBox(panel, wx.ID_ANY, "Use global damage pattern", wx.DefaultPosition,
wx.DefaultSize, 0)
mainSizer.Add(self.cbGlobalDmgPattern, 0, wx.ALL | wx.EXPAND, 5)
@@ -119,6 +123,7 @@ class PFGeneralPref(PreferenceView):
self.sFit = Fit.getInstance()
self.cbGlobalChar.SetValue(self.sFit.serviceFittingOptions["useGlobalCharacter"])
self.cbDefaultCharImplants.SetValue(self.sFit.serviceFittingOptions["useCharacterImplantsByDefault"])
self.cbGlobalDmgPattern.SetValue(self.sFit.serviceFittingOptions["useGlobalDamagePattern"])
self.cbFitColorSlots.SetValue(self.sFit.serviceFittingOptions["colorFitBySlot"] or False)
self.cbRackSlots.SetValue(self.sFit.serviceFittingOptions["rackSlots"] or False)
@@ -136,6 +141,7 @@ class PFGeneralPref(PreferenceView):
self.intDelay.SetValue(self.sFit.serviceFittingOptions["marketSearchDelay"])
self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange)
self.cbDefaultCharImplants.Bind(wx.EVT_CHECKBOX, self.OnCBDefaultCharImplantsStateChange)
self.cbGlobalDmgPattern.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalDmgPatternStateChange)
self.cbFitColorSlots.Bind(wx.EVT_CHECKBOX, self.onCBGlobalColorBySlot)
self.cbRackSlots.Bind(wx.EVT_CHECKBOX, self.onCBGlobalRackSlots)
@@ -187,6 +193,10 @@ class PFGeneralPref(PreferenceView):
self.sFit.serviceFittingOptions["useGlobalCharacter"] = self.cbGlobalChar.GetValue()
event.Skip()
def OnCBDefaultCharImplantsStateChange(self, event):
self.sFit.serviceFittingOptions["useCharacterImplantsByDefault"] = self.cbDefaultCharImplants.GetValue()
event.Skip()
def OnCBGlobalDmgPatternStateChange(self, event):
self.sFit.serviceFittingOptions["useGlobalDamagePattern"] = self.cbGlobalDmgPattern.GetValue()
event.Skip()

View File

@@ -33,7 +33,7 @@ from eos.saveddata.fighter import Fighter as es_Fighter
from eos.saveddata.implant import Implant as es_Implant
from eos.saveddata.ship import Ship as es_Ship
from eos.saveddata.module import Module as es_Module, State, Slot
from eos.saveddata.fit import Fit as FitType
from eos.saveddata.fit import Fit as FitType, ImplantLocation
from service.character import Character
from service.damagePattern import DamagePattern
from service.settings import SettingsProvider
@@ -61,6 +61,7 @@ class Fit(object):
serviceFittingDefaultOptions = {
"useGlobalCharacter": False,
"useCharacterImplantsByDefault": True,
"useGlobalDamagePattern": False,
"defaultCharacter": self.character.ID,
"useGlobalForceReload": False,
@@ -147,6 +148,8 @@ class Fit(object):
fit.targetResists = self.targetResists
fit.character = self.character
fit.booster = self.booster
useCharImplants = self.serviceFittingOptions["useCharacterImplantsByDefault"]
fit.implantLocation = ImplantLocation.CHARACTER if useCharImplants else ImplantLocation.FIT
eos.db.save(fit)
self.recalc(fit)
return fit.ID