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

@@ -32,10 +32,7 @@ local du = require "lib/dtutils"
local https = require "ssl.https"
local cjson = require "cjson"
if not du.check_min_api_version("2.0.0") then
dt.print("ERROR:check_for_updates not loaded. Lua API version 2.0.0 or greater required.")
return
end
du.check_min_api_version("2.0.0", "check_for_updates")
-- compare two version strings of the form "major.minor.patch"
-- returns -1, 0, 1 if the first version is smaller, equal, greater than the second version,

View File

@@ -28,10 +28,7 @@ USAGE
local dt = require "darktable"
local du = require "lib/dtutils"
if not du.check_min_api_version("3.0.0") then
dt.print("ERROR:copy_paste_metadata not loaded. Lua API version 3.0.0 or greater required.")
return
end
du.check_min_api_version("3.0.0", "copy_paste_metadata")
-- set this to "false" if you don't want to overwrite metadata fields
-- (title, description, creator, publisher and rights) that are already set

View File

@@ -31,10 +31,7 @@ all tags longer than the given length will be automatically deleted at every res
local dt = require "darktable"
local du = require "lib/dtutils"
if not du.check_min_api_version("2.0.0") then
dt.print("ERROR:delete_long_tags not loaded. Lua API version 2.0.0 or greater required.")
return
end
du.check_min_api_version("2.0.0", "delete_long_tags")
dt.preferences.register("delete_long_tags", "length", "integer",
"maximum length of tags to keep",

View File

@@ -29,10 +29,7 @@ all tags that are not used will be automatically deleted at every restart
local dt = require "darktable"
local du = require "lib/dtutils"
if not du.check_min_api_version("5.0.0") then
dt.print("ERROR:delete_unused_tags not loaded. Lua API version 5.0.0 or greater required.")
return
end
du.check_min_api_version("5.0.0", "delete_unused_tags")
-- deleting while iterating the tags list seems to break the iterator!
local unused_tags = {}

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:enfuse not loaded. Lua API version 3.0.0 or greater required.")
return
end
du.check_min_api_version("3.0.0", "enfuse")
-- Tell gettext where to find the .mo file translating messages for a particular domain
gettext.bindtextdomain("enfuse",dt.configuration.config_dir.."/lua/locale/")

View File

@@ -39,10 +39,7 @@ local du = require "lib/dtutils"
require "darktable.debug"
require "official/yield"
if not du.check_min_api_version("2.1.0") then
dt.print("ERROR:generate_image_txt not loaded. Lua API version 2.1.0 or greater required.")
return
end
du.check_min_api_version("2.1.0", "generate_image_txt")
dt.preferences.register("generate_image_txt",
"enabled",

View File

@@ -31,10 +31,7 @@ This plugin will add a widget at the bottom of the left column in lighttable mod
local dt = require "darktable"
local du = require "lib/dtutils"
if not du.check_min_api_version("2.0.0") then
dt.print("ERROR:image_path_in_ui not loaded. Lua API version 2.0.0 or greater required.")
return
end
du.check_min_api_version("2.0.0", "image_path_in_ui")
local main_label = dt.new_widget("label"){selectable = true, ellipsize = "middle", halign = "start"}

View File

@@ -36,10 +36,7 @@ increase it if you need more temporary selection buffers
local dt = require "darktable"
local du = require "lib/dtutils"
if not du.check_min_api_version("2.0.0") then
dt.print("ERROR:save_selection not loaded. Lua API version 2.0.0 or greater required.")
return
end
du.check_min_api_version("2.0.0", "save_selection")
local buffer_count = 5

View File

@@ -37,10 +37,7 @@ local dt = require "darktable"
local du = require "lib/dtutils"
require "official/yield"
if not du.check_min_api_version("2.0.0") then
dt.print("ERROR:selection_to_pdf not loaded. Lua API version 2.0.0 or greater required.")
return
end
du.check_min_api_version("2.0.0", "selection_to_pdf")
dt.preferences.register
("selection_to_pdf","Open with","string",