Adding Option to Change "total price" calculation Statview

Hint for module and total price provide detail informations
This commit is contained in:
Indiction
2019-03-16 12:56:10 +01:00
committed by DarkPhoenix
parent 54277ebbda
commit c02cccf415
3 changed files with 108 additions and 15 deletions

View File

@@ -3,7 +3,7 @@ import wx
from gui.preferenceView import PreferenceView
from gui.bitmap_loader import BitmapLoader
from service.settings import StatViewSettings
from service.settings import StatViewSettings, PriceMenuSettings
class PFStatViewPref(PreferenceView):
@@ -12,6 +12,7 @@ class PFStatViewPref(PreferenceView):
def __init__(self):
self.dirtySettings = False
self.settings = StatViewSettings.getInstance()
self.priceSettings = PriceMenuSettings.getInstance()
def refreshPanel(self, fit):
pass
@@ -99,6 +100,28 @@ class PFStatViewPref(PreferenceView):
self.rbOutgoing.SetSelection(self.settings.get('outgoing'))
rbSizerRow3.Add(self.rbOutgoing, 1, wx.TOP | wx.RIGHT, 5)
self.rbOutgoing.Bind(wx.EVT_RADIOBOX, self.OnOutgoingChange)
self.tbTotalPriceBox = wx.StaticBoxSizer(wx.VERTICAL, panel, "Total Price Includes")
self.tbTotalPriceDrones = wx.CheckBox(panel, -1, "Drones", wx.DefaultPosition, wx.DefaultSize, 1)
self.tbTotalPriceDrones.SetValue(self.priceSettings.get("drones"))
self.tbTotalPriceCargo = wx.CheckBox(panel, -1, "Cargo", wx.DefaultPosition, wx.DefaultSize, 1)
self.tbTotalPriceCargo.SetValue(self.priceSettings.get("cargo"))
self.tbTotalPriceImplant = wx.CheckBox(panel, -1, "Implants", wx.DefaultPosition, wx.DefaultSize, 1)
self.tbTotalPriceImplant.SetValue(self.priceSettings.get("character")) #TODO: Value sometimes loaded wrong
self.tbTotalPriceBox.AddSpacer(5)
self.tbTotalPriceBox.Add(self.tbTotalPriceDrones)
self.tbTotalPriceBox.AddSpacer(10)
self.tbTotalPriceBox.Add(self.tbTotalPriceCargo)
self.tbTotalPriceBox.AddSpacer(10)
self.tbTotalPriceBox.Add(self.tbTotalPriceImplant)
self.tbTotalPriceBox.RecalcSizes()
rbSizerRow3.Add(self.tbTotalPriceBox, 1, wx.TOP | wx.RIGHT, 5)
self.tbTotalPriceDrones.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceDroneChange)
self.tbTotalPriceCargo.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCargoChange)
self.tbTotalPriceImplant.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceImplantChange)
mainSizer.Add(rbSizerRow3, 1, wx.ALL | wx.EXPAND, 0)
# We don't have views for these.....yet
'''
self.rbMining = wx.RadioBox(panel, -1, "Mining", wx.DefaultPosition, wx.DefaultSize,
@@ -114,8 +137,6 @@ class PFStatViewPref(PreferenceView):
self.rbDrones.Bind(wx.EVT_RADIOBOX, self.OnDroneChange)
'''
mainSizer.Add(rbSizerRow3, 1, wx.ALL | wx.EXPAND, 0)
panel.SetSizer(mainSizer)
panel.Layout()
@@ -149,6 +170,16 @@ class PFStatViewPref(PreferenceView):
def OnDroneChange(self, event):
self.settings.set('drones', event.GetInt())
def OnTotalPriceDroneChange(self, event):
self.priceSettings.set('drones', event.GetInt())
def OnTotalPriceCargoChange(self, event):
self.priceSettings.set('cargo', event.GetInt())
def OnTotalPriceImplantChange(self, event):
self.priceSettings.set('character', event.GetInt())
def getImage(self):
return BitmapLoader.getBitmap("settings_stats", "gui")