def _step1(self): '''Set options for manual exposure program.''' options = ['captureMode', 'exposureProgram'] values = ['image', 1] thread = ThetaThread('setOptions', self._step2, options, values) thread.start()
def _step2(self, response=None): '''Take a picture.''' if response is None: _log('error', 'Setting options failed.') return thread = ThetaThread('takePicture', self._step3) thread.start()
def _step2(self, response): '''Load available shutter speeds from camera.''' if response is None: _log('error', 'Setting options failed.') return thread = ThetaThread('getOptions', self._step3, ['shutterSpeedSupport']) thread.start()
def _step4(self, response): '''Delete picture from camera.''' if response is None: _log('error', 'Downloading picture failed.') return self._picture_bytes = BytesIO(response) thread = ThetaThread('delete', self._step5, self._file_uri) thread.start()
def _step5(self, response): '''Take a picture.''' if response is None: _log('error', 'Setting picture options failed.') return _log('info', 'Takeing picture {0}'.format(self._current_picture)) self._current_picture += 1 thread = ThetaThread('takePicture', self._step4) thread.start()
def _step4(self, response): '''Set options for next picture.''' if response is None: return if self._current_picture < len(self._shutter_speeds): thread = ThetaThread('setOptions', self._step5, ['shutterSpeed'], [self._shutter_speeds[self._current_picture]]) thread.start()
def _step3(self, response=None): '''Download picture from camera.''' if response is None: _log('error', 'Taking picture failed.') return try: self._file_uri = response['results']['fileUri'] except KeyError: raise except TypeError: raise else: self._file_uri = self._file_uri.encode('ascii', 'ignore') thread = ThetaThread('getImage', self._step4, self._file_uri) thread.start()
def _step1(self): '''Set options for taking a picture.''' options = [ 'captureMode', 'exposureProgram', 'fileFormat', 'iso', 'whiteBalance' ] values = [ 'image', 9, {'type': 'jpeg', 'width': 2048, 'height': 1024}, self._iso, 'daylight' ] thread = ThetaThread('setOptions', self._step2, options, values) thread.start()
def _step1(self): '''Set shared picture options.''' options = [ 'captureMode', 'exposureProgram', 'fileFormat', 'iso', 'whiteBalance' ] values = [ 'image', 1, {'type': 'jpeg', 'width': 5376, 'height': 2688}, self._iso, 'daylight' ] thread = ThetaThread('setOptions', self._step2, options, values) thread.start()