Skip to content

Commit 844e89a

Browse files
authored
Use file chooser to set executable path preference
previous commit failed to actually utilize the newly created file chooser to set the path preference
1 parent d88af9f commit 844e89a

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

contrib/HDRMerge.lua

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ local GUI = { --GUI Elements Table
8181
run = {},
8282
stack = {},
8383
options = {},
84-
exes = {},
85-
exe_chooser = {},
86-
exe_update = {},
84+
exes = {
85+
HDRMerge = {},
86+
update = {},
87+
}
8788
}
8889

8990
--Detect User Styles--
@@ -152,6 +153,7 @@ end
152153

153154
local function ExeUpdate(prog_tbl)
154155
dt.preferences.write(mod, 'bin_exists', 'bool', true)
156+
dt.preferences.write('executable_paths', prog.name, 'string', GUI.exes[prog.name].value)
155157
for _,prog in pairs(prog_tbl) do
156158
prog.bin = df.check_if_bin_exists(prog.name)
157159
if not prog.bin then
@@ -163,11 +165,11 @@ local function ExeUpdate(prog_tbl)
163165
prog.first_run = false
164166
end
165167
if dt.preferences.read(mod, 'bin_exists', 'bool') then
166-
GUI.stack.active = 1
167-
dt.print('update successful')
168-
else
169-
dt.print('update unsuccessful, please try again')
170-
end
168+
GUI.stack.active = 1
169+
dt.print('update successful')
170+
else
171+
dt.print('update unsuccessful, please try again')
172+
end
171173
end
172174

173175
local function UpdateActivePreference() --sliders & entry boxes do not have a click/changed callback, so their values must be saved to the active preference
@@ -364,12 +366,12 @@ GUI.run = dt.new_widget("button"){
364366
tooltip ='run HDRMerge with the above specified settings',
365367
clicked_callback = function() main() end
366368
}
367-
GUI.exe_chooser = dt.new_widget('file_chooser_button'){
369+
GUI.exes.HDRMerge = dt.new_widget('file_chooser_button'){
368370
title = "Select HDRmerge executable",
369371
value = df.get_executable_path_preference(HDRM.name),
370372
is_directory = false
371373
}
372-
GUI.exe_update = dt.new_widget('button'){
374+
GUI.exes.update = dt.new_widget('button'){
373375
label = 'update',
374376
tooltip ='update the binary path with current value',
375377
clicked_callback = function() ExeUpdate({HDRM}) end
@@ -387,17 +389,17 @@ GUI.options = dt.new_widget('box'){
387389
GUI.Target.add_tags,
388390
GUI.run
389391
}
390-
GUI.exes = dt.new_widget('box'){
392+
local exes_box = dt.new_widget('box'){
391393
orientation = 'vertical',
392-
GUI.exe_chooser,
393-
GUI.exe_update
394+
GUI.exes.HDRMerge,
395+
GUI.exes.update
394396
}
395397
GUI.stack = dt.new_widget('stack'){
396398
GUI.options,
397-
GUI.exes
399+
exes_box
398400
}
399401
if dt.preferences.read(mod, 'bin_exists', 'bool') then
400-
GUI.stack.active = 1
402+
GUI.stack.active = 1
401403
else
402404
GUI.stack.active = 2
403405
end

0 commit comments

Comments
 (0)