From dc3d1416ae804a5353f25a1eedcafdce762a29f7 Mon Sep 17 00:00:00 2001 From: Scott Worley Date: Sun, 5 Oct 2025 23:46:45 -0700 Subject: [PATCH] Don't allow previous recording's size to show when starting new recording --- srec.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/srec.py b/srec.py index 64f2d07..0828310 100644 --- a/srec.py +++ b/srec.py @@ -76,12 +76,16 @@ def summarize_size(n: int) -> str: def begin_monitoring_file_size(size_display: Gtk.Label, filename: str) -> None: def update_size_display() -> Any: - try: - size = summarize_size(os.stat(filename).st_size) - except FileNotFoundError: - size = '--' - size_display.set_label(f'{size}') - return GLib.SOURCE_REMOVE if recording is None else GLib.SOURCE_CONTINUE + done = recording is None + if done: + size_display.set_label('') + else: + try: + size = summarize_size(os.stat(filename).st_size) + except FileNotFoundError: + size = '--' + size_display.set_label(f'{size}') + return GLib.SOURCE_REMOVE if done else GLib.SOURCE_CONTINUE GLib.timeout_add_seconds(1, update_size_display) -- 2.50.1