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

Add UI element that displays status updates #856

Closed
hannobraun opened this issue Jul 21, 2022 · 9 comments
Closed

Add UI element that displays status updates #856

hannobraun opened this issue Jul 21, 2022 · 9 comments
Labels
type: feature New features and improvements to existing features

Comments

@hannobraun
Copy link
Owner

Right now, a lot of what's happening with the Fornjot app is only visible on the command-line. This is not user-friendly, since the Fornjot app opens a window, and the user might not expect to receive important information anywhere else. Depending on how the app is started, the user might not even have access to the command-line output.

There are certainly many ways to display status updates in a user-friendly way, but I'd like to start with a single UI element that is flexible enough to display all kinds of status updates: some kind of scrollable text field (I'm sure egui provides a suitable widget).

Off the top of my head, here's what status updates I think should go into that text field:

  • Reloading model (due to a change to the model source code)
  • Model reloaded
  • Error reloading model (with full error message)

Since this information comes from places like fj-host, which doesn't have any concept of UI, it probably makes sense to have some kind of struct with methods like report_error, report_status_update (just suggestions; not to be taken too literally) that just stores the message as a string, and can then be used to display the message where appropriate.

In the regular UI use case, that would mean fj-viewer queries that struct for messages and displays them in the aforementioned text field. When running fj-app on the command-line with the --export argument, which would not result in a window being opened, fj-app could use the same struct to display the messages on the command-line.

I think the appropriate place for that struct would be in fj-interop.

@hannobraun hannobraun added type: feature New features and improvements to existing features topic: model labels Jul 21, 2022
@hannobraun hannobraun added this to the Basic Usability milestone Jul 21, 2022
@devanlooches
Copy link
Contributor

Is it alright if I take a stab at this?

@hannobraun
Copy link
Owner Author

Of course, go ahead! Let me know, if you have any questions.

Thank you for your interest!

@devanlooches
Copy link
Contributor

Hey, Is there an easy way to force the window (if possible only the config part) to redraw in order to reflect the newest status update?

@hannobraun
Copy link
Owner Author

That shouldn't be necessary. The window is redrawn every frame, so hopefully 60 times for second (or slower, depending on your hardware). It shouldn't be necessary to force a redraw, because the next one should be happening in a few milliseconds anyway.

egui is an immediate-mode GUI, meaning there isn't any state in the UI components. The whole UI is rebuilt every frame, so it shouldn't be necessary to do anything special to have it reflect the latest status. Please note that I haven't done our egui integration, nor have I worked with this code so far. I might be missing some subtleties.

What specifically is your problem? Maybe there's something else going on that isn't related to redrawing?

@devanlooches
Copy link
Contributor

Hmm in that case it might be my struct isn't being updated for some reason? For some reason only the first message is being drawn in the ui.

@hannobraun
Copy link
Owner Author

Sounds reasonable. If you want, you can open a pull request and mark it as a draft, and I'll have a look.

@devanlooches
Copy link
Contributor

Sure I will do that shortly

@devanlooches
Copy link
Contributor

I opened #911

@hannobraun
Copy link
Owner Author

This has been addressed in #911 and #919. Thank you, @devanlooches! Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature New features and improvements to existing features
Projects
None yet
Development

No branches or pull requests

2 participants