darktable lua help - widget type for collection-like behavior

tl;dr: I’d like create a widget that is similar to the collections view. It could be a tree or not.

What I’m trying to do is get a list of directories that meet a weird criteria: They contain images that have a specified tag, but also contain images that don’t contain the specified tag. I.e. I have a folder that has 10 images, 5 of them are tagged with “macro” and 5 of them are not. This folder should be returned in the results.

I actually have that piece written just fine, and this started from a python script I created, but then I thought a lua script inside darktable would be a fun project. Currently I am getting a list of the directories where some images with missing tags were found, and getting a list of the specific images.

Where I’m stuck now is what to do with that list of directories that are returned. I’m currently dumping the list into a read-only text_view widget. What I’d ideally like to do is have each directory clickable and update the collection to that directory.

I’m open to just displaying all the found images in the lighttable but I don’t think I can do this as a selection because I want the user (me) to be able to enter a tag (and maybe other parameters) and a single button from registering a selection wouldn’t work.

I’m open to other ideas!

Populate a combobox with the directory list then select which one you want to use. You can update the collection rules from within Lua to manipulate the collection.

2 Likes

I dunno why I didn’t consider using a combobox… :man_facepalming:

Thanks!