Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deregister event? #626

Open
bzh4bzh opened this issue Jul 2, 2020 · 2 comments
Open

Deregister event? #626

bzh4bzh opened this issue Jul 2, 2020 · 2 comments

Comments

@bzh4bzh
Copy link

bzh4bzh commented Jul 2, 2020

Is it possible to deregister event? If so how?

@bzh4bzh bzh4bzh mentioned this issue Jul 3, 2020
@bzh4bzh
Copy link
Author

bzh4bzh commented Jul 3, 2020

Leaving issue open so it'll be marked appropriately.

    def deregisterEvent(self, func):
        """ Remove a queued function from poll register"""
        if func in self.events:
            self.events.pop(self.events.index(func))

@jarvisteach
Copy link
Owner

Exactly this!

There is a function already in the code:

def unregisterEvent(self, func):
    """ Remove the specified function from the event list """
    try:
        self.events.remove(func)
    except ValueError:
        gui.error("Unable to unregister event - not registered.")

Which looks pretty much the same as yours, just you've given yours a more sensible name!

I'll add an overload to the existing method to match the name you gave yours, as that makes more sense.

I'll also look at the docs, to try to make the more clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants