Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LUA: importing an image does not force a refresh of the new thumbtable #4889

Closed
Mark-64 opened this issue May 1, 2020 · 11 comments
Closed

Comments

@Mark-64
Copy link
Contributor

Mark-64 commented May 1, 2020

With lua, the lib function dt.database.import() was used to force a refresh of lighttable so the image appeared immediately in the collection.
No longer so with the new thumbtable. The image is indeed imported, but the view isn't refreshed.
Forcing manually a refresh by changing back and forth film roll or going in and out of darkroom, makes the imported image show in the collection.

DT 3.1 git master on Windows 10

@Mark-64 Mark-64 changed the title LUA: importing an image doesn't not force a refresh of the new thumbtable LUA: importing an image does not force a refresh of the new thumbtable May 1, 2020
@wpferguson
Copy link
Member

Verified in current git. Tested in 3.0.2 and it works correctly. Image thumbnail is displayed on import.

@Mark-64
Copy link
Contributor Author

Mark-64 commented May 2, 2020

@wpferguson I'm not sure I understoos, do you mean that the bug is confirmed in current git ?

@AlicVB
Copy link
Contributor

AlicVB commented May 2, 2020

We certainly miss a refresh or a signal raising.
Sadly I have absolutely no idea how the lua calls are handled in the code. I'll have a look, but if someone with more lua knowledge can help me :)

@wpferguson
Copy link
Member

wpferguson commented May 2, 2020 via email

@Mark-64
Copy link
Contributor Author

Mark-64 commented May 3, 2020

Adding the lines

dt_collection_update_query(darktable.collection, DT_COLLECTION_CHANGE_RELOAD, NULL);
dt_control_signal_raise(darktable.signals, DT_SIGNAL_FILMROLLS_CHANGED);
dt_control_queue_redraw_center();

after line 160 of src/lua/database.c, as suggested by @wpferguson, does the trick.
I took the lines from dt_control_duplicate_images_job_run() in control_jobs.c.
@AlicVB are these the right signal ? If so, I will make a PR.

This makes me think there could be other side effects of the new thumbtable on lua calls. This needs further investigation.

@AlicVB
Copy link
Contributor

AlicVB commented May 3, 2020

@Mark-64 : exactly ! it's so great to see other people fixing my oversights :)
That said, I think you can enhance your code by indicating the inserted image in the first fct, something like dt_collection_update_query(darktable.collection, DT_COLLECTION_CHANGE_RELOAD, g_list_append(NULL, GINT_TO_POINTER(result));
(not tested)

And you're right to say that we need to investigate further the lua parts, as I don't know this part well...

Thanks again !

@wpferguson
Copy link
Member

wpferguson commented May 3, 2020 via email

@Mark-64
Copy link
Contributor Author

Mark-64 commented May 3, 2020

@AlicVB I dont't fully understand what the enhancement you suggested does, but I implemented and tested it, no issues.
PR created

@AlicVB
Copy link
Contributor

AlicVB commented May 3, 2020

@Mark-64 : the last parameter is to say which imageid have changed. That avoid for example to refresh all the view if the image is located outside.

@wpferguson
Copy link
Member

I didn't find any more issues manipulating the view from lua.

@Mark-64 Mark-64 closed this as completed May 4, 2020
@Mark-64
Copy link
Contributor Author

Mark-64 commented May 4, 2020

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants