Skip to content

Refactor get_bottom_toolbar implementation for getting_started.py example #1702

Description

@tleonhardt

The documentation for get_bottom_toolbar correctly warns that this method is called on every UI refresh. However, the implementation in the getting_started.py example performs relatively heavy operations inside this callback and as such I'm worried we are creating somewhat of a bad example for others to follow.

get_app().output.get_size() and datetime.datetime.now() are called every single time the user presses a key. In a high-frequency typing scenario, this might introduce micro-stutter if the terminal resize logic or time fetching becomes a bottleneck.

We should probably have something like a background thread that updates variables with this information (protected by a lock). Then the get_bottom_toolbar callback should just format that info for display.

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