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

Dynamic bindings update #4180

Open
willmcgugan opened this issue Feb 19, 2024 · 1 comment
Open

Dynamic bindings update #4180

willmcgugan opened this issue Feb 19, 2024 · 1 comment
Assignees

Comments

@willmcgugan
Copy link
Collaborator

We need a system to allow for "dynamic bindings" in a declarative manner.

We currently allow for the inspection of bindings to generate a footer, but there is currently no way of updating those bindings once created.

Bindings should be associated with actions. Actions will grow a decorator that exposes parameters such as show, active and description. This decorator creates watchers for those reactives which ultimately update the footer, via a signal.

Here's a rough sketch of the interface:

class MyWidget(Widget):
    BINDINGS = [
        Binding("s", show_feature)
    ]
    
    feature_shown = reactive(False)
    feature_description = reactive("Do a thing")
    
    @action(show=MyWidget.feature_shown, description=MyWidget.feature_description)
    def show_feature(self):
       ...
        
  • Note that we now have an action decorator to create actions, but we should continue to support the action_ naming convention.
  • We will need an update to the Footer widget to support this. Maybe look to Toolong for inspiration there.
  • I think we might want to display keys in a less verbose manner, i.e. ^f rather than ctrl+f

This is a fairly involved task, because it does touch a lot of areas. But a big improvement I think!

@darrenburns
Copy link
Member

Closely related/dupe of: #2269

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