'Context manager for progress bar.
Using it ensures that the progress bar is removed at the end without
needing the `finally` blocks.
Usage:
with self.progressBar(20) as progress:
progress.advance()
or
with self.progressBar() as progress:
progress.advance(0.15)
or
with self.progressBar():
self.progressBarSet(50)
:param iterations: the number of iterations (optional)
:type iterations: int'

@contextlib.contextmanager
def progressBar(self, iterations=0):

    progress_bar = gui.ProgressBar(self, iterations)
    try:
        (yield progress_bar)
    finally:
        progress_bar.finish()
