From 205d14235d907d2c0438291c276464af9f96c3c1 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Thu, 26 Oct 2023 08:55:46 -0700 Subject: [PATCH] hide help and configure buttons when panel is minimized --- docs/changelog.txt | 1 + plugins/lua/stockpiles.lua | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index c5df00ba8..57c60072b 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -56,6 +56,7 @@ Template for new versions: ## New Features ## Fixes +- `stockpiles`: hide configure and help buttons when the overlay panel is minimized ## Misc Improvements diff --git a/plugins/lua/stockpiles.lua b/plugins/lua/stockpiles.lua index 76e0f800b..1173fa2d9 100644 --- a/plugins/lua/stockpiles.lua +++ b/plugins/lua/stockpiles.lua @@ -403,11 +403,15 @@ StockpilesOverlay.ATTRS{ function StockpilesOverlay:init() self.minimized = false + local function is_expanded() + return not self.minimized + end + local main_panel = widgets.Panel{ view_id='main', frame_style=gui.MEDIUM_FRAME, frame_background=gui.CLEAR_PEN, - visible=function() return not self.minimized end, + visible=is_expanded, subviews={ -- widgets.HotkeyLabel{ -- frame={t=0, l=0}, @@ -486,10 +490,12 @@ function StockpilesOverlay:init() widgets.ConfigureButton{ frame={t=0, r=5}, on_click=function() ConfigModal{on_close=self:callback('on_custom_config')}:show() end, + visible=is_expanded, }, widgets.HelpButton{ frame={t=0, r=1}, command='stockpiles', + visible=is_expanded, }, } end