Merge branch 'master' into toggleProjectionFit
Conflicts: config.py
This commit is contained in:
12
config.py
12
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# along with eos. If not, see <http://www.gnu.org/licenses/>.
|
||||
#===============================================================================
|
||||
|
||||
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)
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
@@ -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")
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 871 B After Width: | Height: | Size: 883 B |
Binary file not shown.
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 788 B |
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 750 B |
Reference in New Issue
Block a user