mapteksdk.progress_indicator module
Module containing the protocol and errors for progress indicators.
- exception ProgressIndicatorNotSupportedError
Bases:
ApplicationTooOldError
Error raised if progress indicators aren’t supported.
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- classmethod with_default_message(feature)
Construct a ApplicationTooOldError with the default message.
The message will suggest that feature is not supported.
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception ProgressCancelledError
Bases:
Exception
Error raised if the user cancels the progress indicator.
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- exception ProgressFinishedError
Bases:
Exception
Error raised if accessing the progress indicator after it is closed.
- add_note()
Exception.add_note(note) – add a note to the exception
- args
- with_traceback()
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
- class ProgressIndicator(*args, **kwargs)
Bases:
AbstractContextManager
,Protocol
A user interface element for displaying progress to the user.
Typically this is displayed as a bar which fills up as progress is made. The window (or other UI element used to display progress) is closed when the context manager is exited.
- set_progress(progress)
Set progress displayed in the user interface.
- Parameters:
progress (int) – The percentage complete of the indicator as a number between zero and the maximum progress of the indicator. Zero indicates no progress (The indicator should be empty) and the maximum value indicates completion (The indicator should be full).
- Raises:
ValueError – If progress is not a number, is less than zero or greater than the maximum progress.
ProgressCancelledError – If the user has cancelled the progress indicator in the connected application.
- add_progress(progress=1)
Add progress to the indicator.
By default, this will add one unit of progress to the indicator. It is possible, but not usually necessary, to add more than one unit of progress at once by passing the amount of progress to add.
- Parameters:
progress (int) – The amount of progress to add to the indicator. This is 1 by default. If this is a negative number, progress will be removed from the indicator. If this would make the progress greater than the maximum or less than 0, then the progress will be set to the maximum or 0 respectively.
- Raises:
ProgressCancelledError – If the user has cancelled the progress indicator in the connected application.
- fake_progress()
Set the indicator to display fake progress.
This is useful to provide feedback to the user that something is happening when running part of an operation which does not support progress indication.
Call set_progress() or add_progress() to cancel the fake progress.
- Raises:
ProgressCancelledError – If the user has cancelled the progress indicator in the connected application.
- update_message(new_message)
Update the message displayed with the progress indicator.
- Raises:
ProgressCancelledError – If the user has cancelled the progress indicator in the connected application.
- Parameters:
new_message (str)