Skip to content

Commit

Permalink
Merge pull request #131 from Pyfa-fit/development
Browse files Browse the repository at this point in the history
2017.26.06
  • Loading branch information
Ebag333 committed Jun 26, 2017
2 parents 317eaff + a5a91b9 commit 6aa8a74
Show file tree
Hide file tree
Showing 27 changed files with 133 additions and 75 deletions.
6 changes: 6 additions & 0 deletions eos/effects/online.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
effectType = "active"


def handler(fit, src, context):
# Used to make modules active
pass
2 changes: 1 addition & 1 deletion eos/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def rel_listener(target, value, initiator):
if not target or (isinstance(value, Module) and value.isEmpty):
return

pyfalog.debug('{0} changed the relationship with {1}', repr(value), repr(target))
pyfalog.debug(u'Changed the relationship with {0}', target.ship.name)
target.modified = datetime.datetime.now()


Expand Down
5 changes: 3 additions & 2 deletions eos/saveddata/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,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}", repr(self))
pyfalog.debug(u"Applying gang boosts for {0}", self.name)
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 @@ -1192,7 +1192,8 @@ def simulateCap(self):
if module_list['ReactivationDelay']:
total_run_time += module_list['ReactivationDelay']

cap_per_second += total_amount / (total_run_time / 1000)
if total_run_time > 0 and total_amount > 0:
cap_per_second += total_amount / (total_run_time / 1000)

self.__capUsed = cap_per_second

Expand Down
16 changes: 12 additions & 4 deletions eos/saveddata/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,15 @@ def damageStats(self, targetResists):
volley *= self.getModifiedItemAttr("damageMultiplier") or 1
if volley:
cycleTime = self.cycleTime
# Some weapons repeat multiple times in one cycle (think doomsdays)
# Get the number of times it fires off
weaponDoT = max(
self.getModifiedItemAttr("doomsdayDamageDuration", 1) / self.getModifiedItemAttr("doomsdayDamageCycleTime", 1),
1
)

self.__volley = volley
self.__dps = volley / (cycleTime / 1000.0)
self.__dps = (volley * weaponDoT) / (cycleTime / 1000.0)

return self.__dps, self.__volley

Expand Down Expand Up @@ -358,16 +365,17 @@ def reloadTime(self):
if factor_reload:
# Get reload time from attrs first, then use
# custom value specified otherwise (e.g. in effects)
moduleReloadTime = self.getModifiedItemAttr("reloadTime")
if moduleReloadTime is None:
moduleReloadTime = self.__reloadTime
moduleReloadTime = self.getModifiedItemAttr("reloadTime", getattr(self, "__reloadTime", 0))

if moduleReloadTime is None and getattr(self.item.group, 'name', None) == 'Capacitor Booster':
# Cap boosters don't have reload times, so manually set to 10 seconds
moduleReloadTime = 10
else:
moduleReloadTime = 0

if moduleReloadTime is None:
moduleReloadTime = 0

return moduleReloadTime

@reloadTime.setter
Expand Down
2 changes: 1 addition & 1 deletion gui/PFListPane.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def RefreshList(self, doRefresh=False, doFocus=False):
self.SetFocus()

for i in xrange(len(self._wList)):
iwidth, iheight = self._wList[i].GetSize()
__, iheight = self._wList[i].GetSize()
self._wList[i].SetSize((cwidth, iheight))
if doRefresh is True:
self._wList[i].Refresh()
Expand Down
2 changes: 1 addition & 1 deletion gui/aboutData.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"DarkPhoenix \tKadesh Priestess (retired)",
"Darriele \t\tDarriele (retired)",
)
credits = (
devcredits = (
"Entity (Entity) \tCapacitor calculations / EVEAPI python lib / Reverence",
"Aurora \t\tMaths",
"Corollax (Aamrr) \tVarious EOS / pyfa improvements",
Expand Down
4 changes: 2 additions & 2 deletions gui/builtinContextMenus/commandFits.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def populateFits(cls, evt):
if evt is not None:
ids = getattr(evt, 'typeID')
if not isinstance(ids, set):
ids = set([ids])
ids = {ids}
else:
ids = None

Expand Down Expand Up @@ -67,7 +67,7 @@ def getSubMenu(self, context, selection, rootMenu, i, pitem):

if len(self.__class__.commandFits) < 15:
for fit in sorted(self.__class__.commandFits, key=lambda x: x.name):
pyfalog.debug(repr(fit))
pyfalog.debug(fit.name)
menuItem = self.addFit(rootMenu if msw else sub, fit, True)
sub.AppendItem(menuItem)
else:
Expand Down
8 changes: 4 additions & 4 deletions gui/builtinStatsViews/firepowerViewFull.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ def refreshPanel(self, fit):
else:
self.stEff.Hide()

stats = (("labelFullDpsWeapon", lambda: fit.weaponDPS, 3, 0, 0, "%s DPS", None),
("labelFullDpsDrone", lambda: fit.droneDPS, 3, 0, 0, "%s DPS", None),
("labelFullVolleyTotal", lambda: fit.totalVolley, 3, 0, 0, "%s", "Volley: %.1f"),
("labelFullDpsTotal", lambda: fit.totalDPS, 3, 0, 0, "%s", None))
stats = (("labelFullDpsWeapon", lambda: fit.weaponDPS, 3, 0, 3, "%s DPS", None),
("labelFullDpsDrone", lambda: fit.droneDPS, 3, 0, 3, "%s DPS", None),
("labelFullVolleyTotal", lambda: fit.totalVolley, 3, 0, 3, "%s", "Volley: %.1f"),
("labelFullDpsTotal", lambda: fit.totalDPS, 3, 0, 3, "%s", None))
# See GH issue #
# if fit is not None and fit.totalYield > 0:
# self.miningyield.Show()
Expand Down
9 changes: 6 additions & 3 deletions gui/builtinViewColumns/baseName.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@


class BaseName(ViewColumn):
def delayedText(self, display, colItem):
pass

name = "Base Name"

def __init__(self, fittingView, params):
Expand All @@ -44,7 +47,8 @@ def __init__(self, fittingView, params):
self.columnText = "Name"
self.shipImage = fittingView.imageList.GetImageIndex("ship_small", "gui")
self.mask = wx.LIST_MASK_TEXT
self.projectedView = isinstance(fittingView, gui.projectedView.ProjectedView)
# We can't do an isInstance here because we'll get a circular import
self.projectedView = type(fittingView).__name__ == "ProjectedView"

def getColumnText(self, stuff):
if isinstance(stuff, Drone):
Expand All @@ -63,8 +67,7 @@ def getColumnText(self, stuff):
if info:
return "%dx %s (%s)" % (stuff.getProjectionInfo(fitID).amount, stuff.name, stuff.ship.item.name)

pyfalog.warning("Projected View trying to display things that aren't there. stuff: {}, info: {}", repr(stuff),
info)
pyfalog.warning(u"Projected View trying to display things that aren't there.")
return "<unknown>"
else:
return "%s (%s)" % (stuff.name, stuff.ship.item.name)
Expand Down
28 changes: 27 additions & 1 deletion gui/builtinViewColumns/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@


class Miscellanea(ViewColumn):
def delayedText(self, display, colItem):
pass

name = "Miscellanea"

def __init__(self, fittingView, params=None):
Expand Down Expand Up @@ -72,6 +75,29 @@ def __getData(self, stuff):

if itemGroup == "Ship Modifiers":
return "", None
elif itemGroup in ("Super Weapon", "Structure Doomsday Weapon"):
doomsday_duration = stuff.getModifiedItemAttr("doomsdayDamageDuration", 1)
doomsday_dottime = stuff.getModifiedItemAttr("doomsdayDamageCycleTime", 1)
func = stuff.getModifiedItemAttr

volley = sum(
map(
lambda attr: (func("%sDamage" % attr) or 0),
("em", "thermal", "kinetic", "explosive")
)
)
volley *= stuff.getModifiedItemAttr("damageMultiplier") or 1

if volley <= 0:
text = ""
tooltip = ""
elif max(doomsday_duration / doomsday_dottime, 1) > 1:
text = "{0} dmg over {1} s".format(formatAmount(volley * (doomsday_duration / doomsday_dottime), 3, 0, 3), doomsday_duration / 1000)
tooltip = "Raw damage done over time"
else:
text = "{0} dmg".format(formatAmount(volley * (doomsday_duration / doomsday_dottime), 3, 0, 3))
tooltip = "Raw damage done"
return text, tooltip
elif itemGroup in ("Energy Weapon", "Hybrid Weapon", "Projectile Weapon", "Combat Drone", "Fighter Drone"):
trackingSpeed = stuff.getModifiedItemAttr("trackingSpeed")
if not trackingSpeed:
Expand Down Expand Up @@ -524,7 +550,7 @@ def __getData(self, stuff):

duration = cycles * cycleTime / 1000
for number_of_cycles in {5, 10, 25}:
tooltip = "{0}\n{1} charges lasts {2} seconds ({3} cycles)".format(
tooltip = "{0}\n{1} charges lasts {2} ` ({3} cycles)".format(
tooltip,
formatAmount(number_of_cycles * cycles, 3, 0, 3),
formatAmount((duration + reload_time) * number_of_cycles, 3, 0, 3),
Expand Down
2 changes: 1 addition & 1 deletion gui/characterEditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ def __fetchCallback(self, e=None):
if e is None:
self.stStatus.SetLabel("Successfully fetched {}\'s skills from EVE API.".format(charName))
else:
exc_type, exc_obj, __ = e
__, exc_obj, __ = e
pyfalog.error("Unable to retrieve {0}\'s skills. Error message:\n{1}".format(charName, exc_obj))
self.stStatus.SetLabel("Unable to retrieve {}\'s skills. Error message:\n{}".format(charName, exc_obj))

Expand Down
6 changes: 3 additions & 3 deletions gui/chromeTabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,14 +741,14 @@ def _Render(self):


class PFTabsContainer(wx.Panel):
def __init__(self, parent, pos=(0, 0), size=(100, 22), init_id=wx.ID_ANY, canAdd=True):
def __init__(self, parent, pos=(0, 0), size=(100, 22), id=wx.ID_ANY, canAdd=True):
"""
Defines the tab container. Handles functions such as tab selection and
dragging, and defines minimum width of tabs (all tabs are of equal width,
which is determined via widest tab). Also handles the tab preview, if any.
"""

wx.Panel.__init__(self, parent, init_id, pos, size)
wx.Panel.__init__(self, parent, id, pos, size)
if wx.VERSION >= (3, 0):
self.SetBackgroundStyle(wx.BG_STYLE_PAINT)

Expand Down Expand Up @@ -1384,7 +1384,7 @@ def __init__(self, parent, pos, bitmap, title):
wx.Frame.__init__(
self,
parent,
init_id=wx.ID_ANY,
id=wx.ID_ANY,
title=wx.EmptyString,
pos=pos,
size=wx.DefaultSize,
Expand Down
2 changes: 1 addition & 1 deletion gui/display.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ def populate(self, stuff):
if listItemCount > stuffItemCount:
if listItemCount - stuffItemCount > 20 > stuffItemCount:
self.DeleteAllItems()
for i in range(stuffItemCount):
for __ in range(stuffItemCount):
self.InsertStringItem(sys.maxint, "")
else:
for i in range(listItemCount - stuffItemCount):
Expand Down
8 changes: 2 additions & 6 deletions gui/droneView.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from gui.utils.helpers_wxPython import DragDropHelper
from service.fit import Fit
from service.market import Market
from gui.utils.helpers_static import DRONE_ORDER


class DroneViewDrop(wx.PyDropTarget):
Expand Down Expand Up @@ -155,17 +156,12 @@ def _merge(self, src, dst):
if sFit.mergeDrones(fitID, self.drones[src], self.drones[dst]):
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))

DRONE_ORDER = ('Light Scout Drones', 'Medium Scout Drones',
'Heavy Attack Drones', 'Sentry Drones', 'Fighters',
'Fighter Bombers', 'Combat Utility Drones',
'Electronic Warfare Drones', 'Logistic Drones', 'Mining Drones', 'Salvage Drones')

def droneKey(self, drone):
sMkt = Market.getInstance()

groupName = sMkt.getMarketGroupByItem(drone.item).name

return (self.DRONE_ORDER.index(groupName),
return (DRONE_ORDER.index(groupName),
drone.item.name)

def fitChanged(self, event):
Expand Down
8 changes: 3 additions & 5 deletions gui/mainFrame.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import threading
import time
import webbrowser
from codecs import open
from time import gmtime, strftime

import sqlalchemy
Expand Down Expand Up @@ -53,7 +52,6 @@
from gui.characterSelection import CharacterSelection
from gui.chromeTabs import PFNotebook
from gui.copySelectDialog import CopySelectDialog
from gui.graphFrame import GraphFrame
from gui.mainMenuBar import MainMenuBar
from gui.marketBrowser import ItemSelected, MarketBrowser
from gui.multiSwitch import MultiSwitch
Expand All @@ -67,6 +65,7 @@
from gui.updateDialog import UpdateDialog
from gui.utils.clipboard import fromClipboard, toClipboard
from gui.utils.helpers_wxPython import Frame
from gui.utils.ExportHtml import ExportHtml
from service.character import Character
from service.fit import Fit
from service.port import IPortUser, Port
Expand Down Expand Up @@ -366,7 +365,7 @@ def ShowAboutBox(self, evt):
info.Description = wordwrap(gui.aboutData.description + "\n\nDevelopers:\n\t" +
"\n\t".join(gui.aboutData.developers) +
"\n\nAdditional credits:\n\t" +
"\n\t".join(gui.aboutData.credits) +
"\n\t".join(gui.aboutData.devcredits) +
"\n\nLicenses:\n\t" +
"\n\t".join(gui.aboutData.licenses) +
"\n\nEVE Data: \t" + gamedata_version +
Expand Down Expand Up @@ -881,7 +880,6 @@ def backupToXml(self, event):
self.progressDialog.ShowModal()

def exportHtml(self, event):
from gui.utils.exportHtml import ExportHtml
sFit = Fit.getInstance()
settings = HTMLExportSettings.getInstance()

Expand Down Expand Up @@ -1034,7 +1032,7 @@ def closeWaitDialog(self):

def openGraphFrame(self, event):
if not self.graphFrame:
self.graphFrame = GraphFrame(self)
self.graphFrame = graphFrame.GraphFrame(self)

if graphFrame.graphFrame_enabled:
self.graphFrame.Show()
Expand Down
5 changes: 3 additions & 2 deletions gui/marketBrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

# noinspection PyPackageRequirements
import wx
from wx.lib import newevent
from service.market import Market
from service.attribute import Attribute
from gui.display import Display
Expand All @@ -32,7 +33,7 @@

pyfalog = Logger(__name__)

ItemSelected, ITEM_SELECTED = wx.lib.newevent.NewEvent()
ItemSelected, ITEM_SELECTED = newevent.NewEvent()

RECENTLY_USED_MODULES = -2
MAX_RECENTLY_USED_MODULES = 50
Expand Down Expand Up @@ -207,7 +208,7 @@ def expandLookup(self, event):
self.SortChildren(root)

def jump(self, item):
pyfalog.debug("Open market group and meta tab for item: {0}", repr(item))
pyfalog.debug("Open market group and meta tab for item: {0}", item.name)
self.marketBrowser.searchMode = False
sMkt = self.sMkt
mg = sMkt.getMarketGroupByItem(item)
Expand Down
4 changes: 2 additions & 2 deletions gui/multiSwitch.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def AddPage(self, tabWnd=None, tabTitle="Empty Tab", tabImage=None, showClose=Tr

PFNotebook.AddPage(self, tabWnd, tabTitle, tabImage, True)

def DeletePage(self, n, *args, **kwargs):
PFNotebook.DeletePage(self, n, *args, **kwargs)
def DeletePage(self, n, internal=False):
PFNotebook.DeletePage(self, n, internal=internal)
if self.GetPageCount() == 0:
self.AddPage()

Expand Down
Loading

0 comments on commit 6aa8a74

Please sign in to comment.