diff --git a/gui/builtinShipBrowser/fitItem.py b/gui/builtinShipBrowser/fitItem.py index 3d782fe5f..2f05229d0 100644 --- a/gui/builtinShipBrowser/fitItem.py +++ b/gui/builtinShipBrowser/fitItem.py @@ -23,7 +23,7 @@ pyfalog = Logger(__name__) class FitItem(SFItem.SFBrowserItem): def __init__(self, parent, fitID=None, shipFittingInfo=("Test", "TestTrait", "cnc's avatar", 0, 0, None), shipID=None, - itemData=None, + itemData=None, graphicID=None, id=wx.ID_ANY, pos=wx.DefaultPosition, size=(0, 40), style=0): @@ -51,7 +51,7 @@ class FitItem(SFItem.SFBrowserItem): self.deleted = False if shipID: - self.shipBmp = BitmapLoader.getBitmap(str(shipID), "renders") + self.shipBmp = BitmapLoader.getBitmap(str(graphicID), "renders") if not self.shipBmp: self.shipBmp = BitmapLoader.getBitmap("ship_no_image_big", "gui") diff --git a/gui/builtinShipBrowser/shipItem.py b/gui/builtinShipBrowser/shipItem.py index 4c679fb8a..517648ad6 100644 --- a/gui/builtinShipBrowser/shipItem.py +++ b/gui/builtinShipBrowser/shipItem.py @@ -18,7 +18,7 @@ pyfalog = Logger(__name__) class ShipItem(SFItem.SFBrowserItem): - def __init__(self, parent, shipID=None, shipFittingInfo=("Test", "TestTrait", 2), itemData=None, + def __init__(self, parent, shipID=None, shipFittingInfo=("Test", "TestTrait", 2), itemData=None, graphicID=None, id=wx.ID_ANY, pos=wx.DefaultPosition, size=(0, 40), style=0): SFItem.SFBrowserItem.__init__(self, parent, size=size) @@ -36,8 +36,8 @@ class ShipItem(SFItem.SFBrowserItem): self.fontSmall = wx.Font(fonts.SMALL, wx.SWISS, wx.NORMAL, wx.NORMAL) self.shipBmp = None - if shipID: - self.shipBmp = BitmapLoader.getBitmap(str(shipID), "renders") + if graphicID: + self.shipBmp = BitmapLoader.getBitmap(str(graphicID), "renders") if not self.shipBmp: self.shipBmp = BitmapLoader.getBitmap("ship_no_image_big", "gui") diff --git a/gui/shipBrowser.py b/gui/shipBrowser.py index afa9d6b71..75152a1b4 100644 --- a/gui/shipBrowser.py +++ b/gui/shipBrowser.py @@ -236,10 +236,10 @@ class ShipBrowser(wx.Panel): if self.filterShipsWithNoFits: if fits > 0: if filter_: - self.lpane.AddWidget(ShipItem(self.lpane, ship.ID, (ship.name, shipTrait, fits), ship.race)) + self.lpane.AddWidget(ShipItem(self.lpane, ship.ID, (ship.name, shipTrait, fits), ship.race, ship.graphicID)) else: if filter_: - self.lpane.AddWidget(ShipItem(self.lpane, ship.ID, (ship.name, shipTrait, fits), ship.race)) + self.lpane.AddWidget(ShipItem(self.lpane, ship.ID, (ship.name, shipTrait, fits), ship.race, ship.graphicID)) self.raceselect.RebuildRaces(racesList) @@ -335,8 +335,8 @@ class ShipBrowser(wx.Panel): shipTrait = ship.traits.traitText if (ship.traits is not None) else "" # empty string if no traits - for ID, name, booster, timestamp, notes in fitList: - self.lpane.AddWidget(FitItem(self.lpane, ID, (shipName, shipTrait, name, booster, timestamp, notes), shipID)) + for ID, name, booster, timestamp, notes, graphicID in fitList: + self.lpane.AddWidget(FitItem(self.lpane, ID, (shipName, shipTrait, name, booster, timestamp, notes), shipID, graphicID=graphicID)) self.lpane.RefreshList() self.lpane.Thaw() @@ -374,7 +374,7 @@ class ShipBrowser(wx.Panel): self.lpane.AddWidget( ShipItem(self.lpane, ship.ID, (ship.name, shipTrait, len(sFit.getFitsWithShip(ship.ID))), - ship.race)) + ship.race, ship.graphicID)) for ID, name, shipID, shipName, booster, timestamp, notes in fitList: ship = sMkt.getItem(shipID) @@ -384,7 +384,7 @@ class ShipBrowser(wx.Panel): shipTrait = ship.traits.traitText if (ship.traits is not None) else "" # empty string if no traits - self.lpane.AddWidget(FitItem(self.lpane, ID, (shipName, shipTrait, name, booster, timestamp, notes), shipID)) + self.lpane.AddWidget(FitItem(self.lpane, ID, (shipName, shipTrait, name, booster, timestamp, notes), shipID, graphicID=ship.graphicID)) if len(ships) == 0 and len(fitList) == 0: self.lpane.AddWidget(PFStaticText(self.lpane, label="No matching results.")) self.lpane.RefreshList(doFocus=False) @@ -435,6 +435,7 @@ class ShipBrowser(wx.Panel): fit[4] ), shipItem.ID, + graphicID=shipItem.graphicID )) self.lpane.RefreshList(doFocus=False) self.lpane.Thaw() diff --git a/scripts/icons_update.py b/scripts/icons_update.py index 9bf26735d..7205e3e08 100644 --- a/scripts/icons_update.py +++ b/scripts/icons_update.py @@ -164,49 +164,49 @@ toremove = existing.difference(needed) toupdate = existing.intersection(needed) toadd = needed.difference(existing) -# -# if toremove: -# print('Some icons are not used and will be removed:') -# for fname in sorted(toremove): -# fullname = '{}.png'.format(fname) -# fullpath = os.path.join(icons_dir, fullname) -# os.remove(fullpath) -# -# if toupdate: -# print(('Updating {} icons...'.format(len(toupdate)))) -# missing = set() -# for fname in sorted(toupdate): -# icon = get_icon_file(fname) -# if icon is None: -# missing.add(fname) -# continue -# fullname = '{}.png'.format(fname) -# fullpath = os.path.join(icons_dir, fullname) -# icon.save(fullpath, 'png') -# if missing: -# print((' {} icons are missing in export:'.format(len(missing)))) -# for fname in sorted(missing): -# print((' {}'.format(fname))) -# -# if toadd: -# print(('Adding {} icons...'.format(len(toadd)))) -# missing = set() -# for fname in sorted(toadd): -# icon = icon_json[str(fname)] -# key = icon['iconFile'].lower() -# icon = get_icon_file(key, ICON_SIZE) -# if icon is None: -# missing.add(fname) -# continue -# fullname = '{}.png'.format(fname) -# fullpath = os.path.join(icons_dir, fullname) -# icon.save(fullpath, 'png') -# if missing: -# print((' {} icons are missing in export:'.format(len(missing)))) -# for fname in sorted(missing): -# print((' {}'.format(fname))) -# -# print(missing) + +if toremove: + print('Some icons are not used and will be removed:') + for fname in sorted(toremove): + fullname = '{}.png'.format(fname) + fullpath = os.path.join(icons_dir, fullname) + os.remove(fullpath) + +if toupdate: + print(('Updating {} icons...'.format(len(toupdate)))) + missing = set() + for fname in sorted(toupdate): + icon = get_icon_file(fname) + if icon is None: + missing.add(fname) + continue + fullname = '{}.png'.format(fname) + fullpath = os.path.join(icons_dir, fullname) + icon.save(fullpath, 'png') + if missing: + print((' {} icons are missing in export:'.format(len(missing)))) + for fname in sorted(missing): + print((' {}'.format(fname))) + +if toadd: + print(('Adding {} icons...'.format(len(toadd)))) + missing = set() + for fname in sorted(toadd): + icon = icon_json[str(fname)] + key = icon['iconFile'].lower() + icon = get_icon_file(key, ICON_SIZE) + if icon is None: + missing.add(fname) + continue + fullname = '{}.png'.format(fname) + fullpath = os.path.join(icons_dir, fullname) + icon.save(fullpath, 'png') + if missing: + print((' {} icons are missing in export:'.format(len(missing)))) + for fname in sorted(missing): + print((' {}'.format(fname))) + +print(missing) print("Doing renders") diff --git a/service/fit.py b/service/fit.py index 5fb884cad..e5ed902e5 100644 --- a/service/fit.py +++ b/service/fit.py @@ -95,7 +95,7 @@ class Fit(object): fits = eos.db.getFitsWithShip(shipID) names = [] for fit in fits: - names.append((fit.ID, fit.name, fit.booster, fit.modified or fit.created or datetime.datetime.fromtimestamp(fit.timestamp), fit.notes)) + names.append((fit.ID, fit.name, fit.booster, fit.modified or fit.created or datetime.datetime.fromtimestamp(fit.timestamp), fit.notes, fit.ship.item.graphicID)) return names