Changed check_min_api_version() to print error messages and throw an error if the minimum api is not satisfied. Updated the scripts to reflect the changed check_min_api_version().

This commit is contained in:
Bill Ferguson
2019-02-20 00:22:05 -05:00
parent 451c7fb956
commit 8b714edb67
47 changed files with 64 additions and 185 deletions

View File

@@ -50,10 +50,7 @@
local darktable = require("darktable")
local du = require "lib/dtutils"
if not du.check_min_api_version("3.0.0") then
darktable.print("ERROR:LabelsToTags failed to load. Lua API version 3.0.0 or later required.")
return
end
du.check_min_api_version("3.0.0", "LabelsToTags")
-- Lua 5.3 no longer has "unpack" but "table.unpack"
unpack = unpack or table.unpack

View File

@@ -38,10 +38,7 @@ local du = require "lib/dtutils"
local dsys = require "lib/dtutils.system"
--Check API version
if not du.check_min_api_version("5.0.0") then
dt.print("ERROR:OpenInExplorer failed to load. Lua API version 5.0.0 or greater required.")
return
end
du.check_min_api_version("5.0.0", "OpenInExplorer")
--Detect OS and modify accordingly--
local proper_install = false

View File

@@ -44,10 +44,7 @@ local filelib = require "lib/dtutils.file"
local autostyle_apply_one_image,autostyle_apply_one_image_event,autostyle_apply,exiftool_attribute,capture
-- Tested it with darktable 1.6.1 and darktable git from 2014-01-25
if not du.check_min_api_version("2.0.2") then
darktable.print("ERROR:autostyle failed to load. Lua API version 2.0.2 or later required.")
return
end
du.check_min_api_version("2.0.2", "autostyle")
-- Receive the event triggered
function autostyle_apply_one_image_event(event,image)

View File

@@ -43,10 +43,7 @@ local gettext = dt.gettext
-- not a number
local NaN = 0/0
if not du.check_min_api_version("3.0.0") then
dt.print("ERROR:clear_GPS failed to load. Lua API version 3.0.0 or later required.")
return
end
du.check_min_api_version("3.0.0", "clear_GPS")
-- Tell gettext where to find the .mo file translating messages for a particular domain

View File

@@ -42,10 +42,7 @@ local debug = require "darktable.debug"
local gettext = dt.gettext
if not du.check_min_api_version("3.0.0") then
dt.print("ERROR:copy_attach_detach_tags failed to load. Lua API version 3.0.0 or later required.")
return
end
du.check_min_api_version("3.0.0", "copy_attach_detach_tags")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("copy_attach_detach_tags",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -36,10 +36,7 @@ local darktable = require "darktable"
local du = require "lib/dtutils"
-- Tested with darktable 2.0.1
if not du.check_min_api_version("2.0.0") then
darktable.print("ERROR:cr2hdr failed to load. Lua API version 2.0.0 or later required.")
return
end
du.check_min_api_version("2.0.0", "cr2hdr")
local queue = {}
local processed_files = {}

View File

@@ -67,10 +67,7 @@ local gettext = dt.gettext
local preferences_version = 1 --When releasing an update increment this number by one if changes have been made to the preferences structure that would require a re-initialization
-- works with LUA API version 5.0.0
if not du.check_min_api_version("5.0.0") then
dt.print("ERROR:enfuseAdvanced failed to load. Lua API version 5.0.0 or later required.")
return
end
du.check_min_api_version("5.0.0", "enfuseAdvanced")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("enfuseAdvanced",dt.configuration.config_dir.."/lua/")

View File

@@ -28,10 +28,7 @@ local du = require "lib/dtutils"
local df = require "lib/dtutils.file"
local gettext = dt.gettext
if not du.check_min_api_version("4.0.0") then
dt.print("ERROR:fujifilm_ratings failed to load. Lua API version 4.0.0 or later required.")
return
end
du.check_min_api_version("4.0.0", "fujifilm_ratings")
gettext.bindtextdomain("fujifilm_ratings", dt.configuration.config_dir.."/lua/locale/")

View File

@@ -38,10 +38,7 @@ local df = require "lib/dtutils.file"
require "official/yield"
local gettext = dt.gettext
if not du.check_min_api_version("3.0.0") then
dt.print("ERROR:geoJSON_export failed to load. Lua API version 3.0.0 or later required.")
return
end
du.check_min_api_version("3.0.0", "geoJSON_export")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("geoJSON_export",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -31,10 +31,7 @@ local df = require "lib/dtutils.file"
require "official/yield"
local gettext = dt.gettext
if not du.check_min_api_version("3.0.0") then
dt.print("ERROR:geoToolbox failed to load. Lua API version 3.0.0 or later required.")
return
end
du.check_min_api_version("3.0.0", "geoToolbox")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("geoToolbox",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -70,10 +70,7 @@ local dtsys = require "lib/dtutils.system"
local gettext = dt.gettext
local gimp_widget = nil
if not du.check_min_api_version("5.0.0") then
dt.print("ERROR:gimp failed to load. Lua API version 5.0.0 or greater required.")
return
end
du.check_min_api_version("5.0.0", "gimp")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("gimp",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -27,10 +27,7 @@ local df = require "lib/dtutils.file"
local dl = require "lib/dtutils"
local gettext = dt.gettext
if not dl.check_min_api_version("3.0.0") then
dt.print("ERROR:gpx-export failed to load. Lua API version 3.0.0 or later required.")
return
end
dl.check_min_api_version("3.0.0", "gpx-export")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("gpx_export",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -55,10 +55,7 @@ local executable_table = {"hugin", "hugin_executor", "pto_gen"}
local PQ = dt.configuration.running_os == "windows" and '"' or "'"
-- works with darktable API version from 5.0.0 on
if not du.check_min_api_version("5.0.0") then
dt.print("ERROR:hugin failed to load. Lua API version 5.0.0 or greater required.")
return
end
du.check_min_api_version("5.0.0", "hugin")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("hugin",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -71,10 +71,7 @@ local job = nil
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
-- works with LUA API version 5.0.0
if not du.check_min_api_version("5.0.0") then
dt.print("ERROR:image_stack failed to load. Lua API version 5.0.0 or greater required.")
return
end
du.check_min_api_version("5.0.0", "image_stack")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("image_stack",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -42,10 +42,7 @@ local df = require "lib/dtutils.file"
require "official/yield"
local gettext = dt.gettext
if not du.check_min_api_version("3.0.0") then
dt.print("ERROR:kml_export failed to load. Lua API version 3.0.0 or later required.")
return
end
du.check_min_api_version("3.0.0", kml_export)
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("kml_export",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -39,10 +39,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
local gettext = dt.gettext
if not du.check_min_api_version("2.0.0") then
dt.print("ERROR:passport_guide failed to load. Lua API version 2.0.0 or later required.")
return
end
du.check_min_api_version("2.0.0", "passport_guide")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("passport_guide",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -57,10 +57,7 @@ if not df.check_if_bin_exists("pdflatex") then
return
end
if not du.check_min_api_version("4.0.0") then
dt.print("ERROR:pdf_slideshow failed to load. Lua API version 4.0.0 or greater required.")
return
end
du.check_min_api_version("4.0.0", "pdf_slideshow")
dt.preferences.register
("pdf_slideshow","open with","string",

View File

@@ -50,10 +50,7 @@ local debug = require "darktable.debug"
local gettext = dt.gettext
if not du.check_min_api_version("3.0.0") then
dt.print("ERROR:quicktag failed to load. Lua API version 3.0.0 or later required.")
return
end
du.check_min_api_version("3.0.0", "quicktag")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("quicktag",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -42,10 +42,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
-- added version check
if not du.check_min_api_version("3.0.0") then
dt.print("ERROR:rate_group failed to load. Lua API version 3.0.0 or later required.")
return
end
du.check_min_api_version("3.0.0", "rate_group")
local function apply_rating(rating)
local images = dt.gui.action_images

View File

@@ -33,10 +33,7 @@ local du = require "lib/dtutils"
local debug = require "darktable.debug"
-- check API version
if not du.check_min_api_version("3.0.0") then
darktable.print("ERROR:rename_tags failed to load. Lua API version 3.0.0 or later required.")
return
end
du.check_min_api_version("3.0.0", "rename-tags")
-- GUI entries
local old_tag = darktable.new_widget("entry") { tooltip = "Enter old tag" }

View File

@@ -22,10 +22,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
local gettext = dt.gettext
if not du.check_min_api_version("3.0.0") then
dt.print("ERROR:select_untagged failed to load. Lua API version 3.0.0 or later required.")
return
end
du.check_min_api_version("3.0.0", "select_untagged")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("select_untagged",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -30,10 +30,7 @@ local df = require "lib/dtutils.file"
require "official/yield"
local gettext = dt.gettext
if not du.check_min_api_version("2.0.2") then
dt.print("ERROR:slideshowMusic failed to load. Lua API version 2.0.2 or greater required.")
return
end
du.check_min_api_version("2.0.2", "slideshowMusic")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("slideshowMusic",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -36,10 +36,7 @@ local df = require "lib/dtutils.file"
require "official/yield"
local gettext = dt.gettext
if not du.check_min_api_version("2.0.1") then
dt.print("ERROR:video_mencoder failed to load. Lua API version 2.0.1 or later required.")
return
end
du.check_min_api_version("2.0.1", "video_mencoder")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("video_mencoder",dt.configuration.config_dir.."/lua/locale/")