From 9f580597fd6af3635cb6eb534d4a74c67a3871c9 Mon Sep 17 00:00:00 2001 From: Felix Wehnert Date: Mon, 2 Jul 2018 18:55:48 +0200 Subject: [PATCH 1/4] Make pyfa retina ready MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This should help pyfa to look better on macOS 📺 --- dist_assets/mac/pyfa.spec | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dist_assets/mac/pyfa.spec b/dist_assets/mac/pyfa.spec index da72e4681..cf27cfe87 100644 --- a/dist_assets/mac/pyfa.spec +++ b/dist_assets/mac/pyfa.spec @@ -73,4 +73,7 @@ exe = EXE(pyz, app = BUNDLE(exe, name='pyfa.app', icon=icon, - bundle_identifier=None) \ No newline at end of file + bundle_identifier=None, + info_plist={ + 'NSHighResolutionCapable': 'True' + }) From 1699b8ceee5a51db1411f708e69de259a79cb14a Mon Sep 17 00:00:00 2001 From: Maru Maru Date: Wed, 11 Jul 2018 05:35:19 -0400 Subject: [PATCH 2/4] Add ability to use character implants by default --- eos/db/saveddata/fit.py | 2 +- eos/saveddata/fit.py | 1 + gui/builtinPreferenceViews/pyfaGeneralPreferences.py | 10 ++++++++++ service/fit.py | 9 ++++++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/eos/db/saveddata/fit.py b/eos/db/saveddata/fit.py index 07375dcaf..0ae4509e2 100644 --- a/eos/db/saveddata/fit.py +++ b/eos/db/saveddata/fit.py @@ -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), diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index d44f8adca..1788b96eb 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -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 = ( diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py index 412e1a988..a31e56f8a 100644 --- a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -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() diff --git a/service/fit.py b/service/fit.py index dccb58e5e..fcb1dbdb7 100644 --- a/service/fit.py +++ b/service/fit.py @@ -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 @@ -198,7 +201,11 @@ class Fit(object): def copyFit(fitID): pyfalog.debug("Creating copy of fit ID: {0}", fitID) fit = eos.db.getFit(fitID) + pyfalog.error(fit.name) + pyfalog.error(fit.implantLocation) newFit = copy.deepcopy(fit) + pyfalog.error(newFit.name) + pyfalog.error(newFit.implantLocation) eos.db.save(newFit) return newFit.ID From 7a4c7a8f9ffb86a497c042d15c93e2b7be4432ea Mon Sep 17 00:00:00 2001 From: MaruMaruOO Date: Wed, 11 Jul 2018 10:28:39 -0400 Subject: [PATCH 3/4] Removed excess diagnostic information --- service/fit.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/service/fit.py b/service/fit.py index fcb1dbdb7..98c962534 100644 --- a/service/fit.py +++ b/service/fit.py @@ -201,11 +201,7 @@ class Fit(object): def copyFit(fitID): pyfalog.debug("Creating copy of fit ID: {0}", fitID) fit = eos.db.getFit(fitID) - pyfalog.error(fit.name) - pyfalog.error(fit.implantLocation) newFit = copy.deepcopy(fit) - pyfalog.error(newFit.name) - pyfalog.error(newFit.implantLocation) eos.db.save(newFit) return newFit.ID From d5aee34aa89abcaeea3a5b0e954e8e3dbddb2a07 Mon Sep 17 00:00:00 2001 From: MaruMaruOO Date: Thu, 12 Jul 2018 07:35:14 -0400 Subject: [PATCH 4/4] Added missing data to fit copying --- eos/saveddata/booster.py | 12 +++--------- eos/saveddata/fighter.py | 4 ++++ eos/saveddata/fit.py | 22 +++++++++++++++++++--- 3 files changed, 26 insertions(+), 12 deletions(-) diff --git a/eos/saveddata/booster.py b/eos/saveddata/booster.py index 655a3d3f1..4c6bf23db 100644 --- a/eos/saveddata/booster.py +++ b/eos/saveddata/booster.py @@ -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 diff --git a/eos/saveddata/fighter.py b/eos/saveddata/fighter.py index 180838e31..694970343 100644 --- a/eos/saveddata/fighter.py +++ b/eos/saveddata/fighter.py @@ -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): diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index d44f8adca..8f5cc2b36 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -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):