Progress#

class anchorpoint.Progress(title: str, text: Optional[str] = None, infinite: bool = True, cancelable: bool = False)#

When creating a Progress object a spinning indicator is shown to the user indicating that something is being processed. Additionally, a job in the Anchorpoint Job Stack is created showing title and the provided text. The progress indicator goes away as soon as the object is destroyed or when finish() is called explicitly.

canceled#

True if the user has canceled the action. Can be polled when doing a long running async job.

Type

bool

Examples

Create a spinning progress indicator
>>> progress = anchorpoint.Progress("My Action", "Rendering the scene")
Report a 50% percentage to indicate progress
>>> progress = anchorpoint.Progress("My Action", "Rendering the scene", infinite = False)
>>> progress.report_progress(0.5)
__init__(title: str, text: Optional[str] = None, infinite: bool = True, cancelable: bool = False) None#

Creates a Progress object that starts spinning in the Anchorpoint UI.

Parameters
  • title (str) – The title of the indicator

  • text (Optional[str]) – The text of the indicator

  • infinite (bool) – Set to False when you want to report progress from 0% - 100%, set to True to show a simple infinite spinning progress.

  • cancelable (bool) – Set to True so that the user can cancel the action in the UI. React to cancellation by polling cancelled()

Example

>>> progress = anchorpoint.Progress("My Action", "Rendering the scene")
finish() None#

Explicitly finishes the progress indicator.

Example

>>> progress = anchorpoint.Progress("My Action", "Rendering the scene")
>>> progress.finish()
report_progress(percentage: float) None#

Reports progress to the users by showing a loading bar. Only works if you set infinite=False.

Parameters

percentage (float) – Percentage from 0 to 1

Example

>>> progress = anchorpoint.Progress("My Action", "Rendering the scene", infinite=False)
>>> progress.set_progress(0.75)
set_text(text: str) None#

Updates the text in the progress indicator

Parameters

text (str) – The text to set

Example

>>> progress = anchorpoint.Progress("My Action", "Rendering the scene")
>>> progress.set_text("Uploading Rendering")