Jim, the documentation for LrCatalog:withWriteAccessDo says: "Do not call LrTasks.yield() or any similar call that will cause your task to wait during this call." It's a bug that we're not reporting an error on the LrTasks.yield() call in this case.
If you need to do a task that will take a longer time, then you should call LrCatalog:withProlongedWriteAccessDo instead.
Got that. The yield() was only in there as an attempt to get the main thread to update the ProgressScope.
I've tried "withProlongedWriteAccess" and I'm afraid I have the same problem; the progress scope doesn't appear. I know it's being used, because a) none of the update calls fail, and b) if I put in a LrDialogs.message() at the end of the callback function for withProlonged..., the progress scope appears in front of the dialog.
Incidentally, if I do this then neither dialog will accept input to their "Cancel" or "Ok" buttons. You have to click the 'Close' icon in the top right of the newly-appeared progress bar.
The progress dialog isn't essential, but it would be nice. Still looks like it has a problem when it's called from a menu.
(Windows 7 x64)
withProlongedWriteAccessDo provides you with its own progress scope. Did that not work for you?
No, I'm afraid not. As I said, it has the exact same problem. The progress dialog doesn't appear at all unless I put in an LrDialog.message at the end of the long update, and even then it only appears at that point - i.e. completed - and also locks the screen.
Did you use yield in the prolonged access? Otherwise the UI wouldn't get a chance to update.
Thanks for the suggestion. Unfortunately, I'd already tried both with and without LrTasks.yield() - same result, no GUI. Here's the relevant code:
local DoSyncUpdate = function(context, Prog)
local cat = LrApplication.activeCatalog()
for i,p in ipairs(cat.allPhotos) do
ProcCount = ProcCount + 1
-- Do stuff here
p:setPropertyForPlugin( _PLUGIN, 'NeedsSync', NeedsSync)
LrDialogs.message('Sync status updated.','Check the "Alamy - Sync Needed" Smart Collection.','info')
title = 'Update Sync Status',
caption = 'Checking Sync Status',
pluginName = 'Alamy Uploader',
func = DoSyncUpdate,
There's no GUI activity beyond a busy cursor until the LrDialogs.message, at which point both the message *and* the progress dialog appear.
I repeat, because I think it's significant, that this is being called from a menu item and not from an export module.
I have noticed as well that the progressScope inside a menu item sets up but the progressScope:setPortionComplete() function does absolutely nothing. All works as expected in an export module sdk. Any luck with a workaround?