Skip to content

Add ability to disable callbacks temporarily #20802

Closed

Description

@greglucas

It may be useful to update some attributes on an object that has callbacks temporarily and we don't want those callback signals being processed during that time.

I guess we could add a disabling_callbacks() context manager on CallbackRegistry?

with self.norm.callbacks.disabling_callbacks(), cbook._setattr_cm(self.norm, ...): ...

Originally posted by @anntzer in #19553 (comment)

Activity

  1. timhoffm commented on Aug 7, 2021

    @timhoffm
    Member

    Naming suggestion: callbacks_disabled() or even only disabled():

    with self.norm.callbacks.disabled():
    
  2. QuLogic commented on Aug 9, 2021

    @QuLogic
    Member

    In Qt, this is Widget->blockSignals, and in GTK, it is g_signal_handlers_block_*. Wx has a wxEventBlocker that you add on a widget to temporarily stop events. Not sure if Tk has anything similar.

    IOW, it seems like 'block' is the common term for this for events, though I don't know if these callbacks qualify as 'events'.

  3. added this to the v3.5.0 milestone on Aug 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions