musselwhizzle / Focus-Points

Plugin for Lightroom to show which focus point was active in the camera when a photo was taken
Apache License 2.0
344 stars 42 forks source link

Fixes for plugin progress dialog cancel & LR lockup. #115

Closed philmoz closed 7 years ago

philmoz commented 7 years ago

This change allows the progress dialog to be cancelled. It also prevents the plugin from being run twice which locks up LR with a 'Task Completed' dialog box that can't be closed.

musselwhizzle commented 7 years ago

how does it prevent it from running twice? Does startAsyncTask use single thread pool or something?

EDIT: running this code I can still reproduce the 'Task Completed' dialog that can't be closed. All I'm seeing from this is a check on isCanceled and then not showing the dialog. As I noted in the issue i filed about this, there's no way to interrupt the thread and cancel out immediately. But at least checking for canceled() is better than nothing.

philmoz commented 7 years ago

It appears that doing the call to 'checkPhotoAvailability' outside the 'innerContext' was allowing you to trigger the plugin twice. I was only able to do this by mapping a keyboard shortcut to the plugin - sometimes the plugin would take a while to start and I would hit the shortcut again.

I noticed that the metadata dialog plugin didn't do this, and the main difference was the extra code being run before the 'innerContext'.

musselwhizzle commented 7 years ago

It appears that doing the call to 'checkPhotoAvailability' outside the 'innerContext' was allowing you to trigger the plugin twice.

gezzz......

musselwhizzle commented 7 years ago

turns out the dialog blocks all UI input which is what stops it from opening twice. Move the photo check to inside past the progress dialog opening is the trick needed.

musselwhizzle commented 7 years ago

thanks combined the code and merged in.