From 295368635b12df134be11acc445ed932e92bcf38 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Thu, 21 Mar 2019 14:00:49 +0300 Subject: [PATCH 01/32] Move some of preferences into new group --- gui/builtinPreferenceViews/__init__.py | 3 +- .../pyfaGeneralPreferences.py | 69 +---------- .../pyfaMarketPreferences.py | 110 ++++++++++++++++++ gui/preferenceView.py | 3 +- 4 files changed, 115 insertions(+), 70 deletions(-) create mode 100644 gui/builtinPreferenceViews/pyfaMarketPreferences.py diff --git a/gui/builtinPreferenceViews/__init__.py b/gui/builtinPreferenceViews/__init__.py index 32117a9ec..e3485d555 100644 --- a/gui/builtinPreferenceViews/__init__.py +++ b/gui/builtinPreferenceViews/__init__.py @@ -7,5 +7,6 @@ __all__ = [ "pyfaLoggingPreferences", "pyfaEnginePreferences", "pyfaEsiPreferences", - "pyfaStatViewPreferences"] + "pyfaStatViewPreferences", + "pyfaMarketPreferences"] diff --git a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py index 8b1c0f27a..262b119a0 100644 --- a/gui/builtinPreferenceViews/pyfaGeneralPreferences.py +++ b/gui/builtinPreferenceViews/pyfaGeneralPreferences.py @@ -21,8 +21,6 @@ class PFGeneralPref(PreferenceView): self.openFitsSettings = SettingsProvider.getInstance().getSettings("pyfaPrevOpenFits", {"enabled": False, "pyfaOpenFits": []}) - helpCursor = wx.Cursor(wx.CURSOR_QUESTION_ARROW) - mainSizer = wx.BoxSizer(wx.VERTICAL) self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0) @@ -66,13 +64,9 @@ class PFGeneralPref(PreferenceView): labelSizer.Add(self.cbRackLabels, 0, wx.ALL | wx.EXPAND, 5) mainSizer.Add(labelSizer, 0, wx.LEFT | wx.EXPAND, 30) - self.cbShowTooltip = wx.CheckBox(panel, wx.ID_ANY, "Show tab tooltips", wx.DefaultPosition, wx.DefaultSize, 0) + self.cbShowTooltip = wx.CheckBox(panel, wx.ID_ANY, "Show fitting tab tooltips", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbShowTooltip, 0, wx.ALL | wx.EXPAND, 5) - self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, "Show market shortcuts", wx.DefaultPosition, - wx.DefaultSize, 0) - mainSizer.Add(self.cbMarketShortcuts, 0, wx.ALL | wx.EXPAND, 5) - self.cbGaugeAnimation = wx.CheckBox(panel, wx.ID_ANY, "Animate gauges", wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbGaugeAnimation, 0, wx.ALL | wx.EXPAND, 5) @@ -84,38 +78,6 @@ class PFGeneralPref(PreferenceView): wx.DefaultPosition, wx.DefaultSize, 0) mainSizer.Add(self.cbShowShipBrowserTooltip, 0, wx.ALL | wx.EXPAND, 5) - priceSizer = wx.BoxSizer(wx.HORIZONTAL) - - self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, "Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0) - 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 is absolute and requests will not be made against other systems.')) - - self.chPriceSource = wx.Choice(panel, choices=sorted(Price.sources.keys())) - self.chPriceSystem = wx.Choice(panel, choices=list(Price.systemsList.keys())) - priceSizer.Add(self.chPriceSource, 1, wx.ALL | wx.EXPAND, 5) - priceSizer.Add(self.chPriceSystem, 1, wx.ALL | wx.EXPAND, 5) - - mainSizer.Add(priceSizer, 0, wx.ALL | wx.EXPAND, 0) - - delayTimer = wx.BoxSizer(wx.HORIZONTAL) - - self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, "Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0) - self.stMarketDelay.Wrap(-1) - self.stMarketDelay.SetCursor(helpCursor) - self.stMarketDelay.SetToolTip( - wx.ToolTip('The delay between a keystroke and the market search. Can help reduce lag when typing fast in the market search box.')) - - delayTimer.Add(self.stMarketDelay, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - - self.intDelay = IntCtrl(panel, max=1000, limited=True) - delayTimer.Add(self.intDelay, 0, wx.ALL, 5) - - mainSizer.Add(delayTimer, 0, wx.ALL | wx.EXPAND, 0) - self.sFit = Fit.getInstance() self.cbGlobalChar.SetValue(self.sFit.serviceFittingOptions["useGlobalCharacter"]) @@ -127,13 +89,9 @@ class PFGeneralPref(PreferenceView): self.cbCompactSkills.SetValue(self.sFit.serviceFittingOptions["compactSkills"] or False) self.cbReopenFits.SetValue(self.openFitsSettings["enabled"]) self.cbShowTooltip.SetValue(self.sFit.serviceFittingOptions["showTooltip"] or False) - self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) self.cbGaugeAnimation.SetValue(self.sFit.serviceFittingOptions["enableGaugeAnimation"]) self.cbOpenFitInNew.SetValue(self.sFit.serviceFittingOptions["openFitInNew"]) - self.chPriceSource.SetStringSelection(self.sFit.serviceFittingOptions["priceSource"]) - self.chPriceSystem.SetStringSelection(self.sFit.serviceFittingOptions["priceSystem"]) self.cbShowShipBrowserTooltip.SetValue(self.sFit.serviceFittingOptions["showShipBrowserTooltip"]) - self.intDelay.SetValue(self.sFit.serviceFittingOptions["marketSearchDelay"]) self.cbGlobalChar.Bind(wx.EVT_CHECKBOX, self.OnCBGlobalCharStateChange) self.cbDefaultCharImplants.Bind(wx.EVT_CHECKBOX, self.OnCBDefaultCharImplantsStateChange) @@ -144,23 +102,15 @@ class PFGeneralPref(PreferenceView): self.cbCompactSkills.Bind(wx.EVT_CHECKBOX, self.onCBCompactSkills) self.cbReopenFits.Bind(wx.EVT_CHECKBOX, self.onCBReopenFits) self.cbShowTooltip.Bind(wx.EVT_CHECKBOX, self.onCBShowTooltip) - self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts) self.cbGaugeAnimation.Bind(wx.EVT_CHECKBOX, self.onCBGaugeAnimation) self.cbOpenFitInNew.Bind(wx.EVT_CHECKBOX, self.onCBOpenFitInNew) - self.chPriceSource.Bind(wx.EVT_CHOICE, self.onPricesSourceSelection) - self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection) self.cbShowShipBrowserTooltip.Bind(wx.EVT_CHECKBOX, self.onCBShowShipBrowserTooltip) - self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) self.cbRackLabels.Enable(self.sFit.serviceFittingOptions["rackSlots"] or False) panel.SetSizer(mainSizer) panel.Layout() - def onMarketDelayChange(self, event): - self.sFit.serviceFittingOptions["marketSearchDelay"] = self.intDelay.GetValue() - event.Skip() - def onCBGlobalColorBySlot(self, event): # todo: maybe create a SettingChanged event that we can fire, and have other things hook into, instead of having the preference panel itself handle the # updating of things related to settings. @@ -215,9 +165,6 @@ class PFGeneralPref(PreferenceView): def onCBShowTooltip(self, event): self.sFit.serviceFittingOptions["showTooltip"] = self.cbShowTooltip.GetValue() - def onCBShowShortcuts(self, event): - self.sFit.serviceFittingOptions["showMarketShortcuts"] = self.cbMarketShortcuts.GetValue() - def onCBGaugeAnimation(self, event): self.sFit.serviceFittingOptions["enableGaugeAnimation"] = self.cbGaugeAnimation.GetValue() @@ -230,19 +177,5 @@ class PFGeneralPref(PreferenceView): def getImage(self): return BitmapLoader.getBitmap("prefs_settings", "gui") - def onPriceSelection(self, event): - system = self.chPriceSystem.GetString(self.chPriceSystem.GetSelection()) - self.sFit.serviceFittingOptions["priceSystem"] = system - - fitID = self.mainFrame.getActiveFit() - - self.sFit.refreshFit(fitID) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) - event.Skip() - - def onPricesSourceSelection(self, event): - source = self.chPriceSource.GetString(self.chPriceSource.GetSelection()) - self.sFit.serviceFittingOptions["priceSource"] = source - PFGeneralPref.register() diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py new file mode 100644 index 000000000..73205f086 --- /dev/null +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -0,0 +1,110 @@ +# noinspection PyPackageRequirements +import wx +from wx.lib.intctrl import IntCtrl + +from gui.preferenceView import PreferenceView +from gui.bitmap_loader import BitmapLoader + +import gui.mainFrame +import gui.globalEvents as GE +from service.settings import SettingsProvider +from service.fit import Fit +from service.price import Price + + +class PFMarketPref(PreferenceView): + title = "Market & Prices" + + def populatePanel(self, panel): + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + self.dirtySettings = False + + helpCursor = wx.Cursor(wx.CURSOR_QUESTION_ARROW) + mainSizer = wx.BoxSizer(wx.VERTICAL) + + self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0) + self.stTitle.Wrap(-1) + self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) + + mainSizer.Add(self.stTitle, 0, wx.ALL, 5) + + self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) + mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) + + self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, "Show market shortcuts", wx.DefaultPosition, wx.DefaultSize, 0) + mainSizer.Add(self.cbMarketShortcuts, 0, wx.ALL | wx.EXPAND, 5) + + priceSizer = wx.BoxSizer(wx.HORIZONTAL) + + self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, "Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0) + 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.chPriceSource = wx.Choice(panel, choices=sorted(Price.sources.keys())) + self.chPriceSystem = wx.Choice(panel, choices=list(Price.systemsList.keys())) + priceSizer.Add(self.chPriceSource, 1, wx.ALL | wx.EXPAND, 5) + priceSizer.Add(self.chPriceSystem, 1, wx.ALL | wx.EXPAND, 5) + + mainSizer.Add(priceSizer, 0, wx.ALL | wx.EXPAND, 0) + + delayTimer = wx.BoxSizer(wx.HORIZONTAL) + + self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, "Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0) + self.stMarketDelay.Wrap(-1) + self.stMarketDelay.SetCursor(helpCursor) + self.stMarketDelay.SetToolTip( + wx.ToolTip('The delay between a keystroke and the market search. Can help reduce lag when typing fast in the market search box.')) + + delayTimer.Add(self.stMarketDelay, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) + + self.intDelay = IntCtrl(panel, max=1000, limited=True) + delayTimer.Add(self.intDelay, 0, wx.ALL, 5) + + mainSizer.Add(delayTimer, 0, wx.ALL | wx.EXPAND, 0) + + self.sFit = Fit.getInstance() + + self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) + self.chPriceSource.SetStringSelection(self.sFit.serviceFittingOptions["priceSource"]) + self.chPriceSystem.SetStringSelection(self.sFit.serviceFittingOptions["priceSystem"]) + self.intDelay.SetValue(self.sFit.serviceFittingOptions["marketSearchDelay"]) + + self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts) + self.chPriceSource.Bind(wx.EVT_CHOICE, self.onPricesSourceSelection) + self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection) + self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) + + panel.SetSizer(mainSizer) + panel.Layout() + + def onMarketDelayChange(self, event): + self.sFit.serviceFittingOptions["marketSearchDelay"] = self.intDelay.GetValue() + event.Skip() + + def onCBShowShortcuts(self, event): + self.sFit.serviceFittingOptions["showMarketShortcuts"] = self.cbMarketShortcuts.GetValue() + + def getImage(self): + return BitmapLoader.getBitmap("prefs_settings", "gui") + + def onPriceSelection(self, event): + system = self.chPriceSystem.GetString(self.chPriceSystem.GetSelection()) + self.sFit.serviceFittingOptions["priceSystem"] = system + + fitID = self.mainFrame.getActiveFit() + + self.sFit.refreshFit(fitID) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=fitID)) + event.Skip() + + def onPricesSourceSelection(self, event): + source = self.chPriceSource.GetString(self.chPriceSource.GetSelection()) + self.sFit.serviceFittingOptions["priceSource"] = source + + +PFMarketPref.register() diff --git a/gui/preferenceView.py b/gui/preferenceView.py index 9ce2e676d..5077dee17 100644 --- a/gui/preferenceView.py +++ b/gui/preferenceView.py @@ -49,5 +49,6 @@ from gui.builtinPreferenceViews import ( # noqa: E402, F401 pyfaUpdatePreferences, pyfaEnginePreferences, pyfaDatabasePreferences, - pyfaLoggingPreferences + pyfaLoggingPreferences, + pyfaMarketPreferences ) From c02cccf41502d96d2b1a6dd58209bb919787b5cd Mon Sep 17 00:00:00 2001 From: Indiction Date: Sat, 16 Mar 2019 12:56:10 +0100 Subject: [PATCH 02/32] Adding Option to Change "total price" calculation Statview Hint for module and total price provide detail informations --- .../pyfaStatViewPreferences.py | 37 ++++++++++++-- gui/builtinStatsViews/priceViewFull.py | 48 +++++++++++++++---- gui/builtinStatsViews/priceViewMinimal.py | 38 +++++++++++++-- 3 files changed, 108 insertions(+), 15 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaStatViewPreferences.py b/gui/builtinPreferenceViews/pyfaStatViewPreferences.py index e9e0d8cb0..ae123df5f 100644 --- a/gui/builtinPreferenceViews/pyfaStatViewPreferences.py +++ b/gui/builtinPreferenceViews/pyfaStatViewPreferences.py @@ -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") diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index 92aea617f..853adcbac 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -24,6 +24,7 @@ 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): @@ -90,6 +91,13 @@ 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 @@ -103,6 +111,8 @@ 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: @@ -138,23 +148,45 @@ class PriceViewFull(StatsView): 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))) + 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('{:,.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.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.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))) + self.labelPriceDrones.SetToolTip(wx.ToolTip('{:,.2f} ISK'.format(drone_price + fighter_price))) self.labelPriceCargobay.SetLabel("%s ISK" % formatAmount(cargo_price, 3, 3, 9, currency=True)) - self.labelPriceCargobay.SetToolTip(wx.ToolTip('{:,.2f}'.format(cargo_price))) + 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.SetToolTip(wx.ToolTip('{:,.2f}'.format(booster_price + implant_price))) + 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))) + def processPrices(self, prices): self.refreshPanelPrices(self.fit) diff --git a/gui/builtinStatsViews/priceViewMinimal.py b/gui/builtinStatsViews/priceViewMinimal.py index 4506f2686..133e1667d 100644 --- a/gui/builtinStatsViews/priceViewMinimal.py +++ b/gui/builtinStatsViews/priceViewMinimal.py @@ -24,6 +24,7 @@ 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): @@ -84,6 +85,13 @@ 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 @@ -97,6 +105,8 @@ 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: @@ -134,14 +144,34 @@ class PriceViewMinimal(StatsView): 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))) + 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('{:,.2f}'.format(fitting_price))) + 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.labelPriceTotal.SetLabel("%s ISK" % formatAmount(total_price, 3, 3, 9, currency=True)) - self.labelPriceTotal.SetToolTip(wx.ToolTip('{:,.2f}'.format(total_price))) - + 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))) def processPrices(self, prices): self.refreshPanelPrices(self.fit) From 3229652efab446ae489577a0c5de03097203fc1c Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 25 Mar 2019 15:57:42 +0300 Subject: [PATCH 03/32] Remove detailed price popups and move price preferences to new preference tab --- .../pyfaMarketPreferences.py | 41 ++++++++++++++-- .../pyfaStatViewPreferences.py | 47 +------------------ gui/builtinStatsViews/priceViewFull.py | 39 ++------------- gui/builtinStatsViews/priceViewMinimal.py | 36 ++------------ 4 files changed, 43 insertions(+), 120 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index 73205f086..a8a196f1d 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -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() diff --git a/gui/builtinPreferenceViews/pyfaStatViewPreferences.py b/gui/builtinPreferenceViews/pyfaStatViewPreferences.py index ae123df5f..8ba24b088 100644 --- a/gui/builtinPreferenceViews/pyfaStatViewPreferences.py +++ b/gui/builtinPreferenceViews/pyfaStatViewPreferences.py @@ -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") diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index 853adcbac..93d4e4082 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -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) diff --git a/gui/builtinStatsViews/priceViewMinimal.py b/gui/builtinStatsViews/priceViewMinimal.py index 133e1667d..e59ec306a 100644 --- a/gui/builtinStatsViews/priceViewMinimal.py +++ b/gui/builtinStatsViews/priceViewMinimal.py @@ -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) From fa72345bcfa5c011953806314603575200d98206 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 25 Mar 2019 16:14:14 +0300 Subject: [PATCH 04/32] Add ship and modules as separate entries to menu for feature parity --- .../pyfaMarketPreferences.py | 41 +++++++++++++------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index a8a196f1d..c79753c7d 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -83,23 +83,27 @@ class PFMarketPref(PreferenceView): self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) self.tbTotalPriceBox = wx.StaticBoxSizer(wx.VERTICAL, panel, "Total Price Includes") + self.tbTotalPriceShip = wx.CheckBox(panel, -1, "Ship", wx.DefaultPosition, wx.DefaultSize, 1) + self.tbTotalPriceShip.SetValue(self.priceSettings.get("ship")) + self.tbTotalPriceShip.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceShipChange) + self.tbTotalPriceBox.Add(self.tbTotalPriceShip) + self.tbTotalPriceModules = wx.CheckBox(panel, -1, "Modules", wx.DefaultPosition, wx.DefaultSize, 1) + self.tbTotalPriceModules.SetValue(self.priceSettings.get("modules")) + self.tbTotalPriceModules.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceModulesChange) + self.tbTotalPriceBox.Add(self.tbTotalPriceModules) self.tbTotalPriceDrones = wx.CheckBox(panel, -1, "Drones", wx.DefaultPosition, wx.DefaultSize, 1) self.tbTotalPriceDrones.SetValue(self.priceSettings.get("drones")) + self.tbTotalPriceDrones.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceDroneChange) + self.tbTotalPriceBox.Add(self.tbTotalPriceDrones) 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) + self.tbTotalPriceBox.Add(self.tbTotalPriceCargo) + self.tbTotalPriceCharacter = wx.CheckBox(panel, -1, "Implants && Boosters", wx.DefaultPosition, wx.DefaultSize, 1) + self.tbTotalPriceCharacter.SetValue(self.priceSettings.get("character")) + self.tbTotalPriceCharacter.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCharacterChange) + self.tbTotalPriceBox.Add(self.tbTotalPriceCharacter) + mainSizer.Add(self.tbTotalPriceBox, 1, wx.TOP | wx.RIGHT, 5) panel.SetSizer(mainSizer) panel.Layout() @@ -128,14 +132,25 @@ class PFMarketPref(PreferenceView): source = self.chPriceSource.GetString(self.chPriceSource.GetSelection()) self.sFit.serviceFittingOptions["priceSource"] = source + def OnTotalPriceShipChange(self, event): + self.priceSettings.set('ship', event.GetInt()) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + + def OnTotalPriceModulesChange(self, event): + self.priceSettings.set('modules', event.GetInt()) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + def OnTotalPriceDroneChange(self, event): self.priceSettings.set('drones', event.GetInt()) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) def OnTotalPriceCargoChange(self, event): self.priceSettings.set('cargo', event.GetInt()) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) - def OnTotalPriceImplantChange(self, event): + def OnTotalPriceCharacterChange(self, event): self.priceSettings.set('character', event.GetInt()) + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) PFMarketPref.register() From b269381818761946e6524a06acdc7420d905ba17 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 25 Mar 2019 16:14:48 +0300 Subject: [PATCH 05/32] Include cargo and drones by default in total ship price --- service/settings.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/service/settings.py b/service/settings.py index b901b1d72..f906f4eb6 100644 --- a/service/settings.py +++ b/service/settings.py @@ -470,8 +470,8 @@ class PriceMenuSettings(object): PriceMenuDefaultSettings = { "ship" : 1, "modules" : 1, - "drones" : 0, - "cargo" : 0, + "drones" : 1, + "cargo" : 1, "character" : 0 } From d59111eef557790d6274c9dd8cb3b201ffce3000 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 1 Apr 2019 15:36:58 +0300 Subject: [PATCH 06/32] Remove price cache clear menu item --- eos/gamedata.py | 2 -- gui/builtinContextMenus/priceClear.py | 30 --------------------------- gui/contextMenu.py | 1 - service/settings.py | 7 ------- 4 files changed, 40 deletions(-) delete mode 100644 gui/builtinContextMenus/priceClear.py diff --git a/eos/gamedata.py b/eos/gamedata.py index 50bd66d94..1d933519c 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -142,7 +142,6 @@ class Effect(EqBase): """ if not self.__generated: self.__generateHandler() - return self.__effectDef is not None def isType(self, type): @@ -151,7 +150,6 @@ class Effect(EqBase): """ if not self.__generated: self.__generateHandler() - return self.type is not None and type in self.type def __generateHandler(self): diff --git a/gui/builtinContextMenus/priceClear.py b/gui/builtinContextMenus/priceClear.py deleted file mode 100644 index 9afdb0815..000000000 --- a/gui/builtinContextMenus/priceClear.py +++ /dev/null @@ -1,30 +0,0 @@ -from gui.contextMenu import ContextMenu -import gui.mainFrame -# noinspection PyPackageRequirements -import wx -import gui.globalEvents as GE -from service.price import Price -from service.settings import ContextMenuSettings - - -class PriceClear(ContextMenu): - def __init__(self): - self.mainFrame = gui.mainFrame.MainFrame.getInstance() - self.settings = ContextMenuSettings.getInstance() - - def display(self, srcContext, selection): - if not self.settings.get('priceClear'): - return False - - return srcContext in ("priceViewFull", "priceViewMinimal") - - def getText(self, itmContext, selection): - return "Reset Price Cache" - - def activate(self, fullContext, selection, i): - sPrc = Price.getInstance() - sPrc.clearPriceCache() - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) - - -PriceClear.register() diff --git a/gui/contextMenu.py b/gui/contextMenu.py index ec9048429..0625ff5ba 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -208,7 +208,6 @@ from gui.builtinContextMenus import ( # noqa: E402,F401 changeAffectingSkills, tacticalMode, targetResists, - priceClear, priceOptions, amount, cargoAmmo, diff --git a/service/settings.py b/service/settings.py index f906f4eb6..a518a7674 100644 --- a/service/settings.py +++ b/service/settings.py @@ -438,12 +438,6 @@ class StatViewSettings(object): "outgoing" : 2, } - # We don't have these....yet - ''' - "miningyield": 2, - "drones": 2 - ''' - self.serviceStatViewDefaultSettings = SettingsProvider.getInstance().getSettings("pyfaServiceStatViewSettings", serviceStatViewDefaultSettings) def get(self, type): @@ -519,7 +513,6 @@ class ContextMenuSettings(object): "moduleAmmoPicker" : 1, "moduleGlobalAmmoPicker": 1, "openFit" : 1, - "priceClear" : 1, "project" : 1, "shipJump" : 1, "tacticalMode" : 1, From f784f45b4e676e50cbcd2032c1778d5bcbb2a7e5 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 1 Apr 2019 15:39:15 +0300 Subject: [PATCH 07/32] Remove price options menu item --- gui/builtinContextMenus/priceOptions.py | 50 ------------------------- gui/contextMenu.py | 1 - 2 files changed, 51 deletions(-) delete mode 100644 gui/builtinContextMenus/priceOptions.py diff --git a/gui/builtinContextMenus/priceOptions.py b/gui/builtinContextMenus/priceOptions.py deleted file mode 100644 index c9cb7f74a..000000000 --- a/gui/builtinContextMenus/priceOptions.py +++ /dev/null @@ -1,50 +0,0 @@ -import wx - -import gui.globalEvents as GE -import gui.mainFrame -from gui.contextMenu import ContextMenu -from service.settings import PriceMenuSettings - - -class PriceOptions(ContextMenu): - def __init__(self): - self.mainFrame = gui.mainFrame.MainFrame.getInstance() - self.settings = PriceMenuSettings.getInstance() - self.optionList = ["Ship", "Modules", "Drones", "Cargo", "Character"] - - def display(self, srcContext, selection): - return srcContext in ("priceViewFull", "priceViewMinimal") - - def getText(self, itmContext, selection): - return "Include in total" - - def addOption(self, menu, option): - label = option - id = ContextMenu.nextID() - self.optionIds[id] = option - menuItem = wx.MenuItem(menu, id, label, kind=wx.ITEM_CHECK) - menu.Bind(wx.EVT_MENU, self.handleMode, menuItem) - return menuItem - - def getSubMenu(self, context, selection, rootMenu, i, pitem): - msw = True if "wxMSW" in wx.PlatformInfo else False - self.context = context - self.optionIds = {} - - sub = wx.Menu() - - for option in self.optionList: - menuItem = self.addOption(rootMenu if msw else sub, option) - sub.Append(menuItem) - menuItem.Check(self.settings.get(option.lower())) - - return sub - - def handleMode(self, event): - option = self.optionIds[event.Id] - self.settings.set(option.lower(), event.Int) - - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) - - -PriceOptions.register() diff --git a/gui/contextMenu.py b/gui/contextMenu.py index 0625ff5ba..1e6a49171 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -208,7 +208,6 @@ from gui.builtinContextMenus import ( # noqa: E402,F401 changeAffectingSkills, tacticalMode, targetResists, - priceOptions, amount, cargoAmmo, # droneStack, From 6c29b3f38b1be9879cd5ed5d9b7a4c563aa73ccf Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 1 Apr 2019 15:41:38 +0300 Subject: [PATCH 08/32] ALways include price of ship and modules --- .../pyfaMarketPreferences.py | 16 ---------------- gui/builtinStatsViews/priceViewFull.py | 7 ++----- gui/builtinStatsViews/priceViewMinimal.py | 7 ++----- service/settings.py | 2 -- 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index c79753c7d..f79d7db07 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -83,14 +83,6 @@ class PFMarketPref(PreferenceView): self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) self.tbTotalPriceBox = wx.StaticBoxSizer(wx.VERTICAL, panel, "Total Price Includes") - self.tbTotalPriceShip = wx.CheckBox(panel, -1, "Ship", wx.DefaultPosition, wx.DefaultSize, 1) - self.tbTotalPriceShip.SetValue(self.priceSettings.get("ship")) - self.tbTotalPriceShip.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceShipChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceShip) - self.tbTotalPriceModules = wx.CheckBox(panel, -1, "Modules", wx.DefaultPosition, wx.DefaultSize, 1) - self.tbTotalPriceModules.SetValue(self.priceSettings.get("modules")) - self.tbTotalPriceModules.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceModulesChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceModules) self.tbTotalPriceDrones = wx.CheckBox(panel, -1, "Drones", wx.DefaultPosition, wx.DefaultSize, 1) self.tbTotalPriceDrones.SetValue(self.priceSettings.get("drones")) self.tbTotalPriceDrones.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceDroneChange) @@ -132,14 +124,6 @@ class PFMarketPref(PreferenceView): source = self.chPriceSource.GetString(self.chPriceSource.GetSelection()) self.sFit.serviceFittingOptions["priceSource"] = source - def OnTotalPriceShipChange(self, event): - self.priceSettings.set('ship', event.GetInt()) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) - - def OnTotalPriceModulesChange(self, event): - self.priceSettings.set('modules', event.GetInt()) - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) - def OnTotalPriceDroneChange(self, event): self.priceSettings.set('drones', event.GetInt()) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index 93d4e4082..c69c2c57e 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -125,11 +125,8 @@ class PriceViewFull(StatsView): implant_price += implant.item.price.price total_price = 0 - - if self.settings.get("ship"): - total_price += ship_price - if self.settings.get("modules"): - total_price += module_price + total_price += ship_price + total_price += module_price if self.settings.get("drones"): total_price += drone_price + fighter_price if self.settings.get("cargo"): diff --git a/gui/builtinStatsViews/priceViewMinimal.py b/gui/builtinStatsViews/priceViewMinimal.py index e59ec306a..28a2b9c24 100644 --- a/gui/builtinStatsViews/priceViewMinimal.py +++ b/gui/builtinStatsViews/priceViewMinimal.py @@ -121,11 +121,8 @@ class PriceViewMinimal(StatsView): 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 + total_price += ship_price + total_price += module_price if self.settings.get("drones"): total_price += drone_price + fighter_price if self.settings.get("cargo"): diff --git a/service/settings.py b/service/settings.py index a518a7674..79760c04f 100644 --- a/service/settings.py +++ b/service/settings.py @@ -462,8 +462,6 @@ class PriceMenuSettings(object): # 0 - Do not add to total # 1 - Add to total PriceMenuDefaultSettings = { - "ship" : 1, - "modules" : 1, "drones" : 1, "cargo" : 1, "character" : 0 From b8a8f9c422d712014ea05911ab2fb4b6d4739d63 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 1 Apr 2019 16:52:46 +0300 Subject: [PATCH 09/32] Add metagroup-related preferences --- .../pyfaMarketPreferences.py | 28 +++++++++++++++++-- service/settings.py | 5 +++- 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index f79d7db07..c3977612e 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -16,17 +16,15 @@ 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 helpCursor = wx.Cursor(wx.CURSOR_QUESTION_ARROW) mainSizer = wx.BoxSizer(wx.VERTICAL) - self.stTitle = wx.StaticText(panel, wx.ID_ANY, self.title, wx.DefaultPosition, wx.DefaultSize, 0) + self.stTitle = wx.StaticText(panel, wx.ID_ANY, "Market && Prices", wx.DefaultPosition, wx.DefaultSize, 0) self.stTitle.Wrap(-1) self.stTitle.SetFont(wx.Font(12, 70, 90, 90, False, wx.EmptyString)) @@ -97,6 +95,21 @@ class PFMarketPref(PreferenceView): self.tbTotalPriceBox.Add(self.tbTotalPriceCharacter) mainSizer.Add(self.tbTotalPriceBox, 1, wx.TOP | wx.RIGHT, 5) + self.rbMarketJump = wx.RadioBox(panel, -1, "Item Market Group Jump", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Enable item's metagroup", "Enable item's metagroup, disable others", "Enable all metagroups"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketJump.SetSelection(self.priceSettings.get('marketMGJumpMode')) + mainSizer.Add(self.rbMarketJump, 1, wx.ALL, 5) + self.rbMarketJump.Bind(wx.EVT_RADIOBOX, self.OnMarketJumpChange) + + self.rbMarketEmpty = wx.RadioBox(panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Enable leftmost available metagroup", "Enable all available metagroups", "Enable all metagroups"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketEmpty.SetSelection(self.priceSettings.get('marketMGEmptyMode')) + mainSizer.Add(self.rbMarketEmpty, 1, wx.ALL, 5) + self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketEmptyChange) + + self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Temporarily enable all metagroups"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketSearch.SetSelection(self.priceSettings.get('marketMGSearchMode')) + mainSizer.Add(self.rbMarketSearch, 1, wx.ALL, 5) + self.rbMarketSearch.Bind(wx.EVT_RADIOBOX, self.OnMarketSearchChange) + panel.SetSizer(mainSizer) panel.Layout() @@ -136,5 +149,14 @@ class PFMarketPref(PreferenceView): self.priceSettings.set('character', event.GetInt()) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + def OnMarketJumpChange(self, event): + self.priceSettings.set('marketMGJumpMode', event.GetInt()) + + def OnMarketEmptyChange(self, event): + self.priceSettings.set('marketMGEmptyMode', event.GetInt()) + + def OnMarketSearchChange(self, event): + self.priceSettings.set('marketMGSearchMode', event.GetInt()) + PFMarketPref.register() diff --git a/service/settings.py b/service/settings.py index 79760c04f..350daf9ca 100644 --- a/service/settings.py +++ b/service/settings.py @@ -464,7 +464,10 @@ class PriceMenuSettings(object): PriceMenuDefaultSettings = { "drones" : 1, "cargo" : 1, - "character" : 0 + "character" : 0, + "marketMGJumpMode": 0, + "marketMGEmptyMode": 1, + "marketMGSearchMode": 0 } self.PriceMenuDefaultSettings = SettingsProvider.getInstance().getSettings("pyfaPriceMenuSettings", From a9fb3501ac32577ce51deb06cf61c107aba23c59 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 1 Apr 2019 17:14:50 +0300 Subject: [PATCH 10/32] Change price preferences layout --- .../pyfaMarketPreferences.py | 57 ++++++++----------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index c3977612e..26c647557 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -20,6 +20,7 @@ class PFMarketPref(PreferenceView): def populatePanel(self, panel): self.mainFrame = gui.mainFrame.MainFrame.getInstance() + self.sFit = Fit.getInstance() helpCursor = wx.Cursor(wx.CURSOR_QUESTION_ARROW) mainSizer = wx.BoxSizer(wx.VERTICAL) @@ -33,11 +34,7 @@ class PFMarketPref(PreferenceView): self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) - self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, "Show market shortcuts", wx.DefaultPosition, wx.DefaultSize, 0) - mainSizer.Add(self.cbMarketShortcuts, 0, wx.ALL | wx.EXPAND, 5) - priceSizer = wx.BoxSizer(wx.HORIZONTAL) - self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, "Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0) self.stDefaultSystem.Wrap(-1) priceSizer.Add(self.stDefaultSystem, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) @@ -45,40 +42,15 @@ class PFMarketPref(PreferenceView): 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())) priceSizer.Add(self.chPriceSource, 1, wx.ALL | wx.EXPAND, 5) priceSizer.Add(self.chPriceSystem, 1, wx.ALL | wx.EXPAND, 5) - mainSizer.Add(priceSizer, 0, wx.ALL | wx.EXPAND, 0) - - delayTimer = wx.BoxSizer(wx.HORIZONTAL) - - self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, "Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0) - self.stMarketDelay.Wrap(-1) - self.stMarketDelay.SetCursor(helpCursor) - self.stMarketDelay.SetToolTip( - wx.ToolTip('The delay between a keystroke and the market search. Can help reduce lag when typing fast in the market search box.')) - - delayTimer.Add(self.stMarketDelay, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - - self.intDelay = IntCtrl(panel, max=1000, limited=True) - delayTimer.Add(self.intDelay, 0, wx.ALL, 5) - - mainSizer.Add(delayTimer, 0, wx.ALL | wx.EXPAND, 0) - - self.sFit = Fit.getInstance() - - self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) self.chPriceSource.SetStringSelection(self.sFit.serviceFittingOptions["priceSource"]) - self.chPriceSystem.SetStringSelection(self.sFit.serviceFittingOptions["priceSystem"]) - self.intDelay.SetValue(self.sFit.serviceFittingOptions["marketSearchDelay"]) - - self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts) self.chPriceSource.Bind(wx.EVT_CHOICE, self.onPricesSourceSelection) + self.chPriceSystem.SetStringSelection(self.sFit.serviceFittingOptions["priceSystem"]) 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) @@ -95,6 +67,23 @@ class PFMarketPref(PreferenceView): self.tbTotalPriceBox.Add(self.tbTotalPriceCharacter) mainSizer.Add(self.tbTotalPriceBox, 1, wx.TOP | wx.RIGHT, 5) + delayTimer = wx.BoxSizer(wx.HORIZONTAL) + self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, "Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0) + self.stMarketDelay.Wrap(-1) + self.stMarketDelay.SetCursor(helpCursor) + self.stMarketDelay.SetToolTip(wx.ToolTip('The delay between a keystroke and the market search. Can help reduce lag when typing fast in the market search box.')) + delayTimer.Add(self.stMarketDelay, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) + self.intDelay = IntCtrl(panel, max=1000, limited=True) + delayTimer.Add(self.intDelay, 0, wx.ALL, 5) + mainSizer.Add(delayTimer, 0, wx.ALL | wx.EXPAND, 0) + self.intDelay.SetValue(self.sFit.serviceFittingOptions["marketSearchDelay"]) + self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) + + self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Temporarily enable all metagroups"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketSearch.SetSelection(self.priceSettings.get('marketMGSearchMode')) + mainSizer.Add(self.rbMarketSearch, 1, wx.ALL, 5) + self.rbMarketSearch.Bind(wx.EVT_RADIOBOX, self.OnMarketSearchChange) + self.rbMarketJump = wx.RadioBox(panel, -1, "Item Market Group Jump", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Enable item's metagroup", "Enable item's metagroup, disable others", "Enable all metagroups"], 1, wx.RA_SPECIFY_COLS) self.rbMarketJump.SetSelection(self.priceSettings.get('marketMGJumpMode')) mainSizer.Add(self.rbMarketJump, 1, wx.ALL, 5) @@ -105,10 +94,10 @@ class PFMarketPref(PreferenceView): mainSizer.Add(self.rbMarketEmpty, 1, wx.ALL, 5) self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketEmptyChange) - self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Temporarily enable all metagroups"], 1, wx.RA_SPECIFY_COLS) - self.rbMarketSearch.SetSelection(self.priceSettings.get('marketMGSearchMode')) - mainSizer.Add(self.rbMarketSearch, 1, wx.ALL, 5) - self.rbMarketSearch.Bind(wx.EVT_RADIOBOX, self.OnMarketSearchChange) + self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, "Show market shortcuts", wx.DefaultPosition, wx.DefaultSize, 0) + mainSizer.Add(self.cbMarketShortcuts, 0, wx.ALL | wx.EXPAND, 5) + self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) + self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts) panel.SetSizer(mainSizer) panel.Layout() From be1bd24a050a97dcd590263b82ea88f5cb0834e4 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Tue, 2 Apr 2019 19:22:37 +0300 Subject: [PATCH 11/32] Change layout of options and window size a little --- .../pyfaMarketPreferences.py | 36 +++++++++---------- gui/preferenceDialog.py | 8 ++--- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index 26c647557..200993e5a 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -34,6 +34,21 @@ class PFMarketPref(PreferenceView): self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) + 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.tbTotalPriceDrones.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceDroneChange) + self.tbTotalPriceBox.Add(self.tbTotalPriceDrones) + self.tbTotalPriceCargo = wx.CheckBox(panel, -1, "Cargo", wx.DefaultPosition, wx.DefaultSize, 1) + self.tbTotalPriceCargo.SetValue(self.priceSettings.get("cargo")) + self.tbTotalPriceCargo.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCargoChange) + self.tbTotalPriceBox.Add(self.tbTotalPriceCargo) + self.tbTotalPriceCharacter = wx.CheckBox(panel, -1, "Implants && Boosters", wx.DefaultPosition, wx.DefaultSize, 1) + self.tbTotalPriceCharacter.SetValue(self.priceSettings.get("character")) + self.tbTotalPriceCharacter.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCharacterChange) + self.tbTotalPriceBox.Add(self.tbTotalPriceCharacter) + mainSizer.Add(self.tbTotalPriceBox, 0, wx.TOP | wx.RIGHT | wx.EXPAND, 5) + priceSizer = wx.BoxSizer(wx.HORIZONTAL) self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, "Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0) self.stDefaultSystem.Wrap(-1) @@ -52,21 +67,6 @@ class PFMarketPref(PreferenceView): self.chPriceSystem.SetStringSelection(self.sFit.serviceFittingOptions["priceSystem"]) self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection) - 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.tbTotalPriceDrones.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceDroneChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceDrones) - self.tbTotalPriceCargo = wx.CheckBox(panel, -1, "Cargo", wx.DefaultPosition, wx.DefaultSize, 1) - self.tbTotalPriceCargo.SetValue(self.priceSettings.get("cargo")) - self.tbTotalPriceCargo.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCargoChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceCargo) - self.tbTotalPriceCharacter = wx.CheckBox(panel, -1, "Implants && Boosters", wx.DefaultPosition, wx.DefaultSize, 1) - self.tbTotalPriceCharacter.SetValue(self.priceSettings.get("character")) - self.tbTotalPriceCharacter.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCharacterChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceCharacter) - mainSizer.Add(self.tbTotalPriceBox, 1, wx.TOP | wx.RIGHT, 5) - delayTimer = wx.BoxSizer(wx.HORIZONTAL) self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, "Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0) self.stMarketDelay.Wrap(-1) @@ -81,17 +81,17 @@ class PFMarketPref(PreferenceView): self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Temporarily enable all metagroups"], 1, wx.RA_SPECIFY_COLS) self.rbMarketSearch.SetSelection(self.priceSettings.get('marketMGSearchMode')) - mainSizer.Add(self.rbMarketSearch, 1, wx.ALL, 5) + mainSizer.Add(self.rbMarketSearch, 0, wx.ALL | wx.EXPAND, 5) self.rbMarketSearch.Bind(wx.EVT_RADIOBOX, self.OnMarketSearchChange) self.rbMarketJump = wx.RadioBox(panel, -1, "Item Market Group Jump", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Enable item's metagroup", "Enable item's metagroup, disable others", "Enable all metagroups"], 1, wx.RA_SPECIFY_COLS) self.rbMarketJump.SetSelection(self.priceSettings.get('marketMGJumpMode')) - mainSizer.Add(self.rbMarketJump, 1, wx.ALL, 5) + mainSizer.Add(self.rbMarketJump, 0, wx.ALL | wx.EXPAND, 5) self.rbMarketJump.Bind(wx.EVT_RADIOBOX, self.OnMarketJumpChange) self.rbMarketEmpty = wx.RadioBox(panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Enable leftmost available metagroup", "Enable all available metagroups", "Enable all metagroups"], 1, wx.RA_SPECIFY_COLS) self.rbMarketEmpty.SetSelection(self.priceSettings.get('marketMGEmptyMode')) - mainSizer.Add(self.rbMarketEmpty, 1, wx.ALL, 5) + mainSizer.Add(self.rbMarketEmpty, 0, wx.ALL | wx.EXPAND, 5) self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketEmptyChange) self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, "Show market shortcuts", wx.DefaultPosition, wx.DefaultSize, 0) diff --git a/gui/preferenceDialog.py b/gui/preferenceDialog.py index 37ca5ddaf..f65c8451f 100644 --- a/gui/preferenceDialog.py +++ b/gui/preferenceDialog.py @@ -66,12 +66,10 @@ class PreferenceDialog(wx.Dialog): self.listbook.AddPage(page, prefView.title, imageId=imgID) - minHeight = 550 bestFit = self.GetBestVirtualSize() - if minHeight > bestFit[1]: - self.SetSize(650, minHeight) - else: - self.SetSize(650, bestFit[1]) + width = max(bestFit[0], 800 if "wxGTK" in wx.PlatformInfo else 650) + height = max(bestFit[1], 550) + self.SetSize(width, height) self.Layout() From 0a705d1d7f47e13560982ddc9f579fd8abf58b67 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Tue, 2 Apr 2019 20:00:53 +0300 Subject: [PATCH 12/32] Change price panel padding a little --- .../pyfaMarketPreferences.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index 200993e5a..ed60d0f90 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -38,16 +38,16 @@ class PFMarketPref(PreferenceView): self.tbTotalPriceDrones = wx.CheckBox(panel, -1, "Drones", wx.DefaultPosition, wx.DefaultSize, 1) self.tbTotalPriceDrones.SetValue(self.priceSettings.get("drones")) self.tbTotalPriceDrones.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceDroneChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceDrones) + self.tbTotalPriceBox.Add(self.tbTotalPriceDrones, 0, wx.LEFT | wx.RIGHT | wx.TOP, 5) self.tbTotalPriceCargo = wx.CheckBox(panel, -1, "Cargo", wx.DefaultPosition, wx.DefaultSize, 1) self.tbTotalPriceCargo.SetValue(self.priceSettings.get("cargo")) self.tbTotalPriceCargo.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCargoChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceCargo) + self.tbTotalPriceBox.Add(self.tbTotalPriceCargo, 0, wx.LEFT | wx.RIGHT, 5) self.tbTotalPriceCharacter = wx.CheckBox(panel, -1, "Implants && Boosters", wx.DefaultPosition, wx.DefaultSize, 1) self.tbTotalPriceCharacter.SetValue(self.priceSettings.get("character")) self.tbTotalPriceCharacter.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCharacterChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceCharacter) - mainSizer.Add(self.tbTotalPriceBox, 0, wx.TOP | wx.RIGHT | wx.EXPAND, 5) + self.tbTotalPriceBox.Add(self.tbTotalPriceCharacter, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) + mainSizer.Add(self.tbTotalPriceBox, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) priceSizer = wx.BoxSizer(wx.HORIZONTAL) self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, "Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0) @@ -61,7 +61,7 @@ class PFMarketPref(PreferenceView): self.chPriceSystem = wx.Choice(panel, choices=list(Price.systemsList.keys())) priceSizer.Add(self.chPriceSource, 1, wx.ALL | wx.EXPAND, 5) priceSizer.Add(self.chPriceSystem, 1, wx.ALL | wx.EXPAND, 5) - mainSizer.Add(priceSizer, 0, wx.ALL | wx.EXPAND, 0) + mainSizer.Add(priceSizer, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.chPriceSource.SetStringSelection(self.sFit.serviceFittingOptions["priceSource"]) self.chPriceSource.Bind(wx.EVT_CHOICE, self.onPricesSourceSelection) self.chPriceSystem.SetStringSelection(self.sFit.serviceFittingOptions["priceSystem"]) @@ -75,27 +75,27 @@ class PFMarketPref(PreferenceView): delayTimer.Add(self.stMarketDelay, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) self.intDelay = IntCtrl(panel, max=1000, limited=True) delayTimer.Add(self.intDelay, 0, wx.ALL, 5) - mainSizer.Add(delayTimer, 0, wx.ALL | wx.EXPAND, 0) + mainSizer.Add(delayTimer, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.intDelay.SetValue(self.sFit.serviceFittingOptions["marketSearchDelay"]) self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Temporarily enable all metagroups"], 1, wx.RA_SPECIFY_COLS) self.rbMarketSearch.SetSelection(self.priceSettings.get('marketMGSearchMode')) - mainSizer.Add(self.rbMarketSearch, 0, wx.ALL | wx.EXPAND, 5) + mainSizer.Add(self.rbMarketSearch, 0, wx.RIGHT | wx.TOP | wx.EXPAND, 10) self.rbMarketSearch.Bind(wx.EVT_RADIOBOX, self.OnMarketSearchChange) self.rbMarketJump = wx.RadioBox(panel, -1, "Item Market Group Jump", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Enable item's metagroup", "Enable item's metagroup, disable others", "Enable all metagroups"], 1, wx.RA_SPECIFY_COLS) self.rbMarketJump.SetSelection(self.priceSettings.get('marketMGJumpMode')) - mainSizer.Add(self.rbMarketJump, 0, wx.ALL | wx.EXPAND, 5) + mainSizer.Add(self.rbMarketJump, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketJump.Bind(wx.EVT_RADIOBOX, self.OnMarketJumpChange) self.rbMarketEmpty = wx.RadioBox(panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Enable leftmost available metagroup", "Enable all available metagroups", "Enable all metagroups"], 1, wx.RA_SPECIFY_COLS) self.rbMarketEmpty.SetSelection(self.priceSettings.get('marketMGEmptyMode')) - mainSizer.Add(self.rbMarketEmpty, 0, wx.ALL | wx.EXPAND, 5) + mainSizer.Add(self.rbMarketEmpty, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketEmptyChange) self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, "Show market shortcuts", wx.DefaultPosition, wx.DefaultSize, 0) - mainSizer.Add(self.cbMarketShortcuts, 0, wx.ALL | wx.EXPAND, 5) + mainSizer.Add(self.cbMarketShortcuts, 0, wx.EXPAND | wx.TOP | wx.RIGHT | wx.BOTTOM, 10) self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts) From 292d95f6f88a1e3ddd6091cc8d79be07cc054d4e Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 3 Apr 2019 15:34:26 +0300 Subject: [PATCH 13/32] Implement market jump meta category logic --- gui/builtinMarketBrowser/marketTree.py | 1 - .../pyfaMarketPreferences.py | 4 +-- gui/builtinStatsViews/priceViewFull.py | 4 +-- gui/builtinStatsViews/priceViewMinimal.py | 4 +-- gui/marketBrowser.py | 33 +++++++++++++++++-- service/market.py | 1 + service/settings.py | 4 +-- 7 files changed, 39 insertions(+), 12 deletions(-) diff --git a/gui/builtinMarketBrowser/marketTree.py b/gui/builtinMarketBrowser/marketTree.py index f6c62732c..925df45fa 100644 --- a/gui/builtinMarketBrowser/marketTree.py +++ b/gui/builtinMarketBrowser/marketTree.py @@ -96,4 +96,3 @@ class MarketTree(wx.TreeCtrl): self.Expand(item) self.SelectItem(item) - self.marketBrowser.itemView.selectionMade() diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index ed60d0f90..8f6400c81 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -7,7 +7,7 @@ from gui.bitmap_loader import BitmapLoader import gui.mainFrame import gui.globalEvents as GE -from service.settings import PriceMenuSettings +from service.settings import MarketPriceSettings from service.fit import Fit from service.price import Price @@ -16,7 +16,7 @@ class PFMarketPref(PreferenceView): title = "Market & Prices" def __init__(self): - self.priceSettings = PriceMenuSettings.getInstance() + self.priceSettings = MarketPriceSettings.getInstance() def populatePanel(self, panel): self.mainFrame = gui.mainFrame.MainFrame.getInstance() diff --git a/gui/builtinStatsViews/priceViewFull.py b/gui/builtinStatsViews/priceViewFull.py index c69c2c57e..f77e352fd 100644 --- a/gui/builtinStatsViews/priceViewFull.py +++ b/gui/builtinStatsViews/priceViewFull.py @@ -23,7 +23,7 @@ from gui.statsView import StatsView from gui.bitmap_loader import BitmapLoader from gui.utils.numberFormatter import formatAmount from service.price import Fit, Price -from service.settings import PriceMenuSettings +from service.settings import MarketPriceSettings class PriceViewFull(StatsView): @@ -32,7 +32,7 @@ class PriceViewFull(StatsView): def __init__(self, parent): StatsView.__init__(self) self.parent = parent - self.settings = PriceMenuSettings.getInstance() + self.settings = MarketPriceSettings.getInstance() def getHeaderText(self, fit): return "Price" diff --git a/gui/builtinStatsViews/priceViewMinimal.py b/gui/builtinStatsViews/priceViewMinimal.py index 28a2b9c24..486bf00d5 100644 --- a/gui/builtinStatsViews/priceViewMinimal.py +++ b/gui/builtinStatsViews/priceViewMinimal.py @@ -23,7 +23,7 @@ from gui.statsView import StatsView from gui.bitmap_loader import BitmapLoader from gui.utils.numberFormatter import formatAmount from service.price import Fit, Price -from service.settings import PriceMenuSettings +from service.settings import MarketPriceSettings class PriceViewMinimal(StatsView): @@ -32,7 +32,7 @@ class PriceViewMinimal(StatsView): def __init__(self, parent): StatsView.__init__(self) self.parent = parent - self.settings = PriceMenuSettings.getInstance() + self.settings = MarketPriceSettings.getInstance() def getHeaderText(self, fit): return "Price" diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index d39477523..f54b6447e 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -20,12 +20,12 @@ # noinspection PyPackageRequirements import wx -from service.market import Market - from gui.builtinMarketBrowser.searchBox import SearchBox from gui.builtinMarketBrowser.itemView import ItemView from gui.builtinMarketBrowser.metaButton import MetaButton from gui.builtinMarketBrowser.marketTree import MarketTree +from service.market import Market +from service.settings import MarketPriceSettings from logbook import Logger @@ -33,8 +33,10 @@ pyfalog = Logger(__name__) class MarketBrowser(wx.Panel): + def __init__(self, parent): wx.Panel.__init__(self, parent) + pyfalog.debug("Initialize marketBrowser") vbox = wx.BoxSizer(wx.VERTICAL) self.SetSizer(vbox) @@ -46,8 +48,9 @@ class MarketBrowser(wx.Panel): self.splitter = wx.SplitterWindow(self, style=wx.SP_LIVE_UPDATE) vbox.Add(self.splitter, 1, wx.EXPAND) - # Grab market service instance and create child objects + # Grab service stuff and create child objects self.sMkt = Market.getInstance() + self.settings = MarketPriceSettings.getInstance() self.searchMode = False self.marketView = MarketTree(self.splitter, self) self.itemView = ItemView(self.splitter, self) @@ -98,3 +101,27 @@ class MarketBrowser(wx.Panel): def jump(self, item): self.marketView.jump(item) + setting = self.settings.get('marketMGJumpMode') + itemMetaCat = self.sMkt.META_MAP_REVERSE[self.sMkt.getMetaGroupIdByItem(item)] + # Enable item meta category + if setting == 1: + btn = getattr(self, itemMetaCat) + if not btn.GetValue(): + btn.setUserSelection(True) + # Enable item meta category, disable others + elif setting == 2: + tgtBtn = getattr(self, itemMetaCat) + if not tgtBtn.GetValue(): + tgtBtn.setUserSelection(True) + for btn in self.metaButtons: + if btn is tgtBtn: + continue + if btn.GetValue: + btn.setUserSelection(False) + # Enable all meta categories + elif setting == 3: + for btn in self.metaButtons: + if not btn.GetValue(): + btn.setUserSelection(True) + self.itemView.selectionMade() + diff --git a/service/market.py b/service/market.py index 085fef624..4457445e2 100644 --- a/service/market.py +++ b/service/market.py @@ -316,6 +316,7 @@ class Market(object): ("faction", frozenset((4, 3))), ("complex", frozenset((6,))), ("officer", frozenset((5,)))]) + self.META_MAP_REVERSE = {sv: k for k, v in self.META_MAP.items() for sv in v} self.SEARCH_CATEGORIES = ( "Drone", "Module", diff --git a/service/settings.py b/service/settings.py index 350daf9ca..3723b1dd4 100644 --- a/service/settings.py +++ b/service/settings.py @@ -447,13 +447,13 @@ class StatViewSettings(object): self.serviceStatViewDefaultSettings[type] = value -class PriceMenuSettings(object): +class MarketPriceSettings(object): _instance = None @classmethod def getInstance(cls): if cls._instance is None: - cls._instance = PriceMenuSettings() + cls._instance = MarketPriceSettings() return cls._instance From ca4eeed8d16d7c59cab3ca191a0d9fdd05b7e352 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 3 Apr 2019 15:36:28 +0300 Subject: [PATCH 14/32] Reword some preference descriptions --- gui/builtinPreferenceViews/pyfaMarketPreferences.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index 8f6400c81..dda845a9a 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -79,17 +79,17 @@ class PFMarketPref(PreferenceView): self.intDelay.SetValue(self.sFit.serviceFittingOptions["marketSearchDelay"]) self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) - self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Temporarily enable all metagroups"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Temporarily enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) self.rbMarketSearch.SetSelection(self.priceSettings.get('marketMGSearchMode')) mainSizer.Add(self.rbMarketSearch, 0, wx.RIGHT | wx.TOP | wx.EXPAND, 10) self.rbMarketSearch.Bind(wx.EVT_RADIOBOX, self.OnMarketSearchChange) - self.rbMarketJump = wx.RadioBox(panel, -1, "Item Market Group Jump", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Enable item's metagroup", "Enable item's metagroup, disable others", "Enable all metagroups"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketJump = wx.RadioBox(panel, -1, "Item Market Group Jump", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable item's meta button", "Enable item's meta button, disable others", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) self.rbMarketJump.SetSelection(self.priceSettings.get('marketMGJumpMode')) mainSizer.Add(self.rbMarketJump, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketJump.Bind(wx.EVT_RADIOBOX, self.OnMarketJumpChange) - self.rbMarketEmpty = wx.RadioBox(panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, ["No changes to metagroups", "Enable leftmost available metagroup", "Enable all available metagroups", "Enable all metagroups"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketEmpty = wx.RadioBox(panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable leftmost available meta button", "Enable all available meta buttons", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) self.rbMarketEmpty.SetSelection(self.priceSettings.get('marketMGEmptyMode')) mainSizer.Add(self.rbMarketEmpty, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketEmptyChange) From db07f9d53490f2aa6b308236c53c346abc8bb038 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 3 Apr 2019 15:58:18 +0300 Subject: [PATCH 15/32] Implement logic to autoselect some metagroups if no items were filtered --- gui/builtinMarketBrowser/itemView.py | 24 +++++++++++++++++-- .../pyfaMarketPreferences.py | 2 +- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index 97db645d7..53aa13afc 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -140,13 +140,33 @@ class ItemView(Display): self.unfilteredStore = items def filterItemStore(self): + filteredItems = self.filterItems() + if len(filteredItems) == 0: + setting = self.marketBrowser.settings.get('marketMGEmptyMode') + # Enable leftmost available + if setting == 1: + for btn in self.marketBrowser.metaButtons: + if btn.IsEnabled() and not btn.GetValue(): + btn.setUserSelection(True) + break + filteredItems = self.filterItems() + # Enable all + elif setting == 2: + for btn in self.marketBrowser.metaButtons: + if not btn.GetValue(): + btn.setUserSelection(True) + filteredItems = self.filterItems() + self.filteredStore = filteredItems + self.update(list(self.filteredStore)) + + def filterItems(self): sMkt = self.sMkt selectedMetas = set() for btn in self.marketBrowser.metaButtons: if btn.GetValue(): selectedMetas.update(sMkt.META_MAP[btn.metaName]) - self.filteredStore = sMkt.filterItemsByMeta(self.unfilteredStore, selectedMetas) - self.update(list(self.filteredStore)) + filteredItems = sMkt.filterItemsByMeta(self.unfilteredStore, selectedMetas) + return filteredItems def setToggles(self): metaIDs = set() diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index dda845a9a..bdb9832a3 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -89,7 +89,7 @@ class PFMarketPref(PreferenceView): mainSizer.Add(self.rbMarketJump, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketJump.Bind(wx.EVT_RADIOBOX, self.OnMarketJumpChange) - self.rbMarketEmpty = wx.RadioBox(panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable leftmost available meta button", "Enable all available meta buttons", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketEmpty = wx.RadioBox(panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable leftmost available meta button", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) self.rbMarketEmpty.SetSelection(self.priceSettings.get('marketMGEmptyMode')) mainSizer.Add(self.rbMarketEmpty, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketEmptyChange) From 1d208a0cf780928c37b1f605ae605ef224ba48bd Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 3 Apr 2019 16:30:51 +0300 Subject: [PATCH 16/32] Move search mode reset on market jump to market browser from item view --- gui/builtinMarketBrowser/marketTree.py | 1 - gui/marketBrowser.py | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/builtinMarketBrowser/marketTree.py b/gui/builtinMarketBrowser/marketTree.py index 925df45fa..cdd998b9d 100644 --- a/gui/builtinMarketBrowser/marketTree.py +++ b/gui/builtinMarketBrowser/marketTree.py @@ -72,7 +72,6 @@ class MarketTree(wx.TreeCtrl): def jump(self, item): """Open market group and meta tab of given item""" - self.marketBrowser.searchMode = False sMkt = self.sMkt mg = sMkt.getMarketGroupByItem(item) diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index f54b6447e..d9f8706b9 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -100,6 +100,7 @@ class MarketBrowser(wx.Panel): self.itemView.filterItemStore() def jump(self, item): + self.searchMode = False self.marketView.jump(item) setting = self.settings.get('marketMGJumpMode') itemMetaCat = self.sMkt.META_MAP_REVERSE[self.sMkt.getMetaGroupIdByItem(item)] From 10425cd5d951e9b7e1b3e6eafa87024fba74ba43 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 3 Apr 2019 16:41:33 +0300 Subject: [PATCH 17/32] Do not run "emtpy item list" logic on market groups with no items at all --- gui/builtinMarketBrowser/itemView.py | 3 +-- gui/builtinMarketBrowser/marketTree.py | 1 + gui/builtinMarketBrowser/metaButton.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index 53aa13afc..207d3a447 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -29,7 +29,6 @@ class ItemView(Display): self.filteredStore = set() self.recentlyUsedModules = set() self.sMkt = marketBrowser.sMkt - self.searchMode = marketBrowser.searchMode self.sFit = Fit.getInstance() self.marketBrowser = marketBrowser @@ -141,7 +140,7 @@ class ItemView(Display): def filterItemStore(self): filteredItems = self.filterItems() - if len(filteredItems) == 0: + if len(filteredItems) == 0 and len(self.unfilteredStore) > 0: setting = self.marketBrowser.settings.get('marketMGEmptyMode') # Enable leftmost available if setting == 1: diff --git a/gui/builtinMarketBrowser/marketTree.py b/gui/builtinMarketBrowser/marketTree.py index cdd998b9d..e4052356b 100644 --- a/gui/builtinMarketBrowser/marketTree.py +++ b/gui/builtinMarketBrowser/marketTree.py @@ -9,6 +9,7 @@ pyfalog = Logger(__name__) class MarketTree(wx.TreeCtrl): + def __init__(self, parent, marketBrowser): wx.TreeCtrl.__init__(self, parent, style=wx.TR_DEFAULT_STYLE | wx.TR_HIDE_ROOT) pyfalog.debug("Initialize marketTree") diff --git a/gui/builtinMarketBrowser/metaButton.py b/gui/builtinMarketBrowser/metaButton.py index 3d2762232..0603b4313 100644 --- a/gui/builtinMarketBrowser/metaButton.py +++ b/gui/builtinMarketBrowser/metaButton.py @@ -16,7 +16,7 @@ class MetaButton(wx.ToggleButton): def setMetaAvailable(self, isAvailable): self.Enable(isAvailable) # need to also SetValue(False) for windows because Enabled=False AND SetValue(True) looks enabled. - if not isAvailable: + if not isAvailable and "wxMSW" in wx.PlatformInfo: self.SetValue(False) def reset(self): From c144c16a7fb02b6861fa989c6e7f36e7f6be8369 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 3 Apr 2019 16:45:24 +0300 Subject: [PATCH 18/32] Enable only available buttons in case of empty item list --- gui/builtinMarketBrowser/itemView.py | 2 +- gui/builtinPreferenceViews/pyfaMarketPreferences.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index 207d3a447..b5b36921d 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -152,7 +152,7 @@ class ItemView(Display): # Enable all elif setting == 2: for btn in self.marketBrowser.metaButtons: - if not btn.GetValue(): + if btn.IsEnabled() and not btn.GetValue(): btn.setUserSelection(True) filteredItems = self.filterItems() self.filteredStore = filteredItems diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index bdb9832a3..b3714c8e6 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -89,7 +89,7 @@ class PFMarketPref(PreferenceView): mainSizer.Add(self.rbMarketJump, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketJump.Bind(wx.EVT_RADIOBOX, self.OnMarketJumpChange) - self.rbMarketEmpty = wx.RadioBox(panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable leftmost available meta button", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketEmpty = wx.RadioBox(panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable leftmost available meta button", "Enable all available meta buttons"], 1, wx.RA_SPECIFY_COLS) self.rbMarketEmpty.SetSelection(self.priceSettings.get('marketMGEmptyMode')) mainSizer.Add(self.rbMarketEmpty, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketEmptyChange) From 5dae614fa18d247352f09993c744cd4644b145e2 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 3 Apr 2019 17:49:08 +0300 Subject: [PATCH 19/32] Split search and recent modes --- gui/builtinMarketBrowser/itemView.py | 19 ++++++++----------- gui/marketBrowser.py | 6 ++++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index b5b36921d..0cb73683b 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -98,7 +98,7 @@ class ItemView(Display): self.sMkt.serviceMarketRecentlyUsedModules["pyfaMarketRecentlyUsedModules"].append(itemID) def selectionMade(self, event=None): - self.marketBrowser.searchMode = False + self.marketBrowser.mode = 'normal' # Grab the threeview selection and check if it's fine sel = self.marketView.GetSelection() if sel.IsOk(): @@ -126,13 +126,10 @@ class ItemView(Display): self.updateItemStore(items) # Set toggle buttons / use search mode flag if recently used modules category is selected (in order to have all modules listed and not filtered) - if seldata is not RECENTLY_USED_MODULES: - self.setToggles() - else: - self.marketBrowser.searchMode = True - self.setToggles() + if seldata is RECENTLY_USED_MODULES: + self.marketBrowser.mode = 'recent' - # Update filtered items + self.setToggles() self.filterItemStore() def updateItemStore(self, items): @@ -191,7 +188,7 @@ class ItemView(Display): self.selectionMade() return - self.marketBrowser.searchMode = True + self.marketBrowser.mode = 'search' self.sMkt.searchItems(search, self.populateSearch) def clearSearch(self, event=None): @@ -201,14 +198,14 @@ class ItemView(Display): if event: self.marketBrowser.search.Clear() - self.marketBrowser.searchMode = False + self.marketBrowser.mode = 'normal' self.updateItemStore(set()) self.setToggles() self.filterItemStore() def populateSearch(self, items): # If we're no longer searching, dump the results - if self.marketBrowser.searchMode is False: + if self.marketBrowser.mode != 'search': return self.updateItemStore(items) self.setToggles() @@ -239,7 +236,7 @@ class ItemView(Display): item = self.active[sel] sMkt = self.sMkt - sourceContext = "marketItemGroup" if self.marketBrowser.searchMode is False else "marketItemMisc" + sourceContext = "marketItemMisc" if self.marketBrowser.mode in ("search", "recent") else "marketItemGroup" itemContext = sMkt.getCategoryByItem(item).name menu = ContextMenu.getMenu((item,), (sourceContext, itemContext)) diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index d9f8706b9..447234a93 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -34,6 +34,7 @@ pyfalog = Logger(__name__) class MarketBrowser(wx.Panel): + def __init__(self, parent): wx.Panel.__init__(self, parent) @@ -51,7 +52,8 @@ class MarketBrowser(wx.Panel): # Grab service stuff and create child objects self.sMkt = Market.getInstance() self.settings = MarketPriceSettings.getInstance() - self.searchMode = False + # Here we accept 3 modes: normal, search and recent + self.mode = 'normal' self.marketView = MarketTree(self.splitter, self) self.itemView = ItemView(self.splitter, self) @@ -100,7 +102,7 @@ class MarketBrowser(wx.Panel): self.itemView.filterItemStore() def jump(self, item): - self.searchMode = False + self.mode = 'normal' self.marketView.jump(item) setting = self.settings.get('marketMGJumpMode') itemMetaCat = self.sMkt.META_MAP_REVERSE[self.sMkt.getMetaGroupIdByItem(item)] From f45ad5ceab5c143263c58ac4c0d307a5eb4ebbb2 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Wed, 3 Apr 2019 18:16:10 +0300 Subject: [PATCH 20/32] Implement logic which temporarily enables/disables meta groups for search --- gui/builtinMarketBrowser/itemView.py | 6 ++-- .../pyfaMarketPreferences.py | 2 +- gui/marketBrowser.py | 33 +++++++++++++++++-- 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index 0cb73683b..ff2e2dcf3 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -142,14 +142,14 @@ class ItemView(Display): # Enable leftmost available if setting == 1: for btn in self.marketBrowser.metaButtons: - if btn.IsEnabled() and not btn.GetValue(): + if btn.IsEnabled() and not btn.userSelected: btn.setUserSelection(True) break filteredItems = self.filterItems() # Enable all elif setting == 2: for btn in self.marketBrowser.metaButtons: - if btn.IsEnabled() and not btn.GetValue(): + if btn.IsEnabled() and not btn.userSelected: btn.setUserSelection(True) filteredItems = self.filterItems() self.filteredStore = filteredItems @@ -159,7 +159,7 @@ class ItemView(Display): sMkt = self.sMkt selectedMetas = set() for btn in self.marketBrowser.metaButtons: - if btn.GetValue(): + if btn.userSelected: selectedMetas.update(sMkt.META_MAP[btn.metaName]) filteredItems = sMkt.filterItemsByMeta(self.unfilteredStore, selectedMetas) return filteredItems diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index b3714c8e6..069ecfd12 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -79,7 +79,7 @@ class PFMarketPref(PreferenceView): self.intDelay.SetValue(self.sFit.serviceFittingOptions["marketSearchDelay"]) self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) - self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Temporarily enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search & Recent Items", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable all meta buttons for a duration of search / recents", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) self.rbMarketSearch.SetSelection(self.priceSettings.get('marketMGSearchMode')) mainSizer.Add(self.rbMarketSearch, 0, wx.RIGHT | wx.TOP | wx.EXPAND, 10) self.rbMarketSearch.Bind(wx.EVT_RADIOBOX, self.OnMarketSearchChange) diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index 447234a93..1acb8a144 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -52,8 +52,8 @@ class MarketBrowser(wx.Panel): # Grab service stuff and create child objects self.sMkt = Market.getInstance() self.settings = MarketPriceSettings.getInstance() - # Here we accept 3 modes: normal, search and recent - self.mode = 'normal' + self.__mode = 'normal' + self.__normalBtnMap = {} self.marketView = MarketTree(self.splitter, self) self.itemView = ItemView(self.splitter, self) @@ -128,3 +128,32 @@ class MarketBrowser(wx.Panel): btn.setUserSelection(True) self.itemView.selectionMade() + @property + def mode(self): + return self.__mode + + @mode.setter + def mode(self, newMode): + oldMode = self.__mode + if newMode == oldMode: + return + # Store meta button states when switching from normal + if oldMode == 'normal': + self.__normalBtnMap.clear() + for btn in self.metaButtons: + self.__normalBtnMap[btn] = btn.userSelected + setting = self.settings.get('marketMGSearchMode') + # We turn on all meta buttons for the duration of search/recents + if setting == 1: + if newMode in ('search', 'recent'): + for btn in self.metaButtons: + btn.setUserSelection(True) + if newMode == 'normal': + for btn, state in self.__normalBtnMap.items(): + btn.setUserSelection(state) + # We turn on all meta buttons permanently + if setting == 2: + for btn in self.metaButtons: + btn.setUserSelection(True) + self.__mode = newMode + From 1d5ba89f2e4e05d04ffb5ee7dd2fe2ba0f877242 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Fri, 5 Apr 2019 20:17:13 +0300 Subject: [PATCH 21/32] Revert "Remove price options menu item" This reverts commit f784f45b4e676e50cbcd2032c1778d5bcbb2a7e5. --- gui/builtinContextMenus/priceOptions.py | 50 +++++++++++++++++++++++++ gui/contextMenu.py | 1 + 2 files changed, 51 insertions(+) create mode 100644 gui/builtinContextMenus/priceOptions.py diff --git a/gui/builtinContextMenus/priceOptions.py b/gui/builtinContextMenus/priceOptions.py new file mode 100644 index 000000000..c9cb7f74a --- /dev/null +++ b/gui/builtinContextMenus/priceOptions.py @@ -0,0 +1,50 @@ +import wx + +import gui.globalEvents as GE +import gui.mainFrame +from gui.contextMenu import ContextMenu +from service.settings import PriceMenuSettings + + +class PriceOptions(ContextMenu): + def __init__(self): + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + self.settings = PriceMenuSettings.getInstance() + self.optionList = ["Ship", "Modules", "Drones", "Cargo", "Character"] + + def display(self, srcContext, selection): + return srcContext in ("priceViewFull", "priceViewMinimal") + + def getText(self, itmContext, selection): + return "Include in total" + + def addOption(self, menu, option): + label = option + id = ContextMenu.nextID() + self.optionIds[id] = option + menuItem = wx.MenuItem(menu, id, label, kind=wx.ITEM_CHECK) + menu.Bind(wx.EVT_MENU, self.handleMode, menuItem) + return menuItem + + def getSubMenu(self, context, selection, rootMenu, i, pitem): + msw = True if "wxMSW" in wx.PlatformInfo else False + self.context = context + self.optionIds = {} + + sub = wx.Menu() + + for option in self.optionList: + menuItem = self.addOption(rootMenu if msw else sub, option) + sub.Append(menuItem) + menuItem.Check(self.settings.get(option.lower())) + + return sub + + def handleMode(self, event): + option = self.optionIds[event.Id] + self.settings.set(option.lower(), event.Int) + + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + + +PriceOptions.register() diff --git a/gui/contextMenu.py b/gui/contextMenu.py index 1e6a49171..0625ff5ba 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -208,6 +208,7 @@ from gui.builtinContextMenus import ( # noqa: E402,F401 changeAffectingSkills, tacticalMode, targetResists, + priceOptions, amount, cargoAmmo, # droneStack, From af197e56cf5381630d738aae4604c118e7574983 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Fri, 5 Apr 2019 20:17:25 +0300 Subject: [PATCH 22/32] Revert "Remove price cache clear menu item" This reverts commit d59111eef557790d6274c9dd8cb3b201ffce3000. --- eos/gamedata.py | 2 ++ gui/builtinContextMenus/priceClear.py | 30 +++++++++++++++++++++++++++ gui/contextMenu.py | 1 + service/settings.py | 7 +++++++ 4 files changed, 40 insertions(+) create mode 100644 gui/builtinContextMenus/priceClear.py diff --git a/eos/gamedata.py b/eos/gamedata.py index 1d933519c..50bd66d94 100644 --- a/eos/gamedata.py +++ b/eos/gamedata.py @@ -142,6 +142,7 @@ class Effect(EqBase): """ if not self.__generated: self.__generateHandler() + return self.__effectDef is not None def isType(self, type): @@ -150,6 +151,7 @@ class Effect(EqBase): """ if not self.__generated: self.__generateHandler() + return self.type is not None and type in self.type def __generateHandler(self): diff --git a/gui/builtinContextMenus/priceClear.py b/gui/builtinContextMenus/priceClear.py new file mode 100644 index 000000000..9afdb0815 --- /dev/null +++ b/gui/builtinContextMenus/priceClear.py @@ -0,0 +1,30 @@ +from gui.contextMenu import ContextMenu +import gui.mainFrame +# noinspection PyPackageRequirements +import wx +import gui.globalEvents as GE +from service.price import Price +from service.settings import ContextMenuSettings + + +class PriceClear(ContextMenu): + def __init__(self): + self.mainFrame = gui.mainFrame.MainFrame.getInstance() + self.settings = ContextMenuSettings.getInstance() + + def display(self, srcContext, selection): + if not self.settings.get('priceClear'): + return False + + return srcContext in ("priceViewFull", "priceViewMinimal") + + def getText(self, itmContext, selection): + return "Reset Price Cache" + + def activate(self, fullContext, selection, i): + sPrc = Price.getInstance() + sPrc.clearPriceCache() + wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + + +PriceClear.register() diff --git a/gui/contextMenu.py b/gui/contextMenu.py index 0625ff5ba..ec9048429 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -208,6 +208,7 @@ from gui.builtinContextMenus import ( # noqa: E402,F401 changeAffectingSkills, tacticalMode, targetResists, + priceClear, priceOptions, amount, cargoAmmo, diff --git a/service/settings.py b/service/settings.py index 3723b1dd4..e64cddfe4 100644 --- a/service/settings.py +++ b/service/settings.py @@ -438,6 +438,12 @@ class StatViewSettings(object): "outgoing" : 2, } + # We don't have these....yet + ''' + "miningyield": 2, + "drones": 2 + ''' + self.serviceStatViewDefaultSettings = SettingsProvider.getInstance().getSettings("pyfaServiceStatViewSettings", serviceStatViewDefaultSettings) def get(self, type): @@ -514,6 +520,7 @@ class ContextMenuSettings(object): "moduleAmmoPicker" : 1, "moduleGlobalAmmoPicker": 1, "openFit" : 1, + "priceClear" : 1, "project" : 1, "shipJump" : 1, "tacticalMode" : 1, From 9b8aa672714b2a77ec3aa1e11e0ec93a1a38f7d1 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Fri, 5 Apr 2019 20:18:50 +0300 Subject: [PATCH 23/32] Remove some old commented out code --- service/settings.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) diff --git a/service/settings.py b/service/settings.py index e64cddfe4..1c497b3b8 100644 --- a/service/settings.py +++ b/service/settings.py @@ -48,37 +48,6 @@ class SettingsProvider(object): if not os.path.exists(self.BASE_PATH): os.mkdir(self.BASE_PATH) - # def getSettings(self, area, defaults=None): - # # type: (basestring, dict) -> service.Settings - # # NOTE: needed to change for tests - # settings_obj = self.settings.get(area) - # - # if settings_obj is None and hasattr(self, 'BASE_PATH'): - # canonical_path = os.path.join(self.BASE_PATH, area) - # - # if not os.path.exists(canonical_path): - # info = {} - # if defaults: - # for item in defaults: - # info[item] = defaults[item] - # - # else: - # try: - # f = open(canonical_path, "rb") - # info = cPickle.load(f) - # for item in defaults: - # if item not in info: - # info[item] = defaults[item] - # - # except: - # info = {} - # if defaults: - # for item in defaults: - # info[item] = defaults[item] - # - # self.settings[area] = settings_obj = Settings(canonical_path, info) - # - # return settings_obj def getSettings(self, area, defaults=None): # type: (basestring, dict) -> service.Settings # NOTE: needed to change for tests @@ -438,12 +407,6 @@ class StatViewSettings(object): "outgoing" : 2, } - # We don't have these....yet - ''' - "miningyield": 2, - "drones": 2 - ''' - self.serviceStatViewDefaultSettings = SettingsProvider.getInstance().getSettings("pyfaServiceStatViewSettings", serviceStatViewDefaultSettings) def get(self, type): From 278d946f77fffe38599fe330eb97616f99c788d8 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Fri, 5 Apr 2019 20:22:24 +0300 Subject: [PATCH 24/32] Fix price context menu --- gui/builtinContextMenus/priceOptions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gui/builtinContextMenus/priceOptions.py b/gui/builtinContextMenus/priceOptions.py index c9cb7f74a..540341350 100644 --- a/gui/builtinContextMenus/priceOptions.py +++ b/gui/builtinContextMenus/priceOptions.py @@ -3,14 +3,14 @@ import wx import gui.globalEvents as GE import gui.mainFrame from gui.contextMenu import ContextMenu -from service.settings import PriceMenuSettings +from service.settings import MarketPriceSettings class PriceOptions(ContextMenu): def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() - self.settings = PriceMenuSettings.getInstance() - self.optionList = ["Ship", "Modules", "Drones", "Cargo", "Character"] + self.settings = MarketPriceSettings.getInstance() + self.optionList = ["Drones", "Cargo", "Character"] def display(self, srcContext, selection): return srcContext in ("priceViewFull", "priceViewMinimal") From 5fa96c5e5232d321b1cdedafbae309eb673911ef Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Fri, 5 Apr 2019 21:00:42 +0300 Subject: [PATCH 25/32] Introduce new option group and move some options around --- .../pyfaMarketPreferences.py | 76 ++++++++++--------- gui/preferenceView.py | 4 +- service/settings.py | 3 +- 3 files changed, 46 insertions(+), 37 deletions(-) diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index 069ecfd12..e31b1d82b 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -34,20 +34,22 @@ class PFMarketPref(PreferenceView): self.m_staticline1 = wx.StaticLine(panel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.LI_HORIZONTAL) mainSizer.Add(self.m_staticline1, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5) - 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.tbTotalPriceDrones.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceDroneChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceDrones, 0, wx.LEFT | wx.RIGHT | wx.TOP, 5) - self.tbTotalPriceCargo = wx.CheckBox(panel, -1, "Cargo", wx.DefaultPosition, wx.DefaultSize, 1) - self.tbTotalPriceCargo.SetValue(self.priceSettings.get("cargo")) - self.tbTotalPriceCargo.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCargoChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceCargo, 0, wx.LEFT | wx.RIGHT, 5) - self.tbTotalPriceCharacter = wx.CheckBox(panel, -1, "Implants && Boosters", wx.DefaultPosition, wx.DefaultSize, 1) - self.tbTotalPriceCharacter.SetValue(self.priceSettings.get("character")) - self.tbTotalPriceCharacter.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCharacterChange) - self.tbTotalPriceBox.Add(self.tbTotalPriceCharacter, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) - mainSizer.Add(self.tbTotalPriceBox, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) + delayTimer = wx.BoxSizer(wx.HORIZONTAL) + self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, "Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0) + self.stMarketDelay.Wrap(-1) + self.stMarketDelay.SetCursor(helpCursor) + self.stMarketDelay.SetToolTip(wx.ToolTip('The delay between a keystroke and the market search. Can help reduce lag when typing fast in the market search box.')) + delayTimer.Add(self.stMarketDelay, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) + self.intDelay = IntCtrl(panel, max=1000, limited=True) + delayTimer.Add(self.intDelay, 0, wx.ALL, 5) + mainSizer.Add(delayTimer, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) + self.intDelay.SetValue(self.sFit.serviceFittingOptions["marketSearchDelay"]) + self.intDelay.Bind(wx.lib.intctrl.EVT_INT, self.onMarketDelayChange) + + self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, "Show market shortcuts", wx.DefaultPosition, wx.DefaultSize, 0) + mainSizer.Add(self.cbMarketShortcuts, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) + self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) + self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts) priceSizer = wx.BoxSizer(wx.HORIZONTAL) self.stDefaultSystem = wx.StaticText(panel, wx.ID_ANY, "Default Market Prices:", wx.DefaultPosition, wx.DefaultSize, 0) @@ -67,37 +69,40 @@ class PFMarketPref(PreferenceView): self.chPriceSystem.SetStringSelection(self.sFit.serviceFittingOptions["priceSystem"]) self.chPriceSystem.Bind(wx.EVT_CHOICE, self.onPriceSelection) - delayTimer = wx.BoxSizer(wx.HORIZONTAL) - self.stMarketDelay = wx.StaticText(panel, wx.ID_ANY, "Market Search Delay (ms):", wx.DefaultPosition, wx.DefaultSize, 0) - self.stMarketDelay.Wrap(-1) - self.stMarketDelay.SetCursor(helpCursor) - self.stMarketDelay.SetToolTip(wx.ToolTip('The delay between a keystroke and the market search. Can help reduce lag when typing fast in the market search box.')) - delayTimer.Add(self.stMarketDelay, 0, wx.ALL | wx.ALIGN_CENTER_VERTICAL, 5) - self.intDelay = IntCtrl(panel, max=1000, limited=True) - delayTimer.Add(self.intDelay, 0, wx.ALL, 5) - mainSizer.Add(delayTimer, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) - self.intDelay.SetValue(self.sFit.serviceFittingOptions["marketSearchDelay"]) - 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.tbTotalPriceDrones.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceDroneChange) + self.tbTotalPriceBox.Add(self.tbTotalPriceDrones, 0, wx.LEFT | wx.RIGHT | wx.TOP, 5) + self.tbTotalPriceCargo = wx.CheckBox(panel, -1, "Cargo", wx.DefaultPosition, wx.DefaultSize, 1) + self.tbTotalPriceCargo.SetValue(self.priceSettings.get("cargo")) + self.tbTotalPriceCargo.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCargoChange) + self.tbTotalPriceBox.Add(self.tbTotalPriceCargo, 0, wx.LEFT | wx.RIGHT, 5) + self.tbTotalPriceCharacter = wx.CheckBox(panel, -1, "Implants && Boosters", wx.DefaultPosition, wx.DefaultSize, 1) + self.tbTotalPriceCharacter.SetValue(self.priceSettings.get("character")) + self.tbTotalPriceCharacter.Bind(wx.EVT_CHECKBOX, self.OnTotalPriceCharacterChange) + self.tbTotalPriceBox.Add(self.tbTotalPriceCharacter, 0, wx.LEFT | wx.RIGHT | wx.BOTTOM, 5) + mainSizer.Add(self.tbTotalPriceBox, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) - self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search & Recent Items", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable all meta buttons for a duration of search / recents", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketSearch = wx.RadioBox(panel, -1, "Market Search && Recent Items", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable all meta buttons for a duration of search / recents", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) self.rbMarketSearch.SetSelection(self.priceSettings.get('marketMGSearchMode')) mainSizer.Add(self.rbMarketSearch, 0, wx.RIGHT | wx.TOP | wx.EXPAND, 10) self.rbMarketSearch.Bind(wx.EVT_RADIOBOX, self.OnMarketSearchChange) - self.rbMarketJump = wx.RadioBox(panel, -1, "Item Market Group Jump", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable item's meta button", "Enable item's meta button, disable others", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) - self.rbMarketJump.SetSelection(self.priceSettings.get('marketMGJumpMode')) - mainSizer.Add(self.rbMarketJump, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) - self.rbMarketJump.Bind(wx.EVT_RADIOBOX, self.OnMarketJumpChange) + self.rbMarketEmpty = wx.RadioBox(panel, -1, "Market Group Selection", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketEmpty.SetSelection(self.priceSettings.get('marketMGMarketSelectMode')) + mainSizer.Add(self.rbMarketEmpty, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) + self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketGroupSelectionChange) self.rbMarketEmpty = wx.RadioBox(panel, -1, "Empty Market View", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable leftmost available meta button", "Enable all available meta buttons"], 1, wx.RA_SPECIFY_COLS) self.rbMarketEmpty.SetSelection(self.priceSettings.get('marketMGEmptyMode')) mainSizer.Add(self.rbMarketEmpty, 0, wx.EXPAND | wx.TOP | wx.RIGHT, 10) self.rbMarketEmpty.Bind(wx.EVT_RADIOBOX, self.OnMarketEmptyChange) - self.cbMarketShortcuts = wx.CheckBox(panel, wx.ID_ANY, "Show market shortcuts", wx.DefaultPosition, wx.DefaultSize, 0) - mainSizer.Add(self.cbMarketShortcuts, 0, wx.EXPAND | wx.TOP | wx.RIGHT | wx.BOTTOM, 10) - self.cbMarketShortcuts.SetValue(self.sFit.serviceFittingOptions["showMarketShortcuts"] or False) - self.cbMarketShortcuts.Bind(wx.EVT_CHECKBOX, self.onCBShowShortcuts) + self.rbMarketJump = wx.RadioBox(panel, -1, "Item Market Group Jump", wx.DefaultPosition, wx.DefaultSize, ["No changes to meta buttons", "Enable item's meta button", "Enable item's meta button, disable others", "Enable all meta buttons"], 1, wx.RA_SPECIFY_COLS) + self.rbMarketJump.SetSelection(self.priceSettings.get('marketMGJumpMode')) + mainSizer.Add(self.rbMarketJump, 0, wx.EXPAND | wx.TOP | wx.RIGHT | wx.BOTTOM, 10) + self.rbMarketJump.Bind(wx.EVT_RADIOBOX, self.OnMarketJumpChange) panel.SetSizer(mainSizer) panel.Layout() @@ -147,5 +152,8 @@ class PFMarketPref(PreferenceView): def OnMarketSearchChange(self, event): self.priceSettings.set('marketMGSearchMode', event.GetInt()) + def OnMarketGroupSelectionChange(self, event): + self.priceSettings.set('marketMGMarketSelectMode', event.GetInt()) + PFMarketPref.register() diff --git a/gui/preferenceView.py b/gui/preferenceView.py index 5077dee17..0ee6230f5 100644 --- a/gui/preferenceView.py +++ b/gui/preferenceView.py @@ -46,9 +46,9 @@ from gui.builtinPreferenceViews import ( # noqa: E402, F401 pyfaEsiPreferences, pyfaContextMenuPreferences, pyfaStatViewPreferences, + pyfaMarketPreferences, pyfaUpdatePreferences, pyfaEnginePreferences, pyfaDatabasePreferences, - pyfaLoggingPreferences, - pyfaMarketPreferences + pyfaLoggingPreferences ) diff --git a/service/settings.py b/service/settings.py index 1c497b3b8..aa55f98d4 100644 --- a/service/settings.py +++ b/service/settings.py @@ -436,7 +436,8 @@ class MarketPriceSettings(object): "character" : 0, "marketMGJumpMode": 0, "marketMGEmptyMode": 1, - "marketMGSearchMode": 0 + "marketMGSearchMode": 0, + "marketMGMarketSelectMode": 0 } self.PriceMenuDefaultSettings = SettingsProvider.getInstance().getSettings("pyfaPriceMenuSettings", From 31645d20a5b582fe1ae1c04249431dffbe5dd64c Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Fri, 5 Apr 2019 21:57:01 +0300 Subject: [PATCH 26/32] As recents are int, do == instead of is --- gui/builtinMarketBrowser/itemView.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index ff2e2dcf3..559d807ec 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -126,7 +126,7 @@ class ItemView(Display): self.updateItemStore(items) # Set toggle buttons / use search mode flag if recently used modules category is selected (in order to have all modules listed and not filtered) - if seldata is RECENTLY_USED_MODULES: + if seldata == RECENTLY_USED_MODULES: self.marketBrowser.mode = 'recent' self.setToggles() From 2435e08dc028a14d3bc25580966e808b4a6b2368 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sun, 7 Apr 2019 19:42:44 +0300 Subject: [PATCH 27/32] Implement option to select all meta buttons on market group selection --- gui/builtinMarketBrowser/itemView.py | 13 ++++++++++--- gui/marketBrowser.py | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index 559d807ec..bd7129917 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -23,7 +23,7 @@ class ItemView(Display): def __init__(self, parent, marketBrowser): Display.__init__(self, parent) pyfalog.debug("Initialize ItemView") - marketBrowser.Bind(wx.EVT_TREE_SEL_CHANGED, self.selectionMade) + marketBrowser.Bind(wx.EVT_TREE_SEL_CHANGED, self.treeSelectionChanged) self.unfilteredStore = set() self.filteredStore = set() @@ -97,7 +97,10 @@ class ItemView(Display): self.sMkt.serviceMarketRecentlyUsedModules["pyfaMarketRecentlyUsedModules"].append(itemID) - def selectionMade(self, event=None): + def treeSelectionChanged(self, event=None): + self.selectionMade('tree') + + def selectionMade(self, context): self.marketBrowser.mode = 'normal' # Grab the threeview selection and check if it's fine sel = self.marketView.GetSelection() @@ -130,6 +133,10 @@ class ItemView(Display): self.marketBrowser.mode = 'recent' self.setToggles() + if context == 'tree' and self.marketBrowser.settings.get('marketMGMarketSelectMode') == 1: + for btn in self.marketBrowser.metaButtons: + if not btn.GetValue(): + btn.setUserSelection(True) self.filterItemStore() def updateItemStore(self, items): @@ -185,7 +192,7 @@ class ItemView(Display): realsearch = search.replace("*", "") # Re-select market group if search query has zero length if len(realsearch) == 0: - self.selectionMade() + self.selectionMade('search') return self.marketBrowser.mode = 'search' diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index 1acb8a144..5e9f13cd3 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -126,7 +126,7 @@ class MarketBrowser(wx.Panel): for btn in self.metaButtons: if not btn.GetValue(): btn.setUserSelection(True) - self.itemView.selectionMade() + self.itemView.selectionMade('jump') @property def mode(self): From 953a67e2c4bb3f70d5281f93ba7be36e8d6fd117 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sun, 7 Apr 2019 21:00:57 +0300 Subject: [PATCH 28/32] Update market preferences icon --- .../pyfaMarketPreferences.py | 2 +- imgs/gui/settings_market.png | Bin 0 -> 4470 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 imgs/gui/settings_market.png diff --git a/gui/builtinPreferenceViews/pyfaMarketPreferences.py b/gui/builtinPreferenceViews/pyfaMarketPreferences.py index e31b1d82b..2afd3dcca 100644 --- a/gui/builtinPreferenceViews/pyfaMarketPreferences.py +++ b/gui/builtinPreferenceViews/pyfaMarketPreferences.py @@ -115,7 +115,7 @@ class PFMarketPref(PreferenceView): self.sFit.serviceFittingOptions["showMarketShortcuts"] = self.cbMarketShortcuts.GetValue() def getImage(self): - return BitmapLoader.getBitmap("prefs_settings", "gui") + return BitmapLoader.getBitmap("settings_market", "gui") def onPriceSelection(self, event): system = self.chPriceSystem.GetString(self.chPriceSystem.GetSelection()) diff --git a/imgs/gui/settings_market.png b/imgs/gui/settings_market.png new file mode 100644 index 0000000000000000000000000000000000000000..3b656427abd557f567e0b6be3e30739d14cf50fb GIT binary patch literal 4470 zcmV-+5sB`JP) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3#ba_c%0ME|jhUIM1VupEpLZwI~nJ_S;;CEIs+ z(UL7vAc-L>D=Q(h{`=21|KSz9O(se%sitIk#Tu(`oD_S#uA{T@e4dxTFY*1Q-8?UN zngYjgeNF4WztJuq59D~a_t$ol$K6l4J974A=%6F(`F&rxI|}}4clUQw@8??lw4D3j zkGtE)vfjSO3>Z`BFL>iuaKZ9fbd?dM($(emkX?*+t060*zG;b-s@UjiwUHXxfk_V$~ogk zI*H*tmUw6Wh4Xygm3Lu@gNRL{*?AA+s`H?|U3Akmx7|9&;RaKTetF>b-VYy6TLJ#+ z#|cW*x7$7wo@qiM5`(A(n*DPw?u=W{c*7M&o{l@cqcg`7U*6`s#((pEcC@!r*Ew6B zSTQfJoMsvtIsN1=0^;_KsT_RI+kE1U{S??h1m(b7SYWgL>Y|JL;8r+s4%{a;8hfRN z%k%C4h!|U#j0;4-CKtpdXS4U&IdCk*r!jLMqVGh&iTLTvCN?1?f>XSX%`@4Zd%gIp z8EGL95>m*7h6Ey5F$(<2vB04wL81|nBw317X(^8a;ldhKmMpAmzl@ua_*ZfBKSj=H=>8v(Ga9-(a$n>2P1I&P6(yViX%;G`Hf)5Ao0>2Dp~qj2 zeVuPMti6Bv&FI(Oc5-dUx!~6BvP<5>g|hncsOn^SbLy z*=zc})?VQ>+1--Y`|GNy>_(TlZ>!gecPvcyoO@&x+im)HvIC(in_TmQ8F6EJK9Hl> zAsdY8t-GC@@PI`U0MN~nr{0HapkQ*V)$iuL;qhI7ZfZrAbLn@-Y{qxjggHw20kuA> zT&VfXZL=kq+Rd~Ob3wMkg9|c1qycLt7p?Clz#S+&XY7>$att%AI%P53s#U@odyH&N z>tjy4eS|fh0Ww_eFdXr##KgHZ+HSH|E(2)SbkKOEJ!9B?-ZSm+h)M3=q1!$@8z*Kd zHSM}d&B8RVC~NecUhEk&ZFGD?4tNj{11mX#GjIU3Vn z5i%hNo+*=V5W#|SmPwMcvRF46;#$rN>P zctW~c(FCa7rVhOP7+Zt6H!Gsm&gUqkTV`_XaJ;N=U|ztIst8Awy9B zawCr&R@RN~P4rt<$uibiuYt7{8Z~eODL2C+xl09;jM7ZN0)pbvO+OLU9)~T+9>GVL z5K08FA|>89Zmci_y@$lLP33v(u{1~pE={LL5J#wW&x*P+4X}gtOBde2Ku-;-=f|{1 z$(sG`aTm{mGhr%vZ0JKv#HbkU6@~}cxZ`R|QrFPq4?^Y7Qw}P5hH|6pWws0p-BcVK zb;XIsJ7L1i9CH=qPNf@OhNj83hu%iieiXszOI=Dp^Mk<{kti3=nw``RFN# z>qya{O%f3BjDruN^Ipr`2aF_Jf(gv5s(Y3jal0(rOrC`@7_kW@-A8Ij!?Ahm;=#UiQd=xHXM zlwDk_5p>`q9U#J(D5%@myP27*7TTt@V`g6qDr0bEZYOXo4=i4h!${ z@fB2a>QcT`#cZK2)!ADmya=^t-c&F!>p(<3qzSW1N&=A82K^xb~#zA{s-EgHeWIN=85n8kFb(v8&?1H_?n|Y*Dv> znBhzYrD(!N<$PmznwHJfT1J2LdhB*EZ@FPpdiNc+%R?{4fpL#zP2Z@T#iYptteZFl zTpfwUj%ctCX&AtvetjfLK-HZk7*KpL9qN*(oW2`u8O5$sT-inzK!8}J{!E#2=}Tr8 zc?d3F(|jz^}}&QqjkI7+oq^>yWB})p9P$ZZ@<-F^C7_4^UHJN&rq7URcUkw$v!OH zHljBSFFs=`dDK?mSpsm_WFDJPh}fz!mwyu3B3sl{weHkwVZLkY^`sxZKQUvT+q~@%aJ`t0%n_)5BRwE1Qmdws*xq?uQUow`@`9q47oVxLO?5ZU7E(E!RDyD+q>QFXC7 zbVLVzk|O%k6(L!e?N?8IcN_&C4gD>kxlahm*`|%hq|DA|AVL*6 zNsFQYC4!_$Oq4!sqZX-s=tZj3NKmDhB#oe=Dld)tP&Jjb&HZ(DU9=lae6`_K3PMrf`1e>QWz0U^XZBOy=y zFB?;iYonB#oois37H!WT@j^H~-=4R+teFF7pY5dCzo!vbWjYKA`~GwUzz3xND-pQG z&E=YBcZGzZUr0M?+Ir!=^C!?~zWdNFQg)KN_w5`Lau;aPj^c3Vf#bh}uv%zWF<%bc zpdch_ez0RzL9z8=P36j}`_^sbOEqvg3MX6M2VmPhTUl8J0!XHzXAnM%L}>r~9PKZ> zJxfat6okamJzH1j`>n3W?r&sW4Rl7}%`wdiBr)#R$dzJ;^ujfAk0UnPRfj~-u5CYqF@L1+eS)Q74n2x8K0Vmfa z%=7v@Ke}(-TK?AdPqbDThKWERq+oJG5}1aWO-zmL*bI-x?TarReRR$Ng0F4-YR&rKH~bY#9uxu+$3JcYQn>;!g%AwH zM=+#`6mmAq8&6i`^h7Fdk&or!AuG;Xm084Yo@6W3V{SL{+~nufn+i{hG9rD zj|{XH#HONzw%*Stmqx!{_$yz3I+gsuPU=IK51lv#3 z5-H_uf@!T$+NGj+IbT_R7t(;wt~gxiY2nInAGl(F=WmYv9K!CMNby1d%9ifg_S==~ zgU?h4OK_FG353!v)g^1F@|RN;fQf1Nds{ahy{)LU_)gcsV~6J|;bH;!fEDZZJ@H}H z(m+XNMKMY#wANf-qO?M5h0=;V%g3^k)vT<{XJ`!GYW@r9Wcrm$2abL3dNdXbzyL~s zy1SqK<{KrYg|)$;A76nt^YnBkB09UVCIdzallq!Xm;&B7b%L?s$;Q5y-#ZFnb*r=F z{OJ*PfjH3Lb?}|1TF-PJ?Cy@*m%0WRyEcidHHKwim=bA948z1QEs&bl{(q2C(6C_( z1x4N$vq_nAF|vRqKm|}r@U9ihAFuy@ahdM{Utu0ggMJEqc_>$LeWwgHE}LpM^XC(9 zbMd8j0uYYp=m)|!gyO&q5Fl4#4l(zIof!=9;~$>MAKN&Yx99i9{oaB_{A% zc`Q^9ZdVP>^*?*!s4(Y}vGy3q7&jk)bQQClce7z4#R6feISx zH*$Hb4Iyvjw3GtdQ7BiBt1jc7)n)%SacIItz-$DB z5EzCe8jTZ+#9v#eBrgQOGE5^_TAI(qh=o>~_{>$}GXrR?$@dfiFq59hm=nXua4#}m zAvt5y+ZVG(UOoLsAekElQgXJVg^J32q$N;UIo4W}cBesuVOSZDAV3I-AqCUPG%am? zbi984TR?0f01GK$0AJb0nrH5P-d|qyKw0?`%1eu=EMJ0B8ds?s&rW7SK9xw*ABhni zjN2Wro(s{}_X!Y%a4Hum_5h_o5bzf_KKOJ+P2gcqo>k|#itP_?z|DRP3`27AR6E+$ z(P+=;@$t9L90nr5P{xpCO7bEB2q0tv`D6@+A1DTjzWiKc(<9sKah%Lr(-geh)W(Hh zAK8-i1EX2JNYC{HIVfS+0VW}o$kv5CpxiJd@1AT!XDJX_3V~3k6NnmQ-6EjsO4v07*qo IM6N<$f*9|GPyhe` literal 0 HcmV?d00001 From 9bde08b1ce3b2c3264f0618d97ac4dc4c16f0648 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sun, 7 Apr 2019 23:33:22 +0300 Subject: [PATCH 29/32] Rework price stats panel context menu --- gui/builtinContextMenus/factorReload.py | 2 +- gui/builtinContextMenus/priceClear.py | 30 ----------- gui/builtinContextMenus/priceOptions.py | 72 ++++++++++++++----------- gui/contextMenu.py | 1 - 4 files changed, 43 insertions(+), 62 deletions(-) delete mode 100644 gui/builtinContextMenus/priceClear.py diff --git a/gui/builtinContextMenus/factorReload.py b/gui/builtinContextMenus/factorReload.py index c70028efc..d759734a6 100644 --- a/gui/builtinContextMenus/factorReload.py +++ b/gui/builtinContextMenus/factorReload.py @@ -3,7 +3,6 @@ import gui.mainFrame import gui.globalEvents as GE # noinspection PyPackageRequirements import wx -from gui.bitmap_loader import BitmapLoader from service.fit import Fit from service.settings import ContextMenuSettings @@ -34,4 +33,5 @@ class FactorReload(ContextMenu): sFit = Fit.getInstance() return sFit.serviceFittingOptions["useGlobalForceReload"] + FactorReload.register() diff --git a/gui/builtinContextMenus/priceClear.py b/gui/builtinContextMenus/priceClear.py deleted file mode 100644 index 9afdb0815..000000000 --- a/gui/builtinContextMenus/priceClear.py +++ /dev/null @@ -1,30 +0,0 @@ -from gui.contextMenu import ContextMenu -import gui.mainFrame -# noinspection PyPackageRequirements -import wx -import gui.globalEvents as GE -from service.price import Price -from service.settings import ContextMenuSettings - - -class PriceClear(ContextMenu): - def __init__(self): - self.mainFrame = gui.mainFrame.MainFrame.getInstance() - self.settings = ContextMenuSettings.getInstance() - - def display(self, srcContext, selection): - if not self.settings.get('priceClear'): - return False - - return srcContext in ("priceViewFull", "priceViewMinimal") - - def getText(self, itmContext, selection): - return "Reset Price Cache" - - def activate(self, fullContext, selection, i): - sPrc = Price.getInstance() - sPrc.clearPriceCache() - wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) - - -PriceClear.register() diff --git a/gui/builtinContextMenus/priceOptions.py b/gui/builtinContextMenus/priceOptions.py index 540341350..650d194a4 100644 --- a/gui/builtinContextMenus/priceOptions.py +++ b/gui/builtinContextMenus/priceOptions.py @@ -1,3 +1,5 @@ +from abc import abstractmethod, ABCMeta + import wx import gui.globalEvents as GE @@ -6,45 +8,55 @@ from gui.contextMenu import ContextMenu from service.settings import MarketPriceSettings -class PriceOptions(ContextMenu): +class ItemGroupPrice(ContextMenu, metaclass=ABCMeta): + def __init__(self): self.mainFrame = gui.mainFrame.MainFrame.getInstance() self.settings = MarketPriceSettings.getInstance() - self.optionList = ["Drones", "Cargo", "Character"] + + @property + @abstractmethod + def label(self): + ... + + @property + @abstractmethod + def optionName(self): + ... def display(self, srcContext, selection): return srcContext in ("priceViewFull", "priceViewMinimal") def getText(self, itmContext, selection): - return "Include in total" - - def addOption(self, menu, option): - label = option - id = ContextMenu.nextID() - self.optionIds[id] = option - menuItem = wx.MenuItem(menu, id, label, kind=wx.ITEM_CHECK) - menu.Bind(wx.EVT_MENU, self.handleMode, menuItem) - return menuItem - - def getSubMenu(self, context, selection, rootMenu, i, pitem): - msw = True if "wxMSW" in wx.PlatformInfo else False - self.context = context - self.optionIds = {} - - sub = wx.Menu() - - for option in self.optionList: - menuItem = self.addOption(rootMenu if msw else sub, option) - sub.Append(menuItem) - menuItem.Check(self.settings.get(option.lower())) - - return sub - - def handleMode(self, event): - option = self.optionIds[event.Id] - self.settings.set(option.lower(), event.Int) + return self.label + def activate(self, fullContext, selection, i): + self.settings.set(self.optionName, not self.settings.get(self.optionName)) wx.PostEvent(self.mainFrame, GE.FitChanged(fitID=self.mainFrame.getActiveFit())) + @property + def checked(self): + return self.settings.get(self.optionName) -PriceOptions.register() + +class DronesPrice(ItemGroupPrice): + + label = 'Drones' + optionName = 'drones' + + +class CargoPrice(ItemGroupPrice): + + label = 'Cargo' + optionName = 'cargo' + + +class ImplantBoosterPrice(ItemGroupPrice): + + label = 'Implants && Boosters' + optionName = 'character' + + +DronesPrice.register() +CargoPrice.register() +ImplantBoosterPrice.register() diff --git a/gui/contextMenu.py b/gui/contextMenu.py index ec9048429..0625ff5ba 100644 --- a/gui/contextMenu.py +++ b/gui/contextMenu.py @@ -208,7 +208,6 @@ from gui.builtinContextMenus import ( # noqa: E402,F401 changeAffectingSkills, tacticalMode, targetResists, - priceClear, priceOptions, amount, cargoAmmo, From 9d322ca8624a8beded31e6e8e464cc7d1869bf6e Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sun, 7 Apr 2019 23:50:39 +0300 Subject: [PATCH 30/32] Drop selection when search is used --- gui/marketBrowser.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index 5e9f13cd3..ea24973de 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -142,6 +142,8 @@ class MarketBrowser(wx.Panel): self.__normalBtnMap.clear() for btn in self.metaButtons: self.__normalBtnMap[btn] = btn.userSelected + if newMode == 'search': + self.marketView.UnselectAll() setting = self.settings.get('marketMGSearchMode') # We turn on all meta buttons for the duration of search/recents if setting == 1: From b3a556e70a25f3ebf77f6a76237929a202dd5625 Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Sun, 7 Apr 2019 23:59:54 +0300 Subject: [PATCH 31/32] Raise error instead of doing nothing for abstract methods --- gui/builtinContextMenus/priceOptions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gui/builtinContextMenus/priceOptions.py b/gui/builtinContextMenus/priceOptions.py index 650d194a4..41736e4bc 100644 --- a/gui/builtinContextMenus/priceOptions.py +++ b/gui/builtinContextMenus/priceOptions.py @@ -17,12 +17,12 @@ class ItemGroupPrice(ContextMenu, metaclass=ABCMeta): @property @abstractmethod def label(self): - ... + raise NotImplementedError() @property @abstractmethod def optionName(self): - ... + raise NotImplementedError() def display(self, srcContext, selection): return srcContext in ("priceViewFull", "priceViewMinimal") From feb164a48ec87a02dee52520886fff1bcd634a5a Mon Sep 17 00:00:00 2001 From: DarkPhoenix Date: Mon, 8 Apr 2019 00:16:58 +0300 Subject: [PATCH 32/32] Reset item list to empty during search cancel only if we still were searching, do nothing otherwise --- gui/builtinMarketBrowser/itemView.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gui/builtinMarketBrowser/itemView.py b/gui/builtinMarketBrowser/itemView.py index bd7129917..435845662 100644 --- a/gui/builtinMarketBrowser/itemView.py +++ b/gui/builtinMarketBrowser/itemView.py @@ -205,10 +205,11 @@ class ItemView(Display): if event: self.marketBrowser.search.Clear() - self.marketBrowser.mode = 'normal' - self.updateItemStore(set()) - self.setToggles() - self.filterItemStore() + if self.marketBrowser.mode == 'search': + self.marketBrowser.mode = 'normal' + self.updateItemStore(set()) + self.setToggles() + self.filterItemStore() def populateSearch(self, items): # If we're no longer searching, dump the results