-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPluginInfoProvider.lua
More file actions
289 lines (241 loc) · 11.9 KB
/
Copy pathPluginInfoProvider.lua
File metadata and controls
289 lines (241 loc) · 11.9 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
--[[----------------------------------------------------------------------------
PluginInfoProvider.lua
Settings UI for Film Preview Plugin
This file defines the settings panel that appears in the Plugin Manager
when you select this plugin. It allows users to configure:
- Collection set name (where to create collections)
- Collection suffix (what to append to folder name)
- Filename suffix (what indicates an edited version)
- Log level (how verbose the logs should be)
Settings are stored in Lightroom's preferences and persist across sessions.
--------------------------------------------------------------------------------]]
local LrView = import 'LrView'
local LrBinding = import 'LrBinding'
local LrPrefs = import 'LrPrefs'
-- Get the preferences for this plugin
-- Preferences are stored per-plugin and persist across Lightroom sessions
local prefs = LrPrefs.prefsForPlugin()
-- Set default values if preferences haven't been set yet
-- These are the values that will be used the first time the plugin is loaded
if prefs.collectionSetName == nil then
prefs.collectionSetName = '35mm'
end
if prefs.collectionSuffix == nil then
prefs.collectionSuffix = ' Previews'
end
if prefs.filenameSuffix == nil then
prefs.filenameSuffix = '-Edit'
end
if prefs.logLevel == nil then
prefs.logLevel = 'info' -- Default to info level (less verbose than trace)
end
-- Return the provider table
-- This table defines what appears in the Plugin Manager
return {
-- sectionsForTopOfDialog is called when the Plugin Manager displays this plugin
-- It returns the UI elements to show in the settings panel
sectionsForTopOfDialog = function(viewFactory, propertyTable)
-- viewFactory (also called LrView.osFactory()) provides UI components
-- propertyTable is used for data binding between UI and preferences
-- We bind directly to prefs, not to propertyTable
-- LrBinding will handle the two-way binding automatically
-- Return the UI sections
-- Each section is a table with a title and view
return {
{
title = 'Collection Settings',
synopsis = function(props)
-- This appears as a summary when the section is collapsed
return 'Set: "' ..
(prefs.collectionSetName or '35mm') ..
'", Suffix: "' .. (prefs.collectionSuffix or ' Previews') .. '"'
end,
viewFactory:row {
spacing = viewFactory:control_spacing(),
viewFactory:column {
spacing = viewFactory:label_spacing(),
-- Collection Set Name
viewFactory:row {
viewFactory:static_text {
title = 'Collection Set Name:',
alignment = 'right',
width = LrView.share 'label_width',
},
viewFactory:edit_field {
value = LrView.bind {
key = 'collectionSetName',
object = prefs,
},
immediate = true,
width_in_chars = 20,
tooltip = 'Name of the collection set where new collections will be created.\n' ..
'Example: "35mm" creates collections in the 35mm set.',
},
},
-- Collection Suffix
viewFactory:row {
viewFactory:static_text {
title = 'Collection Suffix:',
alignment = 'right',
width = LrView.share 'label_width',
},
viewFactory:edit_field {
value = LrView.bind {
key = 'collectionSuffix',
object = prefs,
},
immediate = true,
width_in_chars = 20,
tooltip = 'Text to append to folder name for collection name.\n' ..
'Example: " Previews" turns "Roll 4" into "Roll 4 Previews".',
},
},
-- Filename Suffix
viewFactory:row {
viewFactory:static_text {
title = 'Edited File Suffix:',
alignment = 'right',
width = LrView.share 'label_width',
},
viewFactory:edit_field {
value = LrView.bind {
key = 'filenameSuffix',
object = prefs,
},
immediate = true,
width_in_chars = 20,
tooltip = 'Suffix that indicates a file has been edited.\n' ..
'Example: "-Edit" matches files like "raw001-Edit.tif".\n' ..
'This can include uppercase letters (case-insensitive matching).',
},
},
-- Info text
viewFactory:row {
viewFactory:static_text {
title = '',
width = LrView.share 'label_width',
},
viewFactory:static_text {
title = 'These settings affect newly created collections.',
font = '<system/small>',
},
},
},
},
},
{
title = 'Logging Settings',
synopsis = function(props)
return 'Log level: ' .. (prefs.logLevel or 'info')
end,
viewFactory:row {
spacing = viewFactory:control_spacing(),
viewFactory:column {
spacing = viewFactory:label_spacing(),
-- Log Level
viewFactory:row {
viewFactory:static_text {
title = 'Log Level:',
alignment = 'right',
width = LrView.share 'label_width',
},
viewFactory:popup_menu {
value = LrView.bind {
key = 'logLevel',
object = prefs,
},
immediate = true,
items = {
{ title = 'Off (no logging)', value = 'off' },
{ title = 'Error (errors only)', value = 'error' },
{ title = 'Warning (errors and warnings)', value = 'warn' },
{ title = 'Info (general information)', value = 'info' },
{ title = 'Trace (very detailed, for debugging)', value = 'trace' },
},
tooltip = 'Controls how much detail is written to the log file.\n' ..
'Info is recommended for normal use.\n' ..
'Trace is useful for debugging but creates large log files.',
},
},
-- Log file location info
viewFactory:row {
viewFactory:static_text {
title = '',
width = LrView.share 'label_width',
},
viewFactory:static_text {
title = 'Log file: Documents\\FreshFrames.log',
font = '<system/small>',
},
},
viewFactory:row {
viewFactory:static_text {
title = '',
width = LrView.share 'label_width',
},
viewFactory:static_text {
title = 'Use "Show Log File Location" menu item to find it.',
font = '<system/small>',
},
},
},
},
},
{
title = 'About',
viewFactory:row {
spacing = viewFactory:control_spacing(),
viewFactory:column {
spacing = viewFactory:label_spacing(),
viewFactory:static_text {
title = 'Fresh Frames',
font = '<system/bold>',
},
viewFactory:static_text {
title = 'Creates collections with the freshest version of each photo from a folder.',
font = '<system>',
},
viewFactory:spacer { height = 10 },
viewFactory:static_text {
title = 'How it works:',
font = '<system/bold>',
},
viewFactory:static_text {
title = '• Analyzes photos in the selected folder',
font = '<system/small>',
},
viewFactory:static_text {
title = '• Groups files by base name (e.g., "raw001.dng" and "raw001-Edit.tif")',
font = '<system/small>',
},
viewFactory:static_text {
title = '• Selects the edited version if it exists, otherwise uses the original',
font = '<system/small>',
},
viewFactory:static_text {
title = '• Creates a collection with one photo per shot (the freshest version)',
font = '<system/small>',
},
viewFactory:spacer { height = 10 },
viewFactory:static_text {
title = 'Usage:',
font = '<system/bold>',
},
viewFactory:static_text {
title = '1. Select a folder in the Folders panel',
font = '<system/small>',
},
viewFactory:static_text {
title = '2. Go to File > Plug-in Extras > Create Preview Collection from Folder',
font = '<system/small>',
},
viewFactory:static_text {
title = '3. Choose "Dry Run" to preview, or "Create Collection" to proceed',
font = '<system/small>',
},
},
},
},
}
end,
}