From 97ef231711a0529cbafaa663eac198a5b75d0603 Mon Sep 17 00:00:00 2001 From: blitzmann Date: Thu, 23 Aug 2018 21:10:59 -0400 Subject: [PATCH] fix price callbacks --- gui/builtinViewColumns/price.py | 8 ++++---- service/price.py | 9 +++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/gui/builtinViewColumns/price.py b/gui/builtinViewColumns/price.py index 728376bef..e32f49c04 100644 --- a/gui/builtinViewColumns/price.py +++ b/gui/builtinViewColumns/price.py @@ -45,10 +45,10 @@ class Price(ViewColumn): if stuff.isEmpty: return "" - price = stuff.item.price.price + price = stuff.item.price - if not price: - return "" + if not price or not price.isValid: + return False if isinstance(stuff, Drone) or isinstance(stuff, Cargo): price *= stuff.amount @@ -59,7 +59,7 @@ class Price(ViewColumn): sPrice = ServicePrice.getInstance() def callback(item): - price = item.item.price + price = item[0] text = formatAmount(price.price, 3, 3, 9, currency=True) if price.price else "" if price.failed: text += " (!)" diff --git a/service/price.py b/service/price.py index 612937e39..2b8cd474b 100644 --- a/service/price.py +++ b/service/price.py @@ -228,10 +228,11 @@ class PriceWorkerThread(threading.Thread): def trigger(self, prices, callbacks): self.queue.put((callbacks, prices)) - def setToWait(self, itemID, callback): - if itemID not in self.wait: - self.wait[itemID] = [] - self.wait[itemID].append(callback) + def setToWait(self, prices, callback): + for x in prices: + if x.typeID not in self.wait: + self.wait[x.typeID] = [] + self.wait[x.typeID].append(callback) from service.marketSources import evemarketer, evemarketdata # noqa: E402