['-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()
- recording = None
+ if recording is not None:
+ recording.stop()
+ recording = None
if sharing is not None:
sharing.stop()
sharing = None
+
+
+def on_stop_button(_: Gtk.Button, stack: Gtk.Stack) -> None:
+ assert recording is not None
+ stop_streams()
stack.set_visible_child_name("not_recording")
app = Gtk.Application(application_id='net.chkno.srec')
app.connect('activate', on_activate)
app.run(None)
+ stop_streams()
if __name__ == '__main__':