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

A Widget-derived widget with inherit_bindings=False, but no BINDINGS, appears to still inherit bindings #1351

Closed
davep opened this issue Dec 13, 2022 · 6 comments · Fixed by #1352

Comments

@davep
Copy link
Contributor

davep commented Dec 13, 2022

This is very much related to #1343, but I think merits an issue of its own to consider first. The reasons why this happens seem clear enough, but I feel the setup may cause confusion. With Textual as it is of 0.6.0 (with the bindings for movement keys being on Widget), consider this widget:

class Odradek( Widget, inherit_bindings=False ):
    pass

vs this:

class Odradek( Widget, inherit_bindings=False ):
    BINDINGS = []

In the former case the bindings of Widget are still inherited. In the latter they're not.

@willmcgugan
Copy link
Collaborator

Much the same issue as #1336

@rodrigogiraoserrao
Copy link
Contributor

Much the same issue as #1336

So, you are saying that

bindings.append(Bindings(base.BINDINGS))
should be base.__dict__.get("BINDINGS", []) instead of base.BINDINGS?

@rodrigogiraoserrao
Copy link
Contributor

@davep I'll be happy to tackle this one.

@willmcgugan
Copy link
Collaborator

Yup. Suspect that will do it.

davep added a commit to davep/textual that referenced this issue Dec 13, 2022
@davep
Copy link
Contributor Author

davep commented Dec 13, 2022

@davep I'll be happy to tackle this one.

If you do, likely best to not start building up tests for it as I've just popped one for this exactly situation into #1346 and there's going to be more to come, that aren't the same issue but potentially overlap.

@github-actions
Copy link

Don't forget to star the repository!

Follow @textualizeio for Textual updates.

davep added a commit to davep/textual that referenced this issue Dec 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants