Add extension point to notify when browse mode state becomes active or inactive#15450
Conversation
|
cc: @LeonarddeR @XLTechie |
| obj.treeInterceptor=treeInterceptorObject | ||
| else: | ||
| obj.treeInterceptor=None | ||
| if obj.treeInterceptor: |
There was a problem hiding this comment.
Isn't this block executed on every focus change? I guess that's problematic.
There was a problem hiding this comment.
Agreed, this needs needs to be changed. It's probably worth caching the previous browse mode value
Seems not to have undesirable effects. Anyway, if you have another suggestion, please let me know. |
|
I'd rather see the extension point only called on a change. |
|
I'd rather see the extension point only called on a change. For this reason, for now the best way to achieve the possibility of being notified about changes is this one. Hope a best way can be found if this is problematic. |
|
Could you please update the title to be more descriptive of the change? |
|
@LeonarddeR and @seanbudd agree about this:
I think that we can use the globalVars.oldFocusObject and create a variable with its treeInterceptor, if the old object exist. Then, if focusObject.treeInterceptor is not equal to the oldTreeInterceptor, then we can trigger the extension point. Otherwise, it should be triggered just when a tree interceptor exist and the the _set_passThrough function can take charge of this. I'll test this in a few hours after job. |
|
This sounds good to me. It might be good to have a look into reportPassThrough as well. May be that can be simplified based on this new extension point. |
See test results for failed build of commit f3ea2c38d2 |
Yes, though for now my tests are failing. Maybe in a new PR? Or, if you have suggestion, let me know please. I'll mark this as ready for review. |
My mistake. Fixed. |
Link to issue number:
fixes #14969
Summary of the issue:
Sometimes, it would be desirable perform actions when browse mode state changes. For example, this may be useful to activate or deactivate a profile when entering or exiting browse mode.
Description of user facing changes
Description of development approach
A treeInterceptorHandler.post_browseModeStateChange extension point has been added. The browseMode parameter represents the state of browse mode (True or False).
Testing strategy:
Known issues with pull request:
None.
Change log entries:
For Developers
Added treeInterceptorHandler.post_browseModeStateChange extension points, to be notified about state changes in browse mode (#14969)
Code Review Checklist: