-
Notifications
You must be signed in to change notification settings - Fork 368
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
Add pause button to live view #418
Conversation
I have not reviewed the code yet, but I noticed that when running |
Update: seems that it only updates when I keep pressing U |
Codecov ReportPatch coverage has no change and project coverage change:
Additional details and impacted files@@ Coverage Diff @@
## main #418 +/- ##
==========================================
+ Coverage 84.85% 84.99% +0.13%
==========================================
Files 29 29
Lines 3631 3631
==========================================
+ Hits 3081 3086 +5
+ Misses 550 545 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Oh interesting, I'm not seeing that on my side but I just put in a flag to prevent data from being copied a bunch while holding the keys down - and pushed that up. Possibly related? |
|
Thanks a lot @bilbofroggins this looks fantastic. Very good job! 🚀 Can you maybe add a small test that checks the |
Signed-off-by: Patrick Cunniff <pjcfifa@gmail.com>
Signed-off-by: Patrick Cunniff <pjcfifa@gmail.com>
Signed-off-by: Patrick Cunniff <pjcfifa@gmail.com>
Signed-off-by: Patrick Cunniff <pjcfifa@gmail.com>
fe74890
to
81e261c
Compare
👍 Added |
Signed-off-by: Patrick Cunniff <pjcfifa@gmail.com>
Signed-off-by: Patrick Cunniff <pjcfifa@gmail.com>
c397e4d
to
2b717e2
Compare
Will make another pass tomorrow! Thanks for the ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Excellent work @bilbofroggins ✨
Thanks a lot for contributing to memray :)
Add a key binding for pausing refreshes, and another key binding for resuming the display. Ensure that records continue to be consumed from the socket, and only the refreshes of the TUIs data are suspended. Signed-off-by: Pablo Galindo <pablogsal@gmail.com>
*Issue number of the reported bug or feature request: #404 *
Describe your changes
P key to pause, and when paused, U key to unpause.
Couldn't see anything built in to rich live that will automatically do this, so I just split the TUI class into a layout class (TUI) and a data class (TUIData) so that we can snapshot the data when the user pauses and show the snapshot while continuing to write to the live version of data in the background (in update_snapshot)
Previously used to put the whole _snapshot (Iterable[AllocationRecord]) within the TUI class and then extract what we cared about in the render stage (get_body) but there's a bunch of extra stuff in there it seems like is not needed. Instead, extracting the data we need in update_snapshot and then get_body can just pull from TUIData.
Testing performed
Tested an application that has a couple threads - made sure you can still arrow through them.
Sorting still works and carries over paused/unpaused states.
Ran pytest locally.
Closes: #418