Skip to content

Commit 6d9c4c9

Browse files
committed
Used image table returned to callback, and returned selection table to caller so that it could do the selection.
1 parent 5b8282e commit 6d9c4c9

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

contrib/select_untagged.lua

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,31 +36,32 @@ local function stop_job(job)
3636
job.valid = false
3737
end
3838

39-
local function select_untagged_images()
39+
local function select_untagged_images(event, images)
4040
job = dt.gui.create_job(_("select untagged images"), true, stop_job)
4141

4242
local selection = {}
4343

44-
for key,image in ipairs(dt.collection) do
44+
for key,image in ipairs(images) do
4545
if(job.valid) then
46-
job.percent = (key-1)/#dt.collection
46+
job.percent = (key - 1)/#images
4747
local tags = dt.tags.get_tags(image)
4848
local hasTags = false
4949
for _,tag in ipairs(tags) do
50-
if not string.match(tag.name,"darktable|") then
50+
if not string.match(tag.name, "darktable|") then
5151
hasTags = true
5252
end
5353
end
5454
if hasTags == false then
55-
table.insert(selection,image)
55+
table.insert(selection, image)
5656
end
5757
else
5858
break
5959
end
6060
end
6161

6262
job.valid = false
63-
dt.gui.selection(selection)
63+
-- return table of images to set the selection to
64+
return selection
6465
end
6566

6667
if CURR_API_STRING >= "6.2.2" then

0 commit comments

Comments
 (0)