diff --git a/photobooth/Photobooth.py b/photobooth/Photobooth.py index 757ebdd..002fe6a 100644 --- a/photobooth/Photobooth.py +++ b/photobooth/Photobooth.py @@ -83,6 +83,14 @@ class Photobooth: except RuntimeError as e: print('Camera error: ' + str(e)) self._send.send( gui.ErrorState('Camera error', str(e)) ) + event = recv.recv() + if str(event) == 'cancel': + return 1 + elif str(event) == 'ack': + pass + else: + print('Unknown event received: ' + str(event)) + raise RuntimeError('Unknown event received', str(event)) return 0 diff --git a/photobooth/gui/PyQt5Gui.py b/photobooth/gui/PyQt5Gui.py index a2b6166..45db8c5 100644 --- a/photobooth/gui/PyQt5Gui.py +++ b/photobooth/gui/PyQt5Gui.py @@ -123,7 +123,8 @@ class PyQt5Gui(Gui): self._transport.send('ack') self._lastState() else: - self.close() + self._transport.send('cancel') + self.showStart() class PyQt5Receiver(QThread): diff --git a/photobooth/main.py b/photobooth/main.py index 26bf61b..558a277 100644 --- a/photobooth/main.py +++ b/photobooth/main.py @@ -38,9 +38,13 @@ def main_photobooth(config, send, recv): except BaseException as e: send.send( gui.ErrorState('Camera error', str(e)) ) event = recv.recv() - if str(event) != 'ack': - print('Unknown event received: ' + str(event)) - raise RuntimeError('Unknown event received', str(event)) + if str(event) == 'cancel': + return 1 + elif str(event) == 'ack': + pass + else: + print('Unknown event received: ' + str(event)) + raise RuntimeError('Unknown event received', str(event)) def run(argv):