From 6d9c4c90ba4ce1b80b873c58cea0d8c073fc384a Mon Sep 17 00:00:00 2001 From: wpferguson Date: Wed, 10 Feb 2021 14:52:03 -0500 Subject: [PATCH] Used image table returned to callback, and returned selection table to caller so that it could do the selection. --- contrib/select_untagged.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/contrib/select_untagged.lua b/contrib/select_untagged.lua index 238c1ac..7173f5a 100644 --- a/contrib/select_untagged.lua +++ b/contrib/select_untagged.lua @@ -36,23 +36,23 @@ local function stop_job(job) job.valid = false end -local function select_untagged_images() +local function select_untagged_images(event, images) job = dt.gui.create_job(_("select untagged images"), true, stop_job) local selection = {} - for key,image in ipairs(dt.collection) do + for key,image in ipairs(images) do if(job.valid) then - job.percent = (key-1)/#dt.collection + job.percent = (key - 1)/#images local tags = dt.tags.get_tags(image) local hasTags = false for _,tag in ipairs(tags) do - if not string.match(tag.name,"darktable|") then + if not string.match(tag.name, "darktable|") then hasTags = true end end if hasTags == false then - table.insert(selection,image) + table.insert(selection, image) end else break @@ -60,7 +60,8 @@ local function select_untagged_images() end job.valid = false - dt.gui.selection(selection) + -- return table of images to set the selection to + return selection end if CURR_API_STRING >= "6.2.2" then