Enclosed config changes in setActive/setIdle in try-catch-blocks to avoid crashes with Nikon cameras (fixes #55)

This commit is contained in:
Balthasar Reuter committed 2019-01-12 21:31:34 +01:00
1 parent c3f4d5e669
commit 7df2fd66c3
2 files changed
+22 -10

No files matched your search

+12 -6
View File
@@ -136,15 +136,21 @@ class CameraGphoto2(CameraInterface):
def setActive(self):
config = self._cap.get_config()
config.get_child_by_name('output').set_value('PC')
self._cap.set_config(config)
try:
config = self._cap.get_config()
config.get_child_by_name('output').set_value('PC')
self._cap.set_config(config)
except BaseException as e:
logging.warn('Error while setting camera output to active: {}.'.format(e))
def setIdle(self):
config = self._cap.get_config()
config.get_child_by_name('output').set_value('Off')
self._cap.set_config(config)
try:
config = self._cap.get_config()
config.get_child_by_name('output').set_value('Off')
self._cap.set_config(config)
except BaseException as e:
logging.warn('Error while setting camera output to idle: {}.'.format(e))
def getPreview(self):
+10 -4
View File
@@ -106,13 +106,19 @@ class CameraGphoto2Cffi(CameraInterface):
def setActive(self):
self._cap._get_config()['actions']['viewfinder'].set(True)
self._cap._get_config()['settings']['output'].set('PC')
try:
self._cap._get_config()['actions']['viewfinder'].set(True)
self._cap._get_config()['settings']['output'].set('PC')
except BaseException as e:
logging.warn('Error while setting camera output to active: {}.'.format(e))
def setIdle(self):
self._cap._get_config()['actions']['viewfinder'].set(False)
self._cap._get_config()['settings']['output'].set('Off')
try:
self._cap._get_config()['actions']['viewfinder'].set(False)
self._cap._get_config()['settings']['output'].set('Off')
except BaseException as e:
logging.warn('Error while setting camera output to idle: {}.'.format(e))
def getPreview(self):