Skip to content

Commit 28a5318

Browse files
committed
Merge branch 'master' into toggleProjectionFit
Conflicts: config.py
2 parents 609ee13 + b8f73a7 commit 28a5318

12 files changed

Lines changed: 54 additions & 9 deletions

File tree

config.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@
2020
logLevel = logging.DEBUG
2121

2222
# Version data
23-
version = "1.12.1"
23+
version = "1.13.3"
2424
tag = "git"
25-
expansionName = "Singularity"
26-
expansionVersion = "910808"
25+
expansionName = "Aegis"
26+
expansionVersion = "1.0"
2727
evemonMinVersion = "4081"
2828

2929
pyfaPath = None
@@ -32,6 +32,7 @@
3232
saveDB = None
3333
gameDB = None
3434

35+
3536
class StreamToLogger(object):
3637
"""
3738
Fake file-like stream object that redirects writes to a logger instance.
@@ -46,6 +47,9 @@ def write(self, buf):
4647
for line in buf.rstrip().splitlines():
4748
self.logger.log(self.log_level, line.rstrip())
4849

50+
def __createDirs(path):
51+
if not os.path.exists(path):
52+
os.makedirs(path)
4953

5054
def defPaths():
5155
global pyfaPath
@@ -72,6 +76,8 @@ def defPaths():
7276
savePath = unicode(os.path.expanduser(os.path.join("~", ".pyfa")),
7377
sys.getfilesystemencoding())
7478

79+
__createDirs(savePath)
80+
7581
format = '%(asctime)s %(name)-24s %(levelname)-8s %(message)s'
7682
logging.basicConfig(format=format, level=logLevel)
7783
handler = logging.handlers.RotatingFileHandler(os.path.join(savePath, "log.txt"), maxBytes=1000000, backupCount=3)

eos/db/saveddata/queries.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def getFit(lookfor, eager=None):
186186
else:
187187
raise TypeError("Need integer as argument")
188188

189-
if fit.isInvalid:
189+
if fit and fit.isInvalid:
190190
with sd_lock:
191191
removeInvalid([fit])
192192
return None

eos/effectHandlerHelpers.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# along with eos. If not, see <http://www.gnu.org/licenses/>.
1818
#===============================================================================
1919

20-
from sqlalchemy.orm.attributes import flag_modified
20+
#from sqlalchemy.orm.attributes import flag_modified
2121
import eos.db
2222
import eos.types
2323
import logging
@@ -107,7 +107,10 @@ def filteredChargeForce(self, filter, *args, **kwargs):
107107

108108
def remove(self, thing):
109109
# We must flag it as modified, otherwise it not be removed from the database
110-
flag_modified(thing, "itemID")
110+
# @todo: flag_modified isn't in os x skel. need to rebuild to include
111+
#flag_modified(thing, "itemID")
112+
if thing.isInvalid: # see GH issue #324
113+
thing.itemID = 0
111114
list.remove(self, thing)
112115

113116
class HandledModuleList(HandledList):
@@ -189,6 +192,7 @@ def append(self, thing):
189192
oldObj = next((m for m in self if m.slot == thing.slot), None)
190193
if oldObj:
191194
logging.info("Slot %d occupied with %s, replacing with %s", thing.slot, oldObj.item.name, thing.item.name)
195+
oldObj.itemID = 0 # hack to remove from DB. See GH issue #324
192196
self.remove(oldObj)
193197

194198
HandledList.append(self, thing)

eos/saveddata/fit.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,8 @@ def init(self):
9898
item = eos.db.getItem(self.modeID)
9999
# Don't need to verify if it's a proper item, as validateModeItem assures this
100100
self.__mode = self.ship.validateModeItem(item)
101+
else:
102+
self.__mode = self.ship.validateModeItem(None)
101103

102104
self.build()
103105

gui/builtinStatsViews/resistancesViewFull.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,9 @@ def refreshPanel(self, fit):
197197
lbl = getattr(self, "labelResistance%sEhp" % tankType.capitalize())
198198
if ehp is not None:
199199
total += ehp[tankType]
200+
rrFactor = fit.ehp[tankType] / fit.hp[tankType]
200201
lbl.SetLabel(formatAmount(ehp[tankType], 3, 0, 9))
201-
lbl.SetToolTip(wx.ToolTip("%s: %d" % (tankType.capitalize(), ehp[tankType])))
202+
lbl.SetToolTip(wx.ToolTip("%s: %d\nResist Multiplier: x%.2f" % (tankType.capitalize(), ehp[tankType], rrFactor)))
202203
else:
203204
lbl.SetLabel("0")
204205

gui/builtinViewColumns/price.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def __init__(self, fittingView, params):
3333
self.imageId = fittingView.imageList.GetImageIndex("totalPrice_small", "icons")
3434

3535
def getText(self, stuff):
36-
if stuff.item is None:
36+
if stuff.item is None or stuff.item.group.name == "Ship Modifiers":
3737
return ""
3838

3939
sMkt = service.Market.getInstance()

scripts/icons_update.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,21 @@ def unzero(fname):
165165
fnames.add(fname)
166166

167167

168+
def crop_image(img):
169+
w, h = img.size
170+
if h == w:
171+
return img
172+
normal = min(h, w)
173+
diff_w = w - normal
174+
diff_h = h - normal
175+
crop_top = diff_h // 2
176+
crop_bot = diff_h // 2 + diff_h % 2
177+
crop_left = diff_w // 2
178+
crop_right = diff_w // 2 + diff_w % 2
179+
box = (crop_left, crop_top, w - crop_right, h - crop_bot)
180+
return img.crop(box)
181+
182+
168183
def get_icon_file(request):
169184
"""
170185
Get the iconFile field value and find proper
@@ -190,6 +205,7 @@ def get_icon_file(request):
190205
except KeyError:
191206
fullpath = sizes[max(sizes)]
192207
img = Image.open(fullpath)
208+
img = crop_image(img)
193209
img.thumbnail(ICON_SIZE, Image.ANTIALIAS)
194210
else:
195211
img = Image.open(fullpath)

scripts/renders_update.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,27 @@
5858
toadd = needed.difference(existing)
5959

6060

61+
def crop_image(img):
62+
w, h = img.size
63+
if h == w:
64+
return img
65+
normal = min(h, w)
66+
diff_w = w - normal
67+
diff_h = h - normal
68+
crop_top = diff_h // 2
69+
crop_bot = diff_h // 2 + diff_h % 2
70+
crop_left = diff_w // 2
71+
crop_right = diff_w // 2 + diff_w % 2
72+
box = (crop_left, crop_top, w - crop_right, h - crop_bot)
73+
return img.crop(box)
74+
75+
6176
def get_render(type_id):
6277
fname = '{}.png'.format(type_id)
6378
fullpath = os.path.join(export_dir, fname)
6479
img = Image.open(fullpath)
6580
if img.size != RENDER_SIZE:
81+
img = crop_image(img)
6682
img.thumbnail(RENDER_SIZE, Image.ANTIALIAS)
6783
return img
6884

service/price.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def fetchPrices(cls, prices):
5252
item = eos.db.getItem(typeID)
5353
# We're not going to request items only with market group, as eve-central
5454
# doesn't provide any data for items not on the market
55-
if item.marketGroupID:
55+
if item is not None and item.marketGroupID:
5656
toRequest.add(typeID)
5757

5858
# Do not waste our time if all items are not on the market

staticdata/icons/icon107_12.png

12 Bytes
Loading

0 commit comments

Comments
 (0)