コード例 #1
0
from base import Enum, BaseSettings

from PySide.QtCore import Signal, QObject

ControlType = Enum()
ControlType.Combo = 1
ControlType.Slider = 2
ControlType.Button = 3
ControlType.Static = 4
ControlType.LineEdit = 5
ControlType.Checkbox = 6
ControlType.TwinButton = 7

ImageDataFormat = Enum()
ImageDataFormat.JPEG = 1



class AbstractException(Exception):
	pass


def abstract(f):
	""" Decorator for abstract methods """
	def raiser(*args,**kargs):
		raise AbstractException('Abstract function must be overridden by a child class before being called')
	return raiser



class Info(object):
コード例 #2
0
ファイル: manager.py プロジェクト: BackupGGCode/scan-manager
import log
import base

if False:
	# This is here to persuade distribution tools that we're dependant on these packages
	from .canonpsrec import wrapper
	from .wia import wrapper
	from .libgphoto2 import wrapper
	from .directory import wrapper
	from .chdk import wrapper
	
backends = ['libgphoto2','directory','canonpsrec','wia','chdk']


APIState = Enum() #: ENUM holding the current state of a backend API
APIState.Opened = 1
APIState.Imported = 2
APIState.NotSupported = 3
APIState.ImportError = 4
APIState.OpenError = 5


class APITracingWrapper(log.TracingWrapper):
	
	def __init__(self,*args,**kargs):
		
		log.TracingWrapper.__init__(self,*args,**kargs)
		self.__dict__['_trace_cameras'] = None
		
	def getCameras(self):
コード例 #3
0
ファイル: manager.py プロジェクト: swipswaps/scan-manager
import types

import log
import base

if False:
    # This is here to persuade distribution tools that we're dependant on these packages
    from .canonpsrec import wrapper
    from .wia import wrapper
    from .libgphoto2 import wrapper
    from .directory import wrapper
    from .chdk import wrapper

backends = ['libgphoto2', 'directory', 'canonpsrec', 'wia', 'chdk']

APIState = Enum()  #: ENUM holding the current state of a backend API
APIState.Opened = 1
APIState.Imported = 2
APIState.NotSupported = 3
APIState.ImportError = 4
APIState.OpenError = 5


class APITracingWrapper(log.TracingWrapper):
    def __init__(self, *args, **kargs):

        log.TracingWrapper.__init__(self, *args, **kargs)
        self.__dict__['_trace_cameras'] = None

    def getCameras(self):
        if not self._trace_cameras:
コード例 #4
0
"""
Wrap the API in the standard API interface

The rest of the files here define a fully featured manufacturer's API while this file wraps it in a simplified generic interface
"""

from .. import interface
from base import Enum

import importlib
import os.path
import platform
import win32com.client.gencache
import pythoncom

WIAAPIMode = Enum()
WIAAPIMode.Tethered = 1  #: Shoot tethered
WIAAPIMode.Manual = 2  #: Shoot manually and use WIA events to detect new images and transfer them
WIAAPIMode.ManualScan = 3  #: Shoot manually and poll for new image in a particular path on the WIA device

wia = win32com.client.constants  #: shortcut for WIA constants

CFG_WIA_DEVICE_IMAGE_PATH = [
    'DCIM', 'Camera'
]  #: This would used if we ever need to implement ManualScan mode in which case it should be user-configurable on a per-camera basis


class API(interface.API):
    """ 
	A standard API wrapper class around the WIA API
	
コード例 #5
0
ファイル: interface.py プロジェクト: swipswaps/scan-manager
from base import Enum, BaseSettings

from PySide.QtCore import Signal, QObject

ControlType = Enum()
ControlType.Combo = 1
ControlType.Slider = 2
ControlType.Button = 3
ControlType.Static = 4
ControlType.LineEdit = 5
ControlType.Checkbox = 6
ControlType.TwinButton = 7

ImageDataFormat = Enum()
ImageDataFormat.JPEG = 1


class AbstractException(Exception):
    pass


def abstract(f):
    """ Decorator for abstract methods """
    def raiser(*args, **kargs):
        raise AbstractException(
            'Abstract function must be overridden by a child class before being called'
        )

    return raiser