Skip to content

Commit

Permalink
1.3 worked and first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
remov-b4-flight committed Aug 5, 2022
1 parent 043264c commit 1232e02
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
23 changes: 20 additions & 3 deletions C2Cap.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ local prefs = import 'LrPrefs'.prefsForPlugin()

local CurrentCatalog = LrApplication:activeCatalog()
local CurrentSelectionArray = CurrentCatalog:getActiveSources()
local Threshold = 15

if (#CurrentSelectionArray > 1) then
return
Expand Down Expand Up @@ -51,7 +52,7 @@ LrTasks.startAsyncTask( function ()
CurrentCatalog:withWriteAccessDo('Set Caption',function()
--loops photos in collection
for i,PhotoIt in ipairs(currPhotos) do
PhotoIt:setRawMetadata('caption',CollectionName)
PhotoIt:setRawMetadata('caption',CollectionName)
ProgressBar:setPortionComplete(i,countPhotos)
end --end of for photos loop
CompleteFlag = 1
Expand All @@ -65,12 +66,28 @@ LrTasks.startAsyncTask( function ()
-- Revert back to prefs.RevertTo
if prefs.isRevert and CompleteFlag == 1 then
local collections = CurrentCatalog:getChildCollections()
local photocount = 0
local RevertCol,RevertCol2nd
for i,ColIt in ipairs(collections) do
if ColIt:getName()==prefs.RevertTo then
CurrentCatalog:setActiveSources(ColIt)
if ColIt:getName() == prefs.RevertTo then
local tempArray = ColIt:getPhotos()
photocount = #tempArray
RevertCol = ColIt
if Threshold <= photocount then
RevertCol2nd = ColIt
end
elseif ColIt:getName() == prefs.Revert2nd then
RevertCol2nd = ColIt
end
if RevertCol ~= nil and RevertCol2nd ~= nil then
break
end
end
if Threshold <= photocount then
CurrentCatalog:setActiveSources(RevertCol)
else
CurrentCatalog:setActiveSources(RevertCol2nd)
end
end
end ) --end of startAsyncTask function()
return
2 changes: 1 addition & 1 deletion Info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ return {
LrPluginInfoProvider = 'PluginInfo.lua',
LrInitPlugin = 'PluginInit.lua',

VERSION = { major=1, minor=2, revision=6, build=0, },
VERSION = { major=1, minor=3, revision=0, build=0, },

}
11 changes: 10 additions & 1 deletion PluginInfo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ local PluginInfo = {}
function PluginInfo.startDialog( propertyTable )
propertyTable.isRevert = prefs.isRevert
propertyTable.RevertTo = prefs.RevertTo
propertyTable.Revert2nd = prefs.Revert2nd
end

function PluginInfo.endDialog( propertyTable ,why )
prefs.isRevert = propertyTable.isRevert
prefs.RevertTo = propertyTable.RevertTo
prefs.Revert2nd = propertyTable.Revert2nd
end

function PluginInfo.sectionsForTopOfDialog( viewFactory, propertyTable )
Expand All @@ -27,7 +29,14 @@ function PluginInfo.sectionsForTopOfDialog( viewFactory, propertyTable )
bind_to_object = propertyTable,
viewFactory:row {
viewFactory:checkbox {title = 'Revert Back', value = bind 'isRevert',},
viewFactory:edit_field {title = 'Collection', value = bind 'RevertTo',},
},
viewFactory:row {
viewFactory:static_text {title = 'Collection',},
viewFactory:edit_field {value = bind 'RevertTo',},
},
viewFactory:row {
viewFactory:static_text {title = 'Second Col.',},
viewFactory:edit_field {value = bind 'Revert2nd',},
},
},
}
Expand Down

0 comments on commit 1232e02

Please sign in to comment.