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

Setting a keymap doesn't update the Footer or help panel #5695

Open
davep opened this issue Apr 1, 2025 · 5 comments
Open

Setting a keymap doesn't update the Footer or help panel #5695

davep opened this issue Apr 1, 2025 · 5 comments

Comments

@davep
Copy link
Contributor

davep commented Apr 1, 2025

Given this code:

from textual.app import App, ComposeResult
from textual.binding import Binding
from textual.widgets import Footer


class RemapIssueApp(App[None]):

    BINDINGS = [
        Binding("f2", "change", description="Change my own key", id="change"),
    ]

    def compose(self) -> ComposeResult:
        yield Footer()

    def on_mount(self) -> None:
        self.app.action_show_help_panel()

    def action_change(self) -> None:
        self.set_keymap({"change": "f9"})

if __name__ == "__main__":
    RemapIssueApp().run()

Pressing f2 remaps the binding to f9 but the Footer and help panel both show the old mapping. If you pull up the command palette, or tab away from and back to the terminal window (actions that would cause a refresh) then they both catch up.

@davep davep changed the title Setting a keycap doesn't update the Footer or help panel Setting a keymap doesn't update the Footer or help panel Apr 1, 2025
@Forgen
Copy link

Forgen commented Apr 1, 2025

Widgets cannot get automatic notification that the parent bindings change I believe. Try calling a manual refresh in action_change?

@davep
Copy link
Contributor Author

davep commented Apr 1, 2025

@Forgen The fact that both the footer and the key panel subscribe to bindings_updated_signal suggests that the intent is that that should not be necessary.

@Forgen
Copy link

Forgen commented Apr 1, 2025 via email

@davep
Copy link
Contributor Author

davep commented Apr 1, 2025

@Forgen I suspect you're confusing signals and messages. Messages bubble, signals are pub/sub.

@Forgen
Copy link

Forgen commented Apr 1, 2025 via email

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

No branches or pull requests

2 participants