Enclosed config changes in setActive/setIdle in try-catch-blocks to avoid crashes with Nikon cameras (fixes #55)
This commit is contained in:
@@ -136,15 +136,21 @@ class CameraGphoto2(CameraInterface):
|
|||||||
|
|
||||||
def setActive(self):
|
def setActive(self):
|
||||||
|
|
||||||
config = self._cap.get_config()
|
try:
|
||||||
config.get_child_by_name('output').set_value('PC')
|
config = self._cap.get_config()
|
||||||
self._cap.set_config(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):
|
def setIdle(self):
|
||||||
|
|
||||||
config = self._cap.get_config()
|
try:
|
||||||
config.get_child_by_name('output').set_value('Off')
|
config = self._cap.get_config()
|
||||||
self._cap.set_config(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):
|
def getPreview(self):
|
||||||
|
|
||||||
|
|||||||
@@ -106,13 +106,19 @@ class CameraGphoto2Cffi(CameraInterface):
|
|||||||
|
|
||||||
def setActive(self):
|
def setActive(self):
|
||||||
|
|
||||||
self._cap._get_config()['actions']['viewfinder'].set(True)
|
try:
|
||||||
self._cap._get_config()['settings']['output'].set('PC')
|
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):
|
def setIdle(self):
|
||||||
|
|
||||||
self._cap._get_config()['actions']['viewfinder'].set(False)
|
try:
|
||||||
self._cap._get_config()['settings']['output'].set('Off')
|
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):
|
def getPreview(self):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user