-
Notifications
You must be signed in to change notification settings - Fork 55
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
base: main
Are you sure you want to change the base?
Conversation
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.
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) |
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.
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 |
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.
This should be a float.
Adding a new attribute
splash_screen_duration
to control the duration for which the splash screen is shown upon application start.