From 03eb79e83a7752d73411ba0e4c747ed65a4affca Mon Sep 17 00:00:00 2001 From: deekayhd Date: Fri, 13 Mar 2026 21:55:14 +0100 Subject: [PATCH 1/3] enable reset in rename_images.lua --- contrib/rename_images.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/contrib/rename_images.lua b/contrib/rename_images.lua index 0093c540..740864db 100644 --- a/contrib/rename_images.lua +++ b/contrib/rename_images.lua @@ -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( @@ -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) + reset_callback() + end, orientation = "vertical", rename.widgets.pattern, rename.widgets.button, @@ -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 From 2635e261a060096c42f1fcf60ea274a9675a5f9d Mon Sep 17 00:00:00 2001 From: deekayhd <53017684+deekayhd@users.noreply.github.com> Date: Thu, 19 Mar 2026 10:15:26 +0100 Subject: [PATCH 2/3] changes after review --- contrib/rename_images.lua | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/contrib/rename_images.lua b/contrib/rename_images.lua index 740864db..7b5dec38 100644 --- a/contrib/rename_images.lua +++ b/contrib/rename_images.lua @@ -96,11 +96,6 @@ 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( @@ -110,9 +105,6 @@ local function install_module() true, {[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER",700}}, dt.new_widget("box"){ - reset_callback = function (self) - reset_callback() - end, orientation = "vertical", rename.widgets.pattern, rename.widgets.button, @@ -201,7 +193,10 @@ end rename.widgets.pattern = dt.new_widget("entry"){ tooltip = ds.get_substitution_tooltip(), placeholder = _("enter pattern") .. "$(FILE_FOLDER)/$(FILE_NAME)", - text = "" + text = "", + reset_callback = function(self) + self.text = "" + end } local pattern_pref = dt.preferences.read(MODULE_NAME, "pattern", "string") From 7a61d77c27985be7b94143a1e750ff231cc64928 Mon Sep 17 00:00:00 2001 From: deekayhd <53017684+deekayhd@users.noreply.github.com> Date: Thu, 19 Mar 2026 11:12:39 +0100 Subject: [PATCH 3/3] add reset of preference --- contrib/rename_images.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/rename_images.lua b/contrib/rename_images.lua index 7b5dec38..8aeb8b82 100644 --- a/contrib/rename_images.lua +++ b/contrib/rename_images.lua @@ -196,6 +196,7 @@ rename.widgets.pattern = dt.new_widget("entry"){ text = "", reset_callback = function(self) self.text = "" + dt.preferences.write(MODULE_NAME, "pattern", "string", self.text) end }