Fix description and license. Selection uses action_images now. Added GUI messages for copy, attach and detach
This commit is contained in:
@@ -1,22 +1,35 @@
|
||||
--[[
|
||||
copyright (c) 2014 Christian Kanzian
|
||||
LICENSE GPLv2
|
||||
]]
|
||||
This file is part of darktable,
|
||||
copyright 2014-2015 by Christian Kanzian.
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
]]
|
||||
|
||||
--[[
|
||||
(MULTI-)COPY ATTACH DETACH TAG
|
||||
A simple script that will create three shortcuts to copy, attach and detach image tags.
|
||||
(MULTI-)COPY ATTACH DETACH TAG
|
||||
A simple script that will create three shortcuts to copy, attach and detach image tags.
|
||||
|
||||
INSTALATION
|
||||
* copy this file in $CONFIGDIR/lua/ where CONFIGDIR is your darktable configuration directory
|
||||
* add the following line in the file $CONFIGDIR/luarc require "copy_attach_detach_tags.lua"
|
||||
* copy this file in $CONFIGDIR/lua/ where CONFIGDIR is your darktable configuration directory
|
||||
* add the following line in the file $CONFIGDIR/luarc require "copy_attach_detach_tags"
|
||||
|
||||
USAGE
|
||||
* set the shortcuts for copy, attach and detach in the preferences dialog
|
||||
* <your shortcut1> copy will create a list of tags from all selected images
|
||||
* <your shortcut2> attaches copied tags to selected images, whereby
|
||||
darktable internal tags starting with 'darktable|' will not be touched
|
||||
* <your shortcut3> detach removes all expect darktable internal tags from selected images
|
||||
* set the shortcuts for copy, attach and detach in the preferences dialog
|
||||
* <your shortcut1> copy will create a list of tags from all selected images
|
||||
* <your shortcut2> attaches copied tags to selected images, whereby
|
||||
darktable internal tags starting with 'darktable|' will not be touched
|
||||
* <your shortcut3> detach removes all expect darktable internal tags from selected images
|
||||
|
||||
]]
|
||||
|
||||
@@ -26,7 +39,7 @@ dt.configuration.check_version(...,{2,0,0})
|
||||
local image_tags = {}
|
||||
|
||||
local function mcopy_tags()
|
||||
local sel_images = dt.gui.selection()
|
||||
local sel_images = dt.gui.action_images
|
||||
local tag_list_tmp = {}
|
||||
local hash = {}
|
||||
|
||||
@@ -52,7 +65,7 @@ local function mcopy_tags()
|
||||
end
|
||||
end
|
||||
|
||||
-- dt.print("Tags copied.")
|
||||
dt.print("Image tags copied ...")
|
||||
return(image_tags)
|
||||
end
|
||||
|
||||
@@ -60,10 +73,10 @@ local function mcopy_tags()
|
||||
local function attach_tags()
|
||||
|
||||
if next(image_tags) == nil then
|
||||
dt.print("No tags copied, please copy tags first.")
|
||||
dt.print("No tags to attached, please copy tags first.")
|
||||
end
|
||||
|
||||
local sel_images = dt.gui.selection()
|
||||
local sel_images = dt.gui.action_images
|
||||
|
||||
for _,image in ipairs(sel_images) do
|
||||
local present_image_tags = {}
|
||||
@@ -83,13 +96,14 @@ local function attach_tags()
|
||||
end
|
||||
end
|
||||
end
|
||||
dt.print("Tags attached ...")
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
local function detach_tags()
|
||||
local sel_images = dt.gui.selection()
|
||||
local sel_images = dt.gui.action_images
|
||||
|
||||
for _,image in ipairs(sel_images) do
|
||||
local present_image_tags = {}
|
||||
@@ -101,7 +115,8 @@ local function detach_tags()
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
dt.print("Tags removed from image(s).")
|
||||
end
|
||||
|
||||
-- shortcut for copy
|
||||
dt.register_event("shortcut",
|
||||
@@ -120,4 +135,4 @@ dt.register_event("shortcut",
|
||||
|
||||
|
||||
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
|
||||
-- kate: tab-indents: off; indent-width 2; replace-tabs on; remove-trailing-space on;
|
||||
-- kate: tab-indents: off; indent-width 2; replace-tabs on; remove-trailing-space on;
|
||||
|
||||
Reference in New Issue
Block a user