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 Suppress notification for the given property on the given HasProperties instance.
suppressAll Suppress notification for all properties on the given HasProperties instance.
skip Skip the listener with the specified listener name, if/when changes to the specified property occur.
fsleyes_props.suppress.suppress(hasProps, propName, notify=False)

Suppress notification for the given property on the given HasProperties instance.

This function saves the current notification state of the property, disables notification, yields to the calling code, and then restores the notification state.

Parameters:
  • hasPropsHasProperties instance.
  • propName – Property to suppress notifications for.
  • notify – If True, a notification will be triggered on propName via HasProperties.propNotify(), exit. Defaults to False.

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)

Suppress notification for all properties on the given HasProperties instance.

Parameters:hasProps – The HasProperties instance 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 the suppress() function, which restores the previous notification state of the property.

fsleyes_props.suppress.skip(hasProps, propName, listenerName, ignoreInvalid=False)

Skip the listener with the specified listener name, if/when changes to the specified property occur.

Parameters:
  • hasProps – A HasProperties instance.
  • propName – Name of a property on hasProps.
  • listenerName – Name of the listener to skip.
  • ignoreInvalid – Defaults to False. If True, passing a non-existent listener will not result in an error.