Merge branch 'master' into attrGroup

# Conflicts:
#	eve.db
#	gui/bitmap_loader.py
This commit is contained in:
blitzmann
2018-10-27 15:13:54 -04:00
17 changed files with 79 additions and 14 deletions

View File

@@ -24,7 +24,7 @@ saveInRoot = False
# Version data
version = "2.5.0"
version = "2.5.1"
tag = "Stable"
expansionName = "YC120.10"
expansionVersion = "1.0"

View File

@@ -5,5 +5,6 @@
type = "active"
def handler(fit, src, context):
pass
def handler(fit, module, context):
fit.ship.boostItemAttr("signatureRadius", module.getModifiedItemAttr("signatureRadiusBonusPercent"),
stackingPenalties=True)

View File

@@ -124,6 +124,10 @@ class Drone(HandledItem, HandledCharge, ItemAttrShortcut, ChargeAttrShortcut):
def dps(self):
return self.damageStats()
def changeType(self, typeID):
self.itemID = typeID
self.init()
def damageStats(self, targetResists=None):
if self.__dps is None:
self.__volley = 0

View File

@@ -85,14 +85,12 @@ class BitmapLoader(object):
cls.scaling_factor = int(wx.GetApp().GetTopWindow().GetContentScaleFactor())
scale = cls.scaling_factor
filenameScaled = "{0}@{1}x.png".format(name, scale)
img = cls.loadImage(filenameScaled, location)
filename, img = cls.loadScaledBitmap(name, location, scale)
if img is None:
# can't find the scaled image, fallback to no scaling
filename = "{0}.png".format(name)
img = cls.loadImage(filename, location)
scale = 1
while img is None and scale > 0:
# can't find the correctly scaled image, fallback to smaller scales
scale -= 1
filename, img = cls.loadScaledBitmap(name, location, scale)
if img is None:
print(("Missing icon file: {0}/{1}".format(location, filename)))
@@ -100,9 +98,26 @@ class BitmapLoader(object):
bmp: wx.Bitmap = img.ConvertToBitmap()
if scale > 1:
bmp.SetSize((int(bmp.GetWidth()/scale), int(bmp.GetHeight()/scale)))
bmp.SetSize((bmp.GetWidth() // scale, bmp.GetHeight() // scale))
return bmp
@classmethod
def loadScaledBitmap(cls, name, location, scale=0):
"""Attempts to load a scaled bitmap.
Args:
name (str): TypeID or basename of the image being requested.
location (str): Path to a location that may contain the image.
scale (int): Scale factor of the image variant to load. If ``0``, attempts to load the unscaled variant.
Returns:
(str, wx.Image): Tuple of the filename that may have been loaded and the image at that location. The
filename will always be present, but the image may be ``None``.
"""
filename = "{0}@{1}x.png".format(name, scale) if scale > 0 else "{0}.png".format(name)
img = cls.loadImage(filename, location)
return filename, img
@classmethod
def loadImage(cls, filename, location):
if cls.archive:

View File

@@ -0,0 +1,39 @@
import wx
from logbook import Logger
import eos.db
pyfalog = Logger(__name__)
class FitChangeDroneVariationCommand(wx.Command):
""""
Fitting command that changes an existing drone into another variation.
"""
def __init__(self, fitID, position, itemID):
wx.Command.__init__(self, True, "Change Module")
self.fitID = fitID
self.itemID = itemID
self.position = position
self.old_drone = None
def Do(self):
return self.change_drone(self.fitID, self.position, self.itemID)
def Undo(self):
self.change_drone(self.fitID, self.position, self.old_drone)
return True
def change_drone(self, fitID, position, itemID):
fit = eos.db.getFit(self.fitID)
drone = fit.drones[self.position]
if itemID == drone.itemID:
return False
self.old_drone = drone.itemID
drone.changeType(itemID)
eos.db.commit()
# todo: ensure that, whatever type we send in, is actually a variation of the original drone. If not, return False
return True

View File

@@ -12,6 +12,7 @@ from .calc.fitAddCargo import FitAddCargoCommand
from .calc.fitReplaceModule import FitReplaceModuleCommand
from .calc.fitAddFighter import FitAddFighterCommand
from .calc.fitRemoveFighter import FitRemoveFighterCommand
from .calc.fitChangeDroneVariation import FitChangeDroneVariationCommand
class GuiMetaSwapCommand(wx.Command):
@@ -44,7 +45,8 @@ class GuiMetaSwapCommand(wx.Command):
for x in selection:
self.data.append(((FitRemoveFighterCommand, fitID, fit.fighters.index(x)), (FitAddFighterCommand, fitID, itemID)))
elif context == 'droneItem':
raise NotImplementedError()
for x in selection:
self.data.append(((FitChangeDroneVariationCommand, fitID, fit.drones.index(x), itemID),),)
def Do(self):
for cmds in self.data:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 773 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 787 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 602 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 638 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

View File

@@ -150,6 +150,11 @@ def get_icon_file(res_path, size):
if not os.path.isfile(fullpath):
return None
img = Image.open(fullpath)
if size > img.size:
# if we are requesting a size that is bigger than the source, return None. See #1769
return None
img = crop_image(img)
img.thumbnail(size, Image.ANTIALIAS)

View File

@@ -83,7 +83,6 @@ class EfsPort():
@staticmethod
def getPropData(fit, sFit):
fitID = fit.ID
propMods = filter(lambda mod: mod.item and mod.item.group.name == "Propulsion Module", fit.modules)
activePropWBloomFilter = lambda mod: mod.state > 0 and "signatureRadiusBonus" in mod.item.attributes
propWithBloom = next(filter(activePropWBloomFilter, propMods), None)
@@ -341,7 +340,7 @@ class EfsPort():
# This also covers non-bomb weapons with dps values and no hardpoints, most notably targeted doomsdays.
typeing = "SmartBomb"
# Targeted DDs are the only non drone/fighter weapon without an explict max range
if stats.item.group.name == 'Super Weapon' and stats.maxRange == None:
if stats.item.group.name == 'Super Weapon' and stats.maxRange is None:
maxRange = 300000
else:
maxRange = stats.maxRange