[gimp/wip/schumaml/issue-6421-darktable-master-lua] plug-ins: update script to API change in darktable master
- From: Michael Schumacher <schumaml src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/wip/schumaml/issue-6421-darktable-master-lua] plug-ins: update script to API change in darktable master
- Date: Wed, 10 Feb 2021 20:49:01 +0000 (UTC)
commit 99abbede54ba5c436b2aee6367561efef6b56a2e
Author: William Ferguson <>
Date: Wed Feb 10 21:44:54 2021 +0100
plug-ins: update script to API change in darktable master
The Lua API is undergoing changes in darktable master. I've fixed the lua-scripts repository as I've made
changes, but I forgot about the collateral damage.
Attached is a fixed version of file-darktable-export-on-exit.lua which should be good for darktable 3.6
and
beyond.
Fixes #6421
.../file-raw/file-darktable-export-on-exit.lua | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
---
diff --git a/plug-ins/file-raw/file-darktable-export-on-exit.lua
b/plug-ins/file-raw/file-darktable-export-on-exit.lua
index 7a7f81cb02..79b27dc089 100644
--- a/plug-ins/file-raw/file-darktable-export-on-exit.lua
+++ b/plug-ins/file-raw/file-darktable-export-on-exit.lua
@@ -31,6 +31,24 @@ USAGE
local dt = require "darktable"
+local orig_register_event = dt.register_event
+
+function dt.register_event(name, event, func, label)
+ if dt.configuration.api_version_string >= "6.2.1" then
+ if label then
+ orig_register_event(name, event, func, label)
+ else
+ orig_register_event(name, event, func)
+ end
+ else
+ if label then
+ orig_register_event(event, func, label)
+ else
+ orig_register_event(event, func)
+ end
+ end
+end
+
local min_api_version = "2.1.0"
if dt.configuration.api_version_string < min_api_version then
dt.print("the exit export script requires at least darktable version 1.7.0")
@@ -40,9 +58,11 @@ else
dt.print("closing darktable will export the image and make GIMP load it")
end
+local CURR_API_STRING = dt.configuration.api_version_string
+
local export_filename = dt.preferences.read("export_on_exit", "export_filename", "string")
-dt.register_event("exit", function()
+dt.register_event("fileraw", "exit", function()
-- safegurad against someone using this with their library containing 50k images
if #dt.database > 1 then
dt.print_error("too many images, only exporting the first")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]