Merge branch 'master' of https://github.com/pyfa-org/Pyfa into development

This commit is contained in:
blitzman
2017-02-07 00:32:52 -05:00
40 changed files with 181 additions and 127 deletions

2
.gitattributes vendored
View File

@@ -14,7 +14,7 @@
*.py3 text eol=crlf *.py3 text eol=crlf
*.pyw text eol=crlf *.pyw text eol=crlf
*.pyx text eol=crlf *.pyx text eol=crlf
pyfa.py text eol=lf
# Denote all files that are truly binary and should not be modified. # Denote all files that are truly binary and should not be modified.
# Binary files # Binary files

32
ISSUE_TEMPLATE.md Normal file
View File

@@ -0,0 +1,32 @@
# Submit a bug report bug report or feature request
Here you can inform pyfa developers of potential bugs or suggest features / improvements to the project. Please check
to make sure that the bug hasn't been reported or feature requested before submitting. If you have general questions
about the project and want to reach out to the developers personally, please check out out our [Slack]
(https://pyfainvite.azurewebsites.net/).
---
## Bug Report
### Expected behavior:
### Actual behavior:
### Detailed steps to reproduce:
### Fits involved in EFT format (Edit > To Clipboard > EFT):
### Release or development git branch? Please note the release version or commit hash:
### Operating system and version (eg: Windows 10, OS X 10.9, OS X 10.11, Ubuntu 16.10):
### Other relevant information:

View File

@@ -23,16 +23,20 @@ from sqlalchemy.orm import relation, mapper, synonym
from eos.db import gamedata_meta from eos.db import gamedata_meta
from eos.types import AlphaClone, AlphaCloneSkill from eos.types import AlphaClone, AlphaCloneSkill
alphaclones_table = Table("alphaClones", gamedata_meta, alphaclones_table = Table(
Column("alphaCloneID", Integer, primary_key=True), "alphaClones",
Column("alphaCloneName", String), gamedata_meta,
) Column("alphaCloneID", Integer, primary_key=True),
Column("alphaCloneName", String),
)
alphacloneskskills_table = Table("alphaCloneSkills", gamedata_meta, alphacloneskskills_table = Table(
Column("alphaCloneID", Integer, ForeignKey("alphaClones.alphaCloneID"), primary_key=True), "alphaCloneSkills",
Column("typeID", Integer, primary_key=True), gamedata_meta,
Column("level", Integer), Column("alphaCloneID", Integer, ForeignKey("alphaClones.alphaCloneID"), primary_key=True),
) Column("typeID", Integer, primary_key=True),
Column("level", Integer),
)
mapper(AlphaClone, alphaclones_table, mapper(AlphaClone, alphaclones_table,
properties={ properties={

View File

@@ -33,7 +33,7 @@ class DatabaseCleanup:
results = saveddata_engine.execute(query) results = saveddata_engine.execute(query)
return results return results
except sqlalchemy.exc.DatabaseError: except sqlalchemy.exc.DatabaseError:
logger.error("Failed to connect to database or error executing query:\n%s",query) logger.error("Failed to connect to database or error executing query:\n%s", query)
return None return None
@staticmethod @staticmethod

View File

@@ -22,11 +22,8 @@ from sqlalchemy.sql import and_
from eos.db import saveddata_session, sd_lock from eos.db import saveddata_session, sd_lock
from eos.db.saveddata.fit import projectedFits_table from eos.db.saveddata.fit import projectedFits_table
from eos.db.util import processEager, processWhere from eos.db.util import processEager, processWhere
from eos.db import saveddata_session, sd_lock
from eos.types import * from eos.types import *
from eos.db.saveddata.fit import projectedFits_table
from sqlalchemy.sql import and_
import eos.config import eos.config
configVal = getattr(eos.config, "saveddataCache", None) configVal = getattr(eos.config, "saveddataCache", None)

View File

@@ -4,7 +4,8 @@
# Items from market group: Ammunition & Charges > Command Burst Charges (15 of 15) # Items from market group: Ammunition & Charges > Command Burst Charges (15 of 15)
type = "active" type = "active"
def handler(fit, module, context): def handler(fit, module, context):
for x in xrange(1, 4): for x in xrange(1, 4):
value = module.getModifiedChargeAttr("warfareBuff{}Multiplier".format(x)) value = module.getModifiedChargeAttr("warfareBuff{}Multiplier".format(x))
module.multiplyItemAttr("warfareBuff{}Value".format(x), value) module.multiplyItemAttr("warfareBuff{}Value".format(x), value)

View File

@@ -1,5 +1,7 @@
# Not used by any item # Not used by any item
type = "passive" type = "passive"
def handler(fit, module, context): def handler(fit, module, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command Specialist"), fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Information Command Specialist"),
"commandBonusHidden", module.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships") "commandBonusHidden", module.getModifiedItemAttr("eliteBonusCommandShips3"), skill="Command Ships")

View File

@@ -3,6 +3,8 @@
# Used by: # Used by:
# Ship: Rabisu # Ship: Rabisu
type = "passive" type = "passive"
def handler(fit, src, context): def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "falloffEffectiveness", src.getModifiedItemAttr("eliteBonusLogistics1"), skill="Logistics Cruisers") fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "falloffEffectiveness", src.getModifiedItemAttr("eliteBonusLogistics1"), skill="Logistics Cruisers")
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "maxRange", src.getModifiedItemAttr("eliteBonusLogistics1"), skill="Logistics Cruisers") fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "maxRange", src.getModifiedItemAttr("eliteBonusLogistics1"), skill="Logistics Cruisers")

View File

@@ -5,8 +5,7 @@ type = "active", "projected"
def handler(fit, src, context): def handler(fit, src, context):
if "projected" in context and ( if "projected" in context and ((hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")):
(hasattr(src, "state") and src.state >= State.ACTIVE) or hasattr(src, "amountActive")):
multiplier = src.amountActive if hasattr(src, "amountActive") else 1 multiplier = src.amountActive if hasattr(src, "amountActive") else 1
amount = src.getModifiedItemAttr("energyNeutralizerAmount") amount = src.getModifiedItemAttr("energyNeutralizerAmount")
time = src.getModifiedItemAttr("duration") time = src.getModifiedItemAttr("duration")

View File

@@ -4,6 +4,8 @@
# Modules named like: Drone Mining Augmentor (8 of 8) # Modules named like: Drone Mining Augmentor (8 of 8)
# Skill: Ice Harvesting Drone Operation # Skill: Ice Harvesting Drone Operation
type = "passive" type = "passive"
def handler(fit, src, context): def handler(fit, src, context):
lvl = src.level if "skill" in context else 1 lvl = src.level if "skill" in context else 1
fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Operation"), "duration", src.getModifiedItemAttr("rofBonus") * lvl) fit.drones.filteredItemBoost(lambda mod: mod.item.requiresSkill("Ice Harvesting Drone Operation"), "duration", src.getModifiedItemAttr("rofBonus") * lvl)

View File

@@ -3,9 +3,11 @@
# Used by: # Used by:
# Skill: Mining Director # Skill: Mining Director
type = "passive" type = "passive"
def handler(fit, src, context): def handler(fit, src, context):
lvl = src.level lvl = src.level
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff4Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl)
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff3Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl)
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff2Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl)
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Mining Foreman"), "warfareBuff1Value", src.getModifiedItemAttr("commandStrengthBonus") * lvl)

View File

@@ -13,6 +13,8 @@ which warfareBuffID to run (shouldn't need this right now, but better safe than
''' '''
type = "active", "gang" type = "active", "gang"
def handler(fit, module, context, **kwargs): def handler(fit, module, context, **kwargs):
for x in xrange(1, 5): for x in xrange(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)): if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
@@ -21,5 +23,3 @@ def handler(fit, module, context, **kwargs):
if id: if id:
fit.addCommandBonus(id, value, module, kwargs['effect']) fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -4,6 +4,8 @@
# Variations of module: Information Command Burst I (2 of 2) # Variations of module: Information Command Burst I (2 of 2)
type = "active", "gang" type = "active", "gang"
def handler(fit, module, context, **kwargs): def handler(fit, module, context, **kwargs):
for x in xrange(1, 5): for x in xrange(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)): if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
@@ -11,4 +13,4 @@ def handler(fit, module, context, **kwargs):
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x)) id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))
if id: if id:
fit.addCommandBonus(id, value, module, kwargs['effect']) fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -4,6 +4,8 @@
# Variations of module: Mining Foreman Burst I (2 of 2) # Variations of module: Mining Foreman Burst I (2 of 2)
type = "active", "gang" type = "active", "gang"
def handler(fit, module, context, **kwargs): def handler(fit, module, context, **kwargs):
for x in xrange(1, 5): for x in xrange(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)): if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
@@ -11,4 +13,4 @@ def handler(fit, module, context, **kwargs):
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x)) id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))
if id: if id:
fit.addCommandBonus(id, value, module, kwargs['effect']) fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -4,6 +4,8 @@
# Variations of module: Shield Command Burst I (2 of 2) # Variations of module: Shield Command Burst I (2 of 2)
type = "active", "gang" type = "active", "gang"
def handler(fit, module, context, **kwargs): def handler(fit, module, context, **kwargs):
for x in xrange(1, 5): for x in xrange(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)): if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
@@ -11,4 +13,4 @@ def handler(fit, module, context, **kwargs):
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x)) id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))
if id: if id:
fit.addCommandBonus(id, value, module, kwargs['effect']) fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -4,6 +4,8 @@
# Variations of module: Skirmish Command Burst I (2 of 2) # Variations of module: Skirmish Command Burst I (2 of 2)
type = "active", "gang" type = "active", "gang"
def handler(fit, module, context, **kwargs): def handler(fit, module, context, **kwargs):
for x in xrange(1, 5): for x in xrange(1, 5):
if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)): if module.getModifiedChargeAttr("warfareBuff{}ID".format(x)):
@@ -11,4 +13,4 @@ def handler(fit, module, context, **kwargs):
id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x)) id = module.getModifiedChargeAttr("warfareBuff{}ID".format(x))
if id: if id:
fit.addCommandBonus(id, value, module, kwargs['effect']) fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -3,6 +3,8 @@
# Used by: # Used by:
# Modules from group: Titan Phenomena Generator (4 of 4) # Modules from group: Titan Phenomena Generator (4 of 4)
type = "active", "gang" type = "active", "gang"
def handler(fit, module, context, **kwargs): def handler(fit, module, context, **kwargs):
for x in xrange(1, 5): for x in xrange(1, 5):
if module.getModifiedItemAttr("warfareBuff{}ID".format(x)): if module.getModifiedItemAttr("warfareBuff{}ID".format(x)):
@@ -11,7 +13,3 @@ def handler(fit, module, context, **kwargs):
if id: if id:
fit.addCommandBonus(id, value, module, kwargs['effect']) fit.addCommandBonus(id, value, module, kwargs['effect'])

View File

@@ -4,7 +4,8 @@ runTime = "late"
def handler(fit, module, context): def handler(fit, module, context):
if "projected" not in context: return if "projected" not in context:
return
bonus = module.getModifiedItemAttr("structureDamageAmount") bonus = module.getModifiedItemAttr("structureDamageAmount")
duration = module.getModifiedItemAttr("duration") / 1000.0 duration = module.getModifiedItemAttr("duration") / 1000.0
fit.extraAttributes.increase("hullRepair", bonus / duration) fit.extraAttributes.increase("hullRepair", bonus / duration)

View File

@@ -3,6 +3,8 @@
# Used by: # Used by:
# Ship: Rabisu # Ship: Rabisu
type = "passive" type = "passive"
def handler(fit, src, context): def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "falloffEffectiveness", src.getModifiedItemAttr("roleBonusRepairRange")) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "falloffEffectiveness", src.getModifiedItemAttr("roleBonusRepairRange"))
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "maxRange", src.getModifiedItemAttr("roleBonusRepairRange")) fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems"), "maxRange", src.getModifiedItemAttr("roleBonusRepairRange"))

View File

@@ -3,6 +3,8 @@
# Used by: # Used by:
# Ship: Apostle # Ship: Apostle
type = "passive" type = "passive"
def handler(fit, src, context): def handler(fit, src, context):
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4"), skill="Amarr Carrier") fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff4Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4"), skill="Amarr Carrier")
fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4"), skill="Amarr Carrier") fit.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Armored Command") or mod.item.requiresSkill("Information Command"), "warfareBuff3Value", src.getModifiedItemAttr("shipBonusForceAuxiliaryA4"), skill="Amarr Carrier")

View File

@@ -11,5 +11,5 @@ def handler(fit, module, context):
fit.modules.filteredChargeMultiply(lambda mod: mod.charge.requiresSkill("Rockets") or mod.charge.requiresSkill("Light Missiles"), fit.modules.filteredChargeMultiply(lambda mod: mod.charge.requiresSkill("Rockets") or mod.charge.requiresSkill("Light Missiles"),
"{}Damage".format(type), "{}Damage".format(type),
1 / module.getModifiedItemAttr("modeDamageBonusPostDiv"), 1 / module.getModifiedItemAttr("modeDamageBonusPostDiv"),
stackingPenalties = True, stackingPenalties=True,
penaltyGroup="postDiv") penaltyGroup="postDiv")

View File

@@ -4,4 +4,3 @@ type = "passive"
def handler(fit, src, context): def handler(fit, src, context):
fit.extraAttributes.increase("maxTargetsLockedFromSkills", src.getModifiedItemAttr("structureRigMaxTargetBonus")) fit.extraAttributes.increase("maxTargetsLockedFromSkills", src.getModifiedItemAttr("structureRigMaxTargetBonus"))

View File

@@ -148,10 +148,6 @@ class Fighter(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def item(self): def item(self):
return self.__item return self.__item
@property
def charge(self):
return self.__charge
@property @property
def hasAmmo(self): def hasAmmo(self):
return self.charge is not None return self.charge is not None

View File

@@ -487,11 +487,9 @@ class Fit(object):
self.ship.boostItemAttr("armor%sDamageResonance" % damageType, value) self.ship.boostItemAttr("armor%sDamageResonance" % damageType, value)
if warfareBuffID == 14: # Armor Burst: Rapid Repair: Repair Duration/Capacitor if warfareBuffID == 14: # Armor Burst: Rapid Repair: Repair Duration/Capacitor
self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill( self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or mod.item.requiresSkill("Repair Systems"),
"Remote Armor Repair Systems") or mod.item.requiresSkill("Repair Systems"),
"capacitorNeed", value) "capacitorNeed", value)
self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill( self.modules.filteredItemBoost(lambda mod: mod.item.requiresSkill("Remote Armor Repair Systems") or mod.item.requiresSkill("Repair Systems"), "duration",
"Remote Armor Repair Systems") or mod.item.requiresSkill("Repair Systems"), "duration",
value) value)
if warfareBuffID == 15: # Armor Burst: Armor Reinforcement: Armor HP if warfareBuffID == 15: # Armor Burst: Armor Reinforcement: Armor HP
@@ -512,9 +510,8 @@ class Fit(object):
"scan%sStrengthBonus" % scanType, value, "scan%sStrengthBonus" % scanType, value,
stackingPenalties=True) stackingPenalties=True)
for attr in ( for attr in ("missileVelocityBonus", "explosionDelayBonus", "aoeVelocityBonus", "falloffBonus",
"missileVelocityBonus", "explosionDelayBonus", "aoeVelocityBonus", "falloffBonus", "maxRangeBonus", "aoeCloudSizeBonus", "trackingSpeedBonus"):
"maxRangeBonus", "aoeCloudSizeBonus", "trackingSpeedBonus"):
self.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Weapon Disruptor", self.modules.filteredItemBoost(lambda mod: mod.item.group.name == "Weapon Disruptor",
attr, value) attr, value)

BIN
eve.db

Binary file not shown.

5
fun.py
View File

@@ -1,5 +0,0 @@
problem 15
number of moves: XxY
each block added introduces two possible moves

View File

@@ -5,13 +5,13 @@ from gui.bitmapLoader import BitmapLoader
import gui.mainFrame import gui.mainFrame
if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)):
from service.crest import Crest
from service.settings import CRESTSettings from service.settings import CRESTSettings
from wx.lib.intctrl import IntCtrl from wx.lib.intctrl import IntCtrl
if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)):
from service.crest import Crest
class PFCrestPref(PreferenceView): class PFCrestPref(PreferenceView):
title = "CREST" title = "CREST"

View File

@@ -127,7 +127,7 @@ class MiningYieldViewFull(StatsView):
def refreshPanel(self, fit): def refreshPanel(self, fit):
# If we did anything intresting, we'd update our labels to reflect the new fit's stats here # If we did anything intresting, we'd update our labels to reflect the new fit's stats here
stats = (("labelFullminingyieldMiner", lambda: fit.minerYield, 3, 0, 0, u"%s m\u00B3/s",None), stats = (("labelFullminingyieldMiner", lambda: fit.minerYield, 3, 0, 0, u"%s m\u00B3/s", None),
("labelFullminingyieldDrone", lambda: fit.droneYield, 3, 0, 0, u"%s m\u00B3/s", None), ("labelFullminingyieldDrone", lambda: fit.droneYield, 3, 0, 0, u"%s m\u00B3/s", None),
("labelFullminingyieldTotal", lambda: fit.totalYield, 3, 0, 0, u"%s m\u00B3/s", None)) ("labelFullminingyieldTotal", lambda: fit.totalYield, 3, 0, 0, u"%s m\u00B3/s", None))

View File

@@ -1,58 +1,58 @@
# ============================================================================= # =============================================================================
# Copyright (C) 2010 Diego Duclos # Copyright (C) 2010 Diego Duclos
# #
# This file is part of pyfa. # This file is part of pyfa.
# #
# pyfa is free software: you can redistribute it and/or modify # pyfa is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or # the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# pyfa is distributed in the hope that it will be useful, # pyfa is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of # but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details. # GNU General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with pyfa. If not, see <http://www.gnu.org/licenses/>. # along with pyfa. If not, see <http://www.gnu.org/licenses/>.
# ============================================================================= # =============================================================================
import wx import wx
from eos.types import Mode from eos.types import Mode
from service.attribute import Attribute from service.attribute import Attribute
from gui.utils.numberFormatter import formatAmount from gui.utils.numberFormatter import formatAmount
from gui.viewColumn import ViewColumn from gui.viewColumn import ViewColumn
from gui.bitmapLoader import BitmapLoader from gui.bitmapLoader import BitmapLoader
class CapacitorUse(ViewColumn): class CapacitorUse(ViewColumn):
name = "Capacitor Usage" name = "Capacitor Usage"
def __init__(self, fittingView, params): def __init__(self, fittingView, params):
ViewColumn.__init__(self, fittingView) ViewColumn.__init__(self, fittingView)
self.mask = wx.LIST_MASK_IMAGE self.mask = wx.LIST_MASK_IMAGE
Attribute.getInstance().getAttributeInfo("capacitorNeed") Attribute.getInstance().getAttributeInfo("capacitorNeed")
self.imageId = fittingView.imageList.GetImageIndex("capacitorRecharge_small", "gui") self.imageId = fittingView.imageList.GetImageIndex("capacitorRecharge_small", "gui")
self.bitmap = BitmapLoader.getBitmap("capacitorRecharge_small", "gui") self.bitmap = BitmapLoader.getBitmap("capacitorRecharge_small", "gui")
def getText(self, mod): def getText(self, mod):
if isinstance(mod, Mode): if isinstance(mod, Mode):
return "" return ""
capUse = mod.capUse capUse = mod.capUse
if capUse: if capUse:
return "%s%s" % ("+" if capUse < 0 else "", (formatAmount(-capUse, 3, 0, 3))) return "%s%s" % ("+" if capUse < 0 else "", (formatAmount(-capUse, 3, 0, 3)))
else: else:
return "" return ""
def getImageId(self, mod): def getImageId(self, mod):
return -1 return -1
def getToolTip(self, mod): def getToolTip(self, mod):
return self.name return self.name
CapacitorUse.register() CapacitorUse.register()

View File

@@ -230,7 +230,7 @@ class FittingView(d.Display):
if row != -1 and row not in self.blanks: if row != -1 and row not in self.blanks:
data = wx.PyTextDataObject() data = wx.PyTextDataObject()
data.SetText("fitting:"+str(self.mods[row].modPosition)) data.SetText("fitting:" + str(self.mods[row].modPosition))
dropSource = wx.DropSource(self) dropSource = wx.DropSource(self)
dropSource.SetData(data) dropSource.SetData(data)
@@ -403,7 +403,7 @@ class FittingView(d.Display):
return return
if clone and mod2.isEmpty: if clone and mod2.isEmpty:
sFit.cloneModule(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition) sFit.cloneModule(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition)
else: else:
sFit.swapModules(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition) sFit.swapModules(self.mainFrame.getActiveFit(), srcIdx, mod2.modPosition)
@@ -503,7 +503,7 @@ class FittingView(d.Display):
itemContext = "Tactical Mode" itemContext = "Tactical Mode"
fullContext = (srcContext, itemContext) fullContext = (srcContext, itemContext)
if not srcContext in tuple(fCtxt[0] for fCtxt in contexts): if srcContext not in tuple(fCtxt[0] for fCtxt in contexts):
contexts.append(fullContext) contexts.append(fullContext)
selection.append(mod) selection.append(mod)

View File

@@ -4,9 +4,6 @@ import json
import wx import wx
import requests import requests
if not 'wxMac' in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3,0)):
from service.crest import Crest, CrestModes
from service.port import Port from service.port import Port
from service.fit import Fit from service.fit import Fit
@@ -16,6 +13,9 @@ from eos.db import getItem
import gui.display as d import gui.display as d
import gui.globalEvents as GE import gui.globalEvents as GE
if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)):
from service.crest import Crest, CrestModes
class CrestFittings(wx.Frame): class CrestFittings(wx.Frame):
def __init__(self, parent): def __init__(self, parent):

View File

@@ -19,7 +19,6 @@
import os import os
import logging import logging
logger = logging.getLogger(__name__)
import wx import wx
@@ -39,6 +38,9 @@ try:
mplImported = False mplImported = False
except ImportError: except ImportError:
enabled = False enabled = False
logger = logging.getLogger(__name__)
if not enabled:
logger.info("Problems importing matplotlib; continuing without graphs") logger.info("Problems importing matplotlib; continuing without graphs")

View File

@@ -834,7 +834,6 @@ class ItemEffects(wx.Panel):
If effect file does not exist, create it If effect file does not exist, create it
""" """
import os
file_ = config.getPyfaPath(os.path.join("eos", "effects", "%s.py" % event.GetText().lower())) file_ = config.getPyfaPath(os.path.join("eos", "effects", "%s.py" % event.GetText().lower()))
if not os.path.isfile(file_): if not os.path.isfile(file_):

View File

@@ -31,6 +31,7 @@ ItemSelected, ITEM_SELECTED = wx.lib.newevent.NewEvent()
RECENTLY_USED_MODULES = -2 RECENTLY_USED_MODULES = -2
MAX_RECENTLY_USED_MODULES = 20 MAX_RECENTLY_USED_MODULES = 20
class MetaButton(wx.ToggleButton): class MetaButton(wx.ToggleButton):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(MetaButton, self).__init__(*args, **kwargs) super(MetaButton, self).__init__(*args, **kwargs)
@@ -50,6 +51,7 @@ class MetaButton(wx.ToggleButton):
self.Enable(True) self.Enable(True)
self.SetValue(self.userSelected) self.SetValue(self.userSelected)
class MarketBrowser(wx.Panel): class MarketBrowser(wx.Panel):
def __init__(self, parent): def __init__(self, parent):
wx.Panel.__init__(self, parent) wx.Panel.__init__(self, parent)

View File

@@ -5,3 +5,4 @@ pytest-capturelog==0.7
coverage==4.2 coverage==4.2
coveralls==1.1 coveralls==1.1
codecov codecov
tox

View File

@@ -88,7 +88,7 @@ class CharacterImportThread(threading.Thread):
skill.getAttribute("typeID"), skill.getAttribute("typeID"),
skill.getAttribute("level"), skill.getAttribute("level"),
) )
char = sCharacter.new(name+" (EVEMon)") char = sCharacter.new(name + " (EVEMon)")
sCharacter.apiUpdateCharSheet(char.ID, skills) sCharacter.apiUpdateCharSheet(char.ID, skills)
except Exception, e: except Exception, e:
logger.error("Exception on character import:") logger.error("Exception on character import:")

View File

@@ -34,14 +34,13 @@ from eos import db
from service.fit import Fit as svcFit from service.fit import Fit as svcFit
import wx import wx
from service.market import Market
from eos.types import State, Slot, Module, Cargo, Ship, Drone, Implant, Booster, Citadel, Fighter, Fit from eos.types import State, Slot, Module, Cargo, Ship, Drone, Implant, Booster, Citadel, Fighter, Fit
if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)): if 'wxMac' not in wx.PlatformInfo or ('wxMac' in wx.PlatformInfo and wx.VERSION >= (3, 0)):
from service.crest import Crest from service.crest import Crest
from service.market import Market
logger = logging.getLogger("pyfa.service.port") logger = logging.getLogger("pyfa.service.port")
try: try:
@@ -65,7 +64,7 @@ INV_FLAG_FIGHTER = 158
class Port(object): class Port(object):
instance = None instance = None
@classmethod @classmethod
def getInstance(cls): def getInstance(cls):
if cls.instance is None: if cls.instance is None:
@@ -685,7 +684,7 @@ class Port(object):
elif entityState == "Inactive": elif entityState == "Inactive":
d.amountActive = 0 d.amountActive = 0
f.drones.append(d) f.drones.append(d)
elif droneItem.category.name == "Fighter": # EFT saves fighter as drones elif droneItem.category.name == "Fighter": # EFT saves fighter as drones
ft = Fighter(droneItem) ft = Fighter(droneItem)
ft.amount = int(droneAmount) if ft.amount <= ft.fighterSquadronMaxSize else ft.fighterSquadronMaxSize ft.amount = int(droneAmount) if ft.amount <= ft.fighterSquadronMaxSize else ft.fighterSquadronMaxSize
f.fighters.append(ft) f.fighters.append(ft)

View File

@@ -26,9 +26,6 @@ try:
from urllib.parse import quote from urllib.parse import quote
except ImportError: # pragma: no cover except ImportError: # pragma: no cover
from urllib import quote from urllib import quote
import logging
import re
import config
logger = logging.getLogger("pycrest.eve") logger = logging.getLogger("pycrest.eve")
cache_re = re.compile(r'max-age=([0-9]+)') cache_re = re.compile(r'max-age=([0-9]+)')

View File

@@ -1,13 +1,23 @@
"""import tests.""" """import tests."""
import os import os
import sys
import importlib import importlib
import pytest import pytest
script_dir = os.path.dirname(os.path.abspath(__file__))
# Add root to python paths, this allows us to import submodules
sys.path.append(os.path.realpath(os.path.join(script_dir, '..')))
# noinspection PyPep8
import service import service
# noinspection PyPep8
import gui import gui
# noinspection PyPep8
import eos import eos
# noinspection PyPep8
import utils import utils
@@ -17,6 +27,7 @@ def test_packages():
assert eos assert eos
assert utils assert utils
def service_modules(): def service_modules():
for root, folders, files in os.walk("service"): for root, folders, files in os.walk("service"):
for file_ in files: for file_ in files:
@@ -27,6 +38,7 @@ def service_modules():
) )
yield mod_name yield mod_name
def eos_modules(): def eos_modules():
for root, folders, files in os.walk("eos"): for root, folders, files in os.walk("eos"):
for file_ in files: for file_ in files:
@@ -37,6 +49,9 @@ def eos_modules():
) )
yield mod_name yield mod_name
# TODO: Disable walk through Eos paths until eos.types is killed. eos.types causes the import to break
'''
@pytest.mark.parametrize("mod_name", eos_modules()) @pytest.mark.parametrize("mod_name", eos_modules())
def test_service_imports(mod_name): def test_eos_imports(mod_name):
assert importlib.import_module(mod_name) assert importlib.import_module(mod_name)
'''

View File

@@ -12,4 +12,4 @@ commands = py.test -vv --cov Pyfa tests/
[testenv:pep8] [testenv:pep8]
deps = flake8 deps = flake8
commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E127,E501,E731,F401,F403,F405 service gui eos utils config.py pyfa.py --max-line-length=130 commands = flake8 --exclude=.svn,CVS,.bzr,.hg,.git,__pycache__,venv,tests,.tox,build,dist,__init__.py --ignore=E126,E127,E128,E501,E731,F401,F403,F405 service gui eos utils config.py pyfa.py --max-line-length=130