Skip to content

[ENH]: allow passing a function to CallbackRegistry.disconnect #23306

@ianhi

Description

@ianhi

Problem

Currently to disconnect a callback in a callback registry you need to keep track of the connection id. It'd be easier to use if you could instead just pass the function to disconnect.

Proposed solution

Allow for the following:

reg = CallbackRegistry()

def f1():
   pass

cid = reg.connect("something", f1)

reg.disconnect_func("something", f1) 
# above is equivalent to reg.disconnect(cid)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions