Transfer of the price dropbox in the preferences pane.

Moving of the modules list compiling from priceview to price service.
This commit is contained in:
petosorus
2017-02-09 18:25:27 +01:00
parent d15acf89ba
commit bfa772609a
3 changed files with 50 additions and 46 deletions

View File

@@ -6,7 +6,7 @@ from gui.bitmapLoader import BitmapLoader
import gui.mainFrame
import service
import gui.globalEvents as GE
from service import Price
class PFGeneralPref ( PreferenceView):
title = "General"
@@ -65,6 +65,9 @@ class PFGeneralPref ( PreferenceView):
self.cbExportCharges = wx.CheckBox( panel, wx.ID_ANY, u"Export loaded charges", wx.DefaultPosition, wx.DefaultSize, 0 )
mainSizer.Add( self.cbExportCharges, 0, wx.ALL|wx.EXPAND, 5 )
self.chPriceSystem = wx.Choice( panel, choices=Price.systemsList.keys())
mainSizer.Add( self.chPriceSystem, 0, wx.ALL|wx.EXPAND, 5)
defCharSizer = wx.BoxSizer( wx.HORIZONTAL )
self.sFit = service.Fit.getInstance()
@@ -81,6 +84,7 @@ class PFGeneralPref ( PreferenceView):
self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False)
self.cbGaugeAnimation.SetValue(self.sFit.serviceFittingOptions["enableGaugeAnimation"])
self.cbExportCharges.SetValue(self.sFit.serviceFittingOptions["exportCharges"])
self.chPriceSystem.SetStringSelection("Jita")
self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange)
self.cbGlobalDmgPattern.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalDmgPatternStateChange)
@@ -94,6 +98,7 @@ class PFGeneralPref ( PreferenceView):
self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts)
self.cbGaugeAnimation.Bind(wx.EVT_CHECKBOX, self.onCBGaugeAnimation)
self.cbExportCharges.Bind(wx.EVT_CHECKBOX, self.onCBExportCharges)
self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection)
self.cbRackLabels.Enable(self.sFit.serviceFittingOptions["rackSlots"] or False)
@@ -162,4 +167,23 @@ class PFGeneralPref ( PreferenceView):
def getImage(self):
return BitmapLoader.getBitmap("prefs_settings", "gui")
def onPriceSelection(self, event):
Price.currentSystemId = Price.systemsList.get(
self.chPriceSystem.GetString(self.chPriceSystem.GetSelection())
)
mainFrame = gui.mainFrame.MainFrame.getInstance()
sFit = service.Fit.getInstance()
fitID = self.mainFrame.getActiveFit()
fit = sFit.getFit(fitID)
sMkt = service.Market.getInstance()
typeIDs = Price.fitItemsList(fit)
sMkt.getPrices(typeIDs, Price.invalidPrices)
self.sFit.refreshFit(fitID)
wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID))
PFGeneralPref.register()