AdiBags
AdiBags copied to clipboard
Proposed Keyring Support Changes
AdiBags is a complicated addon and I'm fairly busy, so I don't have a whole lot of time to dedicate to fully fleshing this out right now. If you feel so inclined, please take a look at these proposed changes to the initial keyring support (adb91fe) added for Burning Crusade Classic and offer a hand.
Update/clarification: Keyring support (adb91fe) didn't survive the unification of the codebase (#648).
I think this solution just reverts the keyring changes right? Is that what we want? I thought it was to just make the free key slots not show up in the free space.
This is the solution I came up with. It hides both the Key
section and the Key
slots in the Free space
section when you toggle it's visibility.
From 532fc829183768900cb860cb4e2580784858a7e1 Mon Sep 17 00:00:00 2001
From: Will Bender <[email protected]>
Date: Tue, 3 May 2022 22:57:40 -1000
Subject: [PATCH] What I think works
---
widgets/Section.lua | 29 ++++++++++++++++++++++++++---
1 file changed, 26 insertions(+), 3 deletions(-)
diff --git a/widgets/Section.lua b/widgets/Section.lua
index 7b020d3..a43df9a 100644
--- a/widgets/Section.lua
+++ b/widgets/Section.lua
@@ -108,8 +108,15 @@ function sectionProto:OnCreate()
end
function sectionProto:OnShow()
+ local isFreeSpaceSection = self.key == "Free space#Free space"
+ local keySection = self.container:GetSection("Key", "Key")
+
for button in pairs(self.buttons) do
- button:Show()
+ local buttonFamilyIsKeyChain = button.bagFamily == 256 or (button:IsStack() and button:GetBagFamily() == 256)
+ local shouldShow = not (keySection:IsCollapsed() and isFreeSpaceSection and buttonFamilyIsKeyChain)
+ if shouldShow then
+ button:Show()
+ end
end
end
@@ -117,6 +124,15 @@ function sectionProto:OnHide()
for button in pairs(self.buttons) do
button:Hide()
end
+ -- Also hide free keys section in the "Free space"
+ if self.key == "Key#Key" then
+ local section = self.container:GetSection("Free space", "Free space")
+ for button in pairs(section.buttons) do
+ if button.bagFamily == 256 or (button:IsStack() and button:GetBagFamily() == 256) then
+ button:Hide()
+ end
+ end
+ end
end
function sectionProto:ToString()
@@ -358,9 +374,16 @@ function sectionProto:FullLayout()
return self:Hide()
end
+ local isFreeSpaceSection = self.key == "Free space#Free space"
+ local keySection = self.container:GetSection("Key", "Key")
+
for button in pairs(self.buttons) do
- button:Show()
- tinsert(buttonOrder, button)
+ local buttonFamilyIsKeyChain = button.bagFamily == 256 or (button:IsStack() and button:GetBagFamily() == 256)
+ local shouldShow = not (keySection:IsCollapsed() and isFreeSpaceSection and buttonFamilyIsKeyChain)
+ if shouldShow then
+ button:Show()
+ tinsert(buttonOrder, button)
+ end
end
tsort(buttonOrder, CompareButtons)
--
2.36.0.windows.1
Thanks for sharing your solution. I'll review it when I get around to merging the classic/bcc branches back into master (soon, hopefully).
Any update on merging in this change?