Revert changes to accomadate API changes greater than 6.1

This commit is contained in:
Bill Ferguson
2021-06-11 19:47:43 -04:00
parent 350cdfa436
commit 9d59479049
8 changed files with 55 additions and 201 deletions

View File

@@ -175,63 +175,31 @@ local function CollectOnAll_AND()
end
-- GUI --
if CURR_API_STRING < "6.2.3" then
dt.gui.libs.image.register_action(
_("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
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")
)
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
dt.gui.libs.image.register_action(
_("collect: folder"),
function() CollectOnFolder(_ , false) end,
_("Sets the Collect parameters to be the selected images's folder")
)
end
if dt.preferences.read('module_CollectHelper','colors','bool') then
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
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)")
)
end
if dt.preferences.read('module_CollectHelper','all_and','bool') then
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
dt.gui.libs.image.register_action(
_("collect: all (AND)"),
function() CollectOnAll_AND() end,
_("Sets the Collect parameters based on all activated CollectHelper options")
)
end
-- PREFERENCES --

View File

@@ -184,20 +184,11 @@ end
-- GUI --
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
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 act_os ~= "windows" then
dt.preferences.register("OpenInExplorer", "linked_image_files_dir", -- name

View File

@@ -64,21 +64,11 @@ 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

@@ -64,14 +64,7 @@ local function select_untagged_images(event, images)
return selection
end
if CURR_API_STRING >= "6.2.2" then
dt.gui.libs.select.register_selection(
"select_untagged", _("select untagged"),
select_untagged_images,
_("select all images containing no tags or only tags added by darktable"))
else
dt.gui.libs.select.register_selection(
_("select untagged"),
select_untagged_images,
_("select all images containing no tags or only tags added by darktable"))
end
dt.gui.libs.select.register_selection(
_("select untagged"),
select_untagged_images,
_("select all images containing no tags or only tags added by darktable"))

View File

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

View File

@@ -1,51 +0,0 @@
--[[
darktable_transition.lua - temporary library to help with API transition
Copyright (C) 2016 Bill Ferguson <wpferguson@gmail.com>.
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
]]
--[[
darktable_transition - routines to maintain compatibility with new and previous API versions
]]
local dt
for k,v in pairs(package.loaded) do
if string.match(k, "darktable") then
dt = v
break
end
end
if dt then
dt.orig_register_event = dt.register_event
function dt.register_event(name, event, callback, tooltip)
if dt.configuration.api_version_string >= "6.2.1" then
if tooltip then
dt.orig_register_event(name, event, callback, tooltip)
else
dt.orig_register_event(name, event, callback)
end
else
if tooltip then
dt.orig_register_event(event, callback, tooltip)
else
dt.orig_register_event(event, callback)
end
end
end
end

View File

@@ -114,37 +114,17 @@ local function paste(images)
end
end
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(
_("copy metadata"),
function(event, images) copy(images[1]) end,
_("copy metadata of the first selected image")
)
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",

View File

@@ -68,7 +68,7 @@ end
-- api check
du.check_min_api_version("5.0.0", "script_manager")
du.check_min_api_version("6.1.0", "script_manager")
-- - - - - - - - - - - - - - - - - - - - - - - -
@@ -461,9 +461,7 @@ local function populate_buttons(category, first, last)
else
button.label = script.name .. _(" stopped")
end
if CURR_API_STRING >= "6.0.1" then
button.ellipsize = "middle"
end
button.ellipsize = "middle"
button.sensitive = true
button.tooltip = script.doc
button.clicked_callback = function (this)
@@ -772,12 +770,8 @@ for i =1, DEFAULT_BUTTONS_PER_PAGE do
sm.page_status.buttons_create = sm.page_status.buttons_created + 1
end
local page_back = "<"
local page_forward = ">"
if CURR_API_STRING < "6.1.0" then
page_back = " < "
page_forward = " > "
end
local page_back = " < "
local page_forward = " > "
sm.widgets.page_status = dt.new_widget("label"){label = _("Page:")}
sm.widgets.page_back = dt.new_widget("button"){
@@ -849,10 +843,8 @@ sm.widgets.main_stack = dt.new_widget("stack"){
sm.widgets.scripts,
}
if CURR_API_STRING >= "6.0.1" then
sm.widgets.main_stack.h_size_fixed = false
sm.widgets.main_stack.v_size_fixed = false
end
sm.widgets.main_stack.h_size_fixed = false
sm.widgets.main_stack.v_size_fixed = false
-- main menu