Textualize / textual

The lean application framework for Python. Build sophisticated user interfaces with a simple Python API. Run your apps in the terminal and a web browser.
https://textual.textualize.io/
MIT License
24.07k stars 741 forks source link

New default key bindings for DataTable override app-defined bindings #4637

Closed ptmcg closed 3 weeks ago

ptmcg commented 3 weeks ago

New key bindings added to DataTable in 0.67.0 release supersede those I defined for my app (logmerger).

Textual 0.66.0 footer: logmerger_textual_0 66 0

Textual 0.67.0 footer logmerger_textual_0 67 0

After @willmcgugan suggested adding priority=True to my bindings, the footer looks like:

logmerger_textual_0 67 0_priority_true

Bindings for my app are defined in this manner (shown with priority=True added):

class InteractiveLogMergeViewerApp(App):
    """
    Class to display merged results using textual TUI.
    """
    TITLE = "logmerger"

    BINDINGS = [
        Binding(key="q", action="quit", description="Quit", priority=True),
        Binding(key="ctrl+d", action="toggle_dark", description="Toggle Dark Mode", show=False),
        Binding(key="j", action="jump", description="Jump", priority=True),
        Binding(key="f", action="find", description="Find", priority=True),
        Binding(key="n", action="find_next", description="Next", priority=True),
        Binding(key="p", action="find_prev", description="Prev", priority=True),
        Binding(key="l", action="goto_line", description="Go to line", priority=True),
        Binding(key="t", action="goto_timestamp", description="Go to timestamp", priority=True),
        Binding(key="s", action="screenshot", description="Screenshot", priority=True),
        Binding(key="h", action="help_about", description="Help/About", priority=True),
    ]

    def __init__(self, *args, **kwargs):

        ... etc. ...

Here is the full repo for logmerger: https://github.com/ptmcg/logmerger The textual code is in this specific file: https://github.com/ptmcg/logmerger/blob/main/logmerger/interactive_viewing.py and in the related tui directory.

You can run logmerger without any log files as python -m logmerger --demo.

github-actions[bot] commented 3 weeks ago

We found the following entries in the FAQ which you may find helpful:

Feel free to close this issue if you found an answer in the FAQ. Otherwise, please give us a little time to review.

This is an automated reply, generated by FAQtory

ptmcg commented 3 weeks ago

DataTable key binding changes reverted in 0.67.1

github-actions[bot] commented 3 weeks ago

Don't forget to star the repository!

Follow @textualizeio for Textual updates.