[API 6.2.3] Added changes for API 6.2.3 compatibility

This commit is contained in:
wpferguson
2021-02-17 22:24:02 -05:00
parent 448da35327
commit 4053ceb9e5
5 changed files with 127 additions and 44 deletions

View File

@@ -53,6 +53,8 @@ local all_active = false
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("CollectHelper",dt.configuration.config_dir.."/lua/locale/")
local CURR_API_STRING = dt.configuration.api_version_string
local function _(msgid)
return gettext.dgettext("CollectHelper", msgid)
end
@@ -173,31 +175,63 @@ local function CollectOnAll_AND()
end
-- GUI --
dt.gui.libs.image.register_action(
_("collect: previous"),
function() PreviousCollection() end,
_("Sets the Collect parameters to be the previously active parameters")
)
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")
_("collect: previous"),
function() PreviousCollection() end,
_("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
if dt.preferences.read('module_CollectHelper','colors','bool') then
dt.gui.libs.image.register_action(
_("collect: color label(s)"),
function() CollectOnColors(_ , false) end,
_("Sets the Collect parameters to be the selected images's color label(s)")
)
if CURR_API_STRING < "6.2.3" then
dt.gui.libs.image.register_action(
_("collect: 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
if dt.preferences.read('module_CollectHelper','all_and','bool') then
dt.gui.libs.image.register_action(
_("collect: all (AND)"),
function() CollectOnAll_AND() end,
_("Sets the Collect parameters based on all activated CollectHelper options")
)
if CURR_API_STRING < "6.2.3" then
dt.gui.libs.image.register_action(
_("collect: all (AND)"),
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
-- PREFERENCES --

View File

@@ -184,11 +184,21 @@ end
-- GUI --
dt.gui.libs.image.register_action(
_("show in file explorer"),
function() open_in_fmanager() end,
_("Open the file manager at the selected image's location")
)
if CURR_API_STRING < "6.2.3" then
dt.gui.libs.image.register_action(
_("show in file explorer"),
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
dt.preferences.register("OpenInExplorer", "linked_image_files_dir", -- name
"directory", -- type

View File

@@ -64,12 +64,21 @@ local function clear_GPS(images)
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(
"clearGPS", "shortcut",

View File

@@ -231,11 +231,21 @@ end
Add a button to the selected images module in lighttable
]]
dt.gui.libs.image.register_action(
_("extract embedded jpeg"),
function(event, images) extract_embedded_jpeg(images) end,
"extract embedded jpeg"
)
if CURR_API_STRING < "6.2.3" then
dt.gui.libs.image.register_action(
_("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

View File

@@ -114,17 +114,37 @@ local function paste(images)
end
end
dt.gui.libs.image.register_action(
_("copy metadata"),
function(event, images) copy(images[1]) end,
_("copy metadata of the first selected image")
)
if CURR_API_STRING < "6.2.3" then
dt.gui.libs.image.register_action(
_("copy metadata"),
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(
"capmd1", "shortcut",