diff --git a/photobooth/Photobooth.py b/photobooth/Photobooth.py index 9639645..1b6475f 100644 --- a/photobooth/Photobooth.py +++ b/photobooth/Photobooth.py @@ -184,8 +184,11 @@ class Photobooth: def captureSinglePicture(self): self.showCounter() + self.setCameraIdle() self.showPose() - return self._cap.getPicture() + picture = self._cap.getPicture() + self.setCameraActive() + return picture def capturePictures(self): @@ -216,8 +219,8 @@ class Photobooth: self._conn.send(gui.GreeterState()) self.triggerOff() - self.setCameraActive() + self.setCameraActive() self.recvAck() pics = self.capturePictures() @@ -229,7 +232,6 @@ class Photobooth: self.enqueueWorkerTasks(img) self.setCameraIdle() - self.recvAck() self._conn.send(gui.IdleState()) diff --git a/photobooth/camera/CameraGphoto2.py b/photobooth/camera/CameraGphoto2.py index ebcbdc8..692a5e2 100644 --- a/photobooth/camera/CameraGphoto2.py +++ b/photobooth/camera/CameraGphoto2.py @@ -47,14 +47,15 @@ class CameraGphoto2(Camera): logging.info('Camera summary: %s', str(self._cap.get_summary(self._ctxt))) # get configuration tree - self._config = self._cap.get_config() - self._oldconfig = self._config + # self._config = self._cap.get_config() + # self._oldconfig = self._config + config = self._cap.get_config() # make sure camera format is not set to raw - if 'raw' in self._config.get_child_by_name('imageformat').get_value().lower(): + if 'raw' in config.get_child_by_name('imageformat').get_value().lower(): raise RuntimeError('Camera file format is set to RAW') - self._printConfig(self._config) + self._printConfig(config) @staticmethod @@ -95,14 +96,18 @@ class CameraGphoto2(Camera): def setActive(self): - self._config.get_child_by_name('viewfinder').set_value(True) - self._cap.set_config(self._config) + config = self._cap.get_config() + # self._config.get_child_by_name('viewfinder').set_value(True) + config.get_child_by_name('output').set_value('PC') + self._cap.set_config(config) def setIdle(self): - self._config.get_child_by_name('viewfinder').set_value(False) - self._cap.set_config(self._config) + config = self._cap.get_config() + # self._config.get_child_by_name('viewfinder').set_value(False) + config.get_child_by_name('output').set_value('Off') + self._cap.set_config(config) def getPreview(self): diff --git a/photobooth/camera/CameraGphoto2Cffi.py b/photobooth/camera/CameraGphoto2Cffi.py index 621918c..784eea9 100644 --- a/photobooth/camera/CameraGphoto2Cffi.py +++ b/photobooth/camera/CameraGphoto2Cffi.py @@ -63,11 +63,13 @@ class CameraGphoto2Cffi(Camera): def setActive(self): self._cap._get_config()['actions']['viewfinder'].set(True) + self._cap._get_config()['settings']['output'].set('PC') def setIdle(self): self._cap._get_config()['actions']['viewfinder'].set(False) + self._cap._get_config()['settings']['output'].set('Off') def getPreview(self): diff --git a/photobooth/main.py b/photobooth/main.py index e6832f2..0e23b8a 100644 --- a/photobooth/main.py +++ b/photobooth/main.py @@ -134,7 +134,7 @@ def run(argv): gui_proc.join() worker_queue.put('teardown') worker_proc.join() - camera_proc.join(5) + camera_proc.join(1) return gui_proc.exitcode