fsleyes_props.suppress¶
This module provides a couple of functions which may be used as context
managers for suppressing notification of changes to HasProperties
property values.
Suppress notification for the given property on the given |
|
Suppress notification for all properties on the given |
|
Skip the listener with the specified listener name, if/when changes to the specified property occur. |
-
fsleyes_props.suppress.suppress(hasProps, propName, notify=False)[source]¶ Suppress notification for the given property on the given
HasPropertiesinstance.This function saves the current notification state of the property, disables notification, yields to the calling code, and then restores the notification state.
- Parameters
hasProps –
HasPropertiesinstance.propName – Property to suppress notifications for.
notify – If
True, a notification will be triggered onpropNameviaHasProperties.propNotify(), exit. Defaults toFalse.
This function is intended to be used as follows:
with suppress(hasProps1, 'prop1'): # Do stuff which might cause unwanted # property value notifications to occur
-
fsleyes_props.suppress.suppressAll(hasProps)[source]¶ Suppress notification for all properties on the given
HasPropertiesinstance.- Parameters
hasProps – The
HasPropertiesinstance to suppress.
This function is intended to be used as follows:
with suppressAll(hasProps): # Do stuff which might cause unwanted # property value notifications to occur
Note
After this function has completed. notification will be enabled for all properties of
hasProps. This is in contrast to thesuppress()function, which restores the previous notification state of the property.
-
fsleyes_props.suppress.skip(hasProps, propName, listenerName, ignoreInvalid=False)[source]¶ Skip the listener with the specified listener name, if/when changes to the specified property occur.
- Parameters
hasProps – A
HasPropertiesinstance.propName – Name of a property on
hasProps.listenerName – Name of the listener to skip.
ignoreInvalid – Defaults to
False. IfTrue, passing a non-existent listener will not result in an error.