Skip to content

enable reset in rename_images.lua#636

Merged
wpferguson merged 3 commits intodarktable-org:masterfrom
deekayhd:rename_images_reset
Mar 21, 2026
Merged

enable reset in rename_images.lua#636
wpferguson merged 3 commits intodarktable-org:masterfrom
deekayhd:rename_images_reset

Conversation

@deekayhd
Copy link
Contributor

This PR enables the reset function in rename_images.lua.
Clicking the reset button clears the entry field and the hidden preference.

Closes #635

true,
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER",700}},
dt.new_widget("box"){
reset_callback = function (self)
Copy link
Member

@wpferguson wpferguson Mar 18, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move this into the rename.widgets.pattern widget declaration and instead of calling another function, just include the code there

reset_callback = function(self)
  self.text = ""
end

EDIT: Look at image_stack.lua where I reset a bunch of widgets

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wanted to keep it more "modular" (as a pattern) and reset on the highest level. Besides, the function was already there. But anyway, I changed it to your suggestion.
Thanks

@wpferguson
Copy link
Member

wanted to keep it more "modular" (as a pattern) and reset on the highest level. Besides, the function was already there

Okay, now I understand your reasoning. I also went back and read the documentation again for reset callback and it explicitly mentions containers and resetting all the children. I think I need to play with it on something like image_time that has a bunch of reset callbacks. So, your original solution was just as valid as mine and I leave it up to you on how you want to implement it.

I think my new rule of thumb will be if I'm resetting one widget, then I'll do it in the widget and if I'm resetting multiple I'll do it in the container.

Thanks for educating me and forcing me to educate myself 😄

@deekayhd
Copy link
Contributor Author

I leave it up to you on how you want to implement it.

I would like to leave it as it is now. This script is not that complicated with only one relevant widget, so your rule of thumb makes sense to me.

@wpferguson wpferguson merged commit 94c6dff into darktable-org:master Mar 21, 2026
@wpferguson
Copy link
Member

Thanks

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

Successfully merging this pull request may close these issues.

rename_images not resettable

2 participants