total computation + settings
This commit is contained in:
@@ -23,6 +23,7 @@ from gui.statsView import StatsView
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
from service.price import Price
|
||||
from service.settings import PriceMenuSettings
|
||||
|
||||
|
||||
class PriceViewFull(StatsView):
|
||||
@@ -31,6 +32,7 @@ class PriceViewFull(StatsView):
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
self.settings = PriceMenuSettings.getInstance()
|
||||
|
||||
def getHeaderText(self, fit):
|
||||
return "Price"
|
||||
@@ -49,7 +51,7 @@ class PriceViewFull(StatsView):
|
||||
|
||||
gridPrice = wx.GridSizer(2, 3)
|
||||
contentSizer.Add(gridPrice, 0, wx.EXPAND | wx.ALL, 0)
|
||||
for _type in ("ship", "fittings", "drones", "cargoBay", "character", "total"):
|
||||
for _type in ("ship", "fittings", "total", "drones", "cargoBay", "character"):
|
||||
if _type in "ship":
|
||||
image = "ship_big"
|
||||
elif _type in ("fittings", "total"):
|
||||
@@ -125,8 +127,18 @@ class PriceViewFull(StatsView):
|
||||
for implant in fit.implants:
|
||||
implant_price += implant.item.price.price
|
||||
|
||||
fitting_price = module_price + drone_price + fighter_price + cargo_price + booster_price + implant_price
|
||||
total_price = ship_price + fitting_price
|
||||
total_price = 0
|
||||
|
||||
if (self.settings.get("ship")):
|
||||
total_price += ship_price
|
||||
if(self.settings.get("modules")):
|
||||
total_price += module_price
|
||||
if(self.settings.get("drones")):
|
||||
total_price += drone_price + fighter_price
|
||||
if(self.settings.get("cargo")):
|
||||
total_price += cargo_price
|
||||
if(self.settings.get("character")):
|
||||
total_price += booster_price + implant_price
|
||||
|
||||
self.labelPriceShip.SetLabel("%s ISK" % formatAmount(ship_price, 3, 3, 9, currency=True))
|
||||
self.labelPriceShip.SetToolTip(wx.ToolTip('{:,.2f}'.format(ship_price)))
|
||||
@@ -134,6 +146,9 @@ class PriceViewFull(StatsView):
|
||||
self.labelPriceFittings.SetLabel("%s ISK" % formatAmount(module_price, 3, 3, 9, currency=True))
|
||||
self.labelPriceFittings.SetToolTip(wx.ToolTip('{:,.2f}'.format(module_price)))
|
||||
|
||||
self.labelPriceTotal.SetLabel("%s ISK" % formatAmount(total_price, 3, 3, 9, currency=True))
|
||||
self.labelPriceTotal.SetToolTip(wx.ToolTip('{:,.2f}'.format(total_price)))
|
||||
|
||||
self.labelPriceDrones.SetLabel("%s ISK" % formatAmount(drone_price + fighter_price, 3, 3, 9, currency=True))
|
||||
self.labelPriceDrones.SetToolTip(wx.ToolTip('{:,.2f}'.format(drone_price + fighter_price)))
|
||||
|
||||
@@ -143,8 +158,7 @@ class PriceViewFull(StatsView):
|
||||
self.labelPriceCharacter.SetLabel("%s ISK" % formatAmount(booster_price + implant_price, 3, 3, 9, currency=True))
|
||||
self.labelPriceCharacter.SetToolTip(wx.ToolTip('{:,.2f}'.format(booster_price + implant_price)))
|
||||
|
||||
self.labelPriceTotal.SetLabel("%s ISK" % formatAmount(total_price, 3, 3, 9, currency=True))
|
||||
self.labelPriceTotal.SetToolTip(wx.ToolTip('{:,.2f}'.format(total_price)))
|
||||
|
||||
|
||||
def processPrices(self, prices):
|
||||
self.refreshPanelPrices(self.fit)
|
||||
|
||||
@@ -23,6 +23,7 @@ from gui.statsView import StatsView
|
||||
from gui.bitmapLoader import BitmapLoader
|
||||
from gui.utils.numberFormatter import formatAmount
|
||||
from service.price import Price
|
||||
from service.settings import PriceMenuSettings
|
||||
|
||||
|
||||
class PriceViewMinimal(StatsView):
|
||||
@@ -31,6 +32,7 @@ class PriceViewMinimal(StatsView):
|
||||
def __init__(self, parent):
|
||||
StatsView.__init__(self)
|
||||
self.parent = parent
|
||||
self.settings = PriceMenuSettings.getInstance()
|
||||
|
||||
def getHeaderText(self, fit):
|
||||
return "Price"
|
||||
@@ -119,7 +121,24 @@ class PriceViewMinimal(StatsView):
|
||||
for implant in fit.implants:
|
||||
implant_price += implant.item.price.price
|
||||
|
||||
fitting_price = module_price + drone_price + fighter_price + cargo_price + booster_price + implant_price
|
||||
fitting_price = module_price
|
||||
|
||||
total_price = 0
|
||||
|
||||
if (self.settings.get("ship")):
|
||||
total_price += ship_price
|
||||
if(self.settings.get("modules")):
|
||||
total_price += module_price
|
||||
if(self.settings.get("drones")):
|
||||
total_price += drone_price + fighter_price
|
||||
if(self.settings.get("cargo")):
|
||||
total_price += cargo_price
|
||||
if(self.settings.get("character")):
|
||||
total_price += booster_price + implant_price
|
||||
|
||||
|
||||
|
||||
|
||||
total_price = ship_price + fitting_price
|
||||
|
||||
self.labelPriceShip.SetLabel("%s ISK" % formatAmount(ship_price, 3, 3, 9, currency=True))
|
||||
|
||||
@@ -421,6 +421,38 @@ class StatViewSettings(object):
|
||||
self.serviceStatViewDefaultSettings[type] = value
|
||||
|
||||
|
||||
class PriceMenuSettings(object):
|
||||
_instance = None
|
||||
|
||||
@classmethod
|
||||
def getInstance(cls):
|
||||
if cls._instance is None:
|
||||
cls._instance = PriceMenuSettings()
|
||||
|
||||
return cls._instance
|
||||
|
||||
def __init__(self):
|
||||
# mode
|
||||
# 0 - Do not add to total
|
||||
# 1 - Add to total
|
||||
PriceMenuDefaultSettings = {
|
||||
"ship" : 1,
|
||||
"modules" : 1,
|
||||
"drones" : 0,
|
||||
"cargo" : 0,
|
||||
"character" : 0
|
||||
}
|
||||
|
||||
self.PriceMenuDefaultSettings = SettingsProvider.getInstance().getSettings("pyfaPriceMenuSettings",
|
||||
PriceMenuDefaultSettings)
|
||||
|
||||
def get(self, type):
|
||||
return self.PriceMenuDefaultSettings[type]
|
||||
|
||||
def set(self, type, value):
|
||||
self.PriceMenuDefaultSettings[type] = value
|
||||
|
||||
|
||||
class ContextMenuSettings(object):
|
||||
_instance = None
|
||||
|
||||
|
||||
Reference in New Issue
Block a user