Merge pull request #201 from darktable-org/revert-199-library_fixes
Revert "Library fixes"
This commit is contained in:
@@ -54,11 +54,6 @@ Same as other export modules
|
|||||||
global options:
|
global options:
|
||||||
Same as other export modules
|
Same as other export modules
|
||||||
|
|
||||||
----TODO----
|
|
||||||
don't write executale preferences on linux unless asked to
|
|
||||||
add an initialization value to determine if the program has ever been run before
|
|
||||||
add sane values so that an image is produced with no value adjustment by the user
|
|
||||||
|
|
||||||
]]
|
]]
|
||||||
|
|
||||||
local dt = require 'darktable'
|
local dt = require 'darktable'
|
||||||
@@ -78,64 +73,7 @@ local function _(msgid)
|
|||||||
return gettext.dgettext('enfuseAdvanced', msgid)
|
return gettext.dgettext('enfuseAdvanced', msgid)
|
||||||
end
|
end
|
||||||
|
|
||||||
local initialized = dt.preferences.read(mod, "initialized", "bool")
|
|
||||||
|
|
||||||
-- INITS --
|
-- INITS --
|
||||||
local GUI = {
|
|
||||||
AIS = {
|
|
||||||
radial_distortion = nil,
|
|
||||||
optimize_field = nil,
|
|
||||||
optimize_image_center = nil,
|
|
||||||
auto_crop = nil,
|
|
||||||
distortion = nil,
|
|
||||||
grid_size = nil,
|
|
||||||
control_points = nil,
|
|
||||||
control_points_remove = nil,
|
|
||||||
correlation = nil
|
|
||||||
},
|
|
||||||
ENF = {
|
|
||||||
exposure_weight = nil,
|
|
||||||
saturation_weight = nil,
|
|
||||||
contrast_weight = nil,
|
|
||||||
exposure_optimum = nil,
|
|
||||||
exposure_width = nil,
|
|
||||||
hard_masks = nil,
|
|
||||||
save_masks = nil,
|
|
||||||
contrast_window_size = nil,
|
|
||||||
contrast_edge_scale = nil,
|
|
||||||
contrast_min_curvature = nil
|
|
||||||
},
|
|
||||||
Target = {
|
|
||||||
format = nil,
|
|
||||||
depth = nil,
|
|
||||||
compression_level_tif = nil,
|
|
||||||
compression_level_jpg = nil,
|
|
||||||
output_directory = nil,
|
|
||||||
source_location = nil,
|
|
||||||
on_conflict = nil,
|
|
||||||
auto_import = nil,
|
|
||||||
apply_style = nil,
|
|
||||||
copy_tags = nil,
|
|
||||||
add_tags = nil
|
|
||||||
},
|
|
||||||
Presets = {
|
|
||||||
current_preset =nil,
|
|
||||||
load =nil,
|
|
||||||
save =nil,
|
|
||||||
variants =nil,
|
|
||||||
variants_type =nil
|
|
||||||
},
|
|
||||||
exes = {
|
|
||||||
align_image_stack = nil,
|
|
||||||
enfuse = nil,
|
|
||||||
exiftool = nil,
|
|
||||||
update = nil
|
|
||||||
},
|
|
||||||
align = nil,
|
|
||||||
options_contain = nil,
|
|
||||||
show_options = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
local AIS = {
|
local AIS = {
|
||||||
name = 'align_image_stack',
|
name = 'align_image_stack',
|
||||||
bin = '',
|
bin = '',
|
||||||
@@ -144,16 +82,16 @@ local AIS = {
|
|||||||
arg_string = '',
|
arg_string = '',
|
||||||
images_string = '',
|
images_string = '',
|
||||||
args = {
|
args = {
|
||||||
radial_distortion = {text = '-d', style = 'bool', default_value = false, widget_type = "check_button", widget = GUI.AIS.radial_distortion},
|
radial_distortion = {text = '-d', style = 'bool'},
|
||||||
optimize_field = {text = '-m', style = 'bool', default_value = false, widget_type = "check_button", widget = GUI.AIS.optimize_field},
|
optimize_field = {text = '-m', style = 'bool'},
|
||||||
optimize_image_center = {text = '-i', style = 'bool', default_value = false, widget_type = "check_button", widget = GUI.AIS.optimize_image_center},
|
optimize_image_center = {text = '-i', style = 'bool'},
|
||||||
auto_crop = {text = '-C', style = 'bool', default_value = true, widget_type = "check_button", widget = GUI.AIS.auto_crop},
|
auto_crop = {text = '-C', style = 'bool'},
|
||||||
distortion = {text = '--distortion', style = 'bool', default_value = false, widget_type = "check_button", widget = GUI.AIS.distortion},
|
distortion = {text = '--distortion', style = 'bool'},
|
||||||
gpu = {text = '--gpu', style = 'bool', default_value = false, widget_type = "check_button", widget = GUI.AIS.gpu},
|
gpu = {text = '--gpu', style = 'bool'},
|
||||||
grid_size = {text = '-g ', style = 'string', default_value = '5', widget_type = "combobox", widget = GUI.AIS.grid_size},
|
grid_size = {text = '-g ', style = 'integer'},
|
||||||
control_points = {text = '-c ', style = 'string', default_value = '8', widget_type = "combobox", widget = GUI.AIS.control_points},
|
control_points = {text = '-c ', style = 'integer'},
|
||||||
control_points_remove = {text = '-t ', style = 'string', default_value = '3', widget_type = "combobox", widget = GUI.AIS.control_points_remove},
|
control_points_remove = {text = '-t ', style = 'integer'},
|
||||||
correlation = {text = '--corr=', style = 'string', default_value = '0.9', widget_type = "combobox", widget = GUI.AIS.correlation}
|
correlation = {text = '--corr=', style = 'float'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local ENF = {
|
local ENF = {
|
||||||
@@ -164,16 +102,16 @@ local ENF = {
|
|||||||
arg_string = '',
|
arg_string = '',
|
||||||
image_string = '',
|
image_string = '',
|
||||||
args = {
|
args = {
|
||||||
exposure_weight = {text = '--exposure-weight=', style = 'float', default_value = 1.0, widget_type = "slider", widget = GUI.ENF.exposure_weight},
|
exposure_weight = {text = '--exposure-weight=', style = 'float'},
|
||||||
saturation_weight = {text = '--saturation-weight=', style = 'float', default_value = 0.2, widget_type = "slider", widget = GUI.ENF.saturation_weight},
|
saturation_weight = {text = '--saturation-weight=', style = 'float'},
|
||||||
contrast_weight = {text = '--contrast-weight=', style = 'float', default_value = 0.0, widget_type = "slider", widget = GUI.ENF.contrast_weight},
|
contrast_weight = {text = '--contrast-weight=', style = 'float'},
|
||||||
exposure_optimum = {text = '--exposure-optimum=', style = 'float', default_value = 0.5, widget_type = "slider", widget = GUI.ENF.exposure_optimum},
|
exposure_optimum = {text = '--exposure-optimum=', style = 'float'},
|
||||||
exposure_width = {text = '--exposure-width=', style = 'float', default_value = 0.2, widget_type = "slider", widget = GUI.ENF.exposure_width},
|
exposure_width = {text = '--exposure-width=', style = 'float'},
|
||||||
hard_masks = {text = '--hard-mask', style = 'bool', default_value = false, widget_type = "check_button", widget = GUI.ENF.hard_masks},
|
hard_masks = {text = '--hard-mask', style = 'bool'},
|
||||||
save_masks = {text = '--save-masks', style = 'bool', default_value = false, widget_type = "check_button", widget = GUI.ENF.save_masks},
|
save_masks = {text = '--save-masks', style = 'bool'},
|
||||||
contrast_window_size = {text = '--contrast-window-size=', style = 'string', default_value = '5', widget_type = "combobox", widget = GUI.ENF.contrast_window_size},
|
contrast_window_size = {text = '--contrast-window-size=', style = 'integer'},
|
||||||
contrast_edge_scale = {text = '--contrast-edge-scale=', style = 'string', default_value = "0.0", widget_type = "combobox", widget = GUI.ENF.contrast_edge_scale},
|
contrast_edge_scale = {text = '--contrast-edge-scale=', style = 'float'},
|
||||||
contrast_min_curvature = {text = '--contrast-min-curvature=', style = 'string', default_value = '0.0%', widget_type = "combobox", widget = GUI.ENF.contrast_min_curvature}
|
contrast_min_curvature = {text = '--contrast-min-curvature=', style = 'string'}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
local EXF = {
|
local EXF = {
|
||||||
@@ -182,42 +120,56 @@ local EXF = {
|
|||||||
first_run = true,
|
first_run = true,
|
||||||
install_error = false
|
install_error = false
|
||||||
}
|
}
|
||||||
local TARGET = {
|
local GUI = {
|
||||||
format = {style = 'string', default_value = 'tif', widget_type = "combobox", widget = GUI.Target.format},
|
AIS = {
|
||||||
depth = {style = 'string', default_value = '16', widget_type = "combobox", widget = GUI.Target.depth},
|
radial_distortion = {},
|
||||||
compression_level_tif = {style = 'string', default_value = 'lzw', widget_type = "combobox", widget = GUI.Target.compression_level_tif},
|
optimize_field = {},
|
||||||
compression_level_jpg = {style = 'integer', default_value = 85, widget_type = "slider", widget = GUI.Target.compression_level_jpg},
|
optimize_image_center = {},
|
||||||
output_directory = {style = 'string', default_value = '', widget_type = "file_chooser_button", widget = GUI.Target.output_directory},
|
auto_crop = {},
|
||||||
source_location = {style = 'bool', default_value = true, widget_type = "check_button", widget = GUI.Target.source_location},
|
distortion = {},
|
||||||
on_conflict = {style = 'string', default_value = 'create unique filename', widget_type = "combobox", widget = GUI.Target.on_conflict},
|
grid_size = {},
|
||||||
auto_import = {style = 'bool', default_value = true, widget_type = "check_button", widget = GUI.Target.auto_import},
|
control_points = {},
|
||||||
apply_style = {style = 'string', default_value = "none", widget_type = "combobox", widget = GUI.Target.apply_style},
|
control_points_remove = {},
|
||||||
copy_tags = {style = 'bool', default_value = false, widget_type = "check_button", widget = GUI.Target.copy_tags},
|
correlation = {}},
|
||||||
add_tags = {style = 'string', default_value = '', widget_type = "entry", widget = GUI.Target.add_tags}
|
ENF = {
|
||||||
}
|
exposure_weight = {},
|
||||||
|
saturation_weight = {},
|
||||||
local PRESETS = {
|
contrast_weight = {},
|
||||||
current_preset = {style = 'string', default_value = 'dri_1', widget_type = "combobox", widget = GUI.Presets.current_preset},
|
exposure_optimum = {},
|
||||||
load = {style = nil, default_value = nil, widget_type = "button", widget = GUI.Presets.load},
|
exposure_width = {},
|
||||||
save = {style = nil, default_value = nil, widget_type = "button", widget = GUI.Presets.save},
|
hard_masks = {},
|
||||||
variants = {style = 'bool', default_value = false, widget_type = "check_button", widget = GUI.Presets.variants},
|
save_masks = {},
|
||||||
variants_type = {style = 'string', default_value = 'dri', widget_type = "combobox", widget = GUI.Presets.variants_type},
|
contrast_window_size = {},
|
||||||
values = {
|
contrast_edge_scale = {},
|
||||||
dri_1 = "1.0;0.2;0.0;0.5;0.2;F;F;5;0.0;0.0%",
|
contrast_min_curvature = {}},
|
||||||
dri_2 = "1.0;0.2;0.0;0.3;0.2;F;F;5;0.0;0.0%",
|
Target = {
|
||||||
dri_3 = "1.0;0.2;0.0;0.7;0.2;F;F;5;0.0;0.0%",
|
format = {},
|
||||||
dff_1 = "0.0;0.0;1.0;0.5;0.2;T;F;7;0.3;0.5%",
|
depth = {},
|
||||||
dff_2 = "0.0;0.0;1.0;0.5;0.2;T;F;5;0.1;0.3%",
|
compression_level_tif = {},
|
||||||
dff_3 = "0.0;0.0;1.0;0.5;0.2;T;F;9;0.5;0.8%"
|
compression_level_jpg = {},
|
||||||
},
|
output_compress = {},
|
||||||
key = {"exposure_weight", "saturation_weight", "contrast_weight", "exposure_optimum", "exposure_width", "hard_masks", "save_masks", "contrast_window_size",
|
output_directory = {},
|
||||||
"contrast_edge_scale", "contrast_min_curvature"}
|
source_location = {},
|
||||||
}
|
on_conflict = {},
|
||||||
|
auto_import = {},
|
||||||
local MODULE = {
|
apply_style = {},
|
||||||
align = {style = 'bool', default_value = false, widget_type = "check_button", widget = GUI.align},
|
copy_tags = {},
|
||||||
options_contain = {style = 'integer', default_value = 2, widget_type = "stack", widget = GUI.options_contain},
|
add_tags = {}},
|
||||||
show_options = {style = 'string', default_value = 'enfuse/enblend', widget_type = "combobox", widget = GUI.show_options}
|
Presets = {
|
||||||
|
current_preset ={};
|
||||||
|
load ={};
|
||||||
|
save ={};
|
||||||
|
variants ={};
|
||||||
|
variants_type ={}},
|
||||||
|
exes = {
|
||||||
|
align_image_stack = {},
|
||||||
|
enfuse = {},
|
||||||
|
exiftool = {},
|
||||||
|
update = {}
|
||||||
|
},
|
||||||
|
align = {},
|
||||||
|
options_contain = {},
|
||||||
|
show_options = {}
|
||||||
}
|
}
|
||||||
|
|
||||||
local styles = dt.styles
|
local styles = dt.styles
|
||||||
@@ -227,20 +179,6 @@ for _,i in pairs(dt.styles) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- FUNCTION --
|
-- FUNCTION --
|
||||||
local function update_combobox_selected(cmbx, value)
|
|
||||||
dt.print_log("passed in value is " .. value)
|
|
||||||
for i,val in ipairs(cmbx) do
|
|
||||||
if val == value then
|
|
||||||
dt.print_log("matched " .. val .. " setting selected to " .. i)
|
|
||||||
cmbx.selected = i
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if i == #cmbx then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function InRange(test, low, high) -- tests if test value is within range of low and high (inclusive)
|
local function InRange(test, low, high) -- tests if test value is within range of low and high (inclusive)
|
||||||
if test >= low and test <= high then
|
if test >= low and test <= high then
|
||||||
return true
|
return true
|
||||||
@@ -280,28 +218,29 @@ local function BuildExecuteCmd(prog_table) --creates a program command using ele
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function PreCall(prog_tbls) --looks to see if this is the first call, if so checks to see if program is installed properly
|
local function PreCall(prog_tbls) --looks to see if this is the first call, if so checks to see if program is installed properly
|
||||||
dt.print_log("In PreCall")
|
for _,prog in pairs(prog_tbls) do
|
||||||
dt.preferences.write(mod, "bin_exists", "bool", true)
|
if prog.first_run then
|
||||||
for _,prog in pairs(prog_tbls) do
|
prog.bin = df.check_if_bin_exists(prog.name)
|
||||||
prog.bin = df.check_if_bin_exists(prog.name)
|
if not prog.bin then
|
||||||
if not prog.bin then
|
prog.install_error = true
|
||||||
prog.install_error = true
|
dt.preferences.write(mod, 'bin_exists', 'bool', false)
|
||||||
dt.preferences.write(mod, "bin_exists", "bool", false)
|
else
|
||||||
dt.print_error("Could not find executable for " .. prog.name)
|
prog.bin = CleanSpaces(prog.bin)
|
||||||
|
end
|
||||||
|
prog.first_run = false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not dt.preferences.read(mod, 'bin_exists', 'bool') then
|
||||||
|
GUI.options_contain.active = 4
|
||||||
|
GUI.show_options.sensitive = false
|
||||||
|
dt.print(_('please update your binary locations'))
|
||||||
end
|
end
|
||||||
end
|
|
||||||
if not dt.preferences.read(mod, 'bin_exists', 'bool') then
|
|
||||||
GUI.options_contain.active = 4
|
|
||||||
GUI.show_options.sensitive = false
|
|
||||||
dt.print(_('please update your binary locations'))
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function ExeUpdate(prog_tbl) --updates executable paths and verifies them
|
local function ExeUpdate(prog_tbl) --updates executable paths and verifies them
|
||||||
dt.preferences.write(mod, 'bin_exists', 'bool', true)
|
dt.preferences.write(mod, 'bin_exists', 'bool', true)
|
||||||
for _,prog in pairs(prog_tbl) do
|
for _,prog in pairs(prog_tbl) do
|
||||||
prog.bin = dt.preferences.read('executable_paths', prog.name, 'string')
|
dt.preferences.write('executable_paths', prog.name, 'string', GUI.exes[prog.name].value)
|
||||||
--[[dt.preferences.write('executable_paths', prog.name, 'string', GUI.exes[prog.name].value)
|
|
||||||
prog.bin = df.check_if_bin_exists(prog.name)
|
prog.bin = df.check_if_bin_exists(prog.name)
|
||||||
if not prog.bin then
|
if not prog.bin then
|
||||||
prog.install_error = true
|
prog.install_error = true
|
||||||
@@ -309,7 +248,7 @@ local function ExeUpdate(prog_tbl) --updates executable paths and verifies them
|
|||||||
dt.print(_('issue with ')..prog.name.._(' executable'))
|
dt.print(_('issue with ')..prog.name.._(' executable'))
|
||||||
else
|
else
|
||||||
prog.bin = CleanSpaces(prog.bin)
|
prog.bin = CleanSpaces(prog.bin)
|
||||||
end]]
|
end
|
||||||
prog.first_run = false
|
prog.first_run = false
|
||||||
end
|
end
|
||||||
if dt.preferences.read(mod, 'bin_exists', 'bool') then
|
if dt.preferences.read(mod, 'bin_exists', 'bool') then
|
||||||
@@ -383,10 +322,8 @@ local function UpdateENFargs(image_table, prefix) --updates the Enfuse arguments
|
|||||||
images_to_blend = images_to_blend..df.sanitize_filename(temp_image)..' '
|
images_to_blend = images_to_blend..df.sanitize_filename(temp_image)..' '
|
||||||
end
|
end
|
||||||
ENF.arg_string = ENF.arg_string..' --depth='..GUI.Target.depth.value..' '
|
ENF.arg_string = ENF.arg_string..' --depth='..GUI.Target.depth.value..' '
|
||||||
if GUI.Target.format.value == 'tif' then
|
if GUI.Target.format.value == 'tif' then ENF.arg_string = ENF.arg_string..'--compression='..GUI.Target.compression_level_tif.value..' '
|
||||||
ENF.arg_string = ENF.arg_string..'--compression='..GUI.Target.compression_level_tif.value..' '
|
elseif GUI.Target.format.value == 'jpg' then ENF.arg_string = ENF.arg_string..'--compression='..GUI.Target.compression_level_jpg.value..' '
|
||||||
elseif
|
|
||||||
GUI.Target.format.value == 'jpg' then ENF.arg_string = ENF.arg_string..'--compression='..GUI.Target.compression_level_jpg.value..' '
|
|
||||||
end
|
end
|
||||||
if not GUI.Target.source_location.value then out_path = GUI.Target.output_directory.value end
|
if not GUI.Target.source_location.value then out_path = GUI.Target.output_directory.value end
|
||||||
out_name = smallest_name..'-'..largest_id
|
out_name = smallest_name..'-'..largest_id
|
||||||
@@ -525,8 +462,8 @@ local function main(storage, image_table, extra_data)
|
|||||||
local resp = dsys.external_command(run_cmd)
|
local resp = dsys.external_command(run_cmd)
|
||||||
if resp ~= 0 then
|
if resp ~= 0 then
|
||||||
remove_temp_files(images_to_remove)
|
remove_temp_files(images_to_remove)
|
||||||
dt.print_error(ENF.name .. _(' failed'))
|
dt.print_error(ENF.name.._(' failed'))
|
||||||
dt.print(ENF.name .. _(' failed'))
|
dt.print(ENF.name.._(' failed'))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -562,18 +499,6 @@ local function main(storage, image_table, extra_data)
|
|||||||
dt.print('image fusion process complete')
|
dt.print('image fusion process complete')
|
||||||
end
|
end
|
||||||
|
|
||||||
if not initialized then
|
|
||||||
for _,tbl in ipairs({AIS.args, ENF.args, TARGET, MODULE, PRESETS}) do
|
|
||||||
for k,v in pairs(tbl) do
|
|
||||||
if v.style then
|
|
||||||
dt.preferences.write(mod, "active_" .. k, v.style, v.default_value)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
dt.preferences.write(mod, "active_align", "bool", false)
|
|
||||||
end
|
|
||||||
dt.print_log("past functions")
|
|
||||||
|
|
||||||
--GUI--
|
--GUI--
|
||||||
stack_compression = dt.new_widget('stack'){}
|
stack_compression = dt.new_widget('stack'){}
|
||||||
local label_AIS_options= dt.new_widget('section_label'){
|
local label_AIS_options= dt.new_widget('section_label'){
|
||||||
@@ -633,12 +558,12 @@ GUI.AIS.gpu = dt.new_widget('check_button'){
|
|||||||
clicked_callback = function(self) dt.preferences.write(mod, 'active_gpu', 'bool', self.value) end,
|
clicked_callback = function(self) dt.preferences.write(mod, 'active_gpu', 'bool', self.value) end,
|
||||||
reset_callback = function(self) self.value = true end
|
reset_callback = function(self) self.value = true end
|
||||||
}
|
}
|
||||||
--temp = dt.preferences.read(mod, 'active_grid_size_ind', 'integer')
|
temp = dt.preferences.read(mod, 'active_grid_size_ind', 'integer')
|
||||||
--if not InRange(temp, 1, 9) then temp = 5 end
|
if not InRange(temp, 1, 9) then temp = 5 end
|
||||||
GUI.AIS.grid_size = dt.new_widget('combobox'){
|
GUI.AIS.grid_size = dt.new_widget('combobox'){
|
||||||
label = _('image grid size'),
|
label = _('image grid size'),
|
||||||
tooltip = _('break image into a rectangular grid \nand attempt to find num control points in each section.\ndefault: (5x5)'),
|
tooltip = _('break image into a rectangular grid \nand attempt to find num control points in each section.\ndefault: (5x5)'),
|
||||||
selected = 1,
|
selected = temp,
|
||||||
'1','2','3','4','5','6','7','8','9',
|
'1','2','3','4','5','6','7','8','9',
|
||||||
changed_callback = function(self)
|
changed_callback = function(self)
|
||||||
dt.preferences.write(mod, 'active_grid_size', 'integer', self.value)
|
dt.preferences.write(mod, 'active_grid_size', 'integer', self.value)
|
||||||
@@ -650,13 +575,12 @@ GUI.AIS.grid_size = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_grid_size_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_grid_size_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.AIS.grid_size, dt.preferences.read(mod, 'active_grid_size', 'string'))
|
temp = dt.preferences.read(mod, 'active_control_points_ind', 'integer')
|
||||||
--temp = dt.preferences.read(mod, 'active_control_points_ind', 'integer')
|
if not InRange(temp, 1, 9) then temp = 8 end
|
||||||
--if not InRange(temp, 1, 9) then temp = 8 end
|
|
||||||
GUI.AIS.control_points = dt.new_widget('combobox'){
|
GUI.AIS.control_points = dt.new_widget('combobox'){
|
||||||
label = _('control points/grid'),
|
label = _('control points/grid'),
|
||||||
tooltip = _('number of control points (per grid, see option -g) \nto create between adjacent images \ndefault: (8).'),
|
tooltip = _('number of control points (per grid, see option -g) \nto create between adjacent images \ndefault: (8).'),
|
||||||
selected = 1,
|
selected = temp,
|
||||||
'1','2','3','4','5','6','7','8','9',
|
'1','2','3','4','5','6','7','8','9',
|
||||||
changed_callback = function(self)
|
changed_callback = function(self)
|
||||||
dt.preferences.write(mod, 'active_control_points', 'integer', self.value)
|
dt.preferences.write(mod, 'active_control_points', 'integer', self.value)
|
||||||
@@ -668,13 +592,12 @@ GUI.AIS.control_points = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_control_points_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_control_points_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.AIS.control_points, dt.preferences.read(mod, 'active_control_points', 'string'))
|
temp = dt.preferences.read(mod, 'active_control_points_remove_ind', 'integer')
|
||||||
--temp = dt.preferences.read(mod, 'active_control_points_remove_ind', 'integer')
|
if not InRange(temp, 1, 9) then temp = 3 end
|
||||||
--if not InRange(temp, 1, 9) then temp = 3 end
|
|
||||||
GUI.AIS.control_points_remove = dt.new_widget('combobox'){
|
GUI.AIS.control_points_remove = dt.new_widget('combobox'){
|
||||||
label = _('remove control points with error'),
|
label = _('remove control points with error'),
|
||||||
tooltip = _('remove all control points with an error higher \nthan num pixels \ndefault: (3)'),
|
tooltip = _('remove all control points with an error higher \nthan num pixels \ndefault: (3)'),
|
||||||
selected = 1,
|
selected = temp,
|
||||||
'1','2','3','4','5','6','7','8','9',
|
'1','2','3','4','5','6','7','8','9',
|
||||||
changed_callback = function(self)
|
changed_callback = function(self)
|
||||||
dt.preferences.write(mod, 'active_control_points_remove', 'integer', self.value)
|
dt.preferences.write(mod, 'active_control_points_remove', 'integer', self.value)
|
||||||
@@ -686,13 +609,12 @@ GUI.AIS.control_points_remove = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_control_points_remove_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_control_points_remove_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.AIS.control_points_remove, dt.preferences.read(mod, 'active_control_points_remove', 'string'))
|
temp = dt.preferences.read(mod, 'active_correlation_ind', 'integer')
|
||||||
--temp = dt.preferences.read(mod, 'active_correlation_ind', 'integer')
|
if not InRange(temp, 1, 10) then temp = 9 end
|
||||||
--if not InRange(temp, 1, 10) then temp = 9 end
|
|
||||||
GUI.AIS.correlation = dt.new_widget('combobox'){
|
GUI.AIS.correlation = dt.new_widget('combobox'){
|
||||||
label = _('correlation threshold for control points'),
|
label = _('correlation threshold for control points'),
|
||||||
tooltip = _('correlation threshold for identifying \ncontrol points \ndefault: (0.9).'),
|
tooltip = _('correlation threshold for identifying \ncontrol points \ndefault: (0.9).'),
|
||||||
selected = 1,
|
selected = temp,
|
||||||
'0.1','0.2','0.3','0.4','0.5','0.6','0.7','0.8','0.9','1.0',
|
'0.1','0.2','0.3','0.4','0.5','0.6','0.7','0.8','0.9','1.0',
|
||||||
changed_callback = function(self)
|
changed_callback = function(self)
|
||||||
dt.preferences.write(mod, 'active_correlation', 'float', self.value)
|
dt.preferences.write(mod, 'active_correlation', 'float', self.value)
|
||||||
@@ -704,67 +626,65 @@ GUI.AIS.correlation = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_correlation_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_correlation_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.AIS.correlation, dt.preferences.read(mod, 'active_correlation', 'string'))
|
|
||||||
local label_ENF_options= dt.new_widget('section_label'){
|
local label_ENF_options= dt.new_widget('section_label'){
|
||||||
label = _('image fusion options')
|
label = _('image fusion options')
|
||||||
}
|
}
|
||||||
dt.print_log("past GUI.AIS")
|
temp = dt.preferences.read(mod, 'active_exposure_weight', 'float')
|
||||||
--temp = dt.preferences.read(mod, 'active_exposure_weight', 'float')
|
if not InRange(temp, 0, 1) then temp = 1 end
|
||||||
--if not InRange(temp, 0, 1) then temp = 1 end
|
|
||||||
GUI.ENF.exposure_weight = dt.new_widget('slider'){
|
GUI.ENF.exposure_weight = dt.new_widget('slider'){
|
||||||
label = _('exposure weight'),
|
label = _('exposure weight'),
|
||||||
tooltip = _('set the relative weight of the well-exposedness criterion \nas defined by the chosen exposure weight function. \nincreasing this weight relative to the others will\n make well-exposed pixels contribute more to\n the final output. \ndefault: (1.0)'),
|
tooltip = _('set the relative weight of the well-exposedness criterion \nas defined by the chosen exposure weight function. \nincreasing this weight relative to the others will\n make well-exposed pixels contribute more to\n the final output. \ndefault: (1.0)'),
|
||||||
hard_min = 0,
|
hard_min = 0,
|
||||||
hard_max = 1,
|
hard_max = 1,
|
||||||
value = dt.preferences.read(mod, 'active_exposure_weight', 'float'),
|
value = temp,
|
||||||
reset_callback = function(self)
|
reset_callback = function(self)
|
||||||
self.value = 1
|
self.value = 1
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
--temp = dt.preferences.read(mod, 'active_saturation_weight', 'float')
|
temp = dt.preferences.read(mod, 'active_saturation_weight', 'float')
|
||||||
--if not InRange(temp, 0, 1) then temp = .2 end
|
if not InRange(temp, 0, 1) then temp = .2 end
|
||||||
GUI.ENF.saturation_weight = dt.new_widget('slider'){
|
GUI.ENF.saturation_weight = dt.new_widget('slider'){
|
||||||
label = _('saturation weight'),
|
label = _('saturation weight'),
|
||||||
tooltip = _('set the relative weight of high-saturation pixels. \nincreasing this weight makes pixels with high \nsaturation contribute more to the final output. \ndefault: (0.2)'),
|
tooltip = _('set the relative weight of high-saturation pixels. \nincreasing this weight makes pixels with high \nsaturation contribute more to the final output. \ndefault: (0.2)'),
|
||||||
hard_min = 0,
|
hard_min = 0,
|
||||||
hard_max = 1,
|
hard_max = 1,
|
||||||
value = dt.preferences.read(mod, 'active_saturation_weight', 'float'),
|
value = temp,
|
||||||
reset_callback = function(self)
|
reset_callback = function(self)
|
||||||
self.value = 0.2
|
self.value = 0.2
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
--temp = dt.preferences.read(mod, 'active_contrast_weight', 'float')
|
temp = dt.preferences.read(mod, 'active_contrast_weight', 'float')
|
||||||
--if not InRange(temp, 0, 1) then temp = 0 end
|
if not InRange(temp, 0, 1) then temp = 0 end
|
||||||
GUI.ENF.contrast_weight = dt.new_widget('slider'){
|
GUI.ENF.contrast_weight = dt.new_widget('slider'){
|
||||||
label = _('contrast weight'),
|
label = _('contrast weight'),
|
||||||
tooltip = _('sets the relative weight of high local-contrast pixels. \ndefault: (0.0).'),
|
tooltip = _('sets the relative weight of high local-contrast pixels. \ndefault: (0.0).'),
|
||||||
hard_min = 0,
|
hard_min = 0,
|
||||||
hard_max = 1,
|
hard_max = 1,
|
||||||
value = dt.preferences.read(mod, 'active_contrast_weight', 'float'),
|
value = temp,
|
||||||
reset_callback = function(self)
|
reset_callback = function(self)
|
||||||
self.value = 0
|
self.value = 0
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
--temp = dt.preferences.read(mod, 'active_exposure_optimum', 'float')
|
temp = dt.preferences.read(mod, 'active_exposure_optimum', 'float')
|
||||||
--if not InRange(temp, 0, 1) then temp = 0.5 end
|
if not InRange(temp, 0, 1) then temp = 0.5 end
|
||||||
GUI.ENF.exposure_optimum = dt.new_widget('slider'){
|
GUI.ENF.exposure_optimum = dt.new_widget('slider'){
|
||||||
label = _('exposure optimum'),
|
label = _('exposure optimum'),
|
||||||
tooltip = _('determine at what normalized exposure value\n the optimum exposure of the input images\n is. this is, set the position of the maximum\n of the exposure weight curve. use this \noption to fine-tune exposure weighting. \ndefault: (0.5)'),
|
tooltip = _('determine at what normalized exposure value\n the optimum exposure of the input images\n is. this is, set the position of the maximum\n of the exposure weight curve. use this \noption to fine-tune exposure weighting. \ndefault: (0.5)'),
|
||||||
hard_min = 0,
|
hard_min = 0,
|
||||||
hard_max = 1,
|
hard_max = 1,
|
||||||
value = dt.preferences.read(mod, 'active_exposure_optimum', 'float'),
|
value = temp,
|
||||||
reset_callback = function(self)
|
reset_callback = function(self)
|
||||||
self.value = 0.5
|
self.value = 0.5
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
--temp = dt.preferences.read(mod, 'active_exposure_width', 'float')
|
temp = dt.preferences.read(mod, 'active_exposure_width', 'float')
|
||||||
--if not InRange(temp, 0, 1) then temp = 0.2 end
|
if not InRange(temp, 0, 1) then temp = 0.2 end
|
||||||
GUI.ENF.exposure_width = dt.new_widget('slider'){
|
GUI.ENF.exposure_width = dt.new_widget('slider'){
|
||||||
label = _('exposure width'),
|
label = _('exposure width'),
|
||||||
tooltip = _('set the characteristic width (FWHM) of the exposure \nweight function. low numbers give less weight to \npixels that are far from the user-defined \noptimum and vice versa. use this option to \nfine-tune exposure weighting. \ndefault: (0.2)'),
|
tooltip = _('set the characteristic width (FWHM) of the exposure \nweight function. low numbers give less weight to \npixels that are far from the user-defined \noptimum and vice versa. use this option to \nfine-tune exposure weighting. \ndefault: (0.2)'),
|
||||||
hard_min = 0,
|
hard_min = 0,
|
||||||
hard_max = 1,
|
hard_max = 1,
|
||||||
value = dt.preferences.read(mod, 'active_exposure_width', 'float'),
|
value = temp,
|
||||||
reset_callback = function(self)
|
reset_callback = function(self)
|
||||||
self.value = 0.2
|
self.value = 0.2
|
||||||
end
|
end
|
||||||
@@ -783,12 +703,12 @@ GUI.ENF.save_masks = dt.new_widget('check_button'){
|
|||||||
clicked_callback = function(self) dt.preferences.write(mod, 'active_save_masks', 'bool', self.value) end,
|
clicked_callback = function(self) dt.preferences.write(mod, 'active_save_masks', 'bool', self.value) end,
|
||||||
reset_callback = function(self) self.value = false end
|
reset_callback = function(self) self.value = false end
|
||||||
}
|
}
|
||||||
--temp = dt.preferences.read(mod, 'active_contrast_window_size_ind', 'integer')
|
temp = dt.preferences.read(mod, 'active_contrast_window_size_ind', 'integer')
|
||||||
--if not InRange(temp, 1, 8) then temp = 3 end
|
if not InRange(temp, 1, 8) then temp = 3 end
|
||||||
GUI.ENF.contrast_window_size = dt.new_widget('combobox'){
|
GUI.ENF.contrast_window_size = dt.new_widget('combobox'){
|
||||||
label = _('contrast window size'),
|
label = _('contrast window size'),
|
||||||
tooltip = _('set the window size for local contrast analysis. \nthe window will be a square of size × size pixels. \nif given an even size, Enfuse will \nautomatically use the next odd number.\nfor contrast analysis size values larger \nthan 5 pixels might result in a \nblurry composite image. values of 3 and \n5 pixels have given good results on \nfocus stacks. \ndefault: (5) pixels'),
|
tooltip = _('set the window size for local contrast analysis. \nthe window will be a square of size × size pixels. \nif given an even size, Enfuse will \nautomatically use the next odd number.\nfor contrast analysis size values larger \nthan 5 pixels might result in a \nblurry composite image. values of 3 and \n5 pixels have given good results on \nfocus stacks. \ndefault: (5) pixels'),
|
||||||
selected = 1,
|
selected = temp,
|
||||||
'3','4','5','6','7','8','9','10',
|
'3','4','5','6','7','8','9','10',
|
||||||
changed_callback = function(self)
|
changed_callback = function(self)
|
||||||
dt.preferences.write(mod, 'active_contrast_window_size', 'integer', self.value)
|
dt.preferences.write(mod, 'active_contrast_window_size', 'integer', self.value)
|
||||||
@@ -800,13 +720,12 @@ GUI.ENF.contrast_window_size = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_contrast_window_size_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_contrast_window_size_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.ENF.contrast_window_size, dt.preferences.read(mod, 'active_contrast_window_size', 'string'))
|
temp = dt.preferences.read(mod, 'active_contrast_edge_scale_ind', 'integer')
|
||||||
--temp = dt.preferences.read(mod, 'active_contrast_edge_scale_ind', 'integer')
|
if not InRange(temp, 1, 6) then temp = 1 end
|
||||||
--if not InRange(temp, 1, 6) then temp = 1 end
|
|
||||||
GUI.ENF.contrast_edge_scale = dt.new_widget('combobox'){
|
GUI.ENF.contrast_edge_scale = dt.new_widget('combobox'){
|
||||||
label = _('contrast edge scale'),
|
label = _('contrast edge scale'),
|
||||||
tooltip = _('a non-zero value for EDGE-SCALE switches on the \nLaplacian-of-Gaussian (LoG) edge detection algorithm.\n edage-scale is the radius of the Gaussian used \nin the search for edges. a positive LCE-SCALE \nturns on local contrast enhancement (LCE) \nbefore the LoG edge detection. \nDefault: (0.0) pixels.'),
|
tooltip = _('a non-zero value for EDGE-SCALE switches on the \nLaplacian-of-Gaussian (LoG) edge detection algorithm.\n edage-scale is the radius of the Gaussian used \nin the search for edges. a positive LCE-SCALE \nturns on local contrast enhancement (LCE) \nbefore the LoG edge detection. \nDefault: (0.0) pixels.'),
|
||||||
selected = 1,
|
selected = temp,
|
||||||
'0.0','0.1','0.2','0.3','0.4','0.5',
|
'0.0','0.1','0.2','0.3','0.4','0.5',
|
||||||
changed_callback = function(self)
|
changed_callback = function(self)
|
||||||
dt.preferences.write(mod, 'active_contrast_edge_scale', 'float', self.value)
|
dt.preferences.write(mod, 'active_contrast_edge_scale', 'float', self.value)
|
||||||
@@ -818,13 +737,12 @@ GUI.ENF.contrast_edge_scale = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_contrast_edge_scale_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_contrast_edge_scale_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.ENF.contrast_edge_scale, dt.preferences.read(mod, 'active_contrast_edge_scale', 'string'))
|
temp = dt.preferences.read(mod, 'active_contrast_min_curvature_ind', 'integer')
|
||||||
--temp = dt.preferences.read(mod, 'active_contrast_min_curvature_ind', 'integer')
|
if not InRange(temp, 1, 11) then temp = 1 end
|
||||||
--if not InRange(temp, 1, 11) then temp = 1 end
|
|
||||||
GUI.ENF.contrast_min_curvature = dt.new_widget('combobox'){
|
GUI.ENF.contrast_min_curvature = dt.new_widget('combobox'){
|
||||||
label = _('contrast min curvature [%]'),
|
label = _('contrast min curvature [%]'),
|
||||||
tooltip = _('define the minimum curvature for the LoG edge detection. Append a ‘%’ to specify the minimum curvature relative to maximum pixel value in the source image. Default: (0.0%)'),
|
tooltip = _('define the minimum curvature for the LoG edge detection. Append a ‘%’ to specify the minimum curvature relative to maximum pixel value in the source image. Default: (0.0%)'),
|
||||||
selected = 1,
|
selected = temp,
|
||||||
'0.0%','0.1%','0.2%','0.3%','0.4%','0.5%','0.6%','0.7%','0.8%','0.9%','1.0%',
|
'0.0%','0.1%','0.2%','0.3%','0.4%','0.5%','0.6%','0.7%','0.8%','0.9%','1.0%',
|
||||||
changed_callback = function(self)
|
changed_callback = function(self)
|
||||||
dt.preferences.write(mod, 'active_contrast_min_curvature', 'string', self.value)
|
dt.preferences.write(mod, 'active_contrast_min_curvature', 'string', self.value)
|
||||||
@@ -836,17 +754,15 @@ GUI.ENF.contrast_min_curvature = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_contrast_min_curvature_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_contrast_min_curvature_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.ENF.contrast_min_curvature, dt.preferences.read(mod, 'active_contrast_min_curvature', 'string'))
|
|
||||||
local label_target_options= dt.new_widget('section_label'){
|
local label_target_options= dt.new_widget('section_label'){
|
||||||
label = _('target file')
|
label = _('target file')
|
||||||
}
|
}
|
||||||
dt.print_log("past GUI.ENF")
|
temp = dt.preferences.read(mod, 'active_compression_level_tif_ind', 'integer')
|
||||||
--temp = dt.preferences.read(mod, 'active_compression_level_tif_ind', 'integer')
|
if not InRange(temp, 1, 4) then temp = 1 end
|
||||||
--if not InRange(temp, 1, 4) then temp = 1 end
|
|
||||||
GUI.Target.compression_level_tif = dt.new_widget('combobox'){
|
GUI.Target.compression_level_tif = dt.new_widget('combobox'){
|
||||||
label = _('tiff compression'),
|
label = _('tiff compression'),
|
||||||
tooltip = _('compression method for tiff files'),
|
tooltip = _('compression method for tiff files'),
|
||||||
selected = 1,
|
selected = temp,
|
||||||
'none','deflate','lzw','packbits',
|
'none','deflate','lzw','packbits',
|
||||||
changed_callback = function(self)
|
changed_callback = function(self)
|
||||||
dt.preferences.write(mod, 'active_compression_level_tif', 'string', self.value)
|
dt.preferences.write(mod, 'active_compression_level_tif', 'string', self.value)
|
||||||
@@ -858,9 +774,8 @@ GUI.Target.compression_level_tif = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_compression_level_tif_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_compression_level_tif_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.Target.compression_level_tif, dt.preferences.read(mod, 'active_compression_level_tif', 'string'))
|
temp = dt.preferences.read(mod, 'active_compression_level_jpg', 'integer')
|
||||||
--temp = dt.preferences.read(mod, 'active_compression_level_jpg', 'integer')
|
if not InRange(temp, 0, 100) then temp = 0 end
|
||||||
--if not InRange(temp, 0, 100) then temp = 0 end
|
|
||||||
GUI.Target.compression_level_jpg = dt.new_widget('slider'){
|
GUI.Target.compression_level_jpg = dt.new_widget('slider'){
|
||||||
label = _('jpeg compression'),
|
label = _('jpeg compression'),
|
||||||
tooltip = _('jpeg compression level'),
|
tooltip = _('jpeg compression level'),
|
||||||
@@ -870,7 +785,7 @@ GUI.Target.compression_level_jpg = dt.new_widget('slider'){
|
|||||||
hard_max = 100,
|
hard_max = 100,
|
||||||
step = 5,
|
step = 5,
|
||||||
digits = 0,
|
digits = 0,
|
||||||
value = dt.preferences.read(mod, 'active_compression_level_jpg', 'integer'),
|
value = temp,
|
||||||
reset_callback = function(self)
|
reset_callback = function(self)
|
||||||
self.value = 0
|
self.value = 0
|
||||||
end
|
end
|
||||||
@@ -882,12 +797,12 @@ stack_compression = dt.new_widget('stack'){
|
|||||||
blank,
|
blank,
|
||||||
active = 1
|
active = 1
|
||||||
}
|
}
|
||||||
--temp = dt.preferences.read(mod, 'active_format_ind', 'integer')
|
temp = dt.preferences.read(mod, 'active_format_ind', 'integer')
|
||||||
--if not InRange(temp, 1, 6) then temp = 1 end
|
if not InRange(temp, 1, 6) then temp = 1 end
|
||||||
GUI.Target.format = dt.new_widget('combobox'){
|
GUI.Target.format = dt.new_widget('combobox'){
|
||||||
label = _('file format'),
|
label = _('file format'),
|
||||||
tooltip = _('file format of the enfused final image'),
|
tooltip = _('file format of the enfused final image'),
|
||||||
selected = 1,
|
selected = temp,
|
||||||
'tif','jpg','png','pnm','pbm','ppm',
|
'tif','jpg','png','pnm','pbm','ppm',
|
||||||
changed_callback = function(self)
|
changed_callback = function(self)
|
||||||
dt.preferences.write(mod, 'active_format', 'string', self.value)
|
dt.preferences.write(mod, 'active_format', 'string', self.value)
|
||||||
@@ -903,13 +818,12 @@ GUI.Target.format = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_format_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_format_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.Target.format, dt.preferences.read(mod, 'active_format', 'string'))
|
temp = dt.preferences.read(mod, 'active_depth_ind', 'integer')
|
||||||
--temp = dt.preferences.read(mod, 'active_depth_ind', 'integer')
|
if not InRange(temp, 1, 5) then temp = 3 end
|
||||||
--if not InRange(temp, 1, 5) then temp = 3 end
|
|
||||||
GUI.Target.depth = dt.new_widget('combobox'){
|
GUI.Target.depth = dt.new_widget('combobox'){
|
||||||
label = _('bit depth'),
|
label = _('bit depth'),
|
||||||
tooltip = _('bit depth of the enfused file'),
|
tooltip = _('bit depth of the enfused file'),
|
||||||
selected = 1,
|
selected = temp,
|
||||||
'8','16','32','r32','r64',
|
'8','16','32','r32','r64',
|
||||||
changed_callback = function(self)
|
changed_callback = function(self)
|
||||||
dt.preferences.write(mod, 'active_depth', 'string', self.value)
|
dt.preferences.write(mod, 'active_depth', 'string', self.value)
|
||||||
@@ -921,13 +835,12 @@ GUI.Target.depth = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_depth_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_depth_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.Target.depth, dt.preferences.read(mod, 'active_depth', 'string'))
|
|
||||||
local label_directory = dt.new_widget('label'){
|
local label_directory = dt.new_widget('label'){
|
||||||
label = _('directory'),
|
label = _('directory'),
|
||||||
ellipsize = 'start',
|
ellipsize = 'start',
|
||||||
halign = 'start'
|
halign = 'start'
|
||||||
}
|
}
|
||||||
local temp = dt.preferences.read(mod, 'active_output_directory', 'string')
|
temp = dt.preferences.read(mod, 'active_output_directory', 'string')
|
||||||
if temp == '' or temp == nil then temp = dt.collection[1].path end
|
if temp == '' or temp == nil then temp = dt.collection[1].path end
|
||||||
GUI.Target.output_directory = dt.new_widget('file_chooser_button'){
|
GUI.Target.output_directory = dt.new_widget('file_chooser_button'){
|
||||||
title = 'Select export path',
|
title = 'Select export path',
|
||||||
@@ -943,8 +856,8 @@ GUI.Target.source_location = dt.new_widget('check_button'){
|
|||||||
clicked_callback = function(self) dt.preferences.write(mod, 'active_source_location', 'bool', self.value) end,
|
clicked_callback = function(self) dt.preferences.write(mod, 'active_source_location', 'bool', self.value) end,
|
||||||
reset_callback = function(self) self.value = true end
|
reset_callback = function(self) self.value = true end
|
||||||
}
|
}
|
||||||
--temp = dt.preferences.read(mod, 'active_on_conflict_ind', 'integer')
|
temp = dt.preferences.read(mod, 'active_on_conflict_ind', 'integer')
|
||||||
--if not InRange(temp, 1, 2) then temp = 1 end
|
if not InRange(temp, 1, 2) then temp = 1 end
|
||||||
GUI.Target.on_conflict = dt.new_widget('combobox'){
|
GUI.Target.on_conflict = dt.new_widget('combobox'){
|
||||||
label = _('on conflict'),
|
label = _('on conflict'),
|
||||||
selected = 1,
|
selected = 1,
|
||||||
@@ -959,7 +872,6 @@ GUI.Target.on_conflict = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_on_conflict_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_on_conflict_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.Target.on_conflict, dt.preferences.read(mod, 'active_on_conflict', 'string'))
|
|
||||||
GUI.Target.auto_import = dt.new_widget('check_button'){
|
GUI.Target.auto_import = dt.new_widget('check_button'){
|
||||||
label = _('auto import'),
|
label = _('auto import'),
|
||||||
value = dt.preferences.read(mod, 'active_auto_import', 'bool'),
|
value = dt.preferences.read(mod, 'active_auto_import', 'bool'),
|
||||||
@@ -972,7 +884,7 @@ GUI.Target.auto_import = dt.new_widget('check_button'){
|
|||||||
end,
|
end,
|
||||||
reset_callback = function(self) self.value = true end
|
reset_callback = function(self) self.value = true end
|
||||||
}
|
}
|
||||||
--temp = dt.preferences.read(mod, 'active_apply_style_ind', 'integer')
|
temp = dt.preferences.read(mod, 'active_apply_style_ind', 'integer')
|
||||||
GUI.Target.apply_style = dt.new_widget('combobox'){
|
GUI.Target.apply_style = dt.new_widget('combobox'){
|
||||||
label = _('Apply Style on Import'),
|
label = _('Apply Style on Import'),
|
||||||
tooltip = _('Apply selected style on auto-import to newly created blended image'),
|
tooltip = _('Apply selected style on auto-import to newly created blended image'),
|
||||||
@@ -991,7 +903,8 @@ GUI.Target.apply_style = dt.new_widget('combobox'){
|
|||||||
for k=1, (styles_count-1) do
|
for k=1, (styles_count-1) do
|
||||||
GUI.Target.apply_style[k+1] = styles[k].name
|
GUI.Target.apply_style[k+1] = styles[k].name
|
||||||
end
|
end
|
||||||
update_combobox_selected(GUI.Target.apply_style, dt.preferences.read(mod, 'active_apply_style', 'string'))
|
if not InRange(temp, 1, styles_count) then temp = 1 end
|
||||||
|
GUI.Target.apply_style.selected = temp
|
||||||
GUI.Target.copy_tags = dt.new_widget('check_button'){
|
GUI.Target.copy_tags = dt.new_widget('check_button'){
|
||||||
label = _('copy tags'),
|
label = _('copy tags'),
|
||||||
value = dt.preferences.read(mod, 'active_copy_tags', 'bool'),
|
value = dt.preferences.read(mod, 'active_copy_tags', 'bool'),
|
||||||
@@ -1007,9 +920,8 @@ GUI.Target.add_tags = dt.new_widget('entry'){
|
|||||||
placeholder = 'Enter tags, seperated by commas',
|
placeholder = 'Enter tags, seperated by commas',
|
||||||
editable = true
|
editable = true
|
||||||
}
|
}
|
||||||
dt.print_log("past GUI.Target")
|
temp = dt.preferences.read(mod, 'active_current_preset_ind', 'integer')
|
||||||
--temp = dt.preferences.read(mod, 'active_current_preset_ind', 'integer')
|
if not InRange(temp, 1, 6) then temp = 1 end
|
||||||
--if not InRange(temp, 1, 6) then temp = 1 end
|
|
||||||
GUI.Presets.current_preset = dt.new_widget('combobox'){
|
GUI.Presets.current_preset = dt.new_widget('combobox'){
|
||||||
label = _('active preset'),
|
label = _('active preset'),
|
||||||
tooltip = _('preset to be loaded from or saved to'),
|
tooltip = _('preset to be loaded from or saved to'),
|
||||||
@@ -1025,7 +937,6 @@ GUI.Presets.current_preset = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_current_preset_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_current_preset_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.Presets.current_preset, dt.preferences.read(mod, 'active_current_preset', 'string'))
|
|
||||||
GUI.Presets.load = dt.new_widget('button'){
|
GUI.Presets.load = dt.new_widget('button'){
|
||||||
label = _('laod fusion preset'),
|
label = _('laod fusion preset'),
|
||||||
tooltip = _('load current fusion parameters from selected preset'),
|
tooltip = _('load current fusion parameters from selected preset'),
|
||||||
@@ -1053,8 +964,8 @@ GUI.Presets.variants = dt.new_widget('check_button'){
|
|||||||
end,
|
end,
|
||||||
reset_callback = function(self) self.value = false end
|
reset_callback = function(self) self.value = false end
|
||||||
}
|
}
|
||||||
--temp = dt.preferences.read(mod, 'active_variants_type_ind', 'integer')
|
temp = dt.preferences.read(mod, 'active_variants_type_ind', 'integer')
|
||||||
--if not InRange(temp, 1, 2) then temp = 1 end
|
if not InRange(temp, 1, 2) then temp = 1 end
|
||||||
GUI.Presets.variants_type = dt.new_widget('combobox'){
|
GUI.Presets.variants_type = dt.new_widget('combobox'){
|
||||||
label = _('create variants type'),
|
label = _('create variants type'),
|
||||||
tooltip = _('preset type to be used when creating image variants'),
|
tooltip = _('preset type to be used when creating image variants'),
|
||||||
@@ -1070,9 +981,8 @@ GUI.Presets.variants_type = dt.new_widget('combobox'){
|
|||||||
dt.preferences.write(mod, 'active_variants_type_ind', 'integer', self.selected)
|
dt.preferences.write(mod, 'active_variants_type_ind', 'integer', self.selected)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
update_combobox_selected(GUI.Presets.variants_type, dt.preferences.read(mod, 'active_variants_type', 'string'))
|
|
||||||
GUI.Presets.variants_type.sensitive = GUI.Presets.variants.value
|
GUI.Presets.variants_type.sensitive = GUI.Presets.variants.value
|
||||||
--[[temp = df.get_executable_path_preference(AIS.name)
|
temp = df.get_executable_path_preference(AIS.name)
|
||||||
GUI.exes.align_image_stack = dt.new_widget('file_chooser_button'){
|
GUI.exes.align_image_stack = dt.new_widget('file_chooser_button'){
|
||||||
title = 'AIS binary path',
|
title = 'AIS binary path',
|
||||||
value = temp,
|
value = temp,
|
||||||
@@ -1095,13 +1005,12 @@ GUI.exes.exiftool = dt.new_widget('file_chooser_button'){
|
|||||||
tooltip = temp,
|
tooltip = temp,
|
||||||
is_directory = false,
|
is_directory = false,
|
||||||
changed_callback = function(self) self.tooltip = self.value end
|
changed_callback = function(self) self.tooltip = self.value end
|
||||||
} ]]
|
}
|
||||||
GUI.exes.update = dt.new_widget('button'){
|
GUI.exes.update = dt.new_widget('button'){
|
||||||
label = _('update'),
|
label = _('update'),
|
||||||
tooltip = _('update the binary paths with current values'),
|
tooltip = _('update the binary paths with current values'),
|
||||||
clicked_callback = function() ExeUpdate({AIS,ENF,EXF}) end
|
clicked_callback = function() ExeUpdate({AIS,ENF,EXF}) end
|
||||||
}
|
}
|
||||||
dt.print_log("past GUI.Presets")
|
|
||||||
temp = GUI.Target.format.value
|
temp = GUI.Target.format.value
|
||||||
if temp == 'tif' then temp = 1
|
if temp == 'tif' then temp = 1
|
||||||
elseif temp == 'jpg' then temp = 2
|
elseif temp == 'jpg' then temp = 2
|
||||||
@@ -1166,10 +1075,9 @@ local box_Target = dt.new_widget('box'){
|
|||||||
}
|
}
|
||||||
local box_exes = dt.new_widget('box'){
|
local box_exes = dt.new_widget('box'){
|
||||||
orientation = 'vertical',
|
orientation = 'vertical',
|
||||||
--[[GUI.exes.align_image_stack,
|
GUI.exes.align_image_stack,
|
||||||
GUI.exes.enfuse,
|
GUI.exes.enfuse,
|
||||||
GUI.exes.exiftool,]]
|
GUI.exes.exiftool,
|
||||||
df.executable_path_widget({"align_image_stack","enfuse","exiftool"}),
|
|
||||||
GUI.exes.update
|
GUI.exes.update
|
||||||
}
|
}
|
||||||
GUI.options_contain = dt.new_widget('stack'){
|
GUI.options_contain = dt.new_widget('stack'){
|
||||||
@@ -1217,5 +1125,3 @@ else
|
|||||||
GUI.options_contain.active = 4
|
GUI.options_contain.active = 4
|
||||||
GUI.show_options.sensitive = false
|
GUI.show_options.sensitive = false
|
||||||
end
|
end
|
||||||
|
|
||||||
dt.preferences.write(mod, "initialized", "bool", true)
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ dtutils_file.libdoc.functions["check_if_bin_exists"] = {
|
|||||||
quoted and returned. If no preference is specified and the operating system is
|
quoted and returned. If no preference is specified and the operating system is
|
||||||
linux then the which command is used to check for a binary in the path. If found
|
linux then the which command is used to check for a binary in the path. If found
|
||||||
that path is returned. If no binary is found, false is returned.]],
|
that path is returned. If no binary is found, false is returned.]],
|
||||||
Return_Value = [[result - string - the sanitized path of the binary, false if not found]],
|
Return_Value = [[result - string - the path of the binary, false if not found]],
|
||||||
Limitations = [[]],
|
Limitations = [[]],
|
||||||
Example = [[]],
|
Example = [[]],
|
||||||
See_Also = [[]],
|
See_Also = [[]],
|
||||||
@@ -70,9 +70,9 @@ function dtutils_file.check_if_bin_exists(bin)
|
|||||||
if string.len(path) > 0 then
|
if string.len(path) > 0 then
|
||||||
if dtutils_file.check_if_file_exists(path) then
|
if dtutils_file.check_if_file_exists(path) then
|
||||||
if (string.match(path, ".exe$") or string.match(path, ".EXE$")) and dt.configuration.running_os ~= "windows" then
|
if (string.match(path, ".exe$") or string.match(path, ".EXE$")) and dt.configuration.running_os ~= "windows" then
|
||||||
result = dtutils_file.sanitize_filename("wine " .. path)
|
result = "wine " .. "\"" .. path .. "\""
|
||||||
else
|
else
|
||||||
result = dtutils_file.sanitize_filename(path)
|
result = "\"" .. path .. "\""
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif dt.configuration.running_os == "linux" then
|
elseif dt.configuration.running_os == "linux" then
|
||||||
@@ -80,7 +80,7 @@ function dtutils_file.check_if_bin_exists(bin)
|
|||||||
local output = p:read("*a")
|
local output = p:read("*a")
|
||||||
p:close()
|
p:close()
|
||||||
if string.len(output) > 0 then
|
if string.len(output) > 0 then
|
||||||
result = dtutils_file.sanitize_filename(output:sub(1,-2))
|
result = output:sub(1,-2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return result
|
return result
|
||||||
@@ -107,14 +107,9 @@ dtutils_file.libdoc.functions["split_filepath"] = {
|
|||||||
function dtutils_file.split_filepath(str)
|
function dtutils_file.split_filepath(str)
|
||||||
-- strip out single quotes from quoted pathnames
|
-- strip out single quotes from quoted pathnames
|
||||||
str = string.gsub(str, "'", "")
|
str = string.gsub(str, "'", "")
|
||||||
str = string.gsub(str, '"', '')
|
|
||||||
local result = {}
|
local result = {}
|
||||||
-- Thank you Tobias Jakobs for the awesome regular expression, which I tweaked a little
|
-- Thank you Tobias Jakobs for the awesome regular expression, which I tweaked a little
|
||||||
result["path"], result["filename"], result["basename"], result["filetype"] = string.match(str, "(.-)(([^\\/]-)%.?([^%.\\/]*))$")
|
result["path"], result["filename"], result["basename"], result["filetype"] = string.match(str, "(.-)(([^\\/]-)%.?([^%.\\/]*))$")
|
||||||
if result["basename"] == "" and result["filetype"]:len() > 1 then
|
|
||||||
result["basename"] = result["filetype"]
|
|
||||||
result["filetype"] = ""
|
|
||||||
end
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -227,21 +222,15 @@ dtutils_file.libdoc.functions["check_if_file_exists"] = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function dtutils_file.check_if_file_exists(filepath)
|
function dtutils_file.check_if_file_exists(filepath)
|
||||||
local result = false
|
local result
|
||||||
if (dt.configuration.running_os == 'windows') then
|
if (dt.configuration.running_os == 'windows') then
|
||||||
filepath = string.gsub(filepath, '[\\/]+', '\\')
|
filepath = string.gsub(filepath, '[\\/]+', '\\')
|
||||||
local p = io.popen("if exist " .. filepath .. " (echo 'yes') else (echo 'no')")
|
result = os.execute('if exist "'..filepath..'" (cmd /c exit 0) else (cmd /c exit 1)')
|
||||||
local ans = p:read("*all")
|
if not result then
|
||||||
p:close()
|
result = false
|
||||||
if string.match(ans, "yes") then
|
|
||||||
result = true
|
|
||||||
end
|
end
|
||||||
-- result = os.execute('if exist "'..filepath..'" (cmd /c exit 0) else (cmd /c exit 1)')
|
|
||||||
-- if not result then
|
|
||||||
-- result = false
|
|
||||||
-- end
|
|
||||||
elseif (dt.configuration.running_os == "linux") then
|
elseif (dt.configuration.running_os == "linux") then
|
||||||
result = os.execute('test -e ' .. dtutils_file.sanitize_filename(filepath))
|
result = os.execute('test -e ' .. "\"" .. filepath .. "\"")
|
||||||
if not result then
|
if not result then
|
||||||
result = false
|
result = false
|
||||||
end
|
end
|
||||||
@@ -277,11 +266,7 @@ dtutils_file.libdoc.functions["chop_filetype"] = {
|
|||||||
|
|
||||||
function dtutils_file.chop_filetype(path)
|
function dtutils_file.chop_filetype(path)
|
||||||
local length = dtutils_file.get_filetype(path):len() + 2
|
local length = dtutils_file.get_filetype(path):len() + 2
|
||||||
if length > 2 then
|
return string.sub(path, 1, -length)
|
||||||
return string.sub(path, 1, -length)
|
|
||||||
else
|
|
||||||
return path
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
dtutils_file.libdoc.functions["file_copy"] = {
|
dtutils_file.libdoc.functions["file_copy"] = {
|
||||||
@@ -388,7 +373,7 @@ dtutils_file.libdoc.functions["filename_increment"] = {
|
|||||||
"01" is added to the basename. If the filename already has an increment, then
|
"01" is added to the basename. If the filename already has an increment, then
|
||||||
1 is added to it and the filename returned.]],
|
1 is added to it and the filename returned.]],
|
||||||
Return_Value = [[result - string - the incremented filename]],
|
Return_Value = [[result - string - the incremented filename]],
|
||||||
Limitations = [[The filename will be incremented to 99]],
|
Limitations = [[]],
|
||||||
Example = [[]],
|
Example = [[]],
|
||||||
See_Also = [[]],
|
See_Also = [[]],
|
||||||
Reference = [[]],
|
Reference = [[]],
|
||||||
@@ -411,9 +396,6 @@ function dtutils_file.filename_increment(filepath)
|
|||||||
if string.len(increment) > 2 then
|
if string.len(increment) > 2 then
|
||||||
-- we got the filename so set the increment to 01
|
-- we got the filename so set the increment to 01
|
||||||
increment = "01"
|
increment = "01"
|
||||||
elseif increment == "99" then
|
|
||||||
dt.print_error("not incrementing, filename has already been incremented 99 times.")
|
|
||||||
return filepath
|
|
||||||
else
|
else
|
||||||
increment = string.format("%02d", tonumber(increment) + 1)
|
increment = string.format("%02d", tonumber(increment) + 1)
|
||||||
basename = string.gsub(basename, "_(%d-)$", "")
|
basename = string.gsub(basename, "_(%d-)$", "")
|
||||||
@@ -451,9 +433,8 @@ function dtutils_file.create_unique_filename(filepath)
|
|||||||
while dtutils_file.check_if_file_exists(filepath) do
|
while dtutils_file.check_if_file_exists(filepath) do
|
||||||
filepath = dtutils_file.filename_increment(filepath)
|
filepath = dtutils_file.filename_increment(filepath)
|
||||||
-- limit to 99 more exports of the original export
|
-- limit to 99 more exports of the original export
|
||||||
local increment = string.match(dtutils_file.get_basename(filepath), "_(%d-)$")
|
if string.match(dtutils_file.get_basename(filepath), "_(d-)$") == "99" then
|
||||||
if increment == "99" then
|
break
|
||||||
break
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return filepath
|
return filepath
|
||||||
@@ -595,7 +576,6 @@ dtutils_file.libdoc.functions["mkdir"] = {
|
|||||||
License = [[]],
|
License = [[]],
|
||||||
Copyright = [[]],
|
Copyright = [[]],
|
||||||
}
|
}
|
||||||
|
|
||||||
function dtutils_file.mkdir(path)
|
function dtutils_file.mkdir(path)
|
||||||
if not dtutils_file.check_if_file_exists(path) then
|
if not dtutils_file.check_if_file_exists(path) then
|
||||||
local mkdir_cmd = dt.configuration.running_os == "windows" and "mkdir" or "mkdir -p"
|
local mkdir_cmd = dt.configuration.running_os == "windows" and "mkdir" or "mkdir -p"
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ dtutils_string.libdoc.functions["urlencode"] = {
|
|||||||
function dtutils_string.urlencode(str)
|
function dtutils_string.urlencode(str)
|
||||||
if (str) then
|
if (str) then
|
||||||
str = string.gsub (str, "\n", "\r\n")
|
str = string.gsub (str, "\n", "\r\n")
|
||||||
str = string.gsub (str, "([^%w ])", function (c) return string.format ("%%%02X", string.byte(c)) end)
|
str = string.gsub (str, "([^%w ])", function () return string.format ("%%%02X", string.byte()) end)
|
||||||
str = string.gsub (str, " ", "+")
|
str = string.gsub (str, " ", "+")
|
||||||
end
|
end
|
||||||
return str
|
return str
|
||||||
@@ -194,41 +194,14 @@ dtutils_string.libdoc.functions["sanitize"] = {
|
|||||||
|
|
||||||
function dtutils_string.sanitize(str)
|
function dtutils_string.sanitize(str)
|
||||||
local result = ""
|
local result = ""
|
||||||
local os_quote = dt.configuration.running_os == "windows" and '"' or "'"
|
|
||||||
|
|
||||||
if dtutils_string.is_not_sanitized(str) then
|
if dt.configuration.running_os == "windows" then
|
||||||
result = os_quote .. str .. os_quote
|
result = '"' .. str .. '"'
|
||||||
|
else
|
||||||
|
result = "'" .. str .. "'"
|
||||||
end
|
end
|
||||||
|
|
||||||
return result
|
return result
|
||||||
end
|
end
|
||||||
|
|
||||||
dtutils_string.libdoc.functions["is_not_sanitized"] = {
|
|
||||||
Name = [[is_not_sanitized]],
|
|
||||||
Synopsis = [[Check if a string has been sanitized]],
|
|
||||||
Usage = [[local ds = require "lib/dtutils.string"
|
|
||||||
local result = ds.is_not_sanitized(str)
|
|
||||||
str - string - the string that needs to be made safe]],
|
|
||||||
Description = [[is_not_sanitized checks a string to see if it
|
|
||||||
has been made safe use passing as an argument in a system command.]],
|
|
||||||
Return_Value = [[result - boolean - true if the string is not sanitized otherwise false]],
|
|
||||||
Limitations = [[]],
|
|
||||||
Example = [[]],
|
|
||||||
See_Also = [[]],
|
|
||||||
Reference = [[]],
|
|
||||||
License = [[]],
|
|
||||||
Copyright = [[]],
|
|
||||||
}
|
|
||||||
|
|
||||||
function dtutils_string.is_not_sanitized(str)
|
|
||||||
local os_quote = dt.configuration.running_os == "windows" and '"' or "'"
|
|
||||||
|
|
||||||
if string.match(str, os_quote .. ".*" .. os_quote) then
|
|
||||||
return false
|
|
||||||
else
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
return dtutils_string
|
return dtutils_string
|
||||||
|
|||||||
Reference in New Issue
Block a user