From c494e7b2e26a849d7e428bb2e495e6ef6b01bf6e Mon Sep 17 00:00:00 2001 From: heliguy4599 Date: Fri, 11 Oct 2024 13:20:08 -0400 Subject: [PATCH] Allow snapshotting to lock refreshing --- src/snapshot_page/tar_worker.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/snapshot_page/tar_worker.py b/src/snapshot_page/tar_worker.py index aa7db61..ffa3ac8 100644 --- a/src/snapshot_page/tar_worker.py +++ b/src/snapshot_page/tar_worker.py @@ -27,6 +27,7 @@ class TarWorker: json.dump(data, file, indent=4) self.stop = True # tell the check timeout to stop, because we know the file is done being made + HostInfo.main_window.remove_refresh_lockout("managing snapshot") except subprocess.CalledProcessError as cpe: self.do_cancel(cpe.stderr.decode()) # stderr is in bytes, so decode it @@ -52,7 +53,8 @@ class TarWorker: raise subprocess.CalledProcessError(self.process.returncode, self.process.args, output=stdout, stderr=stderr) self.stop = True # tell the check timeout to stop, because we know the file is done being made - + HostInfo.main_window.remove_refresh_lockout("managing snapshot") + except subprocess.CalledProcessError as cpe: self.do_cancel(cpe.stderr.decode()) @@ -74,6 +76,7 @@ class TarWorker: pass self.stop = True + HostInfo.main_window.remove_refresh_lockout("managing snapshot") if self.toast_overlay and error_str != "manual_cancel": self.toast_overlay.add_toast(ErrorToast(_("Error in snapshot handling"), error_str).toast) @@ -90,12 +93,14 @@ class TarWorker: def compress(self): self.stop = False self.files_to_trash_on_cancel = [f'{self.new_path}/{self.file_name}.tar.zst', f'{self.new_path}/{self.file_name}.json'] + HostInfo.main_window.add_refresh_lockout("managing snapshot") Gio.Task.new(None, None, None).run_in_thread(self.compress_thread) GLib.timeout_add(200, self.check_size, f"{self.new_path}/{self.file_name}.tar.zst") def extract(self): self.stop = False self.files_to_trash_on_cancel = [self.new_path] + HostInfo.main_window.add_refresh_lockout("managing snapshot") Gio.Task.new(None, None, None).run_in_thread(self.extract_thread) GLib.timeout_add(200, self.check_size, self.new_path)