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

Fix live updates to footers on Textual TUIs #597

Merged
merged 4 commits into from
May 20, 2024

Conversation

godlygeek
Copy link
Contributor

In Textual 0.61, App.namespace_bindings was removed in favor of Screen.active_bindings. Update our implementation of dynamically updating footer descriptions to work for both, since we still support Textual versions below 0.61.

These actions live on the app, not on the screen.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
Avoid proliferation of hacky code.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
This is necessary pre-factoring for fixing the approach we use for
changing the descriptions of key bindings in the footer to work on the
latest versions of Textual.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
@godlygeek godlygeek self-assigned this May 19, 2024
@godlygeek godlygeek force-pushed the fix_textual_footer branch 2 times, most recently from adab098 to 599fb5a Compare May 19, 2024 21:05
@codecov-commenter
Copy link

codecov-commenter commented May 19, 2024

Codecov Report

Attention: Patch coverage is 80.95238% with 12 lines in your changes are missing coverage. Please review.

Project coverage is 92.86%. Comparing base (41248ed) to head (47e859c).
Report is 38 commits behind head on main.

Files Patch % Lines
src/memray/reporters/tui.py 76.00% 6 Missing ⚠️
src/memray/reporters/tree.py 79.16% 5 Missing ⚠️
src/memray/reporters/_textual_hacks.py 92.85% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #597      +/-   ##
==========================================
+ Coverage   92.55%   92.86%   +0.30%     
==========================================
  Files          91       92       +1     
  Lines       11304    11234      -70     
  Branches     1581     2055     +474     
==========================================
- Hits        10462    10432      -30     
+ Misses        837      802      -35     
+ Partials        5        0       -5     
Flag Coverage Δ
cpp 92.86% <80.95%> (+6.92%) ⬆️
python_and_cython 92.86% <80.95%> (-2.86%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@godlygeek godlygeek force-pushed the fix_textual_footer branch 2 times, most recently from e6cc8a2 to 2fe80b1 Compare May 19, 2024 21:23
@godlygeek godlygeek marked this pull request as ready for review May 19, 2024 21:28
Copy link
Contributor

@sarahmonod sarahmonod left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but as discussed I would prefer for update_key_description to be a shared function in a new file, e.g. src/memray/reporters/_textual_hacks.py

@godlygeek godlygeek enabled auto-merge (rebase) May 20, 2024 03:11
In Textual 0.61, `App.namespace_bindings` was removed in favor of
`Screen.active_bindings`. Update our implementation to work for both,
since we still support Textual versions below 0.61.

Signed-off-by: Matt Wozniski <mwozniski@bloomberg.net>
@godlygeek godlygeek merged commit 2f50fa7 into bloomberg:main May 20, 2024
19 checks passed
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

Successfully merging this pull request may close these issues.

None yet

3 participants