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: log messages to the bottom of the output window instead of the top #946

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

gtdang
Copy link
Collaborator

@gtdang gtdang commented Nov 18, 2024

Prints log messages to the bottom of the output instead of the top.

@gtdang
Copy link
Collaborator Author

gtdang commented Nov 18, 2024

A separate issue is that scrolling to the bottom of the output is not automatic. There is not currently a fix for that though. And it is a noted desired feature/milestone by the ipywidgets devs.
jupyter-widgets/ipywidgets#1815
https://github.com/jupyter-widgets/ipywidgets/milestone/2

@gtdang gtdang marked this pull request as ready for review November 18, 2024 15:35
@gtdang gtdang linked an issue Nov 18, 2024 that may be closed by this pull request
Copy link
Collaborator

@asoplata asoplata left a comment

Choose a reason for hiding this comment

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

As far as I can test, this definitely solves the issue. However, something that was un-noticeable before is that if you have scrolled down the log, and then do something that prints output to the log (such as making a new figure), the log "refreshes" and automatically moves its position back up to the top. We probably never noticed it before since it was printing new messages to the top location itself. Hopefully, if we can ever get auto-scroll working, that will solve this annoyance. (That said, this is only an annoyance, not a bug, so I won't make a thing of it). Thanks George!

@dylansdaniels
Copy link
Collaborator

Can we hold off on merging this? I think we should discuss whether it's better to print to the top or bottom in general. The log isn't useful now as it stands because while information should be printed to the bottom, it doesn't autoscroll to the bottom. It seems like there isn't an easy solution to autoscroll / pin to the bottom, so we may actually want to print new info to the top so users actually see it

@gtdang
Copy link
Collaborator Author

gtdang commented Nov 18, 2024

Keep in mind that there are two message types going to the output at the moment. 1) Statements (usually print) contained within the output widget's context manager will print top to bottom. 2) Logging statements, which use the logger class to send messages to the output widget. This PR changes the order of the logging statements to go to the bottom of the output console.

I'm not quite sure what the fix would be to make (1) print in the reverse order. One solution would be to switch everything to logging statements (2) so all messages come in the same format and we know how to reverse the order. See the ipywidgets docs on integrating output widgets with the logging module to get a sense about how logger is set up with the GUI's output widget.

@jasmainak
Copy link
Collaborator

GUIs typically don't come with an output log ... it's worth asking what purpose the log serves. Do you actually need the user to see the entire history? Maybe you can overwrite the log with every operation so the user sees what just happened. If the history is indeed needed for debugging, the user can refer to the output on the terminal. This way you avoid feature creep ...

@gtdang
Copy link
Collaborator Author

gtdang commented Nov 19, 2024

GUIs typically don't come with an output log ... it's worth asking what purpose the log serves. Do you actually need the user to see the entire history? Maybe you can overwrite the log with every operation so the user sees what just happened. If the history is indeed needed for debugging, the user can refer to the output on the terminal. This way you avoid feature creep ...

I agree, refreshing the output per operation could be a good idea. I feel like the output window mostly serves as a way to tell if an operation is still running (long operations like simulations) and confirmation that an operation has finished (File IO, plotting)--in lieu of having something like a progress bar or other messaging system.

@asoplata asoplata merged commit 4149234 into jonescompneurolab:master Nov 25, 2024
12 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.

BUG: GUI log window prints messages out of order
4 participants