Skip to content

Commit 3d0e536

Browse files
committed
Merge pull request darktable-org#6 from chrik5/tagging
Fix description and license. Selection uses action_images now. Added …
2 parents 0690146 + 994b243 commit 3d0e536

File tree

1 file changed

+34
-19
lines changed

1 file changed

+34
-19
lines changed

contrib/copy_attach_detach_tags.lua

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,35 @@
11
--[[
2-
copyright (c) 2014 Christian Kanzian
3-
LICENSE GPLv2
4-
]]
2+
This file is part of darktable,
3+
copyright 2014-2015 by Christian Kanzian.
4+
5+
This program is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU General Public License as published by
7+
the Free Software Foundation; either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU General Public License for more details.
14+
15+
You should have received a copy of the GNU General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
]]
518

619
--[[
7-
(MULTI-)COPY ATTACH DETACH TAG
8-
A simple script that will create three shortcuts to copy, attach and detach image tags.
20+
(MULTI-)COPY ATTACH DETACH TAG
21+
A simple script that will create three shortcuts to copy, attach and detach image tags.
922
1023
INSTALATION
11-
* copy this file in $CONFIGDIR/lua/ where CONFIGDIR is your darktable configuration directory
12-
* add the following line in the file $CONFIGDIR/luarc require "copy_attach_detach_tags.lua"
24+
* copy this file in $CONFIGDIR/lua/ where CONFIGDIR is your darktable configuration directory
25+
* add the following line in the file $CONFIGDIR/luarc require "copy_attach_detach_tags"
1326
1427
USAGE
15-
* set the shortcuts for copy, attach and detach in the preferences dialog
16-
* <your shortcut1> copy will create a list of tags from all selected images
17-
* <your shortcut2> attaches copied tags to selected images, whereby
18-
darktable internal tags starting with 'darktable|' will not be touched
19-
* <your shortcut3> detach removes all expect darktable internal tags from selected images
28+
* set the shortcuts for copy, attach and detach in the preferences dialog
29+
* <your shortcut1> copy will create a list of tags from all selected images
30+
* <your shortcut2> attaches copied tags to selected images, whereby
31+
darktable internal tags starting with 'darktable|' will not be touched
32+
* <your shortcut3> detach removes all expect darktable internal tags from selected images
2033
2134
]]
2235

@@ -26,7 +39,7 @@ dt.configuration.check_version(...,{2,0,0})
2639
local image_tags = {}
2740

2841
local function mcopy_tags()
29-
local sel_images = dt.gui.selection()
42+
local sel_images = dt.gui.action_images
3043
local tag_list_tmp = {}
3144
local hash = {}
3245

@@ -52,18 +65,18 @@ local function mcopy_tags()
5265
end
5366
end
5467

55-
-- dt.print("Tags copied.")
68+
dt.print("Image tags copied ...")
5669
return(image_tags)
5770
end
5871

5972
-- attach copied tags to all selected images
6073
local function attach_tags()
6174

6275
if next(image_tags) == nil then
63-
dt.print("No tags copied, please copy tags first.")
76+
dt.print("No tags to attached, please copy tags first.")
6477
end
6578

66-
local sel_images = dt.gui.selection()
79+
local sel_images = dt.gui.action_images
6780

6881
for _,image in ipairs(sel_images) do
6982
local present_image_tags = {}
@@ -83,13 +96,14 @@ local function attach_tags()
8396
end
8497
end
8598
end
99+
dt.print("Tags attached ...")
86100
end
87101

88102

89103

90104

91105
local function detach_tags()
92-
local sel_images = dt.gui.selection()
106+
local sel_images = dt.gui.action_images
93107

94108
for _,image in ipairs(sel_images) do
95109
local present_image_tags = {}
@@ -101,7 +115,8 @@ local function detach_tags()
101115
end
102116
end
103117
end
104-
end
118+
dt.print("Tags removed from image(s).")
119+
end
105120

106121
-- shortcut for copy
107122
dt.register_event("shortcut",
@@ -120,4 +135,4 @@ dt.register_event("shortcut",
120135

121136

122137
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua
123-
-- kate: tab-indents: off; indent-width 2; replace-tabs on; remove-trailing-space on;
138+
-- kate: tab-indents: off; indent-width 2; replace-tabs on; remove-trailing-space on;

0 commit comments

Comments
 (0)