[API 7.0.0 compatibility] Made changes to take advantage of the latest API changes
including the ability to start and stop most scripts.
This commit is contained in:
@@ -37,14 +37,29 @@ selected images, the other button performs grouping on the entire active collect
|
||||
]]
|
||||
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("7.0.0", "AutoGrouper")
|
||||
|
||||
dt.print_log("hiding styles")
|
||||
dt.gui.libs["styles"].visible = false
|
||||
|
||||
local MOD = 'autogrouper'
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local gettext = dt.gettext
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
local CURR_API_STRING = dt.configuration_api_version_string
|
||||
gettext.bindtextdomain("AutoGrouper",dt.configuration.config_dir.."/lua/locale/")
|
||||
|
||||
local function _(msgid)
|
||||
return gettext.dgettext("AutoGrouper", msgid)
|
||||
return gettext.dgettext("AutoGrouper", msgid)
|
||||
end
|
||||
|
||||
local Ag = {}
|
||||
@@ -52,123 +67,134 @@ Ag.module_installed = false
|
||||
Ag.event_registered = false
|
||||
|
||||
local GUI = {
|
||||
gap = {},
|
||||
selected = {},
|
||||
collection = {}
|
||||
gap = {},
|
||||
selected = {},
|
||||
collection = {}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
if test >= low and test <= high then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
local function CompTime(first, second) --compares the timestamps and returns true if first was taken before second
|
||||
first_time = first.exif_datetime_taken
|
||||
if string.match(first_time, '[0-9]') == nil then first_time = '9999:99:99 99:99:99' end
|
||||
first_time = tonumber(string.gsub(first_time, '[^0-9]*',''))
|
||||
second_time = second.exif_datetime_taken
|
||||
if string.match(second_time, '[0-9]') == nil then second_time = '9999:99:99 99:99:99' end
|
||||
second_time = tonumber(string.gsub(second_time, '[^0-9]*',''))
|
||||
return first_time < second_time
|
||||
first_time = first.exif_datetime_taken
|
||||
if string.match(first_time, '[0-9]') == nil then first_time = '9999:99:99 99:99:99' end
|
||||
first_time = tonumber(string.gsub(first_time, '[^0-9]*',''))
|
||||
second_time = second.exif_datetime_taken
|
||||
if string.match(second_time, '[0-9]') == nil then second_time = '9999:99:99 99:99:99' end
|
||||
second_time = tonumber(string.gsub(second_time, '[^0-9]*',''))
|
||||
return first_time < second_time
|
||||
end
|
||||
|
||||
local function SeperateTime(str) --seperates the timestamp into individual components for used with OS.time operations
|
||||
local cleaned = string.gsub(str, '[^%d]',':')
|
||||
cleaned = string.gsub(cleaned, '::*',':') --YYYY:MM:DD:hh:mm:ss
|
||||
local year = string.sub(cleaned,1,4)
|
||||
local month = string.sub(cleaned,6,7)
|
||||
local day = string.sub(cleaned,9,10)
|
||||
local hour = string.sub(cleaned,12,13)
|
||||
local min = string.sub(cleaned,15,16)
|
||||
local sec = string.sub(cleaned,18,19)
|
||||
return {year = year, month = month, day = day, hour = hour, min = min, sec = sec}
|
||||
local cleaned = string.gsub(str, '[^%d]',':')
|
||||
cleaned = string.gsub(cleaned, '::*',':') --YYYY:MM:DD:hh:mm:ss
|
||||
local year = string.sub(cleaned,1,4)
|
||||
local month = string.sub(cleaned,6,7)
|
||||
local day = string.sub(cleaned,9,10)
|
||||
local hour = string.sub(cleaned,12,13)
|
||||
local min = string.sub(cleaned,15,16)
|
||||
local sec = string.sub(cleaned,18,19)
|
||||
return {year = year, month = month, day = day, hour = hour, min = min, sec = sec}
|
||||
end
|
||||
|
||||
local function GetTimeDiff(curr_image, prev_image) --returns the time difference (in sec.) from current image and the previous image
|
||||
local curr_time = SeperateTime(curr_image.exif_datetime_taken)
|
||||
local prev_time = SeperateTime(prev_image.exif_datetime_taken)
|
||||
return os.time(curr_time)-os.time(prev_time)
|
||||
local curr_time = SeperateTime(curr_image.exif_datetime_taken)
|
||||
local prev_time = SeperateTime(prev_image.exif_datetime_taken)
|
||||
return os.time(curr_time)-os.time(prev_time)
|
||||
end
|
||||
|
||||
local function main(on_collection)
|
||||
local images = {}
|
||||
if on_collection then
|
||||
local col_images = dt.collection
|
||||
for i,image in ipairs(col_images) do --copy images to a standard table, table.sort barfs on type dt_lua_singleton_image_collection
|
||||
table.insert(images,i,image)
|
||||
end
|
||||
else
|
||||
images = dt.gui.selection()
|
||||
local images = {}
|
||||
if on_collection then
|
||||
local col_images = dt.collection
|
||||
for i,image in ipairs(col_images) do --copy images to a standard table, table.sort barfs on type dt_lua_singleton_image_collection
|
||||
table.insert(images,i,image)
|
||||
end
|
||||
dt.preferences.write(MOD, 'active_gap', 'integer', GUI.gap.value)
|
||||
if #images < 2 then
|
||||
dt.print('please select at least 2 images')
|
||||
return
|
||||
end
|
||||
table.sort(images, function(first, second) return CompTime(first,second) end) --sort images by timestamp
|
||||
|
||||
for i, image in ipairs(images) do
|
||||
if i == 1 then
|
||||
prev_image = image
|
||||
elseif string.match(image.exif_datetime_taken, '[%d]') ~= nil then --make sure current image has a timestamp, if so check if it is within the user specified gap value and add to group
|
||||
local curr_image = image
|
||||
if GetTimeDiff(curr_image, prev_image) <= GUI.gap.value then
|
||||
images[i]:group_with(images[i-1])
|
||||
end
|
||||
prev_image = curr_image
|
||||
end
|
||||
else
|
||||
images = dt.gui.selection()
|
||||
end
|
||||
dt.preferences.write(MOD, 'active_gap', 'integer', GUI.gap.value)
|
||||
if #images < 2 then
|
||||
dt.print('please select at least 2 images')
|
||||
return
|
||||
end
|
||||
table.sort(images, function(first, second) return CompTime(first,second) end) --sort images by timestamp
|
||||
|
||||
for i, image in ipairs(images) do
|
||||
if i == 1 then
|
||||
prev_image = image
|
||||
elseif string.match(image.exif_datetime_taken, '[%d]') ~= nil then --make sure current image has a timestamp, if so check if it is within the user specified gap value and add to group
|
||||
local curr_image = image
|
||||
if GetTimeDiff(curr_image, prev_image) <= GUI.gap.value then
|
||||
images[i]:group_with(images[i-1])
|
||||
end
|
||||
prev_image = curr_image
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function install_module()
|
||||
if not Ag.module_installed then
|
||||
dt.print_log("installing module")
|
||||
dt.register_lib(
|
||||
'AutoGroup_Lib', -- Module name
|
||||
_('auto group'), -- name
|
||||
true, -- expandable
|
||||
true, -- resetable
|
||||
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 99}}, -- containers
|
||||
dt.new_widget("box"){
|
||||
orientation = "vertical",
|
||||
GUI.gap,
|
||||
GUI.selected,
|
||||
GUI.collection
|
||||
}
|
||||
MOD, -- Module name
|
||||
_('auto group'), -- name
|
||||
true, -- expandable
|
||||
true, -- resetable
|
||||
{[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 99}}, -- containers
|
||||
dt.new_widget("box"){
|
||||
orientation = "vertical",
|
||||
GUI.gap,
|
||||
GUI.selected,
|
||||
GUI.collection
|
||||
}
|
||||
)
|
||||
Ag.module_installed = true
|
||||
dt.print_log("module installed")
|
||||
dt.print_log("styles module visibility is " .. tostring(dt.gui.libs["styles"].visible))
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs[MOD].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs[MOD].visible = true
|
||||
end
|
||||
|
||||
-- GUI --
|
||||
temp = dt.preferences.read(MOD, 'active_gap', 'integer')
|
||||
if not InRange(temp, 1, 86400) then temp = 3 end
|
||||
GUI.gap = dt.new_widget('slider'){
|
||||
label = _('group gap [sec.]'),
|
||||
tooltip = _('minimum gap, in seconds, between groups'),
|
||||
soft_min = 1,
|
||||
soft_max = 60,
|
||||
hard_min = 1,
|
||||
hard_max = 86400,
|
||||
step = 1,
|
||||
digits = 0,
|
||||
value = temp,
|
||||
reset_callback = function(self)
|
||||
self.value = 3
|
||||
end
|
||||
label = _('group gap [sec.]'),
|
||||
tooltip = _('minimum gap, in seconds, between groups'),
|
||||
soft_min = 1,
|
||||
soft_max = 60,
|
||||
hard_min = 1,
|
||||
hard_max = 86400,
|
||||
step = 1,
|
||||
digits = 0,
|
||||
value = temp,
|
||||
reset_callback = function(self)
|
||||
self.value = 3
|
||||
end
|
||||
}
|
||||
GUI.selected = dt.new_widget("button"){
|
||||
label = _('auto group: selected'),
|
||||
tooltip =_('auto group selected images'),
|
||||
clicked_callback = function() main(false) end
|
||||
label = _('auto group: selected'),
|
||||
tooltip =_('auto group selected images'),
|
||||
clicked_callback = function() main(false) end
|
||||
}
|
||||
GUI.collection = dt.new_widget("button"){
|
||||
label = _('auto group: collection'),
|
||||
tooltip =_('auto group the entire collection'),
|
||||
clicked_callback = function() main(true) end
|
||||
label = _('auto group: collection'),
|
||||
tooltip =_('auto group the entire collection'),
|
||||
clicked_callback = function() main(true) end
|
||||
}
|
||||
|
||||
if dt.gui.current_view().id == "lighttable" then
|
||||
@@ -176,14 +202,20 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not Ag.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
end
|
||||
end
|
||||
)
|
||||
Ag.event_registered = true
|
||||
"AutoGrouper", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
end
|
||||
end
|
||||
)
|
||||
Ag.event_registered = true
|
||||
end
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.restart = restart
|
||||
script_data.show = restart
|
||||
|
||||
return script_data
|
||||
@@ -46,6 +46,7 @@ In the "Selected Images" module click on "Collect on this Image"
|
||||
]]
|
||||
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local gettext = dt.gettext
|
||||
local previous = nil
|
||||
local all_active = false
|
||||
@@ -53,7 +54,15 @@ local all_active = false
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("CollectHelper",dt.configuration.config_dir.."/lua/locale/")
|
||||
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "CollectHelper")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local function _(msgid)
|
||||
return gettext.dgettext("CollectHelper", msgid)
|
||||
@@ -67,6 +76,7 @@ local function CheckSingleImage(selection)
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
local function CheckHasColorLabel(selection)
|
||||
local ret = false
|
||||
for _,image in pairs(selection) do
|
||||
@@ -83,6 +93,7 @@ local function PreviousCollection()
|
||||
previous = dt.gui.libs.collect.filter(previous)
|
||||
end
|
||||
end
|
||||
|
||||
local function CollectOnFolder(all_rules, all_active)
|
||||
local images = dt.gui.selection()
|
||||
if CheckSingleImage(images) then
|
||||
@@ -103,6 +114,7 @@ local function CollectOnFolder(all_rules, all_active)
|
||||
previous = dt.gui.libs.collect.filter(rules)
|
||||
end
|
||||
end
|
||||
|
||||
local function CollectOnColors(all_rules, all_active)
|
||||
local images = dt.gui.selection()
|
||||
if CheckSingleImage(images) then
|
||||
@@ -159,6 +171,7 @@ local function CollectOnColors(all_rules, all_active)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function CollectOnAll_AND()
|
||||
local images = dt.gui.selection()
|
||||
if CheckSingleImage(images) then
|
||||
@@ -174,29 +187,42 @@ local function CollectOnAll_AND()
|
||||
previous = dt.gui.libs.collect.filter(rules)
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs.image.destroy_action("CollectHelper_prev")
|
||||
if dt.preferences.read('module_CollectHelper','folder','bool') then
|
||||
dt.gui.libs.image.destroy_action("CollectHelper_folder")
|
||||
end
|
||||
if dt.preferences.read('module_CollectHelper','colors','bool') then
|
||||
dt.gui.libs.image.destroy_action("CollectHelper_labels")
|
||||
end
|
||||
if dt.preferences.read('module_CollectHelper','all_and','bool') then
|
||||
dt.gui.libs.image.destroy_action("CollectHelper_and")
|
||||
end
|
||||
end
|
||||
|
||||
-- GUI --
|
||||
dt.gui.libs.image.register_action(
|
||||
_("collect: previous"),
|
||||
"CollectHelper_prev", _("collect: previous"),
|
||||
function() PreviousCollection() end,
|
||||
_("Sets the Collect parameters to be the previously active parameters")
|
||||
)
|
||||
if dt.preferences.read('module_CollectHelper','folder','bool') then
|
||||
dt.gui.libs.image.register_action(
|
||||
_("collect: folder"),
|
||||
dt.gui.libs.image.register_action(
|
||||
"CollectHelper_folder", _("collect: folder"),
|
||||
function() CollectOnFolder(_ , false) end,
|
||||
_("Sets the Collect parameters to be the selected images's folder")
|
||||
)
|
||||
end
|
||||
if dt.preferences.read('module_CollectHelper','colors','bool') then
|
||||
dt.gui.libs.image.register_action(
|
||||
_("collect: color label(s)"),
|
||||
dt.gui.libs.image.register_action(
|
||||
"CollectHelper_labels", _("collect: color label(s)"),
|
||||
function() CollectOnColors(_ , false) end,
|
||||
_("Sets the Collect parameters to be the selected images's color label(s)")
|
||||
)
|
||||
end
|
||||
if dt.preferences.read('module_CollectHelper','all_and','bool') then
|
||||
dt.gui.libs.image.register_action(
|
||||
_("collect: all (AND)"),
|
||||
dt.gui.libs.image.register_action(
|
||||
"CollectHelper_and", _("collect: all (AND)"),
|
||||
function() CollectOnAll_AND() end,
|
||||
_("Sets the Collect parameters based on all activated CollectHelper options")
|
||||
)
|
||||
@@ -206,7 +232,7 @@ end
|
||||
dt.preferences.register("module_CollectHelper", "all_and", -- name
|
||||
"bool", -- type
|
||||
_('CollectHelper: All'), -- label
|
||||
_('Will create a collect parameter set that utelizes all enabled CollectHelper types (AND)'), -- tooltip
|
||||
_('Will create a collect parameter set that utilizes all enabled CollectHelper types (AND)'), -- tooltip
|
||||
true -- default
|
||||
)
|
||||
dt.preferences.register("module_CollectHelper", "colors", -- name
|
||||
@@ -221,3 +247,7 @@ dt.preferences.register("module_CollectHelper", "folder", -- name
|
||||
_('Enable the button that allows you to swap to a collection based on selected image\'s FOLDER location'), -- tooltip
|
||||
true -- default
|
||||
)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -45,9 +45,21 @@ Select a style, whether you want tags to be copied from the original, and any ad
|
||||
]]
|
||||
|
||||
local dt = require 'darktable'
|
||||
local du = require "lib/dtutils"
|
||||
local df = require 'lib/dtutils.file'
|
||||
|
||||
local dsys = require 'lib/dtutils.system'
|
||||
|
||||
du.check_min_api_version("7.0.0", "HDRmerge")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
|
||||
local mod = 'module_HDRMerge'
|
||||
local os_path_seperator = '/'
|
||||
if dt.configuration.running_os == 'windows' then os_path_seperator = '\\' end
|
||||
@@ -287,6 +299,14 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs["HDRMerge_Lib"].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs["HDRMerge_Lib"].visible = true
|
||||
end
|
||||
|
||||
-- GUI Elements --
|
||||
local lbl_hdr = dt.new_widget('section_label'){
|
||||
label = _('HDRMerge options')
|
||||
@@ -439,7 +459,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not HDRM.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
"HDRmerge", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -449,3 +469,10 @@ else
|
||||
HDRM.event_registered = true
|
||||
end
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = restart
|
||||
|
||||
return script_data
|
||||
@@ -50,7 +50,15 @@
|
||||
local darktable = require("darktable")
|
||||
local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("3.0.0", "LabelsToTags")
|
||||
du.check_min_api_version("7.0.0", "LabelsToTags")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Lua 5.3 no longer has "unpack" but "table.unpack"
|
||||
unpack = unpack or table.unpack
|
||||
@@ -60,7 +68,6 @@ ltt.module_installed = false
|
||||
ltt.event_registered = false
|
||||
|
||||
local LIB_ID = "LabelsToTags"
|
||||
local CURR_API_STRING = darktable.configuration.api_version_string
|
||||
|
||||
-- Helper functions: BEGIN
|
||||
|
||||
@@ -144,16 +151,16 @@ local mappingComboBox = darktable.new_widget("combobox"){
|
||||
tooltip = getComboboxTooltip(),
|
||||
reset_callback = function(selfC)
|
||||
if selfC == nil then
|
||||
return
|
||||
return
|
||||
end
|
||||
i = 1
|
||||
for _,m in pairs(keySet(getAvailableMappings())) do
|
||||
selfC[i] = m
|
||||
i = i+1
|
||||
selfC[i] = m
|
||||
i = i+1
|
||||
end
|
||||
n = #selfC
|
||||
for j = i,n do
|
||||
selfC[i] = nil
|
||||
selfC[i] = nil
|
||||
end
|
||||
selfC.value = 1
|
||||
selfC.tooltip = getComboboxTooltip()
|
||||
@@ -172,17 +179,17 @@ local function doTagging(selfC)
|
||||
local tagsToApply = {}
|
||||
local hash = generateLabelHash(img)
|
||||
for k,v in pairs(availableMappings[mappingComboBox.value]) do
|
||||
if hashMatch(hash,k) then
|
||||
for _,tag in ipairs(v) do
|
||||
tagsToApply[tag] = true
|
||||
end
|
||||
end
|
||||
if hashMatch(hash,k) then
|
||||
for _,tag in ipairs(v) do
|
||||
tagsToApply[tag] = true
|
||||
end
|
||||
end
|
||||
end
|
||||
for k,_ in pairs(tagsToApply) do
|
||||
if memoizedTags[k] == nil then
|
||||
memoizedTags[k] = darktable.tags.create(k)
|
||||
end
|
||||
darktable.tags.attach(memoizedTags[k],img)
|
||||
if memoizedTags[k] == nil then
|
||||
memoizedTags[k] = darktable.tags.create(k)
|
||||
end
|
||||
darktable.tags.attach(memoizedTags[k],img)
|
||||
end
|
||||
job.percent = job.percent + pctIncrement
|
||||
end
|
||||
@@ -208,14 +215,14 @@ darktable.register_tag_mapping = function(name, mapping)
|
||||
end
|
||||
for pattern,tags in pairs(mapping) do
|
||||
if string.match(pattern,PATTERN_PATTERN) == nil then
|
||||
darktable.print_error("In tag mapping '" .. name .. "': Pattern '" .. pattern .. "' invalid")
|
||||
return
|
||||
darktable.print_error("In tag mapping '" .. name .. "': Pattern '" .. pattern .. "' invalid")
|
||||
return
|
||||
end
|
||||
for _,tag in ipairs(tags) do
|
||||
if type(tag) ~= "string" then
|
||||
darktable.print_error("In tag mapping '" .. name .. "': All tag mappings must be lists of strings")
|
||||
return
|
||||
end
|
||||
if type(tag) ~= "string" then
|
||||
darktable.print_error("In tag mapping '" .. name .. "': All tag mappings must be lists of strings")
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
availableMappings[name] = mapping
|
||||
@@ -231,6 +238,14 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
darktable.gui.libs[LIB_ID].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
darktable.gui.libs[LIB_ID].visible = true
|
||||
end
|
||||
|
||||
--[[
|
||||
darktable.register_tag_mapping("Example",
|
||||
{ ["+----*"] = { "Red", "Only red" },
|
||||
@@ -248,7 +263,7 @@ if darktable.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not ltt.event_registered then
|
||||
darktable.register_event(
|
||||
"view-changed",
|
||||
LIB_ID, "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -259,3 +274,9 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = restart
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -54,7 +54,15 @@ local dsys = require "lib/dtutils.system"
|
||||
local gettext = dt.gettext
|
||||
|
||||
--Check API version
|
||||
du.check_min_api_version("5.0.0", "OpenInExplorer")
|
||||
du.check_min_api_version("7.0.0", "OpenInExplorer")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("OpenInExplorer",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -65,7 +73,6 @@ end
|
||||
|
||||
local act_os = dt.configuration.running_os
|
||||
local PS = act_os == "windows" and "\\" or "/"
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
--Detect OS and quit if it is not supported.
|
||||
if act_os ~= "macos" and act_os ~= "windows" and act_os ~= "linux" then
|
||||
@@ -181,13 +188,23 @@ local function open_in_fmanager()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs.image.destroy_action("OpenInExplorer")
|
||||
dt.destroy_event("OpenInExplorer", "shortcut")
|
||||
if act_os ~= "windows" then
|
||||
dt.preferences.destroy("OpenInExplorer", "linked_image_files_dir")
|
||||
end
|
||||
dt.preferences.destroy("OpenInExplorer", "use_links")
|
||||
end
|
||||
|
||||
|
||||
-- GUI --
|
||||
dt.gui.libs.image.register_action(
|
||||
_("show in file explorer"),
|
||||
"OpenInExplorer", _("show in file explorer"),
|
||||
function() open_in_fmanager() end,
|
||||
_("Open the file manager at the selected image's location")
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
if act_os ~= "windows" then
|
||||
dt.preferences.register("OpenInExplorer", "linked_image_files_dir", -- name
|
||||
@@ -210,8 +227,11 @@ if act_os ~= "windows" then
|
||||
end
|
||||
|
||||
dt.register_event(
|
||||
"shortcut",
|
||||
"OpenInExplorer", "shortcut",
|
||||
function(event, shortcut) open_in_fmanager() end,
|
||||
"OpenInExplorer"
|
||||
)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -63,7 +63,15 @@ local dtsys = require "lib/dtutils.system"
|
||||
local MODULE_NAME = "RL_out_sharp"
|
||||
|
||||
-- check API version
|
||||
du.check_min_api_version("5.0.0", MODULE_NAME)
|
||||
du.check_min_api_version("7.0.0", MODULE_NAME)
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- OS compatibility
|
||||
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
@@ -155,6 +163,12 @@ local function export2RL(storage, image_table, extra_data)
|
||||
dt.print(_("finished exporting"))
|
||||
end
|
||||
|
||||
-- script_manager integration
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_storage("exp2RL")
|
||||
end
|
||||
|
||||
-- new widgets ----------------------------------------------------------------
|
||||
|
||||
output_folder_selector = dt.new_widget("file_chooser_button"){
|
||||
@@ -224,6 +238,12 @@ sigma_slider.value = dt.preferences.read(MODULE_NAME, "sigma", "float")
|
||||
iterations_slider.value = dt.preferences.read(MODULE_NAME, "iterations", "float")
|
||||
jpg_quality_slider.value = dt.preferences.read(MODULE_NAME, "jpg_quality", "float")
|
||||
|
||||
-- script_manager integration
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
-- end of script --------------------------------------------------------------
|
||||
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -40,101 +40,18 @@ local darktable = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local filelib = require "lib/dtutils.file"
|
||||
|
||||
-- Forward declare the functions
|
||||
local autostyle_apply_one_image,autostyle_apply_one_image_event,autostyle_apply,exiftool_attribute,capture
|
||||
local CURR_API_STRING = darktable.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "autostyle")
|
||||
|
||||
-- Tested it with darktable 1.6.1 and darktable git from 2014-01-25
|
||||
du.check_min_api_version("2.0.2", "autostyle")
|
||||
-- return data structure for script_manager
|
||||
|
||||
-- Receive the event triggered
|
||||
function autostyle_apply_one_image_event(event,image)
|
||||
autostyle_apply_one_image(image)
|
||||
end
|
||||
local script_data = {}
|
||||
|
||||
-- Apply the style to an image, if it matches the tag condition
|
||||
function autostyle_apply_one_image (image)
|
||||
-- We need the tag, the value and the style_name provided from the configuration string
|
||||
local tag,value,style_name=string.match(darktable.preferences.read("autostyle","exif_tag","string"),"(%g+)%s*=%s*(%g+)%s*=>%s*(%g+)")
|
||||
|
||||
-- check they all exist (correct syntax)
|
||||
if (not tag) then
|
||||
darktable.print("EXIF TAG not found in " .. darktable.preferences.read("autostyle","exif_tag","string"))
|
||||
return 0
|
||||
end
|
||||
if (not value) then
|
||||
darktable.print("value to match not found in " .. darktable.preferences.read("autostyle","exif_tag","string"))
|
||||
return 0
|
||||
end
|
||||
if (not style_name) then
|
||||
darktable.print("style name not found in " .. darktable.preferences.read("autostyle","exif_tag","string"))
|
||||
return 0
|
||||
end
|
||||
if not filelib.check_if_bin_exists("exiftool") then
|
||||
darktable.print("Can't find exiftool")
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
-- First find the style (we have its name)
|
||||
local styles= darktable.styles
|
||||
local style
|
||||
for _,s in ipairs(styles) do
|
||||
if s.name == style_name then
|
||||
style=s
|
||||
end
|
||||
end
|
||||
if (not style) then
|
||||
darktable.print("style not found for autostyle: " .. style_name)
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Apply the style to image, if it is tagged
|
||||
local ok,auto_dr_attr= pcall(exiftool_attribute,image.path .. '/' .. image.filename,tag)
|
||||
--darktable.print_error("dr_attr:" .. auto_dr_attr)
|
||||
-- If the lookup fails, stop here
|
||||
if (not ok) then
|
||||
darktable.print("Couldn't get attribute " .. auto_dr_attr .. " from exiftool's output")
|
||||
return 0
|
||||
end
|
||||
if auto_dr_attr==value then
|
||||
darktable.print_log("Image " .. image.filename .. ": autostyle automatically applied " .. darktable.preferences.read("autostyle","exif_tag","string") )
|
||||
darktable.styles.apply(style,image)
|
||||
return 1
|
||||
else
|
||||
darktable.print_log("Image " .. image.filename .. ": autostyle not applied, exif tag " .. darktable.preferences.read("autostyle","exif_tag","string") .. " not matched: " .. auto_dr_attr)
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
function autostyle_apply( shortcut)
|
||||
local images = darktable.gui.action_images
|
||||
local images_processed =0
|
||||
local images_submitted =0
|
||||
for _,image in pairs(images) do
|
||||
images_submitted = images_submitted +1
|
||||
images_processed = images_processed + autostyle_apply_one_image(image)
|
||||
end
|
||||
darktable.print("Applied auto style to " .. images_processed .. " out of " .. images_submitted .. " image(s)")
|
||||
end
|
||||
|
||||
-- Retrieve the attribute through exiftool
|
||||
function exiftool_attribute(path,attr)
|
||||
local cmd="exiftool -" .. attr .. " '" .. path .. "'";
|
||||
local exifresult=get_stdout(cmd)
|
||||
local attribute=string.match(exifresult,": (.*)")
|
||||
if (attribute == nil) then
|
||||
darktable.print_error( "Could not find the attribute " .. attr .. " using the command: <" .. cmd .. ">")
|
||||
-- Raise an error to the caller
|
||||
error( "Could not find the attribute " .. attr .. " using the command: <" .. cmd .. ">");
|
||||
end
|
||||
-- darktable.print_error("Returning attribute: " .. attribute)
|
||||
return attribute
|
||||
end
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- run command and retrieve stdout
|
||||
function get_stdout(cmd)
|
||||
local function get_stdout(cmd)
|
||||
-- Open the command, for reading
|
||||
local fd = assert(io.popen(cmd, 'r'))
|
||||
darktable.control.read(fd)
|
||||
@@ -151,13 +68,108 @@ function get_stdout(cmd)
|
||||
return data
|
||||
end
|
||||
|
||||
-- Retrieve the attribute through exiftool
|
||||
local function exiftool_attribute(path, attr)
|
||||
local cmd = "exiftool -" .. attr .. " '" .. path .. "'";
|
||||
local exifresult = get_stdout(cmd)
|
||||
local attribute = string.match(exifresult, ": (.*)")
|
||||
if (attribute == nil) then
|
||||
darktable.print_error( "Could not find the attribute " .. attr .. " using the command: <" .. cmd .. ">")
|
||||
-- Raise an error to the caller
|
||||
error( "Could not find the attribute " .. attr .. " using the command: <" .. cmd .. ">");
|
||||
end
|
||||
-- darktable.print_error("Returning attribute: " .. attribute)
|
||||
return attribute
|
||||
end
|
||||
|
||||
-- Apply the style to an image, if it matches the tag condition
|
||||
local function autostyle_apply_one_image (image)
|
||||
|
||||
local pref = darktable.preferences.read("autostyle", "exif_tag", "string")
|
||||
-- We need the tag, the value and the style_name provided from the configuration string
|
||||
local tag, value, style_name = string.match(pref, "(%g+)%s*=%s*(%g+)%s*=>%s*(%g+)")
|
||||
|
||||
-- check they all exist (correct syntax)
|
||||
if (not tag) then
|
||||
darktable.print("EXIF TAG not found in " .. pref)
|
||||
return 0
|
||||
end
|
||||
if (not value) then
|
||||
darktable.print("value to match not found in " .. pref)
|
||||
return 0
|
||||
end
|
||||
if (not style_name) then
|
||||
darktable.print("style name not found in " .. pref)
|
||||
return 0
|
||||
end
|
||||
if not filelib.check_if_bin_exists("exiftool") then
|
||||
darktable.print("Can't find exiftool")
|
||||
return 0
|
||||
end
|
||||
|
||||
|
||||
-- First find the style (we have its name)
|
||||
local styles = darktable.styles
|
||||
local style
|
||||
for _, s in ipairs(styles) do
|
||||
if s.name == style_name then
|
||||
style = s
|
||||
end
|
||||
end
|
||||
if (not style) then
|
||||
darktable.print("style not found for autostyle: " .. style_name)
|
||||
return 0
|
||||
end
|
||||
|
||||
-- Apply the style to image, if it is tagged
|
||||
local ok, auto_dr_attr = pcall(exiftool_attribute, image.path .. '/' .. image.filename,tag)
|
||||
--darktable.print_error("dr_attr:" .. auto_dr_attr)
|
||||
-- If the lookup fails, stop here
|
||||
if (not ok) then
|
||||
darktable.print("Couldn't get attribute " .. auto_dr_attr .. " from exiftool's output")
|
||||
return 0
|
||||
end
|
||||
if auto_dr_attr == value then
|
||||
darktable.print_log("Image " .. image.filename .. ": autostyle automatically applied " .. pref)
|
||||
darktable.styles.apply(style,image)
|
||||
return 1
|
||||
else
|
||||
darktable.print_log("Image " .. image.filename .. ": autostyle not applied, exif tag " .. pref .. " not matched: " .. auto_dr_attr)
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- Receive the event triggered
|
||||
local function autostyle_apply_one_image_event(event,image)
|
||||
autostyle_apply_one_image(image)
|
||||
end
|
||||
|
||||
local function autostyle_apply(shortcut)
|
||||
local images = darktable.gui.action_images
|
||||
local images_processed = 0
|
||||
local images_submitted = 0
|
||||
for _,image in pairs(images) do
|
||||
images_submitted = images_submitted + 1
|
||||
images_processed = images_processed + autostyle_apply_one_image(image)
|
||||
end
|
||||
darktable.print("Applied auto style to " .. images_processed .. " out of " .. images_submitted .. " image(s)")
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
darktable.destroy_event("autostyle", "shortcut")
|
||||
darktable.destroy_event("autostyle", "post-import-image")
|
||||
end
|
||||
|
||||
-- Registering events
|
||||
darktable.register_event("shortcut", autostyle_apply,
|
||||
darktable.register_event("autostyle", "shortcut", autostyle_apply,
|
||||
"Apply your chosen style from exiftool tags")
|
||||
|
||||
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","")
|
||||
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", "")
|
||||
|
||||
darktable.register_event("post-import-image",
|
||||
darktable.register_event("autostyle", "post-import-image",
|
||||
autostyle_apply_one_image_event)
|
||||
|
||||
|
||||
script_data.destroy = destroy
|
||||
return script_data
|
||||
@@ -39,14 +39,20 @@
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
-- not a number
|
||||
local NaN = 0/0
|
||||
|
||||
du.check_min_api_version("3.0.0", "clear_GPS")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
du.check_min_api_version("7.0.0", "clear_GPS")
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("clear_GPS",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -64,14 +70,23 @@ local function clear_GPS(images)
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_event("clear_GPS", "shortcut")
|
||||
dt.gui.libs.image.destroy_action("clear_GPS")
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
dt.gui.libs.image.register_action(
|
||||
_("clear GPS data"),
|
||||
"clear_GPS", _("clear GPS data"),
|
||||
function(event, images) clear_GPS(images) end,
|
||||
_("Clear GPS data from selected images")
|
||||
)
|
||||
|
||||
dt.register_event(
|
||||
"shortcut",
|
||||
"clear_GPS", "shortcut",
|
||||
function(event, shortcut) clear_GPS(dt.gui.action_images) end,
|
||||
_("Clear GPS data")
|
||||
)
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -42,8 +42,15 @@ local debug = require "darktable.debug"
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
du.check_min_api_version("3.0.0", "copy_attach_detach_tags")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "copy_attach_detach_tags")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("copy_attach_detach_tags",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -182,6 +189,41 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_event("cadt_ct", "shortcut")
|
||||
dt.destroy_event("cadt_at", "shortcut")
|
||||
dt.destroy_event("cadt_dt", "shortcut")
|
||||
dt.destroy_event("cadt_rt", "shortcut")
|
||||
dt.gui.libs["tagging_addon"].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
-- shortcut for copy
|
||||
dt.register_event("cadt_ct", "shortcut",
|
||||
mcopy_tags,
|
||||
_('copy tags from selected image(s)'))
|
||||
|
||||
-- shortcut for attach
|
||||
dt.register_event("cadt_at", "shortcut",
|
||||
attach_tags,
|
||||
_('paste tags to selected image(s)'))
|
||||
|
||||
-- shortcut for detaching tags
|
||||
dt.register_event("cadt_dt", "shortcut",
|
||||
detach_tags,
|
||||
_('remove tags from selected image(s)'))
|
||||
|
||||
-- shortcut for replace tags
|
||||
dt.register_event("cadt_rt", "shortcut",
|
||||
replace_tags,
|
||||
_('replace tags from selected image(s)'))
|
||||
dt.gui.libs["tagging_addon"].visible = true
|
||||
end
|
||||
|
||||
local function show()
|
||||
dt.gui.libs["tagging_addon"].visible = true
|
||||
end
|
||||
|
||||
-- create modul Tagging addons
|
||||
taglist_label.reset_callback = mcopy_tags
|
||||
|
||||
@@ -234,7 +276,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not cadt.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
"cadt", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -247,24 +289,30 @@ end
|
||||
|
||||
|
||||
-- shortcut for copy
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("cadt_ct", "shortcut",
|
||||
mcopy_tags,
|
||||
_('copy tags from selected image(s)'))
|
||||
|
||||
-- shortcut for attach
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("cadt_at", "shortcut",
|
||||
attach_tags,
|
||||
_('paste tags to selected image(s)'))
|
||||
|
||||
-- shortcut for detaching tags
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("cadt_dt", "shortcut",
|
||||
detach_tags,
|
||||
_('remove tags from selected image(s)'))
|
||||
|
||||
-- shortcut for replace tags
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("cadt_rt", "shortcut",
|
||||
replace_tags,
|
||||
_('replace tags from selected image(s)'))
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = show
|
||||
|
||||
return script_data
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
-- kate: tab-indents: off; indent-width 2; replace-tabs on; remove-trailing-space on;
|
||||
|
||||
@@ -35,9 +35,15 @@ USAGE
|
||||
local darktable = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
|
||||
-- Tested with darktable 2.0.1
|
||||
du.check_min_api_version("2.0.0", "cr2hdr")
|
||||
local CURR_API_STRING = darktable.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "cr2hdr")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local queue = {}
|
||||
local processed_files = {}
|
||||
@@ -108,11 +114,21 @@ local function convert_action_images(shortcut)
|
||||
convert_images()
|
||||
end
|
||||
|
||||
darktable.register_event("shortcut",
|
||||
local function destroy()
|
||||
darktable.destroy_event("cr2hdr", "shortcut")
|
||||
darktable.destroy_event("cr2hdr", "post-import-image")
|
||||
darktable.destroy_event("cr2hdr", "post-import-film")
|
||||
end
|
||||
|
||||
darktable.register_event("cr2hdr", "shortcut",
|
||||
convert_action_images, "Run cr2hdr (Magic Lantern DualISO converter) on selected images")
|
||||
darktable.register_event("post-import-image",
|
||||
darktable.register_event("cr2hdr", "post-import-image",
|
||||
file_imported)
|
||||
darktable.register_event("post-import-film",
|
||||
darktable.register_event("cr2hdr", "post-import-film",
|
||||
film_imported)
|
||||
|
||||
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)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -65,7 +65,15 @@ local mod = 'module_enfuseAdvanced'
|
||||
local os_path_seperator = '/'
|
||||
if dt.configuration.running_os == 'windows' then os_path_seperator = '\\' end
|
||||
|
||||
du.check_min_api_version('5.0.0', 'enfuseAdvanced')
|
||||
du.check_min_api_version("7.0.0", "enfuseAdvanced")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
local gettext = dt.gettext
|
||||
@@ -516,6 +524,10 @@ local function main(storage, image_table, extra_data)
|
||||
dt.print('image fusion process complete')
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_storage('module_enfuseAdvanced')
|
||||
end
|
||||
|
||||
--GUI--
|
||||
stack_compression = dt.new_widget('stack'){}
|
||||
local label_AIS_options= dt.new_widget('section_label'){
|
||||
@@ -1142,3 +1154,7 @@ else
|
||||
GUI.options_contain.active = 4
|
||||
GUI.show_options.sensitive = false
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
@@ -31,10 +31,19 @@ local du = require "lib/dtutils"
|
||||
local df = require("lib/dtutils.file")
|
||||
local ds = require("lib/dtutils.system")
|
||||
|
||||
du.check_min_api_version("7.0.0", "exportLUT")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
gettext.bindtextdomain("exportLUT",dt.configuration.config_dir.."/lua/locale/")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
local function _(msgid)
|
||||
return gettext.dgettext("exportLUT", msgid)
|
||||
@@ -128,7 +137,7 @@ end
|
||||
local function install_module()
|
||||
if not eL.module_installed then
|
||||
dt.register_lib(
|
||||
_("export haldclut"),
|
||||
"export haldclut",
|
||||
_("export haldclut"),
|
||||
true,
|
||||
false,
|
||||
@@ -145,6 +154,14 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs["export haldclut"].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs["export haldclut"].visible = true
|
||||
end
|
||||
|
||||
local export_button = dt.new_widget("button"){
|
||||
label = _("export"),
|
||||
clicked_callback = export_luts
|
||||
@@ -162,7 +179,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not eL.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
"exportLUT", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -173,3 +190,9 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = restart
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -73,12 +73,15 @@ local dtsys = require "lib/dtutils.system"
|
||||
|
||||
-- module name
|
||||
local MODULE_NAME = "ext_editor"
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", MODULE_NAME)
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
-- check API version
|
||||
du.check_min_api_version("5.0.2", MODULE_NAME) -- darktable 3.x
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- OS compatibility
|
||||
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
@@ -95,7 +98,7 @@ local gettext = dt.gettext
|
||||
gettext.bindtextdomain(MODULE_NAME, dt.configuration.config_dir..PS.."lua"..PS.."locale"..PS)
|
||||
local function _(msgid)
|
||||
return gettext.dgettext(MODULE_NAME, msgid)
|
||||
end
|
||||
end
|
||||
|
||||
-- maximum number of external programs, can be increased to necessity
|
||||
local MAX_EDITORS = 9
|
||||
@@ -112,7 +115,7 @@ local allowed_file_types = {"JPG", "jpg", "JPEG", "jpeg", "TIF", "tif", "TIFF",
|
||||
if not dt.preferences.read(MODULE_NAME, "initialized", "bool") then
|
||||
dt.preferences.write(MODULE_NAME, "lastchoice", "integer", 0)
|
||||
dt.preferences.write(MODULE_NAME, "initialized", "bool", true)
|
||||
end
|
||||
end
|
||||
local lastchoice = 0
|
||||
|
||||
|
||||
@@ -137,23 +140,23 @@ local function UpdateProgramList(combobox, button_edit, button_edit_copy, update
|
||||
program_names[i] = name
|
||||
program_paths[i] = df.sanitize_filename(dt.preferences.read(MODULE_NAME, "program_path_"..i, "string"))
|
||||
n_entries = i
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
lastchoice = dt.preferences.read(MODULE_NAME, "lastchoice", "integer")
|
||||
if lastchoice == 0 and n_entries > 0 then lastchoice = 1 end
|
||||
if lastchoice > n_entries then lastchoice = n_entries end
|
||||
dt.preferences.write(MODULE_NAME, "lastchoice", "integer", lastchoice)
|
||||
lastchoice = dt.preferences.read(MODULE_NAME, "lastchoice", "integer")
|
||||
if lastchoice == 0 and n_entries > 0 then lastchoice = 1 end
|
||||
if lastchoice > n_entries then lastchoice = n_entries end
|
||||
dt.preferences.write(MODULE_NAME, "lastchoice", "integer", lastchoice)
|
||||
|
||||
-- widgets enabled if there is at least one program configured
|
||||
combobox.selected = lastchoice
|
||||
local active = n_entries > 0
|
||||
combobox.sensitive = active
|
||||
button_edit.sensitive = active
|
||||
button_edit_copy.sensitive = active
|
||||
-- widgets enabled if there is at least one program configured
|
||||
combobox.selected = lastchoice
|
||||
local active = n_entries > 0
|
||||
combobox.sensitive = active
|
||||
button_edit.sensitive = active
|
||||
button_edit_copy.sensitive = active
|
||||
|
||||
if update_button_pressed then dt.print(n_entries.._(" editors configured")) end
|
||||
end
|
||||
if update_button_pressed then dt.print(n_entries.._(" editors configured")) end
|
||||
end
|
||||
|
||||
|
||||
-- callback for buttons "edit" and "edit a copy" ------------------------------
|
||||
@@ -163,13 +166,13 @@ local function OpenWith(images, choice, copy)
|
||||
if choice > n_entries then
|
||||
dt.print(_("not a valid choice"))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- check if one image is selected, return if not
|
||||
if #images ~= 1 then
|
||||
dt.print(_("please select one image"))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local bin = program_paths[choice]
|
||||
local friendly_name = program_names[choice]
|
||||
@@ -188,18 +191,18 @@ local function OpenWith(images, choice, copy)
|
||||
if v == file_ext then
|
||||
allowed = true
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if not allowed then
|
||||
dt.print(_("file type not allowed"))
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- save image tags, rating and color
|
||||
local tags = {}
|
||||
for i, tag in ipairs(dt.tags.get_tags(image)) do
|
||||
for i, tag in ipairs(dt.tags.get_tags(image)) do
|
||||
if not (string.sub(tag.name, 1, 9) == "darktable") then table.insert(tags, tag) end
|
||||
end
|
||||
end
|
||||
local rating = image.rating
|
||||
local red = image.red
|
||||
local blue = image.blue
|
||||
@@ -221,8 +224,8 @@ local function OpenWith(images, choice, copy)
|
||||
if not copy_success then
|
||||
dt.print(_("error copying file ")..name)
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- launch the external editor, check result, return if error
|
||||
local run_cmd = bin.." "..df.sanitize_filename(new_name)
|
||||
@@ -231,7 +234,7 @@ local function OpenWith(images, choice, copy)
|
||||
if result ~= 0 then
|
||||
dt.print(_("error launching ")..friendly_name)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
if copy then
|
||||
-- import in database and group
|
||||
@@ -256,7 +259,7 @@ local function OpenWith(images, choice, copy)
|
||||
while not found do
|
||||
index, new_leader = next(group_members, index)
|
||||
if new_leader ~= image_leader then found = true end
|
||||
end
|
||||
end
|
||||
new_leader:make_group_leader()
|
||||
image:delete()
|
||||
if image.local_copy then image:drop_cache() end -- to fix fail to allocate cache error
|
||||
@@ -269,15 +272,15 @@ local function OpenWith(images, choice, copy)
|
||||
if image.local_copy then image:drop_cache() end -- to fix fail to allocate cache error
|
||||
new_image = dt.database.import(name)
|
||||
new_image:group_with()
|
||||
end
|
||||
end
|
||||
else
|
||||
-- case 3: image is in a group but is not leader
|
||||
image:delete()
|
||||
if image.local_copy then image:drop_cache() end -- to fix fail to allocate cache error
|
||||
new_image = dt.database.import(name)
|
||||
new_image:group_with(image_leader)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- restore image tags, rating and color
|
||||
for i, tag in ipairs(tags) do dt.tags.attach(tag, new_image) end
|
||||
@@ -296,14 +299,14 @@ local function OpenWith(images, choice, copy)
|
||||
-- refresh darkroom view
|
||||
if dt.gui.current_view().id == "darkroom" then
|
||||
dt.gui.views.darkroom.display_image(new_image)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- callback function for shortcuts --------------------------------------------
|
||||
local function program_shortcut(event, shortcut)
|
||||
OpenWith(dt.gui.action_images, tonumber(string.sub(shortcut, -2)), false)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- export images and reimport in collection -----------------------------------
|
||||
@@ -324,23 +327,23 @@ local function export2collection(storage, image_table, extra_data)
|
||||
if not move_success then
|
||||
dt.print(_("error moving file ")..temp_name)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-- import in database and group
|
||||
new_image = dt.database.import(new_name)
|
||||
new_image:group_with(image.group_leader)
|
||||
end
|
||||
end
|
||||
|
||||
dt.print(_("finished exporting"))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
-- install the module in the UI -----------------------------------------------
|
||||
local function install_module(dr)
|
||||
|
||||
local views = {[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 100}}
|
||||
local views = {[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 90}}
|
||||
if dr then
|
||||
views = {[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 100},
|
||||
views = {[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_RIGHT_CENTER", 90},
|
||||
[dt.gui.views.darkroom] = {"DT_UI_CONTAINER_PANEL_LEFT_CENTER", 100}}
|
||||
end
|
||||
|
||||
@@ -363,6 +366,27 @@ local function install_module(dr)
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
for i = 1, MAX_EDITORS do
|
||||
dt.destroy_event(MODULE_NAME .. i, "shortcut")
|
||||
end
|
||||
dt.destroy_storage("exp2coll")
|
||||
dt.gui.libs[MODULE_NAME].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
for i = 1, MAX_EDITORS do
|
||||
dt.register_event(MODULE_NAME .. i, "shortcut",
|
||||
program_shortcut, _("edit with program ")..string.format("%02d", i))
|
||||
end
|
||||
dt.register_storage("exp2coll", _("collection"), nil, export2collection)
|
||||
dt.gui.libs[MODULE_NAME].visible = true
|
||||
end
|
||||
|
||||
local function show()
|
||||
dt.gui.libs[MODULE_NAME].visible = true
|
||||
end
|
||||
|
||||
|
||||
-- combobox, with variable number of entries ----------------------------------
|
||||
local combobox = dt.new_widget("combobox") {
|
||||
@@ -372,7 +396,7 @@ local combobox = dt.new_widget("combobox") {
|
||||
dt.preferences.write(MODULE_NAME, "lastchoice", "integer", self.selected)
|
||||
end,
|
||||
""
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-- button edit ----------------------------------------------------------------
|
||||
@@ -382,8 +406,8 @@ local button_edit = dt.new_widget("button") {
|
||||
--sensitive = false,
|
||||
clicked_callback = function()
|
||||
OpenWith(dt.gui.action_images, combobox.selected, false)
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
-- button edit a copy ---------------------------------------------------------
|
||||
@@ -392,8 +416,8 @@ local button_edit_copy = dt.new_widget("button") {
|
||||
tooltip = _("create a copy of the selected image and open it in external editor"),
|
||||
clicked_callback = function()
|
||||
OpenWith(dt.gui.action_images, combobox.selected, true)
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
-- button update list ---------------------------------------------------------
|
||||
@@ -402,18 +426,18 @@ local button_update_list = dt.new_widget("button") {
|
||||
tooltip = _("update list of programs if lua preferences are changed"),
|
||||
clicked_callback = function()
|
||||
UpdateProgramList(combobox, button_edit, button_edit_copy, true)
|
||||
end
|
||||
}
|
||||
end
|
||||
}
|
||||
|
||||
|
||||
-- box for the buttons --------------------------------------------------------
|
||||
-- it doesn't seem there is a way to make the buttons equal in size
|
||||
local box1 = dt.new_widget("box") {
|
||||
orientation = "horizontal",
|
||||
orientation = "horizontal",
|
||||
button_edit,
|
||||
button_edit_copy,
|
||||
button_update_list
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-- table with all the widgets --------------------------------------------------
|
||||
@@ -428,7 +452,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not ee.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
MODULE_NAME, "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module(show_dr)
|
||||
@@ -457,7 +481,7 @@ for i = MAX_EDITORS, 1, -1 do
|
||||
dt.preferences.register(MODULE_NAME, "program_name_"..i, "string",
|
||||
_("name of external editor ")..i,
|
||||
_("friendly name of external editor"), "")
|
||||
end
|
||||
end
|
||||
dt.preferences.register(MODULE_NAME, "show_in_darkrooom", "bool",
|
||||
_("show external editors in darkroom"),
|
||||
_("check to show external editors module also in darkroom (requires restart)"), false)
|
||||
@@ -465,11 +489,18 @@ dt.preferences.register(MODULE_NAME, "show_in_darkrooom", "bool",
|
||||
|
||||
-- register the new shortcuts -------------------------------------------------
|
||||
for i = 1, MAX_EDITORS do
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event(MODULE_NAME .. i, "shortcut",
|
||||
program_shortcut, _("edit with program ")..string.format("%02d", i))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = show
|
||||
|
||||
return script_data
|
||||
|
||||
-- end of script --------------------------------------------------------------
|
||||
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -44,7 +44,6 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local df = require "lib/dtutils.file"
|
||||
local dtsys = require "lib/dtutils.system"
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
-- constants
|
||||
@@ -52,7 +51,16 @@ local gettext = dt.gettext
|
||||
local MODULE = "face_recognition"
|
||||
local PS = dt.configuration.running_os == "windows" and '\\' or '/'
|
||||
local OUTPUT = dt.configuration.tmp_dir .. PS .. "facerecognition.txt"
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
du.check_min_api_version("7.0.0", MODULE)
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- namespace
|
||||
|
||||
@@ -60,9 +68,6 @@ local fc = {}
|
||||
fc.module_installed = false
|
||||
fc.event_registered = false
|
||||
|
||||
-- ensure we meet the minimum api
|
||||
du.check_min_api_version("5.0.0", "face_recognition")
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("face_recognition", dt.configuration.config_dir.."/lua/locale/")
|
||||
|
||||
@@ -344,7 +349,7 @@ end
|
||||
local function install_module()
|
||||
if not fc.module_installed then
|
||||
dt.register_lib(
|
||||
"face_recognition", -- Module name
|
||||
MODULE, -- Module name
|
||||
_("face recognition"), -- Visible name
|
||||
true, -- expandable
|
||||
true, -- resetable
|
||||
@@ -357,6 +362,14 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs[MODULE].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs[MODULE].visible = true
|
||||
end
|
||||
|
||||
-- build the interface
|
||||
|
||||
fc.unknown_tag = dt.new_widget("entry"){
|
||||
@@ -491,7 +504,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not fc.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
MODULE, "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -512,5 +525,11 @@ if not dt.preferences.read(MODULE, "initialized", "bool") then
|
||||
dt.preferences.write(MODULE, "initialized", "bool", true)
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = restart
|
||||
|
||||
return script_data
|
||||
--
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -61,8 +61,15 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local df = require "lib/dtutils.file"
|
||||
|
||||
du.check_min_api_version("4.0.0", "fujifilm_dynamic_range")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "fujifilm_dynamic_range")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local function detect_dynamic_range(event, image)
|
||||
if image.exif_maker ~= "FUJIFILM" then
|
||||
@@ -105,7 +112,15 @@ local function detect_dynamic_range(event, image)
|
||||
dt.print_log("[fujifilm_dynamic_range] raw exposure bias " .. tostring(raf_result))
|
||||
end
|
||||
|
||||
dt.register_event("post-import-image",
|
||||
local function destroy()
|
||||
dt.destroy_event("fujifilm_dr", "post-import-image")
|
||||
end
|
||||
|
||||
dt.register_event("fujifilm_dr", "post-import-image",
|
||||
detect_dynamic_range)
|
||||
|
||||
dt.print_log("[fujifilm_dynamic_range] loaded")
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -26,11 +26,17 @@ Dependencies:
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local df = require "lib/dtutils.file"
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
du.check_min_api_version("4.0.0", "fujifilm_ratings")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "fujifilm_ratings")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
gettext.bindtextdomain("fujifilm_ratings", dt.configuration.config_dir.."/lua/locale/")
|
||||
|
||||
@@ -68,7 +74,12 @@ local function detect_rating(event, image)
|
||||
end
|
||||
end
|
||||
|
||||
dt.register_event("post-import-image",
|
||||
local function destroy()
|
||||
dt.destroy_event("fujifilm_rat", "post-import-image")
|
||||
end
|
||||
|
||||
dt.register_event("fujifilm_rat", "post-import-image",
|
||||
detect_rating)
|
||||
|
||||
print(_("fujifilm_ratings loaded."))
|
||||
script_data.destroy = destroy
|
||||
return script_data
|
||||
|
||||
@@ -37,7 +37,15 @@ local du = require "lib/dtutils"
|
||||
local df = require "lib/dtutils.file"
|
||||
local gettext = dt.gettext
|
||||
|
||||
du.check_min_api_version("3.0.0", "geoJSON_export")
|
||||
du.check_min_api_version("7.0.0", "geoJSON_export")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("geoJSON_export",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -291,6 +299,10 @@ local function create_geoJSON_file(storage, image_table, extra_data)
|
||||
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_storage("geoJSON_export")
|
||||
end
|
||||
|
||||
-- Preferences
|
||||
dt.preferences.register("geoJSON_export",
|
||||
"CreateMapBoxHTMLFile",
|
||||
@@ -326,3 +338,7 @@ dt.preferences.register("geoJSON_export",
|
||||
|
||||
-- Register
|
||||
dt.register_storage("geoJSON_export", "geoJSON Export", nil, create_geoJSON_file)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -28,11 +28,17 @@ require "geoToolbox"
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local df = require "lib/dtutils.file"
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
du.check_min_api_version("3.0.0", "geoToolbox")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "geoToolbox")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("geoToolbox",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -595,6 +601,33 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs["geoToolbox"].visible = false
|
||||
dt.destroy_event("geoToolbox_cd", "shortcut")
|
||||
dt.destroy_event("geoToolbox", "mouse-over-image-changed")
|
||||
dt.destroy_event("geoToolbox_wg", "shortcut")
|
||||
dt.destroy_event("geoToolbox_ng", "shortcut")
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.register_event("geoToolbox_cd", "shortcut",
|
||||
print_calc_distance, _("Calculate the distance from latitude and longitude in km"))
|
||||
dt.register_event("geoToolbox", "mouse-over-image-changed",
|
||||
toolbox_calc_distance)
|
||||
|
||||
dt.register_event("geoToolbox_wg", "shortcut",
|
||||
select_with_gps, _("Select all images with GPS information"))
|
||||
dt.register_event("geoToolbox_ng", "shortcut",
|
||||
select_without_gps, _("Select all images without GPS information"))
|
||||
|
||||
dt.gui.libs["geoToolbox"].visible = true
|
||||
end
|
||||
|
||||
local function show()
|
||||
dt.gui.libs["geoToolbox"].visible = true
|
||||
end
|
||||
|
||||
|
||||
|
||||
local separator = dt.new_widget("separator"){}
|
||||
local separator2 = dt.new_widget("separator"){}
|
||||
@@ -689,7 +722,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not gT.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
"geoToolbox", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -709,15 +742,21 @@ dt.preferences.register("geoToolbox",
|
||||
'' )
|
||||
|
||||
-- Register
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("geoToolbox_cd", "shortcut",
|
||||
print_calc_distance, _("Calculate the distance from latitude and longitude in km"))
|
||||
dt.register_event("mouse-over-image-changed",
|
||||
dt.register_event("geoToolbox", "mouse-over-image-changed",
|
||||
toolbox_calc_distance)
|
||||
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("geoToolbox_wg", "shortcut",
|
||||
select_with_gps, _("Select all images with GPS information"))
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("geoToolbox_ng", "shortcut",
|
||||
select_without_gps, _("Select all images without GPS information"))
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = show
|
||||
|
||||
return script_data
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
-- kate: hl Lua;
|
||||
|
||||
@@ -72,7 +72,15 @@ local dtsys = require "lib/dtutils.system"
|
||||
local gettext = dt.gettext
|
||||
local gimp_widget = nil
|
||||
|
||||
du.check_min_api_version("5.0.0", "gimp")
|
||||
du.check_min_api_version("7.0.0", "gimp")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("gimp",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -189,6 +197,10 @@ local function gimp_edit(storage, image_table, extra_data) --finalize
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_storage("module_gimp")
|
||||
end
|
||||
|
||||
-- Register
|
||||
|
||||
gimp_widget = dt.new_widget("check_button"){
|
||||
@@ -203,3 +215,6 @@ gimp_widget = dt.new_widget("check_button"){
|
||||
dt.register_storage("module_gimp", _("Edit with GIMP"), show_status, gimp_edit, nil, nil, gimp_widget)
|
||||
|
||||
--
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -25,11 +25,17 @@ For each source folder, a separate <trk> is generated in the gpx file.
|
||||
local dt = require "darktable"
|
||||
local df = require "lib/dtutils.file"
|
||||
local dl = require "lib/dtutils"
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
dl.check_min_api_version("3.0.0", "gpx-export")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
dl.check_min_api_version("7.0.0", "gpx_export")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("gpx_export",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -149,6 +155,14 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs["gpx_exporter"].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs["gpx_exporter"].visible = true
|
||||
end
|
||||
|
||||
gpx.widget = dt.new_widget("box")
|
||||
{
|
||||
orientation = "vertical",
|
||||
@@ -175,7 +189,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not gpx.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
"gpx_export", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -185,3 +199,9 @@ else
|
||||
gpx.event_registered = true
|
||||
end
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -54,7 +54,15 @@ local executable_table = {"hugin", "hugin_executor", "pto_gen"}
|
||||
local PQ = dt.configuration.running_os == "windows" and '"' or "'"
|
||||
|
||||
-- works with darktable API version from 5.0.0 on
|
||||
du.check_min_api_version("5.0.0", "hugin")
|
||||
du.check_min_api_version("7.0.0", "hugin")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("hugin",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -205,6 +213,10 @@ local function create_panorama(storage, image_table, extra_data) --finalize
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_storage(namespace)
|
||||
end
|
||||
|
||||
-- Register
|
||||
if dt.configuration.running_os ~= "linux" then
|
||||
exec_widget = df.executable_path_widget(executable_table)
|
||||
@@ -224,6 +236,8 @@ hugin_widget = dt.new_widget("box") {
|
||||
|
||||
dt.register_storage(namespace, _("hugin panorama"), show_status, create_panorama, nil, nil, hugin_widget)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
--
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -71,7 +71,15 @@ local job = nil
|
||||
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
|
||||
-- works with LUA API version 5.0.0
|
||||
du.check_min_api_version("5.0.0", "image_stack")
|
||||
du.check_min_api_version("7.0.0", "image_stack")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("image_stack",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -452,6 +460,10 @@ local function stop_job()
|
||||
job.valid = false
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_storage("module_image_stack")
|
||||
end
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- main program
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -585,3 +597,6 @@ dt.preferences.register("align_image_stack", "align_use_gpu", -- name
|
||||
|
||||
dt.register_storage("module_image_stack", _("image stack"), show_status, image_stack, nil, nil, image_stack_widget)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -107,15 +107,21 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local df = require "lib/dtutils.file"
|
||||
local ds = require "lib/dtutils.string"
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
local img_time = {}
|
||||
img_time.module_installed = false
|
||||
img_time.event_registered = false
|
||||
|
||||
du.check_min_api_version("3.0.0", "image_time")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "image_time")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
@@ -410,6 +416,14 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs["image_time"].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs["image_time"].visible = true
|
||||
end
|
||||
|
||||
-- widgets
|
||||
|
||||
img_time.widgets = {
|
||||
@@ -553,7 +567,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not img_time.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
"image_time", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -564,3 +578,9 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = restart
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -43,7 +43,15 @@ local gettext = dt.gettext
|
||||
|
||||
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
|
||||
du.check_min_api_version("5.0.0", kml_export)
|
||||
du.check_min_api_version("7.0.0", "kml_export")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("kml_export",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -301,6 +309,10 @@ local function create_kml_file(storage, image_table, extra_data)
|
||||
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_storage("kml_export")
|
||||
end
|
||||
|
||||
-- Preferences
|
||||
if dt.configuration.running_os == "windows" then
|
||||
dt.preferences.register("kml_export",
|
||||
@@ -369,5 +381,9 @@ else
|
||||
dt.register_storage("kml_export", _("KML/KMZ Export"), nil, create_kml_file)
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
-- kate: hl Lua;
|
||||
|
||||
@@ -56,7 +56,15 @@ if not df.check_if_bin_exists("pdflatex") then
|
||||
return
|
||||
end
|
||||
|
||||
du.check_min_api_version("4.0.0", "pdf_slideshow")
|
||||
du.check_min_api_version("7.0.0", "pdf_slideshow")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
dt.preferences.register
|
||||
("pdf_slideshow","open with","string",
|
||||
@@ -164,6 +172,10 @@ local function slide(latexfile,i,image,file)
|
||||
my_write(latexfile,"\\end{figure}\n")
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_storage("pdf_slideshow")
|
||||
end
|
||||
|
||||
dt.register_storage("pdf_slideshow",_("pdf slideshow"),
|
||||
nil,
|
||||
function(storage,image_table)
|
||||
@@ -243,5 +255,8 @@ dt.register_storage("pdf_slideshow",_("pdf slideshow"),
|
||||
nil,
|
||||
widget)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
--
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -39,13 +39,20 @@
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local df = require "lib/dtutils.file"
|
||||
|
||||
local dtsys = require "lib/dtutils.system"
|
||||
|
||||
local MODULE_NAME = "photils"
|
||||
du.check_min_api_version("5.0.0", MODULE_NAME)
|
||||
du.check_min_api_version("7.0.0", MODULE_NAME)
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
local gettext = dt.gettext
|
||||
gettext.bindtextdomain(MODULE_NAME,
|
||||
@@ -391,6 +398,22 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs[MODULE_NAME].visible = false
|
||||
dt.destroy_event("photils", "mouse-over-image-changed")
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs[MODULE_NAME].visible = true
|
||||
dt.register_event("photils", "mouse-over-image-changed",
|
||||
PHOTILS.image_changed)
|
||||
end
|
||||
|
||||
local function show()
|
||||
dt.gui.libs[MODULE_NAME].visible = true
|
||||
end
|
||||
|
||||
|
||||
-- add a fix number of buttons
|
||||
for _ = 1, PHOTILS.per_page, 1 do
|
||||
local btn_tag = dt.new_widget("check_button") {
|
||||
@@ -454,7 +477,7 @@ dt.preferences.register(MODULE_NAME,
|
||||
"The embedded thumbnail could speedup the tag suggestion but can fail if the RAW file is not supported."),
|
||||
true)
|
||||
|
||||
dt.register_event("mouse-over-image-changed",
|
||||
dt.register_event("photils", "mouse-over-image-changed",
|
||||
PHOTILS.image_changed)
|
||||
|
||||
if dt.gui.current_view().id == "lighttable" then
|
||||
@@ -462,7 +485,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not PHOTILS.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
"photils", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -473,3 +496,9 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = show
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -47,18 +47,23 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local debug = require "darktable.debug"
|
||||
|
||||
du.check_min_api_version("7.0.0", "quicktag")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local qt = {}
|
||||
qt.module_installed = false
|
||||
qt.event_registered = false
|
||||
qt.widget_table = {}
|
||||
|
||||
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
du.check_min_api_version("3.0.0", "quicktag")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("quicktag",dt.configuration.config_dir.."/lua/locale/")
|
||||
|
||||
@@ -163,7 +168,7 @@ abbrevate_tags(quicktag_table)
|
||||
local button = {}
|
||||
|
||||
-- function to create buttons with tags as labels
|
||||
for j=1,qnr do
|
||||
for j = 1, qnr do
|
||||
button[#button+1] = dt.new_widget("button") {
|
||||
label = j..": "..quicktag_table[j],
|
||||
clicked_callback = function() tagattach(tostring(quicktag_table[j]),j) end}
|
||||
@@ -205,12 +210,35 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs["quicktag"].visible = false
|
||||
for i=1,qnr do
|
||||
dt.destroy_event("quicktag " .. tostring(i), "shortcut")
|
||||
end
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs["quicktag"].visible = true
|
||||
for i = 1 ,qnr do
|
||||
dt.register_event("quicktag", "shortcut",
|
||||
function(event, shortcut) tagattach(tostring(quicktag_table[i])) end,
|
||||
string.format(_("quicktag %i"),i))
|
||||
end
|
||||
end
|
||||
|
||||
local function show()
|
||||
dt.gui.libs["quicktag"].visible = true
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
update_quicktag_list()
|
||||
|
||||
local new_quicktag = dt.new_widget("entry"){
|
||||
text = "",
|
||||
placeholder = _("new tag"),
|
||||
is_password = false,
|
||||
is_password = true,
|
||||
editable = true,
|
||||
tooltip = _("enter your tag here")
|
||||
}
|
||||
@@ -257,7 +285,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not qt.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
"quicktag", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -270,10 +298,17 @@ end
|
||||
|
||||
-- create shortcuts
|
||||
for i=1,qnr do
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("quicktag " .. tostring(i), "shortcut",
|
||||
function(event, shortcut) tagattach(tostring(quicktag_table[i])) end,
|
||||
string.format(_("quicktag %i"),i))
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = show
|
||||
|
||||
return script_data
|
||||
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
-- kate: tab-indents: off; indent-width 2; replace-tabs on; remove-trailing-space on;
|
||||
|
||||
@@ -42,8 +42,15 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
|
||||
-- added version check
|
||||
du.check_min_api_version("3.0.0", "rate_group")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "rate_group")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local function apply_rating(rating)
|
||||
local images = dt.gui.action_images
|
||||
@@ -60,37 +67,51 @@ local function apply_rating(rating)
|
||||
end
|
||||
end
|
||||
|
||||
dt.register_event("shortcut",
|
||||
local function destroy()
|
||||
dt.destroy_event("rg_reject", "shortcut")
|
||||
dt.destroy_event("rg0", "shortcut")
|
||||
dt.destroy_event("rg1", "shortcut")
|
||||
dt.destroy_event("rg2", "shortcut")
|
||||
dt.destroy_event("rg3", "shortcut")
|
||||
dt.destroy_event("rg4", "shortcut")
|
||||
dt.destroy_event("rg5", "shortcut")
|
||||
end
|
||||
|
||||
dt.register_event("rg_reject", "shortcut",
|
||||
function(event, shortcut)
|
||||
apply_rating(-1)
|
||||
end, "Reject group")
|
||||
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("rg0", "shortcut",
|
||||
function(event, shortcut)
|
||||
apply_rating(0)
|
||||
end, "Rate group 0")
|
||||
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("rg1", "shortcut",
|
||||
function(event, shortcut)
|
||||
apply_rating(1)
|
||||
end, "Rate group 1")
|
||||
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("rg2", "shortcut",
|
||||
function(event, shortcut)
|
||||
apply_rating(2)
|
||||
end, "Rate group 2")
|
||||
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("rg3", "shortcut",
|
||||
function(event, shortcut)
|
||||
apply_rating(3)
|
||||
end, "Rate group 3")
|
||||
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("rg4", "shortcut",
|
||||
function(event, shortcut)
|
||||
apply_rating(4)
|
||||
end, "Rate group 4")
|
||||
|
||||
dt.register_event("shortcut",
|
||||
dt.register_event("rg5", "shortcut",
|
||||
function(event, shortcut)
|
||||
apply_rating(5)
|
||||
end, "Rate group 5")
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -33,8 +33,15 @@ local du = require "lib/dtutils"
|
||||
local debug = require "darktable.debug"
|
||||
|
||||
-- check API version
|
||||
du.check_min_api_version("3.0.0", "rename-tags")
|
||||
local CURR_API_STRING = darktable.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "rename-tags")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local rt = {}
|
||||
rt.module_installed = false
|
||||
@@ -111,6 +118,14 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
darktable.gui.libs["rename_tags"].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
darktable.gui.libs["rename_tags"].visible = true
|
||||
end
|
||||
|
||||
-- GUI
|
||||
local old_widget = darktable.new_widget ("box") {
|
||||
orientation = "horizontal",
|
||||
@@ -137,7 +152,7 @@ if darktable.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not rt.event_registered then
|
||||
darktable.register_event(
|
||||
"view-changed",
|
||||
"rename_tags", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -148,4 +163,11 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = restart
|
||||
|
||||
return script_data
|
||||
|
||||
|
||||
|
||||
@@ -22,11 +22,18 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local gettext = dt.gettext
|
||||
|
||||
du.check_min_api_version("3.0.0", "select_untagged")
|
||||
du.check_min_api_version("7.0.0", "select_untagged")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("select_untagged",dt.configuration.config_dir.."/lua/locale/")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
local function _(msgid)
|
||||
return gettext.dgettext("select_untagged", msgid)
|
||||
@@ -64,7 +71,15 @@ local function select_untagged_images(event, images)
|
||||
return selection
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs.select.destroy_selection("select_untagged")
|
||||
end
|
||||
|
||||
dt.gui.libs.select.register_selection(
|
||||
_("select untagged"),
|
||||
"select_untagged", _("select untagged"),
|
||||
select_untagged_images,
|
||||
_("select all images containing no tags or only tags added by darktable"))
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -27,12 +27,17 @@ USAGE
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local df = require "lib/dtutils.file"
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
du.check_min_api_version("2.0.2", "slideshowMusic")
|
||||
du.check_min_api_version("7.0.0", "slideshowMusic")
|
||||
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("slideshowMusic",dt.configuration.config_dir.."/lua/locale/")
|
||||
@@ -70,6 +75,12 @@ local function playSlideshowMusic(_, old_view, new_view)
|
||||
end
|
||||
end
|
||||
|
||||
function destroy()
|
||||
dt.destroy_event("slideshow_music", "view-changed")
|
||||
dt.preferences.destroy("slideshowMusic", "SlideshowMusic")
|
||||
dt.preferences.destroy("slideshowMusic", "PlaySlideshowMusic")
|
||||
end
|
||||
|
||||
-- Preferences
|
||||
dt.preferences.register("slideshowMusic", "SlideshowMusic", "file", _("Slideshow background music file"), "", "")
|
||||
dt.preferences.register("slideshowMusic",
|
||||
@@ -79,5 +90,9 @@ dt.preferences.register("slideshowMusic",
|
||||
_("Plays music with rhythmbox if a slideshow starts"),
|
||||
true)
|
||||
-- Register
|
||||
dt.register_event("view-changed",
|
||||
dt.register_event("slideshow_music", "view-changed",
|
||||
playSlideshowMusic)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -78,12 +78,19 @@ local dtutils_file = require("lib/dtutils.file")
|
||||
local dtutils_system = require("lib/dtutils.system")
|
||||
|
||||
local LIB_ID = "transfer_hierarchy"
|
||||
dtutils.check_min_api_version("5.0.0", LIB_ID)
|
||||
dtutils.check_min_api_version("7.0.0", LIB_ID)
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local MKDIR_COMMAND = darktable.configuration.running_os == "windows" and "mkdir " or "mkdir -p "
|
||||
local PATH_SEPARATOR = darktable.configuration.running_os == "windows" and "\\\\" or "/"
|
||||
local PATH_SEGMENT_REGEX = "(" .. PATH_SEPARATOR .. "?)([^" .. PATH_SEPARATOR .. "]+)"
|
||||
local CURR_API_STRING = darktable.configuration.api_version_string
|
||||
|
||||
unpack = unpack or table.unpack
|
||||
gmatch = string.gfind or string.gmatch
|
||||
@@ -302,6 +309,13 @@ local function doCopy()
|
||||
doTransfer(darktable.database.copy_image)
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
darktable.gui.libs[LIB_ID].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
darktable.gui.libs[LIB_ID].visible = true
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -367,7 +381,7 @@ if darktable.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not th.event_registered then
|
||||
darktable.register_event(
|
||||
"view-changed",
|
||||
LIB_ID, "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -377,3 +391,11 @@ else
|
||||
th.event_registered = true
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = restart
|
||||
|
||||
return script_data
|
||||
@@ -39,7 +39,15 @@ local df = require "lib/dtutils.file"
|
||||
local dsys = require "lib/dtutils.system"
|
||||
local gettext = dt.gettext
|
||||
|
||||
du.check_min_api_version("5.0.0")
|
||||
du.check_min_api_version("7.0.0", "video_ffmpeg")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local MODULE_NAME = "video_ffmpeg"
|
||||
|
||||
@@ -448,6 +456,12 @@ local function finalize_export(storage, images_table, extra_data)
|
||||
df.rmdir(df.sanitize_filename(tmp_dir))
|
||||
end
|
||||
|
||||
-- script_manager integration
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_storage("module_video_ffmpeg")
|
||||
end
|
||||
|
||||
dt.register_storage(
|
||||
"module_video_ffmpeg",
|
||||
_(MODULE_NAME),
|
||||
@@ -458,3 +472,8 @@ dt.register_storage(
|
||||
module_widget
|
||||
)
|
||||
|
||||
-- script_manager integration
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -23,5 +23,19 @@ USAGE
|
||||
]]
|
||||
local dt = require "darktable"
|
||||
|
||||
-- script_manager integration to allow a script to be removed
|
||||
-- without restarting darktable
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
local result = dt.configuration.api_version_string
|
||||
dt.print_error("API Version: "..result)
|
||||
|
||||
-- set the destroy routine so that script_manager can call it when
|
||||
-- it's time to destroy the script and then return the data to
|
||||
-- script_manager
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -42,6 +42,12 @@ local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("5.0.2", "darkroom_mode") -- darktable 3.0
|
||||
|
||||
-- script_manager integration to allow a script to be removed
|
||||
-- without restarting darktable
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- C O N S T A N T S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -70,6 +76,16 @@ local sleep = dt.control.sleep
|
||||
|
||||
local current_view = dt.gui.current_view()
|
||||
|
||||
-- check that there is an image selected, otherwise we can't activate darkroom viewe
|
||||
|
||||
local images = dt.gui.action_images
|
||||
dt.print_log(#images .. " images selected")
|
||||
if not images or #images == 0 then
|
||||
dt.print_log("no images selected, creating selection")
|
||||
dt.print_log("using image " .. dt.collection[1].filename)
|
||||
dt.gui.selection({dt.collection[1]})
|
||||
end
|
||||
|
||||
-- enter darkroom view
|
||||
|
||||
dt.gui.current_view(dt.gui.views.darkroom)
|
||||
@@ -96,3 +112,10 @@ dt.print(_("Restoring view"))
|
||||
sleep(1500)
|
||||
dt.gui.current_view(current_view)
|
||||
|
||||
-- set the destroy routine so that script_manager can call it when
|
||||
-- it's time to destroy the script and then return the data to
|
||||
-- script_manager
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -58,6 +58,12 @@ local du = require "lib/dtutils"
|
||||
--check API version
|
||||
du.check_min_api_version("3.0.0", "gettextExample")
|
||||
|
||||
-- script_manager integration to allow a script to be removed
|
||||
-- without restarting darktable
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
-- Not translated Text
|
||||
dt.print_error("Hello World!")
|
||||
|
||||
@@ -77,3 +83,11 @@ local function _(msgid)
|
||||
return gettext.dgettext("gettextExample", msgid)
|
||||
end
|
||||
dt.print_error(_('Hello World!'))
|
||||
|
||||
-- set the destroy routine so that script_manager can call it when
|
||||
-- it's time to destroy the script and then return the data to
|
||||
-- script_manager
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -31,7 +31,20 @@ local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("2.0.0", "hello_world")
|
||||
|
||||
-- script_manager integration to allow a script to be removed
|
||||
-- without restarting darktable
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
dt.print("hello, world")
|
||||
|
||||
-- set the destroy routine so that script_manager can call it when
|
||||
-- it's time to destroy the script and then return the data to
|
||||
-- script_manager
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
--
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -50,6 +50,12 @@ du.check_min_api_version("5.0.2", "lighttable_demo") -- darktable 3.0
|
||||
local MODULE_NAME = "lighttable"
|
||||
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
|
||||
-- script_manager integration to allow a script to be removed
|
||||
-- without restarting darktable
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- T R A N S L A T I O N S
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -75,6 +81,7 @@ local layouts = {
|
||||
"DT_LIGHTTABLE_LAYOUT_ZOOMABLE",
|
||||
"DT_LIGHTTABLE_LAYOUT_FILEMANAGER",
|
||||
"DT_LIGHTTABLE_LAYOUT_CULLING",
|
||||
"DT_LIGHTTABLE_LAYOUT_CULLING_DYNAMIC",
|
||||
}
|
||||
|
||||
local sorts = {
|
||||
@@ -139,6 +146,7 @@ sleep(2000)
|
||||
for n, layout in ipairs(layouts) do
|
||||
dt.gui.libs.lighttable_mode.layout(layout)
|
||||
dt.print(_("set lighttable layout to " .. layout))
|
||||
dt.print_log(_("set lighttable layout to " .. layout))
|
||||
sleep(1500)
|
||||
for i = 1, 10 do
|
||||
dt.gui.libs.lighttable_mode.zoom_level(i)
|
||||
@@ -152,11 +160,17 @@ for n, layout in ipairs(layouts) do
|
||||
end
|
||||
end
|
||||
|
||||
dt.print_log("finished layout and zoom level testing")
|
||||
dt.print_log("starting sort demonstration")
|
||||
-- cycle through sorts
|
||||
|
||||
dt.print(_("lighttable sorting demonstration"))
|
||||
dt.print_log("setting lighttable to filemanager mode")
|
||||
dt.gui.libs.lighttable_mode.layout("DT_LIGHTTABLE_LAYOUT_FILEMANAGER")
|
||||
sleep(500)
|
||||
dt.print_log("setting lighttable to zoom level 5")
|
||||
dt.gui.libs.lighttable_mode.zoom_level(5)
|
||||
dt.print_log("starting sorts")
|
||||
|
||||
for n, sort in ipairs(sorts) do
|
||||
dt.gui.libs.filter.sort(sort)
|
||||
@@ -196,3 +210,11 @@ current_rating = dt.gui.libs.filter.rating(current_rating)
|
||||
current_rating_comparator = dt.gui.libs.filter.rating_comparator(current_rating_comparator)
|
||||
current_sort =dt.gui.libs.filter.sort(current_sort)
|
||||
current_sort_order = dt.gui.libs.filter.sort_order(current_sort_order)
|
||||
|
||||
-- set the destroy routine so that script_manager can call it when
|
||||
-- it's time to destroy the script and then return the data to
|
||||
-- script_manager
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -33,8 +33,15 @@ https://www.darktable.org/lua-api/index.html.php#darktable_new_widget
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("3.0.0", "moduleExample")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "moduleExample")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet, otherwise leave as nil
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- translation
|
||||
|
||||
@@ -86,6 +93,16 @@ local function install_module()
|
||||
end
|
||||
end
|
||||
|
||||
-- script_manager integration to allow a script to be removed
|
||||
-- without restarting darktable
|
||||
local function destroy()
|
||||
dt.gui.libs["exampleModule"].visible = false -- we haven't figured out how to destroy it yet, so we hide it for now
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs["exampleModule"].visible = true -- the user wants to use it again, so we just make it visible and it shows up in the UI
|
||||
end
|
||||
|
||||
-- https://www.darktable.org/lua-api/types_lua_check_button.html
|
||||
local check_button = dt.new_widget("check_button"){label = _("MyCheck_button"), value = true}
|
||||
|
||||
@@ -148,7 +165,7 @@ else
|
||||
if not mE.event_registered then -- if we are not in lighttable view then register an event to signal when we might be
|
||||
-- https://www.darktable.org/lua-api/index.html#darktable_register_event
|
||||
dt.register_event(
|
||||
"view-changed", -- we want to be informed when the view changes
|
||||
"mdouleExample", "view-changed", -- we want to be informed when the view changes
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then -- if the view changes from darkroom to lighttable
|
||||
install_module() -- register the lib
|
||||
@@ -159,5 +176,14 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
-- set the destroy routine so that script_manager can call it when
|
||||
-- it's time to destroy the script and then return the data to
|
||||
-- script_manager
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart -- only required for lib modules until we figure out how to destroy them
|
||||
script_data.destroy_method = "hide" -- tell script_manager that we are hiding the lib so it knows to use the restart function
|
||||
script_data.show = restart -- if the script was "off" when darktable exited, the module is hidden, so force it to show on start
|
||||
|
||||
return script_data
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
-- kate: hl Lua;
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
]]
|
||||
|
||||
local dt = require "darktable"
|
||||
|
||||
|
||||
--[[
|
||||
require "lib/..." provides access to functions that have been pulled from various
|
||||
scripts and consolidated into libraries. Using the libraries eliminates having to
|
||||
@@ -62,7 +62,6 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils" -- utilities
|
||||
local df = require "lib/dtutils.file" -- file utilities
|
||||
local dtsys = require "lib/dtutils.system" -- system utilities
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
--[[
|
||||
darktable is an international program, and it's user interface has been translated into
|
||||
@@ -87,7 +86,7 @@ end
|
||||
screen stating that you couldn't load because the minimum api version wasn't met.
|
||||
]]
|
||||
|
||||
du.check_min_api_version("5.0.0", "multi_os")
|
||||
du.check_min_api_version("7.0.0", "multi_os")
|
||||
|
||||
--[[
|
||||
copy_image_attributes is a local subroutine to copy image attributes in the database from the raw image
|
||||
@@ -197,6 +196,15 @@ local function extract_embedded_jpeg(images)
|
||||
end
|
||||
end
|
||||
|
||||
--[[
|
||||
script_manager integration to allow a script to be removed
|
||||
without restarting darktable
|
||||
]]
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_event("multi_os", "shortcut") -- destroy the event since the callback will no longer be present
|
||||
dt.gui.libs.image.destroy_action("multi_os") -- remove the button from the selected images module
|
||||
end
|
||||
--[[
|
||||
Windows and MacOS don't place executables in the user's path so their location needs to be specified
|
||||
so that the script can find them. An exception to this is packages installed on MacOS with homebrew. Those
|
||||
@@ -231,18 +239,28 @@ end
|
||||
]]
|
||||
|
||||
dt.gui.libs.image.register_action(
|
||||
_("extract embedded jpeg"),
|
||||
"multi_os", _("extract embedded jpeg"),
|
||||
function(event, images) extract_embedded_jpeg(images) end,
|
||||
"extract embedded jpeg"
|
||||
)
|
||||
|
||||
|
||||
--[[
|
||||
Add a shortcut
|
||||
]]
|
||||
|
||||
dt.register_event(
|
||||
"shortcut",
|
||||
"multi_os", "shortcut",
|
||||
function(event, shortcut) extract_embedded_jpeg(dt.gui.action_images) end,
|
||||
"extract embedded jpeg"
|
||||
)
|
||||
|
||||
--[[
|
||||
set the destroy routine so that script_manager can call it when
|
||||
it's time to destroy the script and then return the data to
|
||||
script_manager
|
||||
]]
|
||||
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -41,7 +41,13 @@ local du = require "lib/dtutils"
|
||||
-- V E R S I O N C H E C K
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
du.check_min_api_version("5.0.2", "panels_demo") -- darktable 3.0
|
||||
du.check_min_api_version("7.0.0", "panels_demo")
|
||||
|
||||
-- script_manager integration to allow a script to be removed
|
||||
-- without restarting darktable
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- C O N S T A N T S
|
||||
@@ -134,3 +140,11 @@ for i = 1, #panels do
|
||||
dt.gui.panel_hide(panels[i])
|
||||
end
|
||||
end
|
||||
|
||||
-- set the destroy routine so that script_manager can call it when
|
||||
-- it's time to destroy the script and then return the data to
|
||||
-- script_manager
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -26,6 +26,7 @@ local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("2.0.1", "preferenceExamples")
|
||||
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesString", -- name
|
||||
"string", -- type
|
||||
@@ -34,14 +35,14 @@ dt.preferences.register("preferenceExamples", -- script: This is a string
|
||||
"String") -- default
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesString", -- name
|
||||
"preferenceExamplesBool", -- name
|
||||
"bool", -- type
|
||||
"Example Boolean", -- label
|
||||
"Example Boolean Tooltip", -- tooltip
|
||||
true) -- default
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesString", -- name
|
||||
"preferenceExamplesInteger", -- name
|
||||
"integer", -- type
|
||||
"Example Integer", -- label
|
||||
"Example Integer Tooltip", -- tooltip
|
||||
@@ -50,7 +51,7 @@ dt.preferences.register("preferenceExamples", -- script: This is a string
|
||||
99) -- max
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesString", -- name
|
||||
"preferenceExamplesFloat", -- name
|
||||
"float", -- type
|
||||
"Example Float", -- label
|
||||
"Example Float Tooltip", -- tooltip
|
||||
@@ -60,21 +61,21 @@ dt.preferences.register("preferenceExamples", -- script: This is a string
|
||||
0.5) -- step
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesString", -- name
|
||||
"preferenceExamplesFile", -- name
|
||||
"file", -- type
|
||||
"Example File", -- label
|
||||
"Example File Tooltip", -- tooltip
|
||||
"") -- default
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesString", -- name
|
||||
"preferenceExamplesDirectory", -- name
|
||||
"directory", -- type
|
||||
"Example Directory", -- label
|
||||
"Example Directory Tooltip", -- tooltip
|
||||
"") -- default
|
||||
|
||||
dt.preferences.register("preferenceExamples", -- script: This is a string used to avoid name collision in preferences (i.e namespace). Set it to something unique, usually the name of the script handling the preference.
|
||||
"preferenceExamplesString", -- name
|
||||
"preferenceExamplesEnum", -- name
|
||||
"enum", -- type
|
||||
"Example Enum", -- label
|
||||
"Example Enum Tooltip", -- tooltip
|
||||
|
||||
@@ -24,6 +24,12 @@ local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("5.0.0", "printExamples")
|
||||
|
||||
-- script_manager integration to allow a script to be removed
|
||||
-- without restarting darktable
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
-- Will print a string to the darktable control log (the long
|
||||
-- overlayed window that appears over the main panel).
|
||||
dt.print("print")
|
||||
@@ -38,5 +44,12 @@ dt.print_error("print error")
|
||||
-- to enable the Lua logdomain.
|
||||
dt.print_log("print log")
|
||||
|
||||
-- set the destroy routine so that script_manager can call it when
|
||||
-- it's time to destroy the script and then return the data to
|
||||
-- script_manager
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
--
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -30,7 +30,21 @@ local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("5.0.0", "running_os")
|
||||
|
||||
-- script_manager integration to allow a script to be removed
|
||||
-- without restarting darktable
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
dt.print("You are running: "..dt.configuration.running_os)
|
||||
|
||||
-- set the destroy routine so that script_manager can call it when
|
||||
-- it's time to destroy the script and then return the data to
|
||||
-- script_manager
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
--
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -34,6 +34,14 @@ local cjson = require "cjson"
|
||||
|
||||
du.check_min_api_version("2.0.0", "check_for_updates")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- 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,
|
||||
-- or nil if one or both are of the wrong format
|
||||
@@ -80,6 +88,10 @@ local function compare_versions(a, b)
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
|
||||
-- local function test(a, b, r)
|
||||
-- local cmp = compare_versions(a, b)
|
||||
@@ -134,3 +146,6 @@ if now > (back_then + 60 * 60 * 24 * 7) then
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
return script_data
|
||||
|
||||
@@ -29,8 +29,15 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local gettext = dt.gettext
|
||||
|
||||
du.check_min_api_version("3.0.0", "copy_paste_metadata")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "copy_paste_metadata")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- set this to "false" if you don't want to overwrite metadata fields
|
||||
-- (title, description, creator, publisher and rights) that are already set
|
||||
@@ -113,26 +120,41 @@ local function paste(images)
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs.image.destroy_action("metadata_copy")
|
||||
dt.gui.libs.image.destroy_action("metadata_paste")
|
||||
dt.destroy_event("capmd1", "shortcut")
|
||||
dt.destroy_event("capmd2", "shortcut")
|
||||
end
|
||||
|
||||
dt.gui.libs.image.register_action(
|
||||
_("copy metadata"),
|
||||
"metadata_copy", _("copy metadata"),
|
||||
function(event, images) copy(images[1]) end,
|
||||
_("copy metadata of the first selected image")
|
||||
)
|
||||
|
||||
|
||||
|
||||
dt.gui.libs.image.register_action(
|
||||
_("paste metadata"),
|
||||
"metadata_paste", _("paste metadata"),
|
||||
function(event, images) paste(images) end,
|
||||
_("paste metadata to the selected images")
|
||||
)
|
||||
|
||||
|
||||
|
||||
dt.register_event(
|
||||
"shortcut",
|
||||
"capmd1", "shortcut",
|
||||
function(event, shortcut) copy(dt.gui.action_images[1]) end,
|
||||
"copy metadata"
|
||||
)
|
||||
|
||||
dt.register_event(
|
||||
"shortcut",
|
||||
"capmd2", "shortcut",
|
||||
function(event, shortcut) paste(dt.gui.action_images) end,
|
||||
"paste metadata"
|
||||
)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -33,11 +33,23 @@ local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("2.0.0", "delete_long_tags")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
dt.preferences.register("delete_long_tags", "length", "integer",
|
||||
"maximum length of tags to keep",
|
||||
"tags longer than this get deleted on start",
|
||||
666, 0, 65536)
|
||||
|
||||
local function destroy()
|
||||
-- noting to destroy
|
||||
end
|
||||
|
||||
local max_length = dt.preferences.read("delete_long_tags", "length", "integer")
|
||||
|
||||
-- deleting while iterating the tags list seems to break the iterator!
|
||||
@@ -55,3 +67,7 @@ for _,name in pairs(long_tags) do
|
||||
tag = dt.tags.find(name)
|
||||
tag:delete()
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -31,6 +31,20 @@ local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("5.0.0", "delete_unused_tags")
|
||||
|
||||
local script_data = {}
|
||||
|
||||
local function destroy()
|
||||
-- noting to destroy
|
||||
end
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- deleting while iterating the tags list seems to break the iterator!
|
||||
local unused_tags = {}
|
||||
|
||||
@@ -45,3 +59,6 @@ for _,name in pairs(unused_tags) do
|
||||
tag = dt.tags.find(name)
|
||||
tag:delete()
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
return script_data
|
||||
@@ -38,11 +38,18 @@ local df = require "lib/dtutils.file"
|
||||
local dtsys = require "lib/dtutils.system"
|
||||
|
||||
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
du.check_min_api_version("3.0.0", "enfuse")
|
||||
du.check_min_api_version("7.0.0", "enfuse")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
-- Tell gettext where to find the .mo file translating messages for a particular domain
|
||||
gettext.bindtextdomain("enfuse",dt.configuration.config_dir..PS .. "lua" .. PS .. "locale" .. PS)
|
||||
@@ -76,6 +83,15 @@ local function install_module()
|
||||
enf.module_installed = true
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs["enfuse"].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs["enfuse"].visible = true
|
||||
end
|
||||
|
||||
-- add a new lib
|
||||
-- is enfuse installed?
|
||||
local enfuse_installed = df.check_if_bin_exists("enfuse")
|
||||
@@ -269,7 +285,7 @@ if enfuse_installed then
|
||||
else
|
||||
if not enf.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
"enfuse", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -285,5 +301,11 @@ else
|
||||
dt.print(_("Could not find enfuse executable. Not loading enfuse exporter..."))
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = restart
|
||||
|
||||
return script_data
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
-- kate: hl Lua;
|
||||
|
||||
@@ -38,8 +38,15 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
require "darktable.debug"
|
||||
|
||||
du.check_min_api_version("2.1.0", "generate_image_txt")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "generate_image_txt")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
dt.preferences.register("generate_image_txt",
|
||||
"enabled",
|
||||
@@ -62,11 +69,15 @@ local check_command = function(command)
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.destroy_event("gen_img_txt", "mouse-over-image-changed")
|
||||
end
|
||||
|
||||
|
||||
local command_setting = dt.preferences.read("generate_image_txt", "command", "string")
|
||||
check_command(command_setting)
|
||||
|
||||
dt.register_event("mouse-over-image-changed",
|
||||
dt.register_event("gen_img_txt", "mouse-over-image-changed",
|
||||
function(event, img)
|
||||
-- no need to waste processing time if the image has a txt file already
|
||||
if not img or img.has_txt or not dt.preferences.read("generate_image_txt", "enabled", "bool") then
|
||||
@@ -105,6 +116,9 @@ dt.register_event("mouse-over-image-changed",
|
||||
end
|
||||
)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent
|
||||
-- kate: tab-indents: off; indent-width 2; replace-tabs on; remove-trailing-space on;
|
||||
|
||||
@@ -31,8 +31,15 @@ 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"
|
||||
|
||||
du.check_min_api_version("2.0.0", "image_path_in_ui")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "image_path_in_ui")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local ipiu = {}
|
||||
ipiu.module_installed = false
|
||||
@@ -42,8 +49,8 @@ local main_label = dt.new_widget("label"){selectable = true, ellipsize = "middle
|
||||
|
||||
local function install_module()
|
||||
if not ipiu.module_installed then
|
||||
dt.register_lib("image_path_no_ui", "selected images path", true, false,{
|
||||
[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_CENTER", 300}
|
||||
dt.register_lib("image_path_no_ui","selected images path",true,false,{
|
||||
[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_CENTER",300}
|
||||
}, main_label
|
||||
)
|
||||
ipiu.module_installed = true
|
||||
@@ -67,6 +74,20 @@ local function reset_widget()
|
||||
main_label.label = result
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs["image_path_no_ui"].visible = false
|
||||
dt.destroy_event("ipiu", "mouse-over-image-changed")
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.register_event("ipiu", "mouse-over-image-changed", reset_widget);
|
||||
dt.gui.libs["image_path_no_ui"].visible = true
|
||||
end
|
||||
|
||||
local function show()
|
||||
dt.gui.libs["image_path_no_ui"].visible = true
|
||||
end
|
||||
|
||||
main_label.reset_callback = reset_widget
|
||||
|
||||
if dt.gui.current_view().id == "lighttable" then
|
||||
@@ -85,7 +106,13 @@ else
|
||||
end
|
||||
end
|
||||
|
||||
dt.register_event("mouse-over-image-changed", reset_widget);
|
||||
dt.register_event("ipiu", "mouse-over-image-changed", reset_widget);
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = show
|
||||
|
||||
return script_data
|
||||
--
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -34,7 +34,6 @@ local dt = require "darktable"
|
||||
|
||||
local import_filter_list = {}
|
||||
local n_import_filters = 1
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
-- allow changing the filter from the preferences
|
||||
dt.preferences.register("import_filter_manager", "active_filter", "string",
|
||||
@@ -57,7 +56,7 @@ dt.gui.libs.import.register_widget(filter_dropdown)
|
||||
|
||||
|
||||
-- this is just a wrapper which calls the active import filter
|
||||
dt.register_event("pre-import", function(event, images)
|
||||
dt.register_event("ifm", "pre-import", function(event, images)
|
||||
local active_filter = dt.preferences.read("import_filter_manager", "active_filter", "string")
|
||||
if active_filter == "" then return end
|
||||
local callback = import_filter_list[active_filter]
|
||||
|
||||
@@ -36,25 +36,43 @@ increase it if you need more temporary selection buffers
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("2.0.0", "save_selection")
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
du.check_min_api_version("7.0.0", "save_selection")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local buffer_count = 5
|
||||
|
||||
for i=1,buffer_count do
|
||||
local function destroy()
|
||||
for i = 1, buffer_count do
|
||||
dt.destroy_event("save_selection save " .. i, "shortcut")
|
||||
dt.destroy_event("save_selection restore " .. i, "shortcut")
|
||||
end
|
||||
dt.destroy_event("save_selection switch", "shortcut")
|
||||
end
|
||||
|
||||
for i = 1, buffer_count do
|
||||
local saved_selection
|
||||
dt.register_event("shortcut", function()
|
||||
dt.register_event("save_selection save " .. i, "shortcut", function()
|
||||
saved_selection = dt.gui.selection()
|
||||
end,"save to buffer "..i)
|
||||
dt.register_event("shortcut", function()
|
||||
end, "save to buffer " .. i)
|
||||
dt.register_event("save_selection restore " .. i, "shortcut", function()
|
||||
dt.gui.selection(saved_selection)
|
||||
end,"restore from buffer "..i)
|
||||
end, "restore from buffer " .. i)
|
||||
end
|
||||
|
||||
local bounce_buffer = {}
|
||||
dt.register_event("shortcut", function()
|
||||
dt.register_event("save_selection switch", "shortcut", function()
|
||||
bounce_buffer = dt.gui.selection(bounce_buffer)
|
||||
end,"switch selection with temporary buffer")
|
||||
end, "switch selection with temporary buffer")
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
--
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -36,7 +36,15 @@ Plugin allows you to choose how many thumbnails you need per row
|
||||
local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("2.0.0", "selection_to_pdf")
|
||||
du.check_min_api_version("7.0.0", "selection_to_pdf")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
dt.preferences.register
|
||||
("selection_to_pdf","Open with","string",
|
||||
@@ -101,6 +109,12 @@ local function thumbnail(latexfile,i,image,file)
|
||||
my_write(latexfile,"\\end{minipage}\\quad\n")
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.print_log("destroying storage")
|
||||
dt.destroy_storage("export_pdf")
|
||||
dt.print_log("done destroying")
|
||||
end
|
||||
|
||||
dt.register_storage("export_pdf","Export thumbnails to pdf",
|
||||
nil,
|
||||
function(storage,image_table)
|
||||
@@ -168,5 +182,8 @@ dt.register_storage("export_pdf","Export thumbnails to pdf",
|
||||
end
|
||||
end,nil,nil,widget)
|
||||
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
--
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
|
||||
@@ -32,12 +32,19 @@ local dt = require "darktable"
|
||||
local du = require "lib/dtutils"
|
||||
local df = require "lib/dtutils.file"
|
||||
|
||||
du.check_min_api_version("5.0.0", "executable_manager")
|
||||
du.check_min_api_version("7.0.0", "executable_manager")
|
||||
|
||||
-- return data structure for script_manager
|
||||
|
||||
local script_data = {}
|
||||
|
||||
script_data.destroy = nil -- function to destory the script
|
||||
script_data.destroy_method = nil -- set to hide for libs since we can't destroy them commpletely yet
|
||||
script_data.restart = nil -- how to restart the (lib) script after it's been hidden - i.e. make it visible again
|
||||
|
||||
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
|
||||
local gettext = dt.gettext
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
gettext.bindtextdomain("executable_manager",dt.configuration.config_dir.."/lua/locale/")
|
||||
|
||||
@@ -111,6 +118,15 @@ local function install_module()
|
||||
exec_man.module_installed = true
|
||||
end
|
||||
end
|
||||
|
||||
local function destroy()
|
||||
dt.gui.libs["executable_manager"].visible = false
|
||||
end
|
||||
|
||||
local function restart()
|
||||
dt.gui.libs["executable_manager"].visible = true
|
||||
end
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- M A I N P R O G R A M
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -215,7 +231,7 @@ if dt.gui.current_view().id == "lighttable" then
|
||||
else
|
||||
if not exec_man.event_registered then
|
||||
dt.register_event(
|
||||
"view-changed",
|
||||
"executable_manager", "view-changed",
|
||||
function(event, old_view, new_view)
|
||||
if new_view.name == "lighttable" and old_view.name == "darkroom" then
|
||||
install_module()
|
||||
@@ -225,3 +241,10 @@ else
|
||||
exec_man.event_registered = true
|
||||
end
|
||||
end
|
||||
|
||||
script_data.destroy = destroy
|
||||
script_data.restart = restart
|
||||
script_data.destroy_method = "hide"
|
||||
script_data.show = restart
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -32,6 +32,10 @@ local dtsys = require "lib/dtutils.system"
|
||||
|
||||
du.check_min_api_version("5.0.0", "gen_I18n_mo")
|
||||
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
-- figure out the path separator
|
||||
|
||||
local PS = dt.configuration.running_os == "windows" and "\\" or "/"
|
||||
@@ -97,3 +101,8 @@ dt.preferences.register("executable_paths", "msgfmt", -- name
|
||||
is_directory = false,
|
||||
}
|
||||
)
|
||||
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -12,6 +12,10 @@ local libname = nil
|
||||
|
||||
du.check_min_api_version("3.0.0", "get_lib_manpages")
|
||||
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
local keys = {"Name", "Synopsis", "Usage", "Description", "Return_Value", "Limitations",
|
||||
"Example", "See_Also", "Reference", "License", "Copyright"}
|
||||
|
||||
@@ -74,3 +78,7 @@ for line in output:lines() do
|
||||
libname = nil
|
||||
end
|
||||
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -9,6 +9,10 @@ local du = require "lib/dtutils"
|
||||
|
||||
du.check_min_api_version("3.0.0", "get_libdoc")
|
||||
|
||||
local function destroy()
|
||||
-- nothing to destroy
|
||||
end
|
||||
|
||||
local keys = {"Name", "Synopsis", "Usage", "Description", "Return_Value", "Limitations",
|
||||
"Example", "See_Also", "Reference", "License", "Copyright"}
|
||||
|
||||
@@ -48,3 +52,7 @@ for line in output:lines() do
|
||||
end
|
||||
end
|
||||
|
||||
local script_data = {}
|
||||
script_data.destroy = destroy
|
||||
|
||||
return script_data
|
||||
|
||||
@@ -54,6 +54,7 @@ local df = require "lib/dtutils.file"
|
||||
local ds = require "lib/dtutils.string"
|
||||
local dtsys = require "lib/dtutils.system"
|
||||
local log = require "lib/dtutils.log"
|
||||
local debug = require "darktable.debug"
|
||||
|
||||
local gettext = dt.gettext
|
||||
|
||||
@@ -67,7 +68,7 @@ end
|
||||
|
||||
-- api check
|
||||
|
||||
du.check_min_api_version("6.1.0", "script_manager")
|
||||
du.check_min_api_version("5.0.0", "script_manager")
|
||||
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -91,7 +92,6 @@ local DEFAULT_LOG_LEVEL = log.error
|
||||
local LUA_DIR = dt.configuration.config_dir .. PS .. "lua"
|
||||
local LUA_SCRIPT_REPO = "https://github.com/darktable-org/lua-scripts.git"
|
||||
|
||||
local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- L O G L E V E L
|
||||
@@ -99,7 +99,7 @@ local CURR_API_STRING = dt.configuration.api_version_string
|
||||
|
||||
local old_log_level = log.log_level()
|
||||
|
||||
log.log_level(DEFAULT_LOG_LEVEL)
|
||||
log.log_level(log.debug)
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
-- N A M E S P A C E
|
||||
@@ -118,6 +118,44 @@ sm.event_registered = false
|
||||
|
||||
sm.widgets = {}
|
||||
sm.categories = {}
|
||||
|
||||
--[[
|
||||
|
||||
sm.scripts is a table of tables for containing the scripts
|
||||
It is organized as into category (folder) subtables containing
|
||||
each script definition, which is a table
|
||||
|
||||
sm.scripts-
|
||||
|
|
||||
- category------------|
|
||||
| - script
|
||||
- category----| |
|
||||
- script|
|
||||
| - script
|
||||
- script|
|
||||
|
||||
and a script table looks like
|
||||
|
||||
name the name of the script file without the lua extension
|
||||
path category (folder), path separator, path, name without the lua extension
|
||||
doc the header comments from the script to be used as a tooltip
|
||||
script_name the folder, path separator, and name without the lua extension
|
||||
running true if running, false if not, hidden if running but the
|
||||
lib/storage/action for the script is hidden
|
||||
has_lib true if it creates a module
|
||||
lib_name name of the created lib
|
||||
has_storage true if it creates a storage (exporter)
|
||||
storage_name name of the exporter (in the exporter storage menu)
|
||||
has_action true if it creates an action
|
||||
action_name name on the button
|
||||
has_event true if it creates an event handler
|
||||
event_type type of event, shortcut, post-xxx, pre-xxx
|
||||
callback name of the callback routine
|
||||
initialized all of the above data has been retreived and set. If the
|
||||
script is unloaded and reloaded we don't have to reparse the file
|
||||
|
||||
]]
|
||||
|
||||
sm.scripts = {}
|
||||
sm.page_status = {}
|
||||
sm.page_status.num_buttons = DEFAULT_BUTTONS_PER_PAGE
|
||||
@@ -125,6 +163,9 @@ sm.page_status.buttons_created = 0
|
||||
sm.page_status.current_page = 0
|
||||
sm.page_status.category = ""
|
||||
|
||||
-- use color in the interface?
|
||||
sm.use_color = false
|
||||
|
||||
-- installed script repositories
|
||||
sm.installed_repositories = {
|
||||
{name = "lua-scripts", directory = LUA_DIR},
|
||||
@@ -169,6 +210,16 @@ local function update_combobox_choices(combobox, choice_table, selected)
|
||||
combobox.value = selected
|
||||
end
|
||||
|
||||
local function string_trim(str)
|
||||
local result = string.gsub(str, "^%s+", "")
|
||||
result = string.gsub(result, "%s+$", "")
|
||||
return result
|
||||
end
|
||||
|
||||
local function string_dequote(str)
|
||||
return string.gsub(str, "['\"]", "")
|
||||
end
|
||||
|
||||
local function add_script_category(category)
|
||||
if #sm.categories == 0 or not string.match(du.join(sm.categories, " "), ds.sanitize_lua(category)) then
|
||||
table.insert(sm.categories, category)
|
||||
@@ -197,30 +248,67 @@ local function get_script_doc(script)
|
||||
end
|
||||
|
||||
local function activate(script)
|
||||
local status = nil -- status of start function
|
||||
local err = nil -- error message returned if module doesn't start
|
||||
log.msg(log.info, "activating " .. script.name)
|
||||
local status, err = du.prequire(script.path)
|
||||
if status then
|
||||
pref_write(script.script_name, "bool", true)
|
||||
log.msg(log.screen, _("Loaded ") .. script.script_name)
|
||||
if script.running == false then
|
||||
status, err = du.prequire(script.path)
|
||||
log.msg(log.debug, "prequire returned " .. tostring(status) .. " and for err " .. tostring(err))
|
||||
if status then
|
||||
pref_write(script.script_name, "bool", true)
|
||||
log.msg(log.screen, _("Loaded ") .. script.script_name)
|
||||
script.running = true
|
||||
if err ~= true then
|
||||
log.msg(log.debug, "got lib data")
|
||||
script.data = err
|
||||
if script.data.destroy_method and script.data.destroy_method == "hide" then
|
||||
script.data.show()
|
||||
end
|
||||
else
|
||||
script.data = nil
|
||||
end
|
||||
else
|
||||
log.msg(log.screen, script.script_name .. _(" failed to load"))
|
||||
log.msg(log.error, "Error loading " .. script.script_name)
|
||||
log.msg(log.error, "Error message: " .. err)
|
||||
end
|
||||
else -- script is a lib and loaded but hidden and the user wants to reload
|
||||
script.data.restart()
|
||||
script.running = true
|
||||
else
|
||||
log.msg(log.screen, script.script_name .. _(" failed to load"))
|
||||
log.msg(log.error, "Error loading " .. script.script_name)
|
||||
log.msg(log.error, "Error message: " .. err)
|
||||
status = true
|
||||
pref_write(script.script_name, "bool", true)
|
||||
end
|
||||
return status
|
||||
end
|
||||
|
||||
local function deactivate(script)
|
||||
-- presently the lua api doesn't support unloading gui elements therefore
|
||||
-- we just mark then inactive for the next time darktable starts
|
||||
-- presently the lua api doesn't support unloading gui elements however, we
|
||||
-- can hide libs, so we just mark those as hidden and hide the gui
|
||||
-- can delete storage
|
||||
--therefore we just mark then inactive for the next time darktable starts
|
||||
|
||||
-- deactivate it....
|
||||
|
||||
pref_write(script.script_name, "bool", false)
|
||||
script.running = false
|
||||
log.msg(log.info, "setting " .. script.script_name .. " to not start")
|
||||
log.msg(log.screen, script.name .. _(" will not start when darktable is restarted"))
|
||||
if script.data then
|
||||
script.data.destroy()
|
||||
if script.data.destroy_method then
|
||||
if string.match(script.data.destroy_method, "hide") then
|
||||
script.running = "hidden"
|
||||
else
|
||||
package.loaded[script.script_name] = nil
|
||||
script.running = false
|
||||
end
|
||||
else
|
||||
package.loaded[script.script_name] = nil
|
||||
script.running = false
|
||||
end
|
||||
log.msg(log.info, "turned off " .. script.script_name)
|
||||
log.msg(log.screen, script.name .. _(" stopped"))
|
||||
else
|
||||
script.running = false
|
||||
log.msg(log.info, "setting " .. script.script_name .. " to not start")
|
||||
log.msg(log.screen, script.name .. _(" will not start when darktable is restarted"))
|
||||
end
|
||||
end
|
||||
|
||||
local function add_script_name(name, path, category)
|
||||
@@ -231,7 +319,8 @@ local function add_script_name(name, path, category)
|
||||
path = category .. "/" .. path .. name,
|
||||
running = false,
|
||||
doc = get_script_doc(category .. "/" .. path .. name),
|
||||
script_name = category .. "/" .. name
|
||||
script_name = category .. "/" .. name,
|
||||
data = nil
|
||||
}
|
||||
table.insert(sm.scripts[category], script)
|
||||
if pref_read(script.script_name, "bool") then
|
||||
@@ -438,9 +527,11 @@ local function clear_button(number)
|
||||
button.label = ""
|
||||
button.tooltip = ""
|
||||
button.sensitive = false
|
||||
--button.name = ""
|
||||
end
|
||||
|
||||
local function find_script(category, name)
|
||||
log.msg(log.debug, "looking for script " .. name .. " in category " .. category)
|
||||
for _, script in ipairs(sm.scripts[category]) do
|
||||
if string.match(script.name, "^" .. ds.sanitize_lua(name) .. "$") then
|
||||
return script
|
||||
@@ -455,28 +546,52 @@ local function populate_buttons(category, first, last)
|
||||
for i = first, last do
|
||||
script = sm.scripts[category][i]
|
||||
button = sm.widgets.buttons[button_num]
|
||||
if script.running then
|
||||
button.label = script.name .. _(" started")
|
||||
if script.running == true then
|
||||
if sm.use_color then
|
||||
button.label = script.name
|
||||
button.name = "sm_started"
|
||||
else
|
||||
button.label = script.name .. _(" started")
|
||||
end
|
||||
else
|
||||
button.label = script.name .. _(" stopped")
|
||||
if sm.use_color then
|
||||
button.label = script.name
|
||||
button.name = "sm_stopped"
|
||||
else
|
||||
button.label = script.name .. _(" stopped")
|
||||
end
|
||||
end
|
||||
button.ellipsize = "middle"
|
||||
button.sensitive = true
|
||||
button.tooltip = script.doc
|
||||
button.clicked_callback = function (this)
|
||||
local script_name, state = string.match(this.label, "(.-) (.+)")
|
||||
local script_name = nil
|
||||
local state = nil
|
||||
if sm.use_color then
|
||||
script_name = string.match(this.label, "(.+)")
|
||||
else
|
||||
script_name, state = string.match(this.label, "(.-) (.+)")
|
||||
end
|
||||
local script = find_script(sm.widgets.category_selector.value, script_name)
|
||||
if script then
|
||||
log.msg(log.debug, "found script " .. script.name .. " with path " .. script.path)
|
||||
if string.match(state, "started") then
|
||||
if script.running == true then
|
||||
log.msg(log.debug, "deactivating " .. script.name .. " on " .. script.path .. " for button " .. this.label)
|
||||
deactivate(script)
|
||||
this.label = script.name .. " stopped"
|
||||
if sm.use_color then
|
||||
this.name = "sm_stopped"
|
||||
else
|
||||
this.label = script.name .. _(" stopped")
|
||||
end
|
||||
else
|
||||
log.msg(log.debug, "activating " .. script.name .. " on " .. script.path .. " for button " .. this.label)
|
||||
local result = activate(script)
|
||||
if result then
|
||||
this.label = script.name .. " started"
|
||||
if sm.use_color then
|
||||
this.name = "sm_started"
|
||||
else
|
||||
this.label = script.name .. " started"
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -650,9 +765,21 @@ local function install_module()
|
||||
sm.module_installed = true
|
||||
end
|
||||
sm.run = true
|
||||
sm.use_color = pref_read("use_color", "bool")
|
||||
log.msg(log.debug, "set run to true, loading preferences")
|
||||
load_preferences()
|
||||
scan_repositories()
|
||||
--[[dt.print_log("\n\nsetting sm visible false\n\n")
|
||||
dt.gui.libs["script_manager"].visible = false
|
||||
dt.control.sleep(5000)
|
||||
dt.print_log("setting sm visible true")
|
||||
dt.gui.libs["script_manager"].visible = true
|
||||
--[[dt.control.sleep(5000)
|
||||
dt.print_log("setting sm expanded false")
|
||||
dt.gui.libs["script_manager"].expanded = false
|
||||
dt.control.sleep(5000)
|
||||
dt.print_log("setting sm expanded true")
|
||||
dt.gui.libs["script_manager"].expanded = true]]
|
||||
end
|
||||
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
@@ -665,8 +792,6 @@ log.msg(log.debug, "finished processing scripts")
|
||||
-- U S E R I N T E R F A C E
|
||||
-- - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
sm.widgets = {}
|
||||
|
||||
-- update the scripts
|
||||
|
||||
sm.widgets.update_script_choices = dt.new_widget("combobox"){
|
||||
@@ -769,8 +894,8 @@ for i =1, DEFAULT_BUTTONS_PER_PAGE do
|
||||
sm.page_status.buttons_create = sm.page_status.buttons_created + 1
|
||||
end
|
||||
|
||||
local page_back = " < "
|
||||
local page_forward = " > "
|
||||
local page_back = "<"
|
||||
local page_forward = ">"
|
||||
|
||||
sm.widgets.page_status = dt.new_widget("label"){label = _("Page:")}
|
||||
sm.widgets.page_back = dt.new_widget("button"){
|
||||
@@ -834,6 +959,16 @@ sm.widgets.configure = dt.new_widget("box"){
|
||||
sm.widgets.change_buttons,
|
||||
}
|
||||
|
||||
sm.widgets.color = dt.new_widget("check_button"){
|
||||
label = _("use color interface?"),
|
||||
value = pref_read("use_color", "bool"),
|
||||
clicked_callback = function(this)
|
||||
pref_write("use_color", "bool", this.value)
|
||||
sm.use_color = this.value
|
||||
end
|
||||
}
|
||||
table.insert(sm.widgets.configure, sm.widgets.color)
|
||||
|
||||
-- stack for the options
|
||||
|
||||
sm.widgets.main_stack = dt.new_widget("stack"){
|
||||
|
||||
Reference in New Issue
Block a user