-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage_meta.lua
More file actions
79 lines (62 loc) · 2.28 KB
/
Copy pathimage_meta.lua
File metadata and controls
79 lines (62 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
--[[
This file is part of darktable,
copyright (c) 2014 Jérémy Rosen
darktable 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.
darktable 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 darktable. If not, see <http://www.gnu.org/licenses/>.
]]
--[[
IMAGE_PATH_IN_UI
Add a widget with the path of the selected images for easy copy/past
Simple shortcuts to have multiple selection bufers
USAGE
* require this file from your main lua config file:
This plugin will add a widget at the bottom of the left column in lighttable mode
]]
local dt = require "darktable"
local du = require "lib/dtutils"
require "lib/darktable_transition"
du.check_min_api_version("2.0.0", "image_path_in_ui")
local CURR_API_STRING = dt.configuration.api_version_string
local ipiu = {}
ipiu.module_installed = false
ipiu.event_registered = false
local file_label = dt.new_widget("label"){selectable = true, ellipsize = "middle", halign = "start"}
local function install_module()
if not ipiu.module_installed then
dt.register_lib("image_meta","Image",true,false,{
[dt.gui.views.lighttable] = {"DT_UI_CONTAINER_PANEL_LEFT_CENTER",300}
}, file_label
)
ipiu.module_installed = true
end
end
local function reset_widget(event, image)
if image ~= nil then file_label.label = image.filename end
end
file_label.reset_callback = reset_widget
if dt.gui.current_view().id == "lighttable" then
install_module()
else
if not ipiu.event_registered then
dt.register_event(
"ipiu", "view-changed",
function(event, old_view, new_view)
if new_view.name == "lighttable" and old_view.name == "darkroom" then
install_module()
end
end
)
ipiu.event_registered = true
end
end
dt.register_event("ipiu", "mouse-over-image-changed", reset_widget);
--
-- vim: shiftwidth=2 expandtab tabstop=2 cindent syntax=lua