diff --git a/contrib/hugin.lua b/contrib/hugin.lua index c8106eb..c777ac5 100644 --- a/contrib/hugin.lua +++ b/contrib/hugin.lua @@ -37,17 +37,19 @@ This plugin will add a new storage option and calls hugin after export. local dt = require "darktable" local df = require "lib/dtutils.file" +local log = require "lib/dtutils.log" require "official/yield" local gettext = dt.gettext local namespace = 'module_hugin' local user_pref_str = 'prefer_gui' local user_prefer_gui = dt.preferences.read(namespace, user_pref_str, "bool") +log.msg(log.info, "user_prefer_gui set to ", user_prefer_gui) local hugin_widget = nil local exec_widget = nil local executable_table = {"hugin", "hugin_executor", "pto_gen"} --- works with darktable API version from 2.0.0 to 5.0.0 +-- works with darktable API version from 5.0.0 on dt.configuration.check_version(...,{5,0,0}) -- Tell gettext where to find the .mo file translating messages for a particular domain @@ -73,15 +75,28 @@ local function create_panorama(storage, image_table, extra_data) --finalize -- We need pto_gen to create pto file for hugin_executor -- http://hugin.sourceforge.net/docs/manual/Pto_gen.html + -- save the current log level and set log level to + -- log.error for normal operations + -- log.info for more insight about what is happening + -- log.debug for even more information + + local saved_log_level = log.log_level() + log.log_level(log.error) + local hugin = df.check_if_bin_exists("hugin") + log.msg(log.info, "hugin set to ", hugin) local hugin_executor = df.check_if_bin_exists("hugin_executor") + log.msg(log.info, "hugin_executor set to ", hugin_executor) local pto_gen = df.check_if_bin_exists("pto_gen") + log.msg(log.info, "pto_gen set to ", pto_gen) local gui_available = false if hugin then gui_available = true else dt.print(_("hugin is not found, did you set the path?")) + log.msg(log.error, "hugin executable not found. Check if the executable is installed.") + log.msg(log.error, "If the executable is installed, check that the path is set correctly.") return end @@ -91,21 +106,24 @@ local function create_panorama(storage, image_table, extra_data) --finalize end -- list of exported images - local img_list + local img_list = "" local img_set = {} -- reset and create image list - img_list = "" for k,v in pairs(image_table) do - img_list = img_list..v..' ' + log.msg(log.debug, "k is ", k, " and v is ", v) + img_list = img_list .. "'" .. v .. "'" .. ' ' -- surround the filename with single quotes to handle spaces table.insert(img_set, k) end + log.msg(log.info, "img_list is ", img_list) + -- use first file as basename for output file table.sort(img_set, function(a,b) return a.filename