Skip to content

Commit

Permalink
Add context manager to progress dialogs
Browse files Browse the repository at this point in the history
  • Loading branch information
MoojMidge committed Dec 15, 2023
1 parent 764caec commit 5c27828
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ def __init__(self, dialog, heading, text, total=100):
self._position = 1
self.update(steps=-1)

def __enter__(self):
return self

def __exit__(self, exc_type, exc_val, exc_tb):
self.close()

def get_total(self):
return self._total

Expand Down

0 comments on commit 5c27828

Please sign in to comment.