dt.print made properly with string.format
All print call have been replaced with string.format (when needed) and call to dt.gettext, in a future opening to translation
This commit is contained in:
@@ -121,7 +121,7 @@ dt.register_lib(
|
||||
dt.new_widget("button")
|
||||
{
|
||||
label = enfuse_installed and "run enfuse" or "enfuse not installed",
|
||||
clicked_callback = function (_)
|
||||
clicked_callback = function ()
|
||||
-- remember exposure_mu
|
||||
-- TODO: find a way to save it whenever the value changes
|
||||
local mu = exposure_mu.value
|
||||
@@ -135,7 +135,7 @@ dt.register_lib(
|
||||
local response_file = os.tmpname()
|
||||
local f = io.open(response_file, "w")
|
||||
if not f then
|
||||
dt.print("error writing to `"..response_file.."'")
|
||||
dt.print(string.format(_("Error writing to `%s`"), response_file))
|
||||
os.remove(response_file)
|
||||
return
|
||||
end
|
||||
@@ -144,7 +144,7 @@ dt.register_lib(
|
||||
local cnt = 0
|
||||
local n_skipped = 0
|
||||
local target_dir
|
||||
for _, i in ipairs(dt.gui.action_images) do
|
||||
for i_, i in ipairs(dt.gui.action_images) do
|
||||
-- only use ldr files as enfuse can't open raws. alternatively we could export raws that we encounter
|
||||
if i.is_ldr then
|
||||
cnt = cnt + 1
|
||||
@@ -152,28 +152,27 @@ dt.register_lib(
|
||||
target_dir = i.path
|
||||
elseif i.is_raw and darktable_cli_installed then
|
||||
local tmp_exported = os.tmpname()..".tif"
|
||||
dt.print(string.format(_("Converting raw file '%s' to tiff..."), i.filename))
|
||||
os.execute("darktable-cli \""..i.path.."/"..i.filename.."\" \""..tmp_exported.."\"")
|
||||
dt.print("Raw file "..i.filename.." automatically converted to tiff")
|
||||
|
||||
cnt = cnt + 1
|
||||
f:write(tmp_exported.."\n")
|
||||
target_dir = i.path
|
||||
else
|
||||
dt.print("skipping "..i.filename)
|
||||
dt.print(string.format(_("Skipping %s..."), i.filename))
|
||||
n_skipped = n_skipped + 1
|
||||
end
|
||||
end
|
||||
f:close()
|
||||
-- bail out if there is nothing to do
|
||||
if cnt == 0 then
|
||||
dt.print("no suitable images selected, nothing to do for enfuse")
|
||||
dt.print(_("No suitable images selected, nothing to do for enfuse"))
|
||||
os.remove(response_file)
|
||||
return
|
||||
end
|
||||
if n_skipped == 1 then
|
||||
dt.print(n_skipped.." image skipped")
|
||||
elseif n_skipped > 1 then
|
||||
dt.print(n_skipped.." images skipped")
|
||||
|
||||
if n_skipped > 0 then
|
||||
dt.print(string.format(_("%d image(s) skipped"), n_skipped))
|
||||
end
|
||||
|
||||
-- call enfuse on the response file
|
||||
@@ -188,7 +187,7 @@ dt.register_lib(
|
||||
local command = "enfuse --depth "..depth.value..exposure_option..ugly_decimal_point_hack
|
||||
.." -o \""..output_image.."\" \"@"..response_file.."\""
|
||||
if dt.control.execute( command) > 0 then
|
||||
dt.print("enfuse failed, see terminal output for details")
|
||||
dt.print(_("Enfuse failed, see terminal output for details"))
|
||||
os.remove(response_file)
|
||||
return
|
||||
end
|
||||
@@ -200,9 +199,9 @@ dt.register_lib(
|
||||
local image = dt.database.import(output_image)
|
||||
|
||||
-- tell the user that everything worked
|
||||
dt.print("enfuse was successful, resulting image was imported")
|
||||
dt.print(_("enfuse was successful, resulting image has been imported"))
|
||||
-- normally printing to stdout is bad, but we allow enfuse to show its output, so adding one extra line is ok
|
||||
print("enfuse: done, resulting image '"..output_image.."' was imported with id "..image.id)
|
||||
print(string.format(_("enfuse: done, resulting image '%s' has been imported with id %d"), output_image, image.id))
|
||||
end
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user