From 994b24307b32377deacd4d096d185a14b456faff Mon Sep 17 00:00:00 2001 From: chrik5 Date: Thu, 9 Jul 2015 22:36:51 +0200 Subject: [PATCH] Fix description and license. Selection uses action_images now. Added GUI messages for copy, attach and detach --- contrib/copy_attach_detach_tags.lua | 53 ++++++++++++++++++----------- 1 file changed, 34 insertions(+), 19 deletions(-) diff --git a/contrib/copy_attach_detach_tags.lua b/contrib/copy_attach_detach_tags.lua index 11288e4..d5a7ec8 100644 --- a/contrib/copy_attach_detach_tags.lua +++ b/contrib/copy_attach_detach_tags.lua @@ -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 . +]] --[[ -(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 -* copy will create a list of tags from all selected images -* attaches copied tags to selected images, whereby - darktable internal tags starting with 'darktable|' will not be touched -* detach removes all expect darktable internal tags from selected images + * set the shortcuts for copy, attach and detach in the preferences dialog + * copy will create a list of tags from all selected images + * attaches copied tags to selected images, whereby + darktable internal tags starting with 'darktable|' will not be touched + * 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; \ No newline at end of file +-- kate: tab-indents: off; indent-width 2; replace-tabs on; remove-trailing-space on;