From 5c278282f7ac188bdabe0cccc16342754b8d3132 Mon Sep 17 00:00:00 2001 From: MoojMidge <56883549+MoojMidge@users.noreply.github.com> Date: Fri, 15 Dec 2023 14:48:23 +1100 Subject: [PATCH] Add context manager to progress dialogs --- .../youtube_plugin/kodion/ui/abstract_progress_dialog.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/resources/lib/youtube_plugin/kodion/ui/abstract_progress_dialog.py b/resources/lib/youtube_plugin/kodion/ui/abstract_progress_dialog.py index 0af140254..3406a7ca4 100644 --- a/resources/lib/youtube_plugin/kodion/ui/abstract_progress_dialog.py +++ b/resources/lib/youtube_plugin/kodion/ui/abstract_progress_dialog.py @@ -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