From 58bc3a69dff57a8149494fcf6f873b9d588837e6 Mon Sep 17 00:00:00 2001 From: Bill Ferguson Date: Thu, 26 Mar 2026 13:57:04 -0400 Subject: [PATCH] contrib/toggle_group_view - moved from official to contrib to handle event conflict with official/group_persistence. Moving to contrib forces toggle_group_view to load before group_persistence and thus get events that both need, first. If the order is reversed then toggle_group_view can bog down in a loop making darktable unresponsive. Fixed bad call in destroy and added check for selection-changed to make sure there are images before trying to set sensitivity. --- {official => contrib}/toggle_group_view.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) rename {official => contrib}/toggle_group_view.lua (95%) diff --git a/official/toggle_group_view.lua b/contrib/toggle_group_view.lua similarity index 95% rename from official/toggle_group_view.lua rename to contrib/toggle_group_view.lua index bdb2f6a..09d731f 100644 --- a/official/toggle_group_view.lua +++ b/contrib/toggle_group_view.lua @@ -172,7 +172,7 @@ end -- - - - - - - - - - - - - - - - - - - - - - - - local function destroy() - dt.gui.libs.destroy_action(MODULE, "toggle group view") + dt.gui.libs.image.destroy_action(MODULE, "toggle group view") dt.destroy_event(MODULE, "selection_changed") -- leave the shortcut so it doesn't need to be reassigned -- the next time this module starts @@ -212,15 +212,21 @@ dt.register_event( "toggle group view for selected image" ) +-- check the number of groups and ... dt.register_event(MODULE, "selection-changed", function(event) set_button_sensitive(dt.gui.selection()) end ) +-- it's a delete event just countdown instead of trying to keep track of +-- the selection and once I reach 0 do the set sensitive dt.register_event(MODULE, "image-group-information-changed", function(event, reason, image, other_image) - set_button_sensitive(dt.gui.selection()) + local images = dt.gui.selection() + if images then + set_button_sensitive(images) + end end ) return script_data