- class itom.progressObserver(progressBar=None, label=None, progressMinimum=0, progressMaximum=100)¶
Creates a progressObserver object.
progressObserverobject 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
progressBarand / or
label. For more information see also this section: Interruptible filters and progress information.
Target functions, that can make use of this
progressObservercan 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
_observeof 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
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
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.
Minimum progress value that should be used and reported by the target of this observer.
Maximum progress value that should be used and reported by the target of this observer.
This class wraps the C++ class ito::FunctionCancellationAndObserver.
- connect(signalSignature, callableMethod, minRepeatInterval=0)¶
Connects the signal of the progressObserver with the given callable Python method.
This object of
progressObserverwraps an underlying object of the C++ class
ito::FunctionCancellationAndObserver, which can emit various signals. Use this method to connect any signal to any callable python method (bounded or unbounded). This method must have the same number of arguments than the signal and the types of the signal definition must be convertable into a python object.
Possible signals are (among others):
progressTextChanged(QString) -> emitted when the observed function reports a new progress text,
progressValueChanged(int) -> emitted whenever the observed function reports a new progress value,
cancellationRequested() -> emitted if a cancellation of the observed function has been requested,
resetDone() -> emitted if the progressObserver has been reset.
New in itom 4.1.
This must be the valid signature. Possible signatures are:
Valid method or function that is called if the signal is emitted. The method must provide one parameter for the string or number argument of the signal.
If > 0, the same signal only invokes a slot once within the given interval (in ms). Default: 0 (all signals will invoke the callable Python method.
- disconnect(signalSignature, callableMethod)¶
Disconnects a connection which must have been established with exactly the same parameters.
New in itom 4.1.
Prints information about possible signals to the command line.
0: only signals from the plugin class are printed (default) 1: all signals from all inherited classes are printed
Requests the cancellation of the filter.
progressObserveris currently passed to an object, filter or algorithm, that can be cancelled, a cancellation request is sent to this object. Calling this method will emit the
Resets this object.
Resets this object and empties the current progress text, resets the current progress value to its minimum and resets the cancellation request. Emits the
int: 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.
int: 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.
str: the current progress text
This attribute gives access to the current progress text. When set, the signal
progressTextChangedis emitted. It can for instance be connected to a
setTextslot of a QLabel. The text should inform about the step, the long-running method is currently executing.