Merge branch 'development' into feature/strictSkills

Conflicts:
	eos/gamedata.py
This commit is contained in:
blitzmann
2017-04-26 19:42:29 -04:00
5 changed files with 23 additions and 18 deletions

View File

@@ -461,9 +461,10 @@ class Item(EqBase):
@property
def price(self):
# todo: use `from sqlalchemy import inspect` instead (need to verify it works in old and new OS X builds)
if self.__price is not None and getattr(self.__price, '_sa_instance_state', None):
pyfalog.debug("Price data for {} was deleted, resetting object".format(self.ID))
# todo: use `from sqlalchemy import inspect` instead (mac-deprecated doesn't have inspect(), was imp[lemented in 0.8)
if self.__price is not None and getattr(self.__price, '_sa_instance_state', None) and self.__price._sa_instance_state.deleted:
pyfalog.debug("Price data for {} was deleted (probably from a cache reset), resetting object".format(self.ID))
self.__price = None
if self.__price is None:

View File

@@ -45,8 +45,7 @@ class Price(ViewColumn):
if stuff.isEmpty:
return ""
sPrice = ServicePrice.getInstance()
price = sPrice.getPriceNow(stuff.item)
price = stuff.item.price.price
if not price:
return ""
@@ -60,7 +59,7 @@ class Price(ViewColumn):
sPrice = ServicePrice.getInstance()
def callback(item):
price = sPrice.getPriceNow(item.ID)
price = item.item.price
text = formatAmount(price.price, 3, 3, 9, currency=True) if price.price else ""
if price.failed:
text += " (!)"

View File

@@ -481,6 +481,7 @@ class FittingView(d.Display):
# This only happens when turning on/off slot divisions
self.populate(self.mods)
self.refresh(self.mods)
self.Refresh()
self.Show(self.activeFitID is not None and self.activeFitID == event.fitID)
except wx._core.PyDeadObjectError:

View File

@@ -535,6 +535,10 @@ class ItemParams(wx.Panel):
class ItemCompare(wx.Panel):
def __init__(self, parent, stuff, item, items, context=None):
# Start dealing with Price stuff to get that thread going
sPrice = ServicePrice.getInstance()
sPrice.getPrices(items, self.UpdateList)
wx.Panel.__init__(self, parent)
mainSizer = wx.BoxSizer(wx.VERTICAL)
@@ -591,11 +595,10 @@ class ItemCompare(wx.Panel):
wx.DefaultSize, 0)
bSizer.Add(self.toggleViewBtn, 0, wx.ALIGN_CENTER_VERTICAL)
if stuff is not None:
self.refreshBtn = wx.Button(self, wx.ID_ANY, u"Refresh", wx.DefaultPosition, wx.DefaultSize,
wx.BU_EXACTFIT)
bSizer.Add(self.refreshBtn, 0, wx.ALIGN_CENTER_VERTICAL)
self.refreshBtn.Bind(wx.EVT_BUTTON, self.RefreshValues)
self.refreshBtn = wx.Button(self, wx.ID_ANY, u"Refresh", wx.DefaultPosition, wx.DefaultSize,
wx.BU_EXACTFIT)
bSizer.Add(self.refreshBtn, 0, wx.ALIGN_CENTER_VERTICAL)
self.refreshBtn.Bind(wx.EVT_BUTTON, self.RefreshValues)
mainSizer.Add(bSizer, 0, wx.ALIGN_RIGHT)
@@ -610,7 +613,8 @@ class ItemCompare(wx.Panel):
self.PopulateList(event.Column)
self.Thaw()
def UpdateList(self):
def UpdateList(self, items=None):
# We do nothing with `items`, but it gets returned by the price service thread
self.Freeze()
self.paramList.ClearAll()
self.PopulateList()
@@ -680,9 +684,8 @@ class ItemCompare(wx.Panel):
self.paramList.SetStringItem(i, x + 1, valueUnit)
# Add prices
sPrice = ServicePrice.getInstance()
self.paramList.SetStringItem(i, len(self.attrs) + 1, formatAmount(sPrice.getPriceNow(item), 3, 3, 9, currency=True))
# Add prices
self.paramList.SetStringItem(i, len(self.attrs) + 1, formatAmount(item.price.price, 3, 3, 9, currency=True))
self.paramList.RefreshRows()
self.Layout()
@@ -1431,10 +1434,9 @@ class ItemProperties(wx.Panel):
else:
attrName = name.title()
value = getattr(self.item, name)
except Exception as e:
except:
# TODO: Add logging to this.
# We couldn't get a property for some reason. Skip it for now.
print(e)
continue
index = self.paramList.InsertStringItem(sys.maxint, attrName)

View File

@@ -255,7 +255,9 @@ class MainFrame(wx.Frame):
# Remove any fits that cause exception when fetching (non-existent fits)
for id in fits[:]:
try:
sFit.getFit(id, basic=True)
fit = sFit.getFit(id, basic=True)
if fit is None:
fits.remove(id)
except:
fits.remove(id)