]> git.scottworley.com Git - srec/blobdiff - srec.py
Extract stop_streams()
[srec] / srec.py
diff --git a/srec.py b/srec.py
index 3490695939be861a7dbd3eec0d439ba660948bb8..7ef4d466514f0d5a0f4fe810697e91d66312dcb3 100644 (file)
--- a/srec.py
+++ b/srec.py
@@ -126,7 +126,7 @@ def on_start_button(_: Gtk.Button, stack: Gtk.Stack) -> None:
         ['-f', 'pulse', '-ac', '2', '-i', 'default', filename])
 
 
         ['-f', 'pulse', '-ac', '2', '-i', 'default', filename])
 
 
-def on_stop_button(_: Gtk.Button, stack: Gtk.Stack) -> None:
+def stop_streams() -> None:
     global recording, sharing  # pylint: disable=global-statement
     assert recording is not None
     recording.stop()
     global recording, sharing  # pylint: disable=global-statement
     assert recording is not None
     recording.stop()
@@ -134,6 +134,10 @@ def on_stop_button(_: Gtk.Button, stack: Gtk.Stack) -> None:
     if sharing is not None:
         sharing.stop()
         sharing = None
     if sharing is not None:
         sharing.stop()
         sharing = None
+
+
+def on_stop_button(_: Gtk.Button, stack: Gtk.Stack) -> None:
+    stop_streams()
     stack.set_visible_child_name("not_recording")
 
 
     stack.set_visible_child_name("not_recording")