Skip to content

Fix description and license. Selection uses action_images now. Added … #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 25, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 34 additions & 19 deletions contrib/copy_attach_detach_tags.lua
Original file line number Diff line number Diff line change
@@ -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

]]

Expand All @@ -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 = {}

Expand All @@ -52,18 +65,18 @@ local function mcopy_tags()
end
end

-- dt.print("Tags copied.")
dt.print("Image tags copied ...")
return(image_tags)
end

-- attach copied tags to all selected images
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 = {}
Expand All @@ -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 = {}
Expand All @@ -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",
Expand All @@ -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;