# Path: pyrikura/ipyrikura.py
# class IPyrikuraPlugin(Interface):
# class ITrigger(Interface):
# class IImageProcessor(Interface):
# class IFileOp(Interface):
# class ICamera(Interface):
#     def trigger(self):
#     def process(self):
#     def process(self):


import threading
import logging
import shutter
from struct import pack
from twisted.plugin import IPlugin
from twisted.internet import defer
from twisted.internet import interfaces
from twisted.internet import threads
from twisted.protocols import basic
from zope.interface import implements
from pyrikura import ipyrikura
                    self._camera.capture_preview(self.preview_filename)
                except shutter.shutter.ShutterError:
                    pass
            return self.preview_filename

        return threads.deferToThread(capture)

    def capture_image(self, filename=None):
        """ Capture a full image and save to a file
        """

        def capture():
            with self._lock:
                self._camera.capture_image(self.capture_filename)
            return self.capture_filename

        return threads.deferToThread(capture)

    def download_preview(self):
        """ Capture preview image and return data
        """

        def capture():
            with self._lock:
                return self._camera.capture_preview().get_data()

        return threads.deferToThread(capture)


class ShutterCameraFactory(object):

# Path: pyrikura/ipyrikura.py
# class IPyrikuraPlugin(Interface):
# class ITrigger(Interface):
# class IImageProcessor(Interface):
# class IFileOp(Interface):
# class ICamera(Interface):
#     def trigger(self):
#     def process(self):
#     def process(self):


# Path: pyrikura/twisted/plugins/shuttercamera.py
import threading
import logging
import shutter
from struct import pack
from twisted.plugin import IPlugin
from twisted.internet import defer
from twisted.internet import interfaces
from twisted.internet import threads
from twisted.protocols import basic
from zope.interface import implements
from pyrikura import ipyrikura

                    self._camera.capture_preview(self.preview_filename)
                except shutter.shutter.ShutterError:
                    pass
            return self.preview_filename

        return threads.deferToThread(capture)

    def capture_image(self, filename=None):
        """ Capture a full image and save to a file
        """

        def capture():
            with self._lock:
                self._camera.capture_image(self.capture_filename)
            return self.capture_filename

        return threads.deferToThread(capture)

    def download_preview(self):
        """ Capture preview image and return data
        """

        def capture():
            with self._lock:
                return self._camera.capture_preview().get_data()

        return threads.deferToThread(capture)


class ShutterCameraFactory(object):

    implements(IPlugin, ipyrikura.IPyrikuraPlugin)