From d961bf53448005b59de1e3cc1fa66f309941d86c Mon Sep 17 00:00:00 2001 From: PhatPhuckDave Date: Sat, 6 Dec 2025 01:39:23 +0100 Subject: [PATCH] Make fits a check instead of radio button --- gui/marketBrowser.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/gui/marketBrowser.py b/gui/marketBrowser.py index 5fac37969..edc99a8ff 100644 --- a/gui/marketBrowser.py +++ b/gui/marketBrowser.py @@ -93,6 +93,8 @@ class MarketBrowser(wx.Panel): slotBox.Add(fitsBtn, 1, wx.ALIGN_CENTER) fitsBtn.Bind(wx.EVT_TOGGLEBUTTON, self.toggleSlotButton) fitsBtn.filterType = "fits" + # Fits button starts deselected (checkbox, off by default) + fitsBtn.setUserSelection(False) self.slotButtons.append(fitsBtn) # High, Med, Low buttons @@ -108,6 +110,8 @@ class MarketBrowser(wx.Panel): slotBtn.Bind(wx.EVT_TOGGLEBUTTON, self.toggleSlotButton) slotBtn.filterType = "slot" slotBtn.slotType = slot + # Slot buttons start deselected (unlike meta buttons which start selected) + slotBtn.setUserSelection(False) self.slotButtons.append(slotBtn) # Make itemview to set toggles according to list contents @@ -135,12 +139,20 @@ class MarketBrowser(wx.Panel): self.itemView.filterItemStore() def toggleSlotButton(self, event): - """Process clicks on slot/fits filter buttons - works IDENTICALLY to meta buttons""" + """Process clicks on slot/fits filter buttons""" clickedBtn = event.EventObject + # Fits button works as a checkbox (independent toggle) + if clickedBtn.filterType == "fits": + clickedBtn.setUserSelection(clickedBtn.GetValue()) + self.itemView.filterItemStore() + return + + # Slot buttons (High/Med/Low) work as radio buttons (mutually exclusive) if wx.GetMouseState().GetModifiers() == wx.MOD_CONTROL: - activeBtns = [btn for btn in self.slotButtons if btn.GetValue()] - if activeBtns: + # Get only slot buttons (not fits) + activeSlotBtns = [btn for btn in self.slotButtons if btn.GetValue() and btn.filterType == "slot"] + if activeSlotBtns: clickedBtn.setUserSelection(clickedBtn.GetValue()) self.itemView.filterItemStore() else: @@ -148,8 +160,10 @@ class MarketBrowser(wx.Panel): # Keep button in the same state clickedBtn.setUserSelection(True) else: + # Deselect all slot buttons, then select clicked one for btn in self.slotButtons: - btn.setUserSelection(btn == clickedBtn) + if btn.filterType == "slot": + btn.setUserSelection(btn == clickedBtn) self.itemView.filterItemStore()