Skip to content

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

Closed
@ptmcg

Description

@ptmcg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions