From 688be95d2b299ebf10c891771ac2053d608aa11d Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Tue, 27 Oct 2009 15:28:49 -0500 Subject: [PATCH] Collapse empty categories when selecting a weight --- config.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/config.lua b/config.lua index 41c82b1..925c8d7 100644 --- a/config.lua +++ b/config.lua @@ -104,12 +104,29 @@ end --opens a new config pane to edit stat weights function configSelectWeight(weightFrame) + local empty + ww_config.rightPanel.weightFrame = weightFrame ww_config.rightPanel.statList = ww_vars.weightsList[weightFrame.category.class][weightFrame.name] -- Fills the right panel with the current weight's stats configResetWeight() + for _, categoryFrame in ipairs(ww_config.rightPanel.scrollFrame.categories) do + empty = true + for _, statFrame in ipairs({categoryFrame:GetChildren()}) do + if statFrame.statName then + if statFrame.statValue:GetText() ~= "" then + empty = false + break + end + end + end + if (categoryFrame.collapsed and not empty) or (not categoryFrame.collapsed and empty) then + categoryFrame.text:Click() + end + end + ww_config.rightPanel.header:SetText(weightFrame.name) ww_config.rightPanel:Show() end -- 1.7.9.5