9.13. progressObserver

class itom.progressObserver(progressBar: uiItem = None, label: uiItem = None, progressMinimum: int = 0, progressMaximum: int = 100) → creates a progressObserver object.

Bases: object

A ‘progressObserver’ object can be passed to functions, that might need some time to be finished, such that these functions can regularily report their current progress (as number as well as text) via this progress observer. These reported progress values are then displayed in the passed ‘progressBar’ and / or ‘label’.

Target functions, that can make use of this ‘progressObserver’ can be contained in itom algorithm plugins. However these functions must implement the FilterDefExt interface, which is available from itom 3.3 on. Check the method itom.filterHelp() or the help widget of itom in order to find out whether a filter in an algorithm plugin has this ability.

If a filter accepts a progressObserver, pass this object to the keyword argument ‘_observer’ of the method itom.filter(). Algorithms, that accept this kind of observer can also use the same observer to interrupt the algorithm once the additional interrupt flag of the observer is set. This flag is either set whenever a Python script execution is interrupted or if a signal of a widget has been emitted that was previously connected to this interrupt flag using the method invokeProgressObserverCancellation().

Parameters

progressBar : {uiItem, optional}

This is an optional handle to a progress bar in any user interface. The minimum requirement is that the given widget has at least a slot ‘setValue(int)’, which is called once this progress observer reports a new progress value (bound between ‘progressMinimum’ and ‘progressMaximum’. If this argument is not given, None is assumed.

label : {uiItem, optional}

This argument is very similar to ‘progressBar’, however it requires a handle to a label widget or any other widget that has a slot ‘setText(QString)’. This slot is called whenever the target algorithm for this observer reports a new progress text.

progressMinimum : {int, optional}

Minimum progress value that should be used and reported by the target of this observer.

progressMaximu : {int, optional}

Maximum progress value that should be used and reported by the target of this observer.

Notes

This class uses the C++ class ito::FunctionCancellationAndObserver.

progressMaximum

Gets the maximum value of the progress.

The maximum progress value is the maximum scalar value that the observed function or algorithm should set as its highest progress value.

progressMinimum

Gets the minimum value of the progress.

The minimum progress value is the minimum scalar value that the observed function or algorithm should set as its lowest progress value.