enable reset in rename_images.lua#636
Conversation
contrib/rename_images.lua
Outdated
| true, | ||
| {[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER",700}}, | ||
| dt.new_widget("box"){ | ||
| reset_callback = function (self) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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 😄 |
This PR enables the reset function in rename_images.lua.
Clicking the reset button clears the entry field and the hidden preference.
Closes #635