Skip to content
Permalink
Browse files

[processing] Catch the gdal process console progress report output

and show algorithm progress bars when running GDAL algorithms
  • Loading branch information
nyalldawson committed Jan 8, 2021
1 parent 54ec5ac commit b14dc49c853450ec585514bc873d4a48a516ee4e
Showing with 12 additions and 0 deletions.
  1. +12 −0 python/plugins/processing/algs/gdal/GdalUtils.py
@@ -105,13 +105,25 @@ def runGdal(commands, feedback=None):

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)
feedback.setProgress(on_stdout.progress)
elif val == '.':
on_stdout.progress += 2.5
feedback.setProgress(on_stdout.progress)

on_stdout.buffer += val
if on_stdout.buffer.endswith('\n') or on_stdout.buffer.endswith('\r'):
# flush buffer
feedback.pushConsoleInfo(on_stdout.buffer.rstrip())
loglines.append(on_stdout.buffer.rstrip())
on_stdout.buffer = ''

on_stdout.progress = 0
on_stdout.buffer = ''

def on_stderr(ba):

0 comments on commit b14dc49

Please sign in to comment.
You can’t perform that action at this time.