Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/pyfa-org/development' into Catchup
Browse files Browse the repository at this point in the history
# Conflicts:
#	.appveyor.yml
#	config.py
#	eos/gamedata.py
#	eos/saveddata/fit.py
#	gui/builtinContextMenus/changeAffectingSkills.py
#	gui/builtinPreferenceViews/pyfaDatabasePreferences.py
#	gui/builtinPreferenceViews/pyfaGeneralPreferences.py
#	gui/itemStats.py
#	gui/marketBrowser.py
#	gui/notesView.py
#	gui/utils/helpers_wxPython.py
#	requirements.txt
#	service/fit.py
#	service/settings.py
#	setup.py
#	tests/test_modules/test_eos/test_saveddata/test_fit_2.py
  • Loading branch information
Ebag333 committed May 11, 2017
2 parents 8b25a60 + f734931 commit b4d1ea7
Show file tree
Hide file tree
Showing 5 changed files with 108 additions and 3 deletions.
78 changes: 78 additions & 0 deletions eos/saveddata/booster.py
Expand Up @@ -64,6 +64,29 @@ def build(self):
self.__itemModifiedAttributes.overrides = self.__item.overrides
self.__slot = self.__calculateSlot(self.__item)

# Legacy booster side effect code, disabling as not currently implemented
'''
for effect in self.__item.effects.itervalues():
if effect.isType("boosterSideEffect"):
s = SideEffect(self)
s.effect = effect
s.active = effect.ID in self.__activeSideEffectIDs
self.__sideEffects.append(s)
'''

# Legacy booster side effect code, disabling as not currently implemented
'''
def iterSideEffects(self):
return self.__sideEffects.__iter__()
def getSideEffect(self, name):
for sideEffect in self.iterSideEffects():
if sideEffect.effect.name == name:
return sideEffect
raise KeyError("SideEffect with %s as name not found" % name)
'''

@property
def itemModifiedAttributes(self):
return self.__itemModifiedAttributes
Expand Down Expand Up @@ -101,6 +124,13 @@ def calculateModifiedAttributes(self, fit, runTime, forceProjected=False):
effect.activeByDefault:
effect.handler(fit, self, ("booster",))

# Legacy booster code, not fully implemented
'''
for sideEffect in self.iterSideEffects():
if sideEffect.active and sideEffect.effect.runTime == runTime:
sideEffect.effect.handler(fit, self, ("boosterSideEffect",))
'''

@validates("ID", "itemID", "ammoID", "active")
def validator(self, key, val):
map = {
Expand All @@ -120,4 +150,52 @@ def __deepcopy__(self, memo):
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
'''

return copy


# Legacy booster side effect code, disabling as not currently implemented
'''
class SideEffect(object):
def __init__(self, owner):
self.__owner = owner
self.__active = False
self.__effect = None
@property
def active(self):
return self.__active
@active.setter
def active(self, active):
if not isinstance(active, bool):
raise TypeError("Expecting a bool, not a " + type(active))
if active != self.__active:
if active:
self.__owner._Booster__activeSideEffectIDs.append(self.effect.ID)
else:
self.__owner._Booster__activeSideEffectIDs.remove(self.effect.ID)
self.__active = active
@property
def effect(self):
return self.__effect
@effect.setter
def effect(self, effect):
if not hasattr(effect, "handler"):
raise TypeError("Need an effect with a handler")
self.__effect = effect
'''
3 changes: 2 additions & 1 deletion eos/saveddata/fit.py
Expand Up @@ -469,7 +469,7 @@ def addCommandBonus(self, warfareBuffID, value, module, effect, runTime="normal"
self.commandBonuses[warfareBuffID] = (runTime, value, module, effect)

def __runCommandBoosts(self, runTime="normal"):
pyfalog.debug("Applying gang boosts for {0}", self.ID)
pyfalog.debug("Applying gang boosts for {0}", repr(self))
for warfareBuffID in self.commandBonuses.keys():
# Unpack all data required to run effect properly
effect_runTime, value, thing, effect = self.commandBonuses[warfareBuffID]
Expand Down Expand Up @@ -750,6 +750,7 @@ def calculateModifiedFitAttributes(self, targetFit=None):
pyfalog.debug("Fit has already been calculated and is not projected, returning: {0}", self)
return

# Loop through our run times here. These determine which effects are run in which order.
for runTime in ("early", "normal", "late"):
pyfalog.debug("Run time: {0}", runTime)
u = [
Expand Down
7 changes: 6 additions & 1 deletion gui/characterSelection.py
Expand Up @@ -155,12 +155,16 @@ def selectChar(self, charID):
return False

def fitChanged(self, event):
"""
When fit is changed, or new fit is selected
"""
self.charChoice.Enable(event.fitID is not None)
choice = self.charChoice
sFit = Fit.getInstance()
currCharID = choice.GetClientData(choice.GetCurrentSelection())
fit = sFit.getFit(event.fitID)
newCharID = fit.character.ID if fit is not None else None

if event.fitID is None:
self.skillReqsStaticBitmap.SetBitmap(self.cleanSkills)
self.skillReqsStaticBitmap.SetToolTipString("No active fit")
Expand Down Expand Up @@ -198,7 +202,8 @@ def fitChanged(self, event):

elif currCharID != newCharID:
self.selectChar(newCharID)
self.charChanged(None)
if not fit.calculated:
self.charChanged(None)

event.Skip()

Expand Down
1 change: 1 addition & 0 deletions requirements_build_windows.txt
@@ -1,4 +1,5 @@
PyInstaller >= 3.2.1
cx_freeze == 4.3.4
cycler >= 0.10.0
functools32 >= 3.2.3
future >= 0.16.0
Expand Down
22 changes: 21 additions & 1 deletion setup.py
Expand Up @@ -24,6 +24,24 @@
# noinspection PyPackageRequirements,PyUnresolvedReferences
from cx_Freeze import setup, Executable
import config
import tempfile
import os
import zipfile
import shutil
tmpdir = tempfile.mkdtemp()

imagesFile = os.path.join(tmpdir, "imgs.zip")

def zipdir(path, zip):
for root, dirs, files in os.walk(path):
for file in files:
zip.write(os.path.join(root, file))

os.chdir('imgs')
with zipfile.ZipFile(imagesFile, 'w') as images:
for dir in icon_dirs:
zipdir(dir, images)
os.chdir('..')

app_name = 'pyfa'
app_version = '{}'.format(config.version)
Expand All @@ -32,7 +50,7 @@
# Windows-specific options
build_options_winexe = {
'packages' : packages,
'include_files': include_files,
'include_files': include_files+[imagesFile],
'includes' : includes,
'excludes' : excludes,
'compressed' : True,
Expand Down Expand Up @@ -80,3 +98,5 @@
},
executables=[Executable(**executable_options)]
)

shutil.rmtree(tmpdir)

0 comments on commit b4d1ea7

Please sign in to comment.