fsleyes_widgets.utils.progress
This module provides some classes and functions which use the
wx.ProgressDialog to display the progress of some task.
- fsleyes_widgets.utils.progress.bounce(*args, **kwargs)[source]
Context manager which creates, starts and yields a
Bouncedialog, and destroys it on exit.
- fsleyes_widgets.utils.progress.runWithBounce(task, *args, **kwargs)[source]
Runs the given
taskin a separate thread, and creates aBouncedialog which is displayed while the task is running.- Parameters:
callback – Must be passed as a keyword argument. A function to call when the
taskhas finished. Must accept one boolean parameter which isTrueif the task ended, orFalseif the progress dialog was cancelled.dlg – Must be passed as a keyword argument. A
Bouncedialog to use. If not provided, one is created. If provided, the caller is responsible for destroying it.polltime – Must be passed as a keyword argument. Amount of time in seconds to wait while periodically checking the task state. Defaults to 0.1 seconds.
All other arguments are passed through to
Bounce.__init__(), unless adlgis provided.Note
This function is non-blocking - it returns immediately. Use the
callbackfunction to be notified when thetaskhas completed.
- class fsleyes_widgets.utils.progress.Bounce(title=None, message=None, *args, **kwargs)[source]
Bases:
ProgressDialogDisplay a ‘bouncing’ progress bar.
The
Bounceclass is awx.ProgressDialogfor use with tasks with an unknown duration. The progress bar ‘bounces’ back and forth until the dialog is destroyed or cancelled.A
Bouncedialog can either be controlled manually via theDoBounce()method, , or allowed to run automatically via theStartBounce(). Automatic bouncing can be stopped viaStopBounce().Create a
Bouncedialog.- Parameters:
title – Dialog title.
message – Dialog message.
delay – Must be passed as a keyword argument. Delay in milliseconds between progress bar updates. Defaults to 200 milliseconds.
values – Must be passed as a keyword argument. A sequence of values from 1 to 99 specifying the locations of the progress bar on each update. Deafults to
[1, 25, 50, 75, 99].
All other arguments are passed through to
wx.ProgressDialog.- classmethod runWithBounce(task, *args, **kwargs)[source]
Deprecated - use the standalone
runWithBounce()function instead.