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 properties 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/properties occur.

fsleyes_props.suppress.suppress(hasProps, *propNames, notify=False)[source]

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

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

Parameters:
  • hasPropsHasProperties instance.

  • propNames – Properties to suppress notifications for.

  • notify – If True, a notification will be triggered on propNames 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)[source]

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, propNames, listenerName, ignoreInvalid=False)[source]

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

Parameters:
  • hasProps – A HasProperties instance.

  • propNames – Name of a property on hasProps, or a sequence of property names.

  • listenerName – Name of the listener to skip.

  • ignoreInvalid – Defaults to False. If True, passing a non-existent listener will not result in an error.