Skip to content

Commit

Permalink
Better handling of GDAL progess report
Browse files Browse the repository at this point in the history
  • Loading branch information
nicogodet authored and nyalldawson committed Nov 28, 2022
1 parent 98995b2 commit aa590b7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions python/plugins/processing/algs/gdal/GdalUtils.py
Expand Up @@ -102,15 +102,17 @@ def runGdal(commands, feedback=None):
feedback.pushInfo(GdalUtils.tr('GDAL command output:'))

loglines = [GdalUtils.tr('GDAL execution console output')]
# create string list of number from 0 to 99
progress_string_list = [str(a) for a in range(0, 100)]

def on_stdout(ba):
val = ba.data().decode('UTF-8')
# catch progress reports
if val == '100 - done.':
on_stdout.progress = 100
feedback.setProgress(on_stdout.progress)
elif val in ('0', '10', '20', '30', '40', '50', '60', '70', '80', '90'):
on_stdout.progress = int(val)
elif val.strip('. ') in progress_string_list:
on_stdout.progress = int(val.strip('. '))
feedback.setProgress(on_stdout.progress)
elif val == '.':
on_stdout.progress += 2.5
Expand Down

0 comments on commit aa590b7

Please sign in to comment.