Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions contrib/rename_images.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ local function stop_job(job)
job.valid = false
end

local function reset_callback()
rename.widgets.pattern.text = ""
dt.preferences.write(MODULE_NAME, "pattern", "string", rename.widgets.pattern.text)
end

local function install_module()
if not rename.module_installed then
dt.register_lib(
Expand All @@ -105,6 +110,9 @@ local function install_module()
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

reset_callback()
end,
orientation = "vertical",
rename.widgets.pattern,
rename.widgets.button,
Expand Down Expand Up @@ -185,9 +193,6 @@ local function do_rename(images)
end
end

local function reset_callback()
rename.widgets.pattern.text = ""
end

-- - - - - - - - - - - - - - - - - - - - - - - -
-- W I D G E T S
Expand Down