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 splash_screen_duration to GUIApplication class. #1144

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jonathanrocher
Copy link
Collaborator

@jonathanrocher jonathanrocher commented Jul 7, 2022

Adding a new attribute splash_screen_duration to control the duration for which the splash screen is shown upon application start.

Copy link
Contributor

@corranwebster corranwebster left a comment

Choose a reason for hiding this comment

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

If I'm guessing what you want, is for the splash screen to persist for at least a minimum amount of time so it is visible to the user.

Probably the right way of doing this is to instead modify start_event_loop to do something like

    def start_event_loop(self):
        if self._splash_screen is not None:
            self.invoke_after(
                self.splash_screen_duration * 1000,  # milliseconds
                self.self._splash_screen.close,
            )
    ...

which avoids locking up the app, and also allows the user to dismiss by clicking on it.

@@ -167,6 +172,8 @@ def start(self):
# create the GUI so that the splash screen comes up first thing
if self.gui is Undefined:
self.gui = GUI(splash_screen=self.splash_screen)
if self.splash_screen_duration > 0:
sleep(self.splash_screen_duration)
Copy link
Contributor

Choose a reason for hiding this comment

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

This halts all processing for a number of seconds, and in particular the event loop will not be running so the app will be locked-up, which is generally not a good thing. At a minimum, this should occasionally be processing events.

@@ -64,6 +66,9 @@ class GUIApplication(Application):
#: The splash screen for the application. No splash screen by default
splash_screen = Instance(ISplashScreen)

#: How long to display the splash screen, in seconds. Flashed by default.
splash_screen_duration = Int
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be a float.

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

2 participants