Fixed autofocus issue when using preview
This commit is contained in:
@@ -184,8 +184,11 @@ class Photobooth:
|
|||||||
def captureSinglePicture(self):
|
def captureSinglePicture(self):
|
||||||
|
|
||||||
self.showCounter()
|
self.showCounter()
|
||||||
|
self.setCameraIdle()
|
||||||
self.showPose()
|
self.showPose()
|
||||||
return self._cap.getPicture()
|
picture = self._cap.getPicture()
|
||||||
|
self.setCameraActive()
|
||||||
|
return picture
|
||||||
|
|
||||||
|
|
||||||
def capturePictures(self):
|
def capturePictures(self):
|
||||||
@@ -216,8 +219,8 @@ class Photobooth:
|
|||||||
|
|
||||||
self._conn.send(gui.GreeterState())
|
self._conn.send(gui.GreeterState())
|
||||||
self.triggerOff()
|
self.triggerOff()
|
||||||
self.setCameraActive()
|
|
||||||
|
|
||||||
|
self.setCameraActive()
|
||||||
self.recvAck()
|
self.recvAck()
|
||||||
|
|
||||||
pics = self.capturePictures()
|
pics = self.capturePictures()
|
||||||
@@ -229,7 +232,6 @@ class Photobooth:
|
|||||||
self.enqueueWorkerTasks(img)
|
self.enqueueWorkerTasks(img)
|
||||||
|
|
||||||
self.setCameraIdle()
|
self.setCameraIdle()
|
||||||
|
|
||||||
self.recvAck()
|
self.recvAck()
|
||||||
|
|
||||||
self._conn.send(gui.IdleState())
|
self._conn.send(gui.IdleState())
|
||||||
|
|||||||
@@ -47,14 +47,15 @@ class CameraGphoto2(Camera):
|
|||||||
logging.info('Camera summary: %s', str(self._cap.get_summary(self._ctxt)))
|
logging.info('Camera summary: %s', str(self._cap.get_summary(self._ctxt)))
|
||||||
|
|
||||||
# get configuration tree
|
# get configuration tree
|
||||||
self._config = self._cap.get_config()
|
# self._config = self._cap.get_config()
|
||||||
self._oldconfig = self._config
|
# self._oldconfig = self._config
|
||||||
|
config = self._cap.get_config()
|
||||||
|
|
||||||
# make sure camera format is not set to raw
|
# 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')
|
raise RuntimeError('Camera file format is set to RAW')
|
||||||
|
|
||||||
self._printConfig(self._config)
|
self._printConfig(config)
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -95,14 +96,18 @@ class CameraGphoto2(Camera):
|
|||||||
|
|
||||||
def setActive(self):
|
def setActive(self):
|
||||||
|
|
||||||
self._config.get_child_by_name('viewfinder').set_value(True)
|
config = self._cap.get_config()
|
||||||
self._cap.set_config(self._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):
|
def setIdle(self):
|
||||||
|
|
||||||
self._config.get_child_by_name('viewfinder').set_value(False)
|
config = self._cap.get_config()
|
||||||
self._cap.set_config(self._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):
|
def getPreview(self):
|
||||||
|
|||||||
@@ -63,11 +63,13 @@ class CameraGphoto2Cffi(Camera):
|
|||||||
def setActive(self):
|
def setActive(self):
|
||||||
|
|
||||||
self._cap._get_config()['actions']['viewfinder'].set(True)
|
self._cap._get_config()['actions']['viewfinder'].set(True)
|
||||||
|
self._cap._get_config()['settings']['output'].set('PC')
|
||||||
|
|
||||||
|
|
||||||
def setIdle(self):
|
def setIdle(self):
|
||||||
|
|
||||||
self._cap._get_config()['actions']['viewfinder'].set(False)
|
self._cap._get_config()['actions']['viewfinder'].set(False)
|
||||||
|
self._cap._get_config()['settings']['output'].set('Off')
|
||||||
|
|
||||||
|
|
||||||
def getPreview(self):
|
def getPreview(self):
|
||||||
|
|||||||
@@ -134,7 +134,7 @@ def run(argv):
|
|||||||
gui_proc.join()
|
gui_proc.join()
|
||||||
worker_queue.put('teardown')
|
worker_queue.put('teardown')
|
||||||
worker_proc.join()
|
worker_proc.join()
|
||||||
camera_proc.join(5)
|
camera_proc.join(1)
|
||||||
return gui_proc.exitcode
|
return gui_proc.exitcode
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user