William Ferguson (2019-May-16, excerpt):
> so if you're looking for the newest features then you might have to
> generate a manual from source.
I'm looking for documentation of the rationale behind the API, and the
overall architecture. Having only lists of function signatures (with
incomplete sentences in between) is like solving a jigsaw puzzle with
all tiles face down.
About this:
> > i:delete()
> > dt.database.import(path)
> >
> > * It works more often than not, but sometimes the images disappear
>
> I'm not exactly sure why this happens, but I believe it's a timing
> issue. [...] You could try adding a dt.control.sleep(250) between
> the delete and the import and see if that helps.
That did not help. But it seems to have gone away now (which is scary).
About the selection:
> > * All images get a new image ID, and probably as a consequence,
> > * the selection of images is lost (meaning: deselected).
>
> You could remove the deleted file from the selection and add the imported
> one. The selection is just a table, so you can add and remove image
> items. Then your code could
>
> for i,img in pairs(dt.gui.action_images) do
> [...]
> if (os.execute(cmd)) then
> local path = img.path .. "/" .. img.filename
> img:delete()
> dt.gui.action_images[i] = dt.database.import(path)
> end
> [...]
> end
Well, I'm not too happy about modifying `dt.gui.action_images` while
iterating over it. Are you sure this is a good idea?
The alternative has a caveat. I've tried this: Collect all imported
images in a new table, and set the selection to that via
`dt.gui.selection`:
newSelection = {}
for _, img in pairs(dt.gui.action_images) do
--...
if (os.execute(cmdString)) then
--...
local path = cat{img.path, '/', img.filename}
img:delete()
local imported = dt.database.import(path)
if imported then
table.insert(newSelection, imported)
end
end
end
-- use constructed collection
dt.gui.selection(newSelection)
Now the following can happen: If a re-imported image is added to the
selection, but does not meet the criteria given by darktable's
"collection" any more (maybe `exiv2` changed the publisher, and you
collect by publisher), it will be included in future uses of
`dt.gui.action_images`, although not visible to the user! So the user
*will* act on images, not intending to do so.
There seems to be a subtle difference in how DT reachts to changes in
`dt.gui.action_images` vs. calling `dt.gui.selection`. Why is this?
I'd call behaviour of the latter buggy. Is it?
Cheers
Stefan
--
http://stefan-klinger.de o/X
I prefer receiving plain text messages, not exceeding 32kB. /\/
\
____________________________________________________________________________
darktable user mailing list
to unsubscribe send a mail to [email protected]