diff --git a/config.py b/config.py index fb0e93eff..382ee6e1b 100644 --- a/config.py +++ b/config.py @@ -20,10 +20,10 @@ saveInRoot = False logLevel = logging.DEBUG # Version data -version = "1.12.1" +version = "1.13.3" tag = "git" -expansionName = "Singularity" -expansionVersion = "910808" +expansionName = "Aegis" +expansionVersion = "1.0" evemonMinVersion = "4081" pyfaPath = None @@ -32,6 +32,7 @@ staticPath = None saveDB = None gameDB = None + class StreamToLogger(object): """ Fake file-like stream object that redirects writes to a logger instance. @@ -46,6 +47,9 @@ class StreamToLogger(object): for line in buf.rstrip().splitlines(): self.logger.log(self.log_level, line.rstrip()) +def __createDirs(path): + if not os.path.exists(path): + os.makedirs(path) def defPaths(): global pyfaPath @@ -72,6 +76,8 @@ def defPaths(): savePath = unicode(os.path.expanduser(os.path.join("~", ".pyfa")), sys.getfilesystemencoding()) + __createDirs(savePath) + format = '%(asctime)s %(name)-24s %(levelname)-8s %(message)s' logging.basicConfig(format=format, level=logLevel) handler = logging.handlers.RotatingFileHandler(os.path.join(savePath, "log.txt"), maxBytes=1000000, backupCount=3) diff --git a/eos/db/saveddata/queries.py b/eos/db/saveddata/queries.py index fe4f0310c..b71f6b98a 100644 --- a/eos/db/saveddata/queries.py +++ b/eos/db/saveddata/queries.py @@ -186,7 +186,7 @@ def getFit(lookfor, eager=None): else: raise TypeError("Need integer as argument") - if fit.isInvalid: + if fit and fit.isInvalid: with sd_lock: removeInvalid([fit]) return None diff --git a/eos/effectHandlerHelpers.py b/eos/effectHandlerHelpers.py index fee65fad0..40349f467 100644 --- a/eos/effectHandlerHelpers.py +++ b/eos/effectHandlerHelpers.py @@ -17,7 +17,7 @@ # along with eos. If not, see . #=============================================================================== -from sqlalchemy.orm.attributes import flag_modified +#from sqlalchemy.orm.attributes import flag_modified import eos.db import eos.types import logging @@ -107,7 +107,10 @@ class HandledList(list): def remove(self, thing): # We must flag it as modified, otherwise it not be removed from the database - flag_modified(thing, "itemID") + # @todo: flag_modified isn't in os x skel. need to rebuild to include + #flag_modified(thing, "itemID") + if thing.isInvalid: # see GH issue #324 + thing.itemID = 0 list.remove(self, thing) class HandledModuleList(HandledList): @@ -189,6 +192,7 @@ class HandledImplantBoosterList(HandledList): oldObj = next((m for m in self if m.slot == thing.slot), None) if oldObj: logging.info("Slot %d occupied with %s, replacing with %s", thing.slot, oldObj.item.name, thing.item.name) + oldObj.itemID = 0 # hack to remove from DB. See GH issue #324 self.remove(oldObj) HandledList.append(self, thing) diff --git a/eos/saveddata/fit.py b/eos/saveddata/fit.py index 2ded319b7..3048b1702 100644 --- a/eos/saveddata/fit.py +++ b/eos/saveddata/fit.py @@ -98,6 +98,8 @@ class Fit(object): item = eos.db.getItem(self.modeID) # Don't need to verify if it's a proper item, as validateModeItem assures this self.__mode = self.ship.validateModeItem(item) + else: + self.__mode = self.ship.validateModeItem(None) self.build() diff --git a/gui/builtinStatsViews/resistancesViewFull.py b/gui/builtinStatsViews/resistancesViewFull.py index 9a1df251f..a35424335 100644 --- a/gui/builtinStatsViews/resistancesViewFull.py +++ b/gui/builtinStatsViews/resistancesViewFull.py @@ -197,8 +197,9 @@ class ResistancesViewFull(StatsView): lbl = getattr(self, "labelResistance%sEhp" % tankType.capitalize()) if ehp is not None: total += ehp[tankType] + rrFactor = fit.ehp[tankType] / fit.hp[tankType] lbl.SetLabel(formatAmount(ehp[tankType], 3, 0, 9)) - lbl.SetToolTip(wx.ToolTip("%s: %d" % (tankType.capitalize(), ehp[tankType]))) + lbl.SetToolTip(wx.ToolTip("%s: %d\nResist Multiplier: x%.2f" % (tankType.capitalize(), ehp[tankType], rrFactor))) else: lbl.SetLabel("0") diff --git a/gui/builtinViewColumns/price.py b/gui/builtinViewColumns/price.py index 17c7ade3c..c046a4b55 100644 --- a/gui/builtinViewColumns/price.py +++ b/gui/builtinViewColumns/price.py @@ -33,7 +33,7 @@ class Price(ViewColumn): self.imageId = fittingView.imageList.GetImageIndex("totalPrice_small", "icons") def getText(self, stuff): - if stuff.item is None: + if stuff.item is None or stuff.item.group.name == "Ship Modifiers": return "" sMkt = service.Market.getInstance() diff --git a/scripts/icons_update.py b/scripts/icons_update.py index ea44ca97c..c152f55be 100644 --- a/scripts/icons_update.py +++ b/scripts/icons_update.py @@ -165,6 +165,21 @@ for fname in os.listdir(export_dir): fnames.add(fname) +def crop_image(img): + w, h = img.size + if h == w: + return img + normal = min(h, w) + diff_w = w - normal + diff_h = h - normal + crop_top = diff_h // 2 + crop_bot = diff_h // 2 + diff_h % 2 + crop_left = diff_w // 2 + crop_right = diff_w // 2 + diff_w % 2 + box = (crop_left, crop_top, w - crop_right, h - crop_bot) + return img.crop(box) + + def get_icon_file(request): """ Get the iconFile field value and find proper @@ -190,6 +205,7 @@ def get_icon_file(request): except KeyError: fullpath = sizes[max(sizes)] img = Image.open(fullpath) + img = crop_image(img) img.thumbnail(ICON_SIZE, Image.ANTIALIAS) else: img = Image.open(fullpath) diff --git a/scripts/renders_update.py b/scripts/renders_update.py index e57fd5486..dfe88e448 100644 --- a/scripts/renders_update.py +++ b/scripts/renders_update.py @@ -58,11 +58,27 @@ toupdate = existing.intersection(needed) toadd = needed.difference(existing) +def crop_image(img): + w, h = img.size + if h == w: + return img + normal = min(h, w) + diff_w = w - normal + diff_h = h - normal + crop_top = diff_h // 2 + crop_bot = diff_h // 2 + diff_h % 2 + crop_left = diff_w // 2 + crop_right = diff_w // 2 + diff_w % 2 + box = (crop_left, crop_top, w - crop_right, h - crop_bot) + return img.crop(box) + + def get_render(type_id): fname = '{}.png'.format(type_id) fullpath = os.path.join(export_dir, fname) img = Image.open(fullpath) if img.size != RENDER_SIZE: + img = crop_image(img) img.thumbnail(RENDER_SIZE, Image.ANTIALIAS) return img diff --git a/service/price.py b/service/price.py index 78e3e289b..71858cf7c 100644 --- a/service/price.py +++ b/service/price.py @@ -52,7 +52,7 @@ class Price(): item = eos.db.getItem(typeID) # We're not going to request items only with market group, as eve-central # doesn't provide any data for items not on the market - if item.marketGroupID: + if item is not None and item.marketGroupID: toRequest.add(typeID) # Do not waste our time if all items are not on the market diff --git a/staticdata/icons/icon107_12.png b/staticdata/icons/icon107_12.png index 0b907587e..1bf43c7e2 100644 Binary files a/staticdata/icons/icon107_12.png and b/staticdata/icons/icon107_12.png differ diff --git a/staticdata/icons/icon109_64_1.png b/staticdata/icons/icon109_64_1.png index d1fa7dc82..7563b2257 100644 Binary files a/staticdata/icons/icon109_64_1.png and b/staticdata/icons/icon109_64_1.png differ diff --git a/staticdata/icons/icon109_64_2.png b/staticdata/icons/icon109_64_2.png index 876929af5..57d3548da 100644 Binary files a/staticdata/icons/icon109_64_2.png and b/staticdata/icons/icon109_64_2.png differ