[API 6.2.3] Added changes for API 6.2.3 compatibility
This commit is contained in:
@@ -53,6 +53,8 @@ local all_active = false
|
|||||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||||
gettext.bindtextdomain("CollectHelper",dt.configuration.config_dir.."/lua/locale/")
|
gettext.bindtextdomain("CollectHelper",dt.configuration.config_dir.."/lua/locale/")
|
||||||
|
|
||||||
|
local CURR_API_STRING = dt.configuration.api_version_string
|
||||||
|
|
||||||
local function _(msgid)
|
local function _(msgid)
|
||||||
return gettext.dgettext("CollectHelper", msgid)
|
return gettext.dgettext("CollectHelper", msgid)
|
||||||
end
|
end
|
||||||
@@ -173,31 +175,63 @@ local function CollectOnAll_AND()
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- GUI --
|
-- GUI --
|
||||||
dt.gui.libs.image.register_action(
|
if CURR_API_STRING < "6.2.3" then
|
||||||
_("collect: previous"),
|
|
||||||
function() PreviousCollection() end,
|
|
||||||
_("Sets the Collect parameters to be the previously active parameters")
|
|
||||||
)
|
|
||||||
if dt.preferences.read('module_CollectHelper','folder','bool') then
|
|
||||||
dt.gui.libs.image.register_action(
|
dt.gui.libs.image.register_action(
|
||||||
_("collect: folder"),
|
_("collect: previous"),
|
||||||
function() CollectOnFolder(_ , false) end,
|
function() PreviousCollection() end,
|
||||||
_("Sets the Collect parameters to be the selected images's folder")
|
_("Sets the Collect parameters to be the previously active parameters")
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
"CollectHelper_prev", _("collect: previous"),
|
||||||
|
function() PreviousCollection() end,
|
||||||
|
_("Sets the Collect parameters to be the previously active parameters")
|
||||||
|
)
|
||||||
|
end
|
||||||
|
if dt.preferences.read('module_CollectHelper','folder','bool') then
|
||||||
|
if CURR_API_STRING < "6.2.3" then
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
_("collect: folder"),
|
||||||
|
function() CollectOnFolder(_ , false) end,
|
||||||
|
_("Sets the Collect parameters to be the selected images's folder")
|
||||||
|
)
|
||||||
|
else
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
"CollectHelper_folder", _("collect: folder"),
|
||||||
|
function() CollectOnFolder(_ , false) end,
|
||||||
|
_("Sets the Collect parameters to be the selected images's folder")
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if dt.preferences.read('module_CollectHelper','colors','bool') then
|
if dt.preferences.read('module_CollectHelper','colors','bool') then
|
||||||
dt.gui.libs.image.register_action(
|
if CURR_API_STRING < "6.2.3" then
|
||||||
_("collect: color label(s)"),
|
dt.gui.libs.image.register_action(
|
||||||
function() CollectOnColors(_ , false) end,
|
_("collect: color label(s)"),
|
||||||
_("Sets the Collect parameters to be the selected images's color label(s)")
|
function() CollectOnColors(_ , false) end,
|
||||||
)
|
_("Sets the Collect parameters to be the selected images's color label(s)")
|
||||||
|
)
|
||||||
|
else
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
"CollectHelper_labels", _("collect: color label(s)"),
|
||||||
|
function() CollectOnColors(_ , false) end,
|
||||||
|
_("Sets the Collect parameters to be the selected images's color label(s)")
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if dt.preferences.read('module_CollectHelper','all_and','bool') then
|
if dt.preferences.read('module_CollectHelper','all_and','bool') then
|
||||||
dt.gui.libs.image.register_action(
|
if CURR_API_STRING < "6.2.3" then
|
||||||
_("collect: all (AND)"),
|
dt.gui.libs.image.register_action(
|
||||||
function() CollectOnAll_AND() end,
|
_("collect: all (AND)"),
|
||||||
_("Sets the Collect parameters based on all activated CollectHelper options")
|
function() CollectOnAll_AND() end,
|
||||||
)
|
_("Sets the Collect parameters based on all activated CollectHelper options")
|
||||||
|
)
|
||||||
|
else
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
"CollectHelper_and", _("collect: all (AND)"),
|
||||||
|
function() CollectOnAll_AND() end,
|
||||||
|
_("Sets the Collect parameters based on all activated CollectHelper options")
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- PREFERENCES --
|
-- PREFERENCES --
|
||||||
|
|||||||
@@ -184,11 +184,21 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- GUI --
|
-- GUI --
|
||||||
dt.gui.libs.image.register_action(
|
if CURR_API_STRING < "6.2.3" then
|
||||||
_("show in file explorer"),
|
dt.gui.libs.image.register_action(
|
||||||
function() open_in_fmanager() end,
|
_("show in file explorer"),
|
||||||
_("Open the file manager at the selected image's location")
|
function() open_in_fmanager() end,
|
||||||
)
|
_("Open the file manager at the selected image's location")
|
||||||
|
)
|
||||||
|
else
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
"OpenInExplorer", _("show in file explorer"),
|
||||||
|
function() open_in_fmanager() end,
|
||||||
|
_("Open the file manager at the selected image's location")
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
if act_os ~= "windows" then
|
if act_os ~= "windows" then
|
||||||
dt.preferences.register("OpenInExplorer", "linked_image_files_dir", -- name
|
dt.preferences.register("OpenInExplorer", "linked_image_files_dir", -- name
|
||||||
"directory", -- type
|
"directory", -- type
|
||||||
|
|||||||
@@ -64,12 +64,21 @@ local function clear_GPS(images)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if CURR_API_STRING < "6.2.3" then
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
_("clear GPS data"),
|
||||||
|
function(event, images) clear_GPS(images) end,
|
||||||
|
_("Clear GPS data from selected images")
|
||||||
|
)
|
||||||
|
else
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
_"clear_GPS", ("clear GPS data"),
|
||||||
|
function(event, images) clear_GPS(images) end,
|
||||||
|
_("Clear GPS data from selected images")
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
dt.gui.libs.image.register_action(
|
|
||||||
_("clear GPS data"),
|
|
||||||
function(event, images) clear_GPS(images) end,
|
|
||||||
_("Clear GPS data from selected images")
|
|
||||||
)
|
|
||||||
|
|
||||||
dt.register_event(
|
dt.register_event(
|
||||||
"clearGPS", "shortcut",
|
"clearGPS", "shortcut",
|
||||||
|
|||||||
@@ -231,11 +231,21 @@ end
|
|||||||
Add a button to the selected images module in lighttable
|
Add a button to the selected images module in lighttable
|
||||||
]]
|
]]
|
||||||
|
|
||||||
dt.gui.libs.image.register_action(
|
if CURR_API_STRING < "6.2.3" then
|
||||||
_("extract embedded jpeg"),
|
dt.gui.libs.image.register_action(
|
||||||
function(event, images) extract_embedded_jpeg(images) end,
|
_("extract embedded jpeg"),
|
||||||
"extract embedded jpeg"
|
function(event, images) extract_embedded_jpeg(images) end,
|
||||||
)
|
"extract embedded jpeg"
|
||||||
|
)
|
||||||
|
else
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
"multi_os", _("extract embedded jpeg"),
|
||||||
|
function(event, images) extract_embedded_jpeg(images) end,
|
||||||
|
"extract embedded jpeg"
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Add a shortcut
|
Add a shortcut
|
||||||
|
|||||||
@@ -114,17 +114,37 @@ local function paste(images)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
dt.gui.libs.image.register_action(
|
if CURR_API_STRING < "6.2.3" then
|
||||||
_("copy metadata"),
|
dt.gui.libs.image.register_action(
|
||||||
function(event, images) copy(images[1]) end,
|
_("copy metadata"),
|
||||||
_("copy metadata of the first selected image")
|
function(event, images) copy(images[1]) end,
|
||||||
)
|
_("copy metadata of the first selected image")
|
||||||
|
)
|
||||||
|
else
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
"metadata_copy", _("copy metadata"),
|
||||||
|
function(event, images) copy(images[1]) end,
|
||||||
|
_("copy metadata of the first selected image")
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if CURR_API_STRING < "6.2.3" then
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
_("paste metadata"),
|
||||||
|
function(event, images) paste(images) end,
|
||||||
|
_("paste metadata to the selected images")
|
||||||
|
)
|
||||||
|
else
|
||||||
|
dt.gui.libs.image.register_action(
|
||||||
|
"metadata_paste", _("paste metadata"),
|
||||||
|
function(event, images) paste(images) end,
|
||||||
|
_("paste metadata to the selected images")
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
dt.gui.libs.image.register_action(
|
|
||||||
_("paste metadata"),
|
|
||||||
function(event, images) paste(images) end,
|
|
||||||
_("paste metadata to the selected images")
|
|
||||||
)
|
|
||||||
|
|
||||||
dt.register_event(
|
dt.register_event(
|
||||||
"capmd1", "shortcut",
|
"capmd1", "shortcut",
|
||||||
|
|||||||
Reference in New Issue
Block a user