Make fits a check instead of radio button
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user