Remove detailed price popups and move price preferences to new preference tab

This commit is contained in:
DarkPhoenix
2019-03-25 15:57:42 +03:00
parent c02cccf415
commit 3229652efa
4 changed files with 43 additions and 120 deletions

View File

@@ -7,7 +7,7 @@ from gui.bitmap_loader import BitmapLoader
import gui.mainFrame
import gui.globalEvents as GE
from service.settings import SettingsProvider
from service.settings import PriceMenuSettings
from service.fit import Fit
from service.price import Price
@@ -15,6 +15,10 @@ from service.price import Price
class PFMarketPref(PreferenceView):
title = "Market & Prices"
def __init__(self):
self.dirtySettings = False
self.priceSettings = PriceMenuSettings.getInstance()
def populatePanel(self, panel):
self.mainFrame = gui.mainFrame.MainFrame.getInstance()
self.dirtySettings = False
@@ -40,10 +44,9 @@ class PFMarketPref(PreferenceView):
self.stDefaultSystem.Wrap(-1)
priceSizer.Add(self.stDefaultSystem, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5)
self.stDefaultSystem.SetCursor(helpCursor)
self.stDefaultSystem.SetToolTip(
wx.ToolTip(
'The source you choose will be tried first, but subsequent sources will be used if the preferred source fails. '
'The system you choose will also be tried first, and if no data is available, global prices will be used.'))
self.stDefaultSystem.SetToolTip(wx.ToolTip(
'The source you choose will be tried first, but subsequent sources will be used if the preferred source fails. '
'The system you choose will also be tried first, and if no data is available, global price will be used.'))
self.chPriceSource = wx.Choice(panel, choices=sorted(Price.sources.keys()))
self.chPriceSystem = wx.Choice(panel, choices=list(Price.systemsList.keys()))
@@ -79,6 +82,25 @@ class PFMarketPref(PreferenceView):
self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection)
self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange)
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()
mainSizer.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)
panel.SetSizer(mainSizer)
panel.Layout()
@@ -106,5 +128,14 @@ class PFMarketPref(PreferenceView):
source = self.chPriceSource.GetString(self.chPriceSource.GetSelection())
self.sFit.serviceFittingOptions["priceSource"] = source
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())
PFMarketPref.register()

View File

@@ -3,7 +3,7 @@ import wx
from gui.preferenceView import PreferenceView
from gui.bitmap_loader import BitmapLoader
from service.settings import StatViewSettings, PriceMenuSettings
from service.settings import StatViewSettings
class PFStatViewPref(PreferenceView):
@@ -12,7 +12,6 @@ class PFStatViewPref(PreferenceView):
def __init__(self):
self.dirtySettings = False
self.settings = StatViewSettings.getInstance()
self.priceSettings = PriceMenuSettings.getInstance()
def refreshPanel(self, fit):
pass
@@ -101,42 +100,8 @@ class PFStatViewPref(PreferenceView):
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,
['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
self.rbMining.SetSelection(self.settings.get('miningyield'))
rbSizerRow3.Add(self.rbMining, 1, wx.ALL, 5)
self.rbMining.Bind(wx.EVT_RADIOBOX, self.OnMiningYieldChange)
self.rbDrones = wx.RadioBox(panel, -1, "Drones", wx.DefaultPosition, wx.DefaultSize,
['None', 'Minimal', 'Full'], 1, wx.RA_SPECIFY_COLS)
self.rbDrones.SetSelection(self.settings.get('drones'))
rbSizerRow3.Add(self.rbDrones, 1, wx.ALL, 5)
self.rbDrones.Bind(wx.EVT_RADIOBOX, self.OnDroneChange)
'''
panel.SetSizer(mainSizer)
panel.Layout()
@@ -170,16 +135,6 @@ 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")

View File

@@ -24,7 +24,6 @@ from gui.bitmap_loader import BitmapLoader
from gui.utils.numberFormatter import formatAmount
from service.price import Fit, Price
from service.settings import PriceMenuSettings
from eos.const import FittingSlot
class PriceViewFull(StatsView):
@@ -91,13 +90,6 @@ class PriceViewFull(StatsView):
ship_price = 0
module_price = 0
module_slot_price = {
FittingSlot.HIGH: 0,
FittingSlot.MED: 0,
FittingSlot.LOW: 0,
FittingSlot.RIG: 0,
FittingSlot.SUBSYSTEM: 0
}
drone_price = 0
fighter_price = 0
cargo_price = 0
@@ -111,8 +103,6 @@ class PriceViewFull(StatsView):
for module in fit.modules:
if not module.isEmpty:
module_price += module.item.price.price
if module.slot in module_slot_price:
module_slot_price[module.slot] += module.item.price.price
if fit.drones:
for drone in fit.drones:
@@ -151,12 +141,7 @@ class PriceViewFull(StatsView):
self.labelPriceShip.SetToolTip(wx.ToolTip('{:,.2f} ISK'.format(ship_price)))
self.labelPriceFittings.SetLabel("%s ISK" % formatAmount(module_price, 3, 3, 9, currency=True))
self.labelPriceFittings.SetToolTip(wx.ToolTip('Highs:\t\t{:,.2f} ISK \n'.format(module_slot_price[FittingSlot.HIGH])+
'Meds:\t\t{:,.2f} ISK \n'.format(module_slot_price[FittingSlot.MED]) +
'Lows:\t\t{:,.2f} ISK \n'.format(module_slot_price[FittingSlot.LOW]) +
'Rigs:\t\t{:,.2f} ISK \n'.format(module_slot_price[FittingSlot.RIG]) +
'Subsystems:\t{:,.2f} ISK \n'.format(module_slot_price[FittingSlot.SUBSYSTEM])+
'Total:\t\t{:,.2f} ISK \n'.format(module_price)))
self.labelPriceFittings.SetToolTip(wx.ToolTip('{:,.2f} ISK'.format(module_price)))
self.labelPriceDrones.SetLabel("%s ISK" % formatAmount(drone_price + fighter_price, 3, 3, 9, currency=True))
self.labelPriceDrones.SetToolTip(wx.ToolTip('{:,.2f} ISK'.format(drone_price + fighter_price)))
@@ -164,29 +149,11 @@ class PriceViewFull(StatsView):
self.labelPriceCargobay.SetLabel("%s ISK" % formatAmount(cargo_price, 3, 3, 9, currency=True))
self.labelPriceCargobay.SetToolTip(wx.ToolTip('{:,.2f} ISK'.format(cargo_price)))
self.labelPriceCharacter.SetLabel(
"%s ISK" % formatAmount(booster_price + implant_price, 3, 3, 9, currency=True))
self.labelPriceCharacter.SetLabel("%s ISK" % formatAmount(booster_price + implant_price, 3, 3, 9, currency=True))
self.labelPriceCharacter.SetToolTip(wx.ToolTip('{:,.2f} ISK'.format(booster_price + implant_price)))
self.labelPriceTotal.SetLabel("%s ISK" % formatAmount(total_price, 3, 3, 9, currency=True))
self.labelPriceTotal.SetToolTip(wx.ToolTip('Ship + Modules:\t{:,.2f} ISK \n'.format(ship_price +
module_price) +
'+ Drones:\t{:,.2f} ISK \n'.format(ship_price +
module_price +
drone_price +
fighter_price) +
'+ Cargo:\t\t{:,.2f} ISK \n'.format(ship_price +
module_price +
drone_price +
fighter_price +
cargo_price) +
'+ Implants:\t{:,.2f} ISK'.format(ship_price +
module_price +
drone_price +
fighter_price +
cargo_price +
implant_price)))
self.labelPriceTotal.SetToolTip(wx.ToolTip('{:,.2f} ISK'.format(total_price)))
def processPrices(self, prices):
self.refreshPanelPrices(self.fit)

View File

@@ -24,7 +24,6 @@ from gui.bitmap_loader import BitmapLoader
from gui.utils.numberFormatter import formatAmount
from service.price import Fit, Price
from service.settings import PriceMenuSettings
from eos.const import FittingSlot
class PriceViewMinimal(StatsView):
@@ -85,13 +84,6 @@ class PriceViewMinimal(StatsView):
ship_price = 0
module_price = 0
module_slot_price = {
FittingSlot.HIGH: 0,
FittingSlot.MED: 0,
FittingSlot.LOW: 0,
FittingSlot.RIG: 0,
FittingSlot.SUBSYSTEM: 0
}
drone_price = 0
fighter_price = 0
cargo_price = 0
@@ -105,8 +97,6 @@ class PriceViewMinimal(StatsView):
for module in fit.modules:
if not module.isEmpty:
module_price += module.item.price.price
if module.slot in module_slot_price:
module_slot_price[module.slot] += module.item.price.price
if fit.drones:
for drone in fit.drones:
@@ -147,31 +137,11 @@ class PriceViewMinimal(StatsView):
self.labelPriceShip.SetToolTip(wx.ToolTip('{:,.2f} ISK'.format(ship_price)))
self.labelPriceFittings.SetLabel("%s ISK" % formatAmount(fitting_price, 3, 3, 9, currency=True))
self.labelPriceFittings.SetToolTip(wx.ToolTip('Highs:\t\t{:,.2f} ISK \n'.format(module_slot_price[FittingSlot.HIGH])+
'Meds:\t\t{:,.2f} ISK \n'.format(module_slot_price[FittingSlot.MED]) +
'Lows:\t\t{:,.2f} ISK \n'.format(module_slot_price[FittingSlot.LOW]) +
'Rigs:\t\t{:,.2f} ISK \n'.format(module_slot_price[FittingSlot.RIG]) +
'Subsystems:\t{:,.2f} ISK \n'.format(module_slot_price[FittingSlot.SUBSYSTEM])+
'Total:\t\t{:,.2f} ISK \n'.format(fitting_price)))
self.labelPriceFittings.SetToolTip(wx.ToolTip('{:,.2f} ISK'.format(fitting_price)))
self.labelPriceTotal.SetLabel("%s ISK" % formatAmount(total_price, 3, 3, 9, currency=True))
self.labelPriceTotal.SetToolTip(wx.ToolTip('Ship + Modules:\t{:,.2f} ISK \n'.format(ship_price +
module_price) +
'+ Drones:\t{:,.2f} ISK \n'.format(ship_price +
module_price +
drone_price +
fighter_price) +
'+ Cargo:\t\t{:,.2f} ISK \n'.format(ship_price +
module_price +
drone_price +
fighter_price +
cargo_price) +
'+ Implants:\t{:,.2f} ISK \n'.format(ship_price +
module_price +
drone_price +
fighter_price +
cargo_price +
implant_price)))
self.labelPriceTotal.SetToolTip(wx.ToolTip('{:,.2f} ISK'.format(total_price)))
def processPrices(self, prices):
self.refreshPanelPrices(self.fit)