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

@@ -142,15 +142,15 @@ class PriceViewFull(StatsView):
shipPrice = 0
modPrice = sum(map(lambda p: p.price or 0, prices[1:]))
if self._cachedShip != shipPrice:
self.labelPriceShip.SetLabel("%s ISK" % formatAmount(shipPrice, 3, 3, 9))
self.labelPriceShip.SetLabel("%s ISK" % formatAmount(shipPrice, 3, 3, 9, currency=True))
self.labelPriceShip.SetToolTip(wx.ToolTip("%.2f ISK" % shipPrice))
self._cachedShip = shipPrice
if self._cachedFittings != modPrice:
self.labelPriceFittings.SetLabel("%s ISK" % formatAmount(modPrice, 3, 3, 9))
self.labelPriceFittings.SetLabel("%s ISK" % formatAmount(modPrice, 3, 3, 9, currency=True))
self.labelPriceFittings.SetToolTip(wx.ToolTip("%.2f ISK" % modPrice))
self._cachedFittings = modPrice
if self._cachedTotal != (shipPrice+modPrice):
self.labelPriceTotal.SetLabel("%s ISK" % formatAmount(shipPrice + modPrice, 3, 3, 9))
self.labelPriceTotal.SetLabel("%s ISK" % formatAmount(shipPrice + modPrice, 3, 3, 9, currency=True))
self.labelPriceTotal.SetToolTip(wx.ToolTip("%.2f ISK" % (shipPrice + modPrice)))
self._cachedTotal = shipPrice + modPrice
self.panel.Layout()