diff --git a/config.py b/config.py index d65e2d9f7..4b8f6df8f 100644 --- a/config.py +++ b/config.py @@ -24,7 +24,7 @@ saveInRoot = False # Version data -version = "2.5.0" +version = "2.5.1" tag = "Stable" expansionName = "YC120.10" expansionVersion = "1.0" diff --git a/eos/effects/microjumpportaldrive.py b/eos/effects/microjumpportaldrive.py index 1e5a02569..0b96a9743 100644 --- a/eos/effects/microjumpportaldrive.py +++ b/eos/effects/microjumpportaldrive.py @@ -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) diff --git a/eos/saveddata/drone.py b/eos/saveddata/drone.py index da4c512f2..4cddbea42 100644 --- a/eos/saveddata/drone.py +++ b/eos/saveddata/drone.py @@ -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 diff --git a/gui/bitmap_loader.py b/gui/bitmap_loader.py index 2c516b413..042a6674b 100644 --- a/gui/bitmap_loader.py +++ b/gui/bitmap_loader.py @@ -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: diff --git a/gui/fitCommands/calc/fitChangeDroneVariation.py b/gui/fitCommands/calc/fitChangeDroneVariation.py new file mode 100644 index 000000000..7f277895a --- /dev/null +++ b/gui/fitCommands/calc/fitChangeDroneVariation.py @@ -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 diff --git a/gui/fitCommands/guiMetaSwap.py b/gui/fitCommands/guiMetaSwap.py index 13497a233..d0c99b8bf 100644 --- a/gui/fitCommands/guiMetaSwap.py +++ b/gui/fitCommands/guiMetaSwap.py @@ -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: diff --git a/imgs/icons/10886@1x.png b/imgs/icons/10886@1x.png deleted file mode 100644 index bc33a7cea..000000000 Binary files a/imgs/icons/10886@1x.png and /dev/null differ diff --git a/imgs/icons/10886@2x.png b/imgs/icons/10886@2x.png deleted file mode 100644 index 72b667cce..000000000 Binary files a/imgs/icons/10886@2x.png and /dev/null differ diff --git a/imgs/icons/10887@1x.png b/imgs/icons/10887@1x.png deleted file mode 100644 index 0dc4ceb8d..000000000 Binary files a/imgs/icons/10887@1x.png and /dev/null differ diff --git a/imgs/icons/10887@2x.png b/imgs/icons/10887@2x.png deleted file mode 100644 index 8a85f1071..000000000 Binary files a/imgs/icons/10887@2x.png and /dev/null differ diff --git a/imgs/icons/20959@2x.png b/imgs/icons/20959@2x.png deleted file mode 100644 index fdb721f65..000000000 Binary files a/imgs/icons/20959@2x.png and /dev/null differ diff --git a/imgs/icons/20966@2x.png b/imgs/icons/20966@2x.png deleted file mode 100644 index edd49286e..000000000 Binary files a/imgs/icons/20966@2x.png and /dev/null differ diff --git a/imgs/icons/20967@2x.png b/imgs/icons/20967@2x.png deleted file mode 100644 index 4039ba05c..000000000 Binary files a/imgs/icons/20967@2x.png and /dev/null differ diff --git a/imgs/icons/20968@2x.png b/imgs/icons/20968@2x.png deleted file mode 100644 index dba4a2726..000000000 Binary files a/imgs/icons/20968@2x.png and /dev/null differ diff --git a/imgs/icons/21420@2x.png b/imgs/icons/21420@2x.png deleted file mode 100644 index fc02b120b..000000000 Binary files a/imgs/icons/21420@2x.png and /dev/null differ diff --git a/scripts/icons_update.py b/scripts/icons_update.py index 50945ff1c..03bbb9fd7 100644 --- a/scripts/icons_update.py +++ b/scripts/icons_update.py @@ -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) diff --git a/service/port/efs.py b/service/port/efs.py index ef224e850..b572e5376 100755 --- a/service/port/efs.py +++ b/service/port/efs.py @@ -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