forked from willthames/photodeck.lrdevplugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPhotoDeckDialogs.lua
671 lines (603 loc) · 23.5 KB
/
PhotoDeckDialogs.lua
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
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
local LrBinding = import 'LrBinding'
local LrDialogs = import 'LrDialogs'
local LrTasks = import 'LrTasks'
local LrView = import 'LrView'
local LrProgressScope = import 'LrProgressScope'
local PhotoDeckAPI = require 'PhotoDeckAPI'
local PhotoDeckUtils = require 'PhotoDeckUtils'
local PhotoDeckDialogs = {}
-- Updates the website name in the plugin settings
local function updateWebsiteName(propertyTable, key, value)
propertyTable.websiteName = propertyTable.websites[value].title
end
-- Updates the media library name in the plugin settings
local function updateArtistName(propertyTable, key, value)
propertyTable.artistName = propertyTable.artists[value].name
end
-- Ping PhotoDeck and show result in plugin settings
local function ping(propertyTable)
propertyTable.connectionStatus = LOC "$$$/PhotoDeck/ConnectionStatus/Connecting=Connecting to PhotoDeck^."
LrTasks.startAsyncTask(function()
PhotoDeckAPI.connect(propertyTable.apiKey, propertyTable.apiSecret, propertyTable.username, propertyTable.password)
local ping, error_msg = PhotoDeckAPI.ping()
if error_msg then
propertyTable.connectionStatus = LOC("$$$/PhotoDeck/ConnectionStatus/Failed=Connection failed: ^1", error_msg)
elseif propertyTable.loggedin then
propertyTable.connectionStatus = LOC "$$$/PhotoDeck/ConnectionStatus/Connected=Connected"
else
propertyTable.connectionStatus = LOC "$$$/PhotoDeck/ConnectionStatus/ConnectedPleaseLogin=Connected, please log in"
end
end, 'PhotoDeckAPI Ping')
end
-- Login in PhotoDeck and show result in plugin settings
local function login(propertyTable)
propertyTable.connectionStatus = LOC "$$$/PhotoDeck/ConnectionStatus/LoggingIn=Logging in^."
LrTasks.startAsyncTask(function()
PhotoDeckAPI.connect(propertyTable.apiKey, propertyTable.apiSecret, propertyTable.username, propertyTable.password)
local result, error_msg = PhotoDeckAPI.whoami()
if error_msg then
propertyTable.connectionStatus = error_msg
elseif not PhotoDeckAPI.loggedin then
propertyTable.connectionStatus = LOC "$$$/PhotoDeck/ConnectionStatus/CredentialsError=Couldn't log in using those credentials"
else
propertyTable.connectionStatus = LOC("$$$/PhotoDeck/ConnectionStatus/LoggedInAs=Logged in as ^1 ^2", result.firstname, result.lastname)
end
propertyTable.loggedin = PhotoDeckAPI.loggedin
if PhotoDeckAPI.loggedin then
-- get available websites
local websites
websites, error_msg = PhotoDeckAPI.websites()
if error_msg then
propertyTable.connectionStatus = LOC("$$$/PhotoDeck/ConnectionStatus/FailedLoadingWebsite=Couldn't get your website: ^1", error_msg)
propertyTable.loggedin = PhotoDeckAPI.loggedin
else
propertyTable.websites = websites
propertyTable.websiteChoices = {}
local websitesCount = 0
local firstWebsite = nil
local foundCurrent = false
for k, v in pairs(propertyTable.websites) do
websitesCount = websitesCount + 1
if not firstWebsite then
firstWebsite = k
end
if k == propertyTable.websiteChosen then
foundCurrent = true
end
table.insert(propertyTable.websiteChoices, { title = v.title .. " (" .. v.hostname .. ")", value = k })
end
if not foundCurrent then
-- automatically select first website
propertyTable.websiteChosen = firstWebsite
end
propertyTable.multipleWebsites = websitesCount > 1
updateWebsiteName(propertyTable, nil, propertyTable.websiteChosen)
end
-- get available media libraries
local artists
artists, error_msg = PhotoDeckAPI.artists()
if error_msg then
propertyTable.connectionStatus = LOC("$$$/PhotoDeck/ConnectionStatus/FailedLoadingArtist=Couldn't get your media library: ^1", error_msg)
propertyTable.loggedin = PhotoDeckAPI.loggedin
else
propertyTable.artists = artists
propertyTable.artistChoices = {}
local artistsCount = 0
local firstArtist = nil
local foundCurrent = false
for k, v in pairs(propertyTable.artists) do
artistsCount = artistsCount + 1
if not firstArtist then
firstArtist = k
end
if k == propertyTable.artistChosen then
foundCurrent = true
end
table.insert(propertyTable.artistChoices, { title = v.name, value = k })
end
if not foundCurrent then
-- automatically select first artist
propertyTable.artistChosen = firstArtist
end
propertyTable.multipleArtists = artistsCount > 1
updateArtistName(propertyTable, nil, propertyTable.artistChosen)
end
-- show synchronization message if in progress
if not propertyTable.canSynchronize then
propertyTable.synchronizeGalleriesResult = LOC("$$$/PhotoDeck/SynchronizeStatus/InProgress=In progress")
end
end
end, 'PhotoDeckAPI Login')
end
-- What happens when user clicks "Synchronize galleries" in plugin settings
local function synchronizeGalleries(propertyTable)
propertyTable.synchronizeGalleriesResult = LOC("$$$/PhotoDeck/SynchronizeStatus/InProgress=In progress")
propertyTable.canSynchronize = false
local progressScope = LrProgressScope({
title = LOC("$$$/PhotoDeck/SynchronizeStatus/Title=Gallery synchronization"),
caption = LOC("$$$/PhotoDeck/SynchronizeStatus/Starting=Starting") })
progressScope:setCancelable(true)
LrTasks.startAsyncTask(function()
PhotoDeckAPI.connect(propertyTable.apiKey, propertyTable.apiSecret, propertyTable.username, propertyTable.password)
local result, error_msg = PhotoDeckAPI.synchronizeGalleries(propertyTable.websiteChosen, propertyTable.LR_publishService, progressScope)
if error_msg then
propertyTable.synchronizeGalleriesResult = error_msg
elseif result then
if result.created == 0 and result.deleted == 0 and result.updated == 0 and result.errors == 0 then
propertyTable.synchronizeGalleriesResult = LOC("$$$/PhotoDeck/SynchronizeStatus/FinishedWithNoChanges=Finished, no changes")
else
propertyTable.synchronizeGalleriesResult = LOC("$$$/PhotoDeck/SynchronizeStatus/FinishedWithChanges=Finished: ^1 created, ^2 deleted, ^3 updated, ^4 errors", result.created, result.deleted, result.updated, result.errors)
end
else
propertyTable.synchronizeGalleriesResult = "?"
end
propertyTable.canSynchronize = true
progressScope:setCaption(propertyTable.synchronizeGalleriesResult)
progressScope:done()
end, 'PhotoDeckAPI galleries synchronization')
end
-- API key & secret dialog
function PhotoDeckDialogs.updateApiKeyAndSecret(propertyTable)
local f = LrView.osFactory()
local c = f:column {
bind_to_object = propertyTable,
spacing = f:dialog_spacing(),
f:row {
f:static_text {
title = LOC "$$$/PhotoDeck/ApiKeyDialog/ApiKey=API Key:",
width = LrView.share "label_width",
alignment = "right",
},
f:edit_field {
value = LrView.bind 'apiKey',
immediate = false,
width_in_chars = 40,
}
},
f:row {
f:static_text {
title = LOC "$$$/PhotoDeck/ApiKeyDialog/ApiSecret=API Secret:",
width = LrView.share "label_width",
alignment = "right",
},
f:edit_field {
value = LrView.bind 'apiSecret',
immediate = false,
width_in_chars = 40,
},
},
}
local result = LrDialogs.presentModalDialog({
title = LOC "$$$/PhotoDeck/ApiKeyDialog/Title=PhotoDeck API Keys",
contents = c,
})
return propertyTable
end
-- What happens when user clicks "Change website" in plugin settings
local function chooseWebsite(propertyTable)
local f = LrView.osFactory()
local c = f:row {
spacing = f:dialog_spacing(),
bind_to_object = propertyTable,
f:popup_menu {
items = LrView.bind 'websiteChoices',
value = LrView.bind 'websiteChosen',
},
}
local result = LrDialogs.presentModalDialog({
title = LOC "$$$/PhotoDeck/WebsitesDialog/Title=PhotoDeck Websites",
contents = c,
})
return propertyTable
end
-- What happens when user clicks "Change media library" in plugin settings
local function chooseArtist(propertyTable)
local f = LrView.osFactory()
local c = f:row {
spacing = f:dialog_spacing(),
bind_to_object = propertyTable,
f:popup_menu {
items = LrView.bind 'artistChoices',
value = LrView.bind 'artistChosen',
},
}
local result = LrDialogs.presentModalDialog({
title = LOC "$$$/PhotoDeck/ArtistsDialog/Title=PhotoDeck Media libaries",
contents = c,
})
return propertyTable
end
-- Prevent the plugin settings dialog to be saved, until logged in
local function updateCantExportBecause(propertyTable)
if not propertyTable.loggedin then
propertyTable.LR_cantExportBecause = LOC "$$$/PhotoDeck/AccountDialog/NoLogin=You haven't logged in to PhotoDeck yet."
return
end
propertyTable.LR_cantExportBecause = nil
end
-- Open plugin settings dialog
function PhotoDeckDialogs.startDialog(propertyTable)
propertyTable.loggedin = false
propertyTable.websiteChoices = {}
propertyTable.artistChoices = {}
propertyTable.galleryDisplayStyles = {}
propertyTable.multipleWebsites = false
propertyTable.websiteName = ''
propertyTable.multipleArtists = false
propertyTable.artistName = ''
propertyTable.canSynchronize = PhotoDeckAPI.canSynchronize
propertyTable.synchronizeGalleriesResult = ''
if propertyTable.LR_editingExistingPublishConnection == false then
-- new publish connection: reset credentials
propertyTable.username = nil
propertyTable.password = nil
PhotoDeckAPI.loggedin = false
end
propertyTable:addObserver('loggedin', function() updateCantExportBecause(propertyTable) end)
updateCantExportBecause(propertyTable)
propertyTable:addObserver('websiteChosen', updateWebsiteName)
propertyTable:addObserver('artistChosen', updateArtistName)
local keysAreValid = PhotoDeckAPI.hasDistributionKeys or (
propertyTable.apiKey and propertyTable.apiKey ~= '' and
propertyTable.apiSecret and propertyTable.apiSecret ~= '')
if not keysAreValid then
propertyTable = PhotoDeckDialogs.updateApiKeyAndSecret(propertyTable)
end
if propertyTable.username and propertyTable.username ~= '' and
propertyTable.password and propertyTable.password ~= '' and
keysAreValid then
login(propertyTable)
else
ping(propertyTable)
end
end
-- Top plugin settings
function PhotoDeckDialogs.sectionsForTopOfDialog(f, propertyTable)
local isPublish = not not propertyTable.LR_publishService
local apiCredentials = {
title = LOC "$$$/PhotoDeck/ApiKeyDialog/Title=PhotoDeck API Keys",
synopsis = LrView.bind 'connectionStatus',
f:row {
bind_to_object = propertyTable,
f:column {
f:row {
f:static_text {
title = LOC "$$$/PhotoDeck/ApiKeyDialog/ApiKey=API Key:",
width = LrView.share "label_width",
alignment = 'right'
},
f:static_text {
title = LrView.bind 'apiKey',
width_in_chars = 40,
}
},
f:row {
f:static_text {
title = LOC "$$$/PhotoDeck/ApiKeyDialog/ApiSecret=API Secret:",
width = LrView.share "label_width",
alignment = 'right'
},
f:static_text {
title = LrView.bind 'apiSecret',
width_in_chars = 40,
}
},
},
f:column {
f:push_button {
title = LOC "$$$/PhotoDeck/ApiKeyDialog/ChangeAction=Change",
action = function() propertyTable = PhotoDeckDialogs.updateApiKeyAndSecret(propertyTable) end,
},
},
},
}
local userAccount = {
title = LOC "$$$/PhotoDeck/AccountDialog/Title=PhotoDeck Account",
synopsis = LrView.bind 'connectionStatus',
f:row {
bind_to_object = propertyTable,
f:column {
f:row {
f:static_text {
title = LOC "$$$/PhotoDeck/AccountDialog/Email=Email:",
width = LrView.share "user_label_width",
alignment = 'right'
},
f:edit_field {
value = LrView.bind 'username',
width = 300,
}
},
f:row {
f:static_text {
title = LOC "$$$/PhotoDeck/AccountDialog/Password=Password:",
width = LrView.share "user_label_width",
alignment = 'right'
},
f:password_field {
value = LrView.bind 'password',
width = 300,
}
},
},
f:column {
f:push_button {
title = LOC "$$$/PhotoDeck/AccountDialog/LoginAction=Login",
enabled = LrBinding.negativeOfKey('loggedin'),
action = function () login(propertyTable) end
},
},
},
f:row {
bind_to_object = propertyTable,
f:column {
f:static_text {
title = "",
width = LrView.share "user_label_width",
alignment = 'right'
},
},
f:column {
f:static_text {
title = LrView.bind 'connectionStatus',
font = '<system/small/bold>',
width = 300,
height_in_lines = 2
},
},
},
f:row {
bind_to_object = propertyTable,
f:column {
f:row {
f:static_text {
visible = LrBinding.andAllKeys('loggedin'),
title = LOC "$$$/PhotoDeck/AccountDialog/Website=Website:",
width = LrView.share "user_label_width",
alignment = 'right'
},
f:static_text {
visible = LrBinding.andAllKeys('loggedin'),
title = LrView.bind 'websiteName',
width = 300,
font = '<system/small/bold>',
}
},
},
f:column {
f:push_button {
title = LOC "$$$/PhotoDeck/AccountDialog/WebsiteChangeAction=Change",
visible = LrBinding.andAllKeys('loggedin'),
enabled = LrBinding.andAllKeys('loggedin', 'multipleWebsites'),
action = function() propertyTable = chooseWebsite(propertyTable) end,
},
},
}
}
local publishSettings = {
title = LOC "$$$/PhotoDeck/PublishOptionsDialog/Title=PhotoDeck Publish options",
f:row {
bind_to_object = propertyTable,
f:column {
f:row {
f:static_text {
visible = LrBinding.andAllKeys('loggedin'),
title = LOC "$$$/PhotoDeck/PublishOptionsDialog/Artist=Media library:",
width = LrView.share "user_label_width",
alignment = 'right'
},
f:static_text {
visible = LrBinding.andAllKeys('loggedin'),
title = LrView.bind 'artistName',
width = 300,
font = '<system/small/bold>',
}
},
},
f:column {
f:push_button {
title = LOC "$$$/PhotoDeck/PublishOptionsDialog/ArtistChangeAction=Change",
visible = LrBinding.andAllKeys('loggedin'),
enabled = LrBinding.andAllKeys('loggedin', 'multipleArtists'),
action = function() propertyTable = chooseArtist(propertyTable) end,
},
},
},
f:row {
margin_top = 10,
f:static_text {
title = LOC "$$$/PhotoDeck/PublishOptionsDialog/WatermarkingTitle=Watermark: ",
width = LrView.share "user_label_width",
alignment = 'right'
},
f:static_text {
title = LOC "$$$/PhotoDeck/PublishOptionsDialog/WatermarkingNote=the watermark set as default watermark in PhotoDeck's uploder will be applied to the images shown on your website. Note that Lightroom's own watermark feature (below), if selected, is applied before the upload to PhotoDeck, and therefore will be visible also on high-res images.",
font = '<system/small>',
fill_horizontal = 1,
height_in_lines = -1,
width_in_chars = 40
}
},
f:row {
bind_to_object = propertyTable,
f:checkbox {
title = LOC "$$$/PhotoDeck/PublishOptionsDialog/UploadOnRepublish=Re-upload photo when re-publishing",
value = LrView.bind 'uploadOnRepublish'
}
},
f:row {
f:push_button {
title = LOC "$$$/PhotoDeck/PublishOptionsDialog/SynchronizeGalleries/Action=Import PhotoDeck galleries",
action = function()
local result = LrDialogs.confirm(
LOC "$$$/PhotoDeck/PublishOptionsDialog/SynchronizeGalleries/ConfirmTitle=This will mirror your existing PhotoDeck galleries in Lightroom.",
LOC "$$$/PhotoDeck/PublishOptionsDialog/SynchronizeGalleries/ConfirmSubtitle=Gallery content is currently not imported.",
LOC "$$$/PhotoDeck/PublishOptionsDialog/SynchronizeGalleries/ProceedAction=Proceed",
LOC "$$$/PhotoDeck/PublishOptionsDialog/SynchronizeGalleries/CancelAction=Cancel")
if result == "ok" then
synchronizeGalleries(propertyTable)
end
end,
enabled = LrBinding.andAllKeys('loggedin', 'canSynchronize'),
},
f:static_text {
title = LrView.bind 'synchronizeGalleriesResult',
alignment = 'right',
fill_horizontal = 1,
height_in_lines = 1,
},
}
}
local dialogs = {}
if not PhotoDeckAPI.hasDistributionKeys then
table.insert(dialogs, apiCredentials)
end
table.insert(dialogs, userAccount);
if isPublish then
table.insert(dialogs, publishSettings);
end
return dialogs
end
-- Dialog when a publish service has been created
function PhotoDeckDialogs.didCreateNewPublishService(publishSettings, info)
local result = LrDialogs.confirm(
LOC "$$$/PhotoDeck/InitialSynchronizationDialog/Title=Would you like to import your existing PhotoDeck galleries in Lightroom now?",
LOC "$$$/PhotoDeck/InitialSynchronizationDialog/ConfirmSubtitle=Gallery content is currently not imported.^n^nYou can also import (or re-import) your PhotoDeck galleries later from the publish service settings.",
LOC "$$$/PhotoDeck/InitialSynchronizationDialog/ProceedAction=Yes, proceed now",
LOC "$$$/PhotoDeck/InitialSynchronizationDialog/NoAction=No")
if result == "ok" then
publishSettings.LR_publishService = info.publishService
synchronizeGalleries(publishSettings)
end
end
-- What happens when a gallery display style is selected
local function onGalleryDisplayStyleSelect(propertyTable, key, value)
local chosenStyle = PhotoDeckUtils.filter(propertyTable.galleryDisplayStyles, function(v) return v.value == value end)
if #chosenStyle > 0 then
propertyTable.galleryDisplayStyleName = chosenStyle[1].title
end
end
-- What happens when user clicks "Change gallery display style"
local function chooseGalleryDisplayStyle(propertyTable, collectionInfo)
local f = LrView.osFactory()
local c = f:row {
spacing = f:dialog_spacing(),
bind_to_object = collectionInfo,
f:popup_menu {
items = LrView.bind 'galleryDisplayStyles',
value = LrView.bind { bind_to_object = collectionInfo, key = 'display_style' }
},
}
local result = LrDialogs.presentModalDialog({
title = LOC "$$$/PhotoDeck/GalleryDisplayStylesDialog/Title=Gallery Display Styles",
contents = c,
})
return propertyTable
end
-- Published Collection (=gallery) & Published Collection Set (=folder) settings
PhotoDeckDialogs.viewForCollectionSettings = function(f, publishSettings, info)
info.collectionSettings:addObserver('display_style', onGalleryDisplayStyleSelect)
local publishedCollection = info.publishedCollection
local galleryId
if publishedCollection then
galleryId = publishedCollection:getRemoteId()
if galleryId == '' then
galleryId = nil
end
end
info.collectionSettings.galleryDisplayStyles = {}
publishSettings.currentGalleryId = galleryId
publishSettings.connectionStatus = LOC "$$$/PhotoDeck/CollectionSettingsDialog/ConnectionStatus/Connecting=Connecting to PhotoDeck^."
LrTasks.startAsyncTask(function()
PhotoDeckAPI.connect(publishSettings.apiKey, publishSettings.apiSecret, publishSettings.username, publishSettings.password)
local error_msg = nil
if publishedCollection then
if galleryId then
-- read current live settings
local gallery
gallery, error_msg = PhotoDeckAPI.gallery(publishSettings.websiteChosen, galleryId)
if error_msg then
publishSettings.connectionStatus = LOC("$$$/PhotoDeck/CollectionSettingsDialog/ConnectionStatus/GalleryFailed=Error reading gallery from PhotoDeck: ^1", error_msg)
else
info.collectionSettings.LR_liveName = gallery.name
info.collectionSettings.description = gallery.description
info.collectionSettings.display_style = gallery.displaystyle
end
end
end
if not error_msg then
local galleryDisplayStyles
galleryDisplayStyles, error_msg = PhotoDeckAPI.galleryDisplayStyles(publishSettings.websiteChosen)
if error_msg then
publishSettings.connectionStatus = LOC("$$$/PhotoDeck/CollectionSettingsDialog/ConnectionStatus/GalleryDisplayStylesFailed=Error reading gallery display styles from PhotoDeck: ^1", error_msg)
elseif galleryDisplayStyles then
-- populate gallery display style choices
for k, v in pairs(galleryDisplayStyles) do
table.insert(info.collectionSettings.galleryDisplayStyles, { title = v.name, value = v.uuid })
end
if info.collectionSettings.display_style and info.collectionSettings.display_style ~= '' then
onGalleryDisplayStyleSelect(info.collectionSettings, nil, info.collectionSettings.display_style)
end
end
end
if not error_msg then
publishSettings.connectionStatus = LOC("$$$/PhotoDeck/CollectionSettingsDialog/ConnectionStatus/OK=Connected to PhotoDeck")
end
end, 'PhotoDeckAPI Get Gallery Attributes')
local c = f:view {
bind_to_object = info,
spacing = f:dialog_spacing(),
f:row {
f:static_text {
bind_to_object = publishSettings,
title = LrView.bind 'connectionStatus',
font = '<system/small/bold>',
fill_horizontal = 1
},
f:push_button {
bind_to_object = publishSettings,
action = function() PhotoDeckAPI.openGalleryInBackend(publishSettings.currentGalleryId) end,
visible = LrBinding.keyIsNotNil 'currentGalleryId',
title = LOC("$$$/PhotoDeck/CollectionSettingsDialog/EditInPhotoDeckAction=Open in PhotoDeck"),
}
},
f:row {
f:static_text {
title = LOC("$$$/PhotoDeck/CollectionSettingsDialog/Description=Introduction:"),
width = LrView.share "collectionset_labelwidth",
},
f:edit_field {
bind_to_object = info.collectionSettings,
value = LrView.bind 'description',
width_in_chars = 60,
height_in_lines = 8,
}
},
f:row {
f:static_text {
title = LOC("$$$/PhotoDeck/CollectionSettingsDialog/GalleryDisplayStyle=Gallery Style:"),
width = LrView.share "collectionset_labelwidth",
},
f:static_text {
bind_to_object = info.collectionSettings,
title = LrView.bind 'galleryDisplayStyleName',
width_in_chars = 30,
fill_horizontal = 1
},
f:push_button {
bind_to_object = info.collectionSettings,
action = function() chooseGalleryDisplayStyle(publishSettings, info.collectionSettings) end,
enabled = LrBinding.keyIsNotNil 'galleryDisplayStyles',
title = LOC("$$$/PhotoDeck/CollectionSettingsDialog/ChooseGalleryDisplayStyleAction=Change Style"),
}
},
f:row {
f:static_text {
title = '' -- Dummy entry to give some vertical space, esp for MacOS
}
}
}
return c
end
-- Done
return PhotoDeckDialogs