Rework number formatter to avoid silly stuff like formatting 999999 with precision of 3 to 1000k instead of 1M

This commit is contained in:
DarkPhoenix
2011-06-24 21:37:41 +04:00
parent 18b43bea41
commit 3488a5d26e
3 changed files with 93 additions and 59 deletions

View File

@@ -37,12 +37,12 @@ class Price(ViewColumn):
sMarket = service.Market.getInstance()
price = sMarket.getPriceNow(stuff.item.ID)
return formatAmount(price.price, 3, 3, 9) if price and price.price else False
return formatAmount(price.price, 3, 3, 9, currency=True) if price and price.price else False
def delayedText(self, mod, display, colItem):
def callback(requests):
price = requests[0].price
colItem.SetText(formatAmount(price, 3, 3, 9) if price else "")
colItem.SetText(formatAmount(price, 3, 3, 9, currency=True) if price else "")
display.SetItem(colItem)
service.Market.getInstance().getPrices([mod.item.ID], callback)