Skip to content

Commit b1498aa

Browse files
committed
inline if didn't work. Added intermediate register_event function in transition library
1 parent 2b28f02 commit b1498aa

33 files changed

Lines changed: 139 additions & 57 deletions

‎contrib/AutoGrouper.lua‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ selected images, the other button performs grouping on the entire active collect
3737
]]
3838

3939
local dt = require "darktable"
40+
require "lib/darktable_transition"
4041
local MOD = 'autogrouper'
4142
local gettext = dt.gettext
4243
-- Tell gettext where to find the .mo file translating messages for a particular domain
@@ -175,7 +176,7 @@ if dt.gui.current_view().id == "lighttable" then
175176
else
176177
if not Ag.event_registered then
177178
dt.register_event(
178-
CURR_API_STRING >= "6.2.1" and "AutoGrouper", "view-changed" or "view-changed" ,
179+
"AutoGrouper", "view-changed",
179180
function(event, old_view, new_view)
180181
if new_view.name == "lighttable" and old_view.name == "darkroom" then
181182
install_module()

‎contrib/HDRMerge.lua‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Select a style, whether you want tags to be copied from the original, and any ad
4646

4747
local dt = require 'darktable'
4848
local df = require 'lib/dtutils.file'
49+
require "lib/darktable_transition"
4950
local dsys = require 'lib/dtutils.system'
5051
local mod = 'module_HDRMerge'
5152
local os_path_seperator = '/'
@@ -438,7 +439,7 @@ if dt.gui.current_view().id == "lighttable" then
438439
else
439440
if not HDRM.event_registered then
440441
dt.register_event(
441-
CURR_API_STRING >= "6.2.1" and "HDRmerge", "view-changed" or "view-changed" ,
442+
"HDRmerge", "view-changed",
442443
function(event, old_view, new_view)
443444
if new_view.name == "lighttable" and old_view.name == "darkroom" then
444445
install_module()

‎contrib/LabelsToTags.lua‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949

5050
local darktable = require("darktable")
5151
local du = require "lib/dtutils"
52+
require "lib/darktable_transition"
5253

5354
du.check_min_api_version("3.0.0", "LabelsToTags")
5455

@@ -248,7 +249,7 @@ if darktable.gui.current_view().id == "lighttable" then
248249
else
249250
if not ltt.event_registered then
250251
darktable.register_event(
251-
CURR_API_STRING >= "6.2.1" and LIB_ID, "view-changed" or "view-changed" ,
252+
LIB_ID, "view-changed",
252253
function(event, old_view, new_view)
253254
if new_view.name == "lighttable" and old_view.name == "darkroom" then
254255
install_module()

‎contrib/OpenInExplorer.lua‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ As an alternative option you can choose to show the image file names as symbolic
5050
local dt = require "darktable"
5151
local du = require "lib/dtutils"
5252
local df = require "lib/dtutils.file"
53+
require "lib/darktable_transition"
5354
local dsys = require "lib/dtutils.system"
5455
local gettext = dt.gettext
5556

@@ -209,7 +210,7 @@ if act_os ~= "windows" then
209210
end
210211

211212
dt.register_event(
212-
CURR_API_STRING >= "6.2.1" and "OpenInExplorer", "shortcut" or "shortcut",
213+
"OpenInExplorer", "shortcut",
213214
function(event, shortcut) open_in_fmanager() end,
214215
"OpenInExplorer"
215216
)

‎contrib/autostyle.lua‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ GPLv2
3838

3939
local darktable = require "darktable"
4040
local du = require "lib/dtutils"
41+
require "lib/darktable_transition"
4142
local filelib = require "lib/dtutils.file"
4243

4344
-- Forward declare the functions
@@ -152,12 +153,12 @@ function get_stdout(cmd)
152153
end
153154

154155
-- Registering events
155-
darktable.register_event(CURR_API_STRING >= "6.2.1" and "autostyle", "shortcut" or "shortcut" ,autostyle_apply,
156+
darktable.register_event("autostyle", "shortcut", autostyle_apply,
156157
"Apply your chosen style from exiftool tags")
157158

158159
darktable.preferences.register("autostyle","exif_tag","string","Autostyle: EXIF_tag=value=>style","apply a style automatically if an EXIF_tag matches value. Find the tag with exiftool","")
159160

160-
darktable.register_event(CURR_API_STRING >= "6.2.1" and "autostyle", "post-import-image" or "post-import-image" ,
161+
darktable.register_event("autostyle", "post-import-image",
161162
autostyle_apply_one_image_event)
162163

163164

‎contrib/clear_GPS.lua‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838

3939
local dt = require "darktable"
4040
local du = require "lib/dtutils"
41+
require "lib/darktable_transition"
4142
local gettext = dt.gettext
4243

4344
-- not a number
@@ -71,7 +72,7 @@ dt.gui.libs.image.register_action(
7172
)
7273

7374
dt.register_event(
74-
CURR_API_STRING >= "6.2.1" and "clearGPS", "shortcut" or "shortcut" ,
75+
"clearGPS", "shortcut",
7576
function(event, shortcut) clear_GPS(dt.gui.action_images) end,
7677
_("Clear GPS data")
7778
)

‎contrib/copy_attach_detach_tags.lua‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ USAGE
3939
local dt = require "darktable"
4040
local du = require "lib/dtutils"
4141
local debug = require "darktable.debug"
42+
require "lib/darktable_transition"
4243

4344
local gettext = dt.gettext
4445

@@ -234,7 +235,7 @@ if dt.gui.current_view().id == "lighttable" then
234235
else
235236
if not cadt.event_registered then
236237
dt.register_event(
237-
CURR_API_STRING >= "6.2.1" and "cadt", "view-changed" or "view-changed" ,
238+
"cadt", "view-changed",
238239
function(event, old_view, new_view)
239240
if new_view.name == "lighttable" and old_view.name == "darkroom" then
240241
install_module()
@@ -247,22 +248,22 @@ end
247248

248249

249250
-- shortcut for copy
250-
dt.register_event(CURR_API_STRING >= "6.2.1" and "cadt_ct", "shortcut" or "shortcut" ,
251+
dt.register_event("cadt_ct", "shortcut",
251252
mcopy_tags,
252253
_('copy tags from selected image(s)'))
253254

254255
-- shortcut for attach
255-
dt.register_event(CURR_API_STRING >= "6.2.1" and "cadt_at", "shortcut" or "shortcut" ,
256+
dt.register_event("cadt_at", "shortcut",
256257
attach_tags,
257258
_('paste tags to selected image(s)'))
258259

259260
-- shortcut for detaching tags
260-
dt.register_event(CURR_API_STRING >= "6.2.1" and "cadt_dt", "shortcut" or "shortcut" ,
261+
dt.register_event("cadt_dt", "shortcut",
261262
detach_tags,
262263
_('remove tags from selected image(s)'))
263264

264265
-- shortcut for replace tags
265-
dt.register_event(CURR_API_STRING >= "6.2.1" and "cadt_rt", "shortcut" or "shortcut" ,
266+
dt.register_event("cadt_rt", "shortcut",
266267
replace_tags,
267268
_('replace tags from selected image(s)'))
268269

‎contrib/cr2hdr.lua‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ USAGE
3434

3535
local darktable = require "darktable"
3636
local du = require "lib/dtutils"
37+
require "lib/darktable_transition"
3738

3839
-- Tested with darktable 2.0.1
3940
du.check_min_api_version("2.0.0", "cr2hdr")
@@ -108,11 +109,11 @@ local function convert_action_images(shortcut)
108109
convert_images()
109110
end
110111

111-
darktable.register_event(CURR_API_STRING >= "6.2.1" and "cr2hdr", "shortcut" or "shortcut" ,
112+
darktable.register_event("cr2hdr", "shortcut",
112113
convert_action_images, "Run cr2hdr (Magic Lantern DualISO converter) on selected images")
113-
darktable.register_event(CURR_API_STRING >= "6.2.1" and "cr2hdr", "post-import-image" or "post-import-image" ,
114+
darktable.register_event("cr2hdr", "post-import-image",
114115
file_imported)
115-
darktable.register_event(CURR_API_STRING >= "6.2.1" and "cr2hdr", "post-import-film" or "post-import-film" ,
116+
darktable.register_event("cr2hdr", "post-import-film",
116117
film_imported)
117118

118119
darktable.preferences.register("cr2hdr", "onimport", "bool", "Invoke on import", "If true then cr2hdr will try to proccess every file during importing. Warning: cr2hdr is quite slow even in figuring out on whether the file is Dual ISO or not.", false)

‎contrib/exportLUT.lua‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ local dt = require "darktable"
3030
local du = require "lib/dtutils"
3131
local df = require("lib/dtutils.file")
3232
local ds = require("lib/dtutils.system")
33+
require "lib/darktable_transition"
3334

3435
local gettext = dt.gettext
3536

@@ -162,7 +163,7 @@ if dt.gui.current_view().id == "lighttable" then
162163
else
163164
if not eL.event_registered then
164165
dt.register_event(
165-
CURR_API_STRING >= "6.2.1" and "exportLUT", "view-changed" or "view-changed" ,
166+
"exportLUT", "view-changed",
166167
function(event, old_view, new_view)
167168
if new_view.name == "lighttable" and old_view.name == "darkroom" then
168169
install_module()

‎contrib/ext_editor.lua‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
local dt = require "darktable"
7171
local du = require "lib/dtutils"
7272
local df = require "lib/dtutils.file"
73+
require "lib/darktable_transition"
7374
local dtsys = require "lib/dtutils.system"
7475

7576

@@ -417,7 +418,7 @@ if dt.gui.current_view().id == "lighttable" then
417418
else
418419
if not ee.event_registered then
419420
dt.register_event(
420-
CURR_API_STRING >= "6.2.1" and MODULE_NAME, "view-changed" or "view-changed" ,
421+
MODULE_NAME, "view-changed",
421422
function(event, old_view, new_view)
422423
if new_view.name == "lighttable" and old_view.name == "darkroom" then
423424
install_module()
@@ -452,7 +453,7 @@ for i = MAX_EDITORS, 1, -1 do
452453

453454
-- register the new shortcuts -------------------------------------------------
454455
for i = 1, MAX_EDITORS do
455-
dt.register_event(CURR_API_STRING >= "6.2.1" and MODULE_NAME .. i, "shortcut" or "shortcut" ,
456+
dt.register_event(MODULE_NAME .. i, "shortcut",
456457
program_shortcut, _("edit with program ")..string.format("%02d", i))
457458
end
458459

0 commit comments

Comments
 (0)