1
1
--[[
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
+ ]]
5
18
6
19
--[[
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.
9
22
10
23
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"
13
26
14
27
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
20
33
21
34
]]
22
35
@@ -26,7 +39,7 @@ dt.configuration.check_version(...,{2,0,0})
26
39
local image_tags = {}
27
40
28
41
local function mcopy_tags ()
29
- local sel_images = dt .gui .selection ()
42
+ local sel_images = dt .gui .action_images
30
43
local tag_list_tmp = {}
31
44
local hash = {}
32
45
@@ -52,18 +65,18 @@ local function mcopy_tags()
52
65
end
53
66
end
54
67
55
- -- dt.print("Tags copied.")
68
+ dt .print (" Image tags copied .. ." )
56
69
return (image_tags )
57
70
end
58
71
59
72
-- attach copied tags to all selected images
60
73
local function attach_tags ()
61
74
62
75
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." )
64
77
end
65
78
66
- local sel_images = dt .gui .selection ()
79
+ local sel_images = dt .gui .action_images
67
80
68
81
for _ ,image in ipairs (sel_images ) do
69
82
local present_image_tags = {}
@@ -83,13 +96,14 @@ local function attach_tags()
83
96
end
84
97
end
85
98
end
99
+ dt .print (" Tags attached ..." )
86
100
end
87
101
88
102
89
103
90
104
91
105
local function detach_tags ()
92
- local sel_images = dt .gui .selection ()
106
+ local sel_images = dt .gui .action_images
93
107
94
108
for _ ,image in ipairs (sel_images ) do
95
109
local present_image_tags = {}
@@ -101,7 +115,8 @@ local function detach_tags()
101
115
end
102
116
end
103
117
end
104
- end
118
+ dt .print (" Tags removed from image(s)." )
119
+ end
105
120
106
121
-- shortcut for copy
107
122
dt .register_event (" shortcut" ,
@@ -120,4 +135,4 @@ dt.register_event("shortcut",
120
135
121
136
122
137
-- 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