Since I sometimes have to process cross product of two vector layers with geoprocessing scripts, causing me to use nested loops like
source_count = source_layer.featureCount()
target_count = target_layer.featureCount()
nsource = 1.0
for f_source in source_layer.getFeatures():
ntarget = 1.0
for f_target in target_layer.getFeatures():
#do something
targetprogress = 100 * (ntarget / target_count)
ntarget += 1
sourceprogress = 100 *(nsource / source_count)
progress.setPercentage(sourceprogress)
nsource += 1
When both layers consist of, let's say, some ten thousands of features, processing can be extremely time consuming, and to communicate the user that the processing is still alive, it would make sense to have a progress bar for each inner and outer loop.
I don't think this can be achieved with standard processing gui tools, but this combined with some Qt
widgets? I'd like to do the processing in a script, not a plugin, in wich's Qt
form various QprogressBars
would be easy to implement.