From 123735e9efdb7dec5c9eb02bbbd8f632195d0267 Mon Sep 17 00:00:00 2001 From: Balthasar Reuter Date: Sat, 5 May 2018 23:32:45 +0200 Subject: [PATCH] Fixed bug when restarting photobooth from main menu --- photobooth/Photobooth.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/photobooth/Photobooth.py b/photobooth/Photobooth.py index d70b77d..30044c8 100644 --- a/photobooth/Photobooth.py +++ b/photobooth/Photobooth.py @@ -98,17 +98,27 @@ class Photobooth: return self._display_time - def run(self, send, recv): + def initRun(self): - self._send = send self.setCameraIdle() self._send.send(gui.IdleState()) self.triggerOn() + + def run(self, send, recv): + + self._send = send + self.initRun() + while True: try: event = recv.recv() - if str(event) != 'triggered': + + if str(event) == 'start': + print('Camera already started') + self.initRun() + continue + elif str(event) != 'triggered': print('Unknown event received: ' + str(event)) raise RuntimeError('Unknown event received', str(event)) except EOFError: