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

Show loading screen on startup #581

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

orende
Copy link
Contributor

@orende orende commented Sep 7, 2023

Description

Adds a loading screen (splash screen) that is shown during application startup so that the application does not appear unresponsive if e.g. the network is slow. I moved most of the heavy initialization work from the Window class constructor to the library.initialize() method. In order to get the splash screen to work, some changes to initialization order had to be done in the minigalaxy file, and the initialization in the Library class had to be moved to a thread so that the GTK initialization was not blocked.

Additionally, the related unit tests were updated, an AI-generated splash screen image was added and two additional useless game ids were added to the constants.py file.

This PR solves #575 .

Checklist

  • CHANGELOG.md was updated (format: - Change made (thanks to github_username))

Adds a loading screen shown on startup. Also refactors library and window classes to reduce coupling and move most of the slow work done in the window constructor to library.initialize().
Adds game ids for "Cyberpunk 2077 Digital Goodies" and "Xenonauts 2 alpha demo".
Copy link
Owner

@sharkwouter sharkwouter left a comment

Choose a reason for hiding this comment

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

I'm seeing some issues on my system. First time I started it, Minigalaxy froze and the main window was not shown at all. Now I've tried again a couple of times and I'm seeing this:

wouter@wouter-gridscale:~/Personal/minigalaxy$ bin/minigalaxy 

(minigalaxy:31402): Gtk-CRITICAL **: 11:21:59.893: gtk_widget_get_toplevel: assertion 'GTK_IS_WIDGET (widget)' failed

(minigalaxy:31402): Gtk-CRITICAL **: 11:21:59.893: _gtk_widget_captured_event: assertion 'WIDGET_REALIZED_FOR_EVENT (widget, event)' failed
wouter@wouter-gridscale:~/Personal/minigalaxy$ bin/minigalaxy 

(minigalaxy:31444): Gdk-ERROR **: 11:22:08.672: The program 'minigalaxy' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadImplementation (server does not implement operation)'.
  (Details: serial 528 error_code 17 request_code 20 (core protocol) minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the GDK_SYNCHRONIZE environment
   variable to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
Trace/breakpoint trap (core dumped)

I think there is an issue with multithreading again. Threads outside of the main thread cannot use gtk objects without potentially causing crashes. Using Glib.idle_add prevents this issue, by scheduling it on the main thread. I'm not sure if the main thread does not get stuck somewhere, though.

Copy link
Owner

Choose a reason for hiding this comment

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

Could you use the Minigalaxy logo that's used for the about window instead of this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will do.

@sharkwouter
Copy link
Owner

sharkwouter commented Oct 5, 2023

I was testing this on Ubuntu 22.04. Just so you know. When I tested this on Debian earlier, it was working. It's a bit odd.

@sharkwouter
Copy link
Owner

Sorry it took this long to review this. I really appreciate the work! Thanks!

@orende
Copy link
Contributor Author

orende commented Oct 5, 2023 via email

@orende
Copy link
Contributor Author

orende commented Oct 18, 2023

After moving the GUI-related function calls in library.initialize() to GLib.idle_add, I started having trouble with credentials not being shared across threads. Still investigating that, but haven't had much time to spend on it lately.

@sharkwouter
Copy link
Owner

Thanks for the update! I appreciate the work you put in this. I'm sorry for not getting back to you earlier, I had quite the situation in my private life. Now I'll be able to support you again, though, so let me know if I can do anything.

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.

2 participants