Make the slot filters a toggle instead of radio

This commit is contained in:
2025-12-15 23:12:17 +01:00
parent 6bb0938be0
commit 135fdd8812

View File

@@ -144,30 +144,9 @@ class MarketBrowser(wx.Panel):
"""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:
# 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:
# Do 'nothing' if we're trying to turn last active button off
# Keep button in the same state
clickedBtn.setUserSelection(True)
else:
# Deselect all slot buttons, then select clicked one
for btn in self.slotButtons:
if btn.filterType == "slot":
btn.setUserSelection(btn == clickedBtn)
self.itemView.filterItemStore()
# All buttons (Fits, High, Med, Low, Rig) work as checkboxes (independent toggles)
clickedBtn.setUserSelection(clickedBtn.GetValue())
self.itemView.filterItemStore()
def getFitsFilter(self):
"""Check if Fits button is active"""