diff --git a/avalon/photoshop/README.md b/avalon/photoshop/README.md new file mode 100644 index 000000000..426a7f84b --- /dev/null +++ b/avalon/photoshop/README.md @@ -0,0 +1,256 @@ +# Photoshop Integration + +`NOTE: This integration is only tested on Windows.` + +This integration requires the third part library `pywin32` which can be installed with: + +``` +pip install pywin32 +``` + +## Setup + +The Photoshop integration requires two components to work; `extension` and `server`. + +### Extension + +To install the extension download [Extension Manager Command Line tool (ExManCmd)](https://github.com/Adobe-CEP/Getting-Started-guides/tree/master/Package%20Distribute%20Install#option-2---exmancmd). + +``` +ExManCmd /install {path to avalon-core}\avalon\photoshop\extension.zxp +``` + +### Server + +The easiest way to get the server and Photoshop launch is with: + +``` +python -c ^"import avalon.photoshop;avalon.photoshop.launch(""C:\Program Files\Adobe\Adobe Photoshop 2020\Photoshop.exe"")^" +``` + +`avalon.photoshop.launch` launches the application and server, and also closes the server when Photoshop exists. + +You can also run the server separately with: + +``` +python -c "from avalon.tools import html_server;html_server.app.start_server(5000)" +``` + +## Usage + +The Photoshop extension can be found under `Window > Extensions > Avalon`. Once launched you should be presented with a panel like this: + +![Avalon Panel](panel.PNG "Avalon Panel") + +If the server is not running you will get a page failure: + +![Avalon Panel Failure](panel_failure.PNG "Avalon Panel Failure") + +Start the server and hit `Refresh`. + +## Developing + +### Extension +When developing the extension you can load it [unsigned](https://github.com/Adobe-CEP/CEP-Resources/blob/master/CEP_9.x/Documentation/CEP%209.0%20HTML%20Extension%20Cookbook.md#debugging-unsigned-extensions). + +When signing the extension you can use this [guide](https://github.com/Adobe-CEP/Getting-Started-guides/tree/master/Package%20Distribute%20Install#package-distribute-install-guide). + +``` +ZXPSignCmd -selfSignedCert NA NA Avalon Avalon-Photoshop avalon extension.p12 +ZXPSignCmd -sign {path to avalon-core}\avalon\photoshop\extension {path to avalon-core}\avalon\photoshop\extension.zxp extension.p12 avalon +``` + +### Plugin Examples + +These plugins were made with the [polly config](https://github.com/mindbender-studio/config). To fully integrate and load, you will have to use this config and add `image` to the [integration plugin](https://github.com/mindbender-studio/config/blob/master/polly/plugins/publish/integrate_asset.py). + +#### Creator Plugin +```python +from avalon import photoshop + + +class CreateImage(photoshop.Creator): + """Image folder for publish.""" + + name = "imageDefault" + label = "Image" + family = "image" + + def __init__(self, *args, **kwargs): + super(CreateImage, self).__init__(*args, **kwargs) +``` + +#### Collector Plugin +```python +import pythoncom + +from avalon import photoshop + +import pyblish.api + + +class CollectInstances(pyblish.api.ContextPlugin): + """Gather instances by LayerSet and file metadata + + This collector takes into account assets that are associated with + an LayerSet and marked with a unique identifier; + + Identifier: + id (str): "pyblish.avalon.instance" + """ + + label = "Instances" + order = pyblish.api.CollectorOrder + hosts = ["photoshop"] + + def process(self, context): + # Necessary call when running in a different thread which pyblish-qml + # can be. + pythoncom.CoInitialize() + + for layer in photoshop.get_layers_in_document(): + layer_data = photoshop.read(layer) + + # Skip layers without metadata. + if layer_data is None: + continue + + # Skip containers. + if "container" in layer_data["id"]: + continue + + child_layers = [*layer.Layers] + if not child_layers: + self.log.info("%s skipped, it was empty." % layer.Name) + continue + + instance = context.create_instance(layer.Name) + instance.append(layer) + instance.data.update(layer_data) + + # Produce diagnostic message for any graphical + # user interface interested in visualising it. + self.log.info("Found: \"%s\" " % instance.data["name"]) +``` + +#### Extractor Plugin +```python +import os + +import pyblish.api +from avalon import photoshop, Session + + +class ExtractImage(pyblish.api.InstancePlugin): + """Produce a flattened image file from instance + + This plug-in takes into account only the layers in the group. + """ + + label = "Extract Image" + order = pyblish.api.ExtractorOrder + hosts = ["photoshop"] + families = ["image"] + + def process(self, instance): + + dirname = os.path.join( + os.path.normpath( + Session["AVALON_WORKDIR"] + ).replace("\\", "/"), + instance.data["name"] + ) + + try: + os.makedirs(dirname) + except OSError: + pass + + # Store reference for integration + if "files" not in instance.data: + instance.data["files"] = list() + + path = os.path.join(dirname, instance.data["name"]) + + # Perform extraction + with photoshop.maintained_selection(): + self.log.info("Extracting %s" % str(list(instance))) + with photoshop.maintained_visibility(): + # Hide all other layers. + extract_ids = [ + x.id for x in photoshop.get_layers_in_layers([instance[0]]) + ] + for layer in photoshop.get_layers_in_document(): + if layer.id not in extract_ids: + layer.Visible = False + + save_options = { + "png": photoshop.com_objects.PNGSaveOptions(), + "jpg": photoshop.com_objects.JPEGSaveOptions() + } + + for extension, save_option in save_options.items(): + photoshop.app().ActiveDocument.SaveAs( + path, save_option, True + ) + instance.data["files"].append( + "{}.{}".format(path, extension) + ) + + instance.data["stagingDir"] = dirname + + self.log.info("Extracted {instance} to {path}".format(**locals())) +``` + +#### Loader Plugin +```python +from avalon import api, photoshop + + +class ImageLoader(api.Loader): + """Load images + + Stores the imported asset in a container named after the asset. + """ + + families = ["image"] + representations = ["*"] + + def load(self, context, name=None, namespace=None, data=None): + with photoshop.maintained_selection(): + layer = photoshop.import_smart_object(self.fname) + + self[:] = [layer] + + return photoshop.containerise( + name, + namespace, + layer, + context, + self.__class__.__name__ + ) + + def update(self, container, representation): + layer = container.pop("layer") + + with photoshop.maintained_selection(): + photoshop.replace_smart_object( + layer, api.get_representation_path(representation) + ) + + photoshop.imprint( + layer, {"representation": str(representation["_id"])} + ) + + def remove(self, container): + container["layer"].Delete() + + def switch(self, container, representation): + self.update(container, representation) +``` + +## Resources + - https://github.com/lohriialo/photoshop-scripting-python + - https://www.adobe.com/devnet/photoshop/scripting.html + - https://github.com/Adobe-CEP/Getting-Started-guides + - https://github.com/Adobe-CEP/CEP-Resources diff --git a/avalon/photoshop/__init__.py b/avalon/photoshop/__init__.py new file mode 100644 index 000000000..1b55598ad --- /dev/null +++ b/avalon/photoshop/__init__.py @@ -0,0 +1,70 @@ +"""Public API + +Anything that isn't defined here is INTERNAL and unreliable for external use. + +""" + +from .pipeline import ( + ls, + Creator, + install, + containerise +) + +from .workio import ( + file_extensions, + has_unsaved_changes, + save_file, + open_file, + current_file, + work_root, +) + +from .lib import ( + launch, + app, + Dispatch, + maintained_selection, + maintained_visibility, + get_layers_in_document, + get_layers_in_layers, + get_selected_layers, + group_selected_layers, + imprint, + read, + get_com_objects, + import_smart_object, + replace_smart_object +) + +__all__ = [ + # pipeline + "ls", + "Creator", + "install", + "containerise", + + # workfiles + "file_extensions", + "has_unsaved_changes", + "save_file", + "open_file", + "current_file", + "work_root", + + # lib + "launch", + "app", + "Dispatch", + "maintained_selection", + "maintained_visibility", + "get_layers_in_document", + "get_layers_in_layers", + "get_selected_layers", + "group_selected_layers", + "imprint", + "read", + "get_com_objects", + "import_smart_object", + "replace_smart_object" +] diff --git a/avalon/photoshop/com_objects.py b/avalon/photoshop/com_objects.py new file mode 100644 index 000000000..95a88d4be --- /dev/null +++ b/avalon/photoshop/com_objects.py @@ -0,0 +1,7281 @@ +# Taken from https://github.com/lohriialo/photoshop-scripting-python/blob/master/api_reference/photoshop_2020.py +# This may later need to factor in the Photoshop version and platform. +# -*- coding: mbcs -*- +# Created by makepy.py version 0.5.01 +# By python version 2.7.10 (default, Aug 21 2015, 12:07:58) [MSC v.1500 64 bit (AMD64)] +# From type library 'ScriptingSupport.8li' +# On Thu Nov 07 10:50:43 2019 +'Adobe Photoshop 2020 Object Library' +makepy_version = '0.5.01' +python_version = 0x2070af0 + +import win32com.client.CLSIDToClass, pythoncom, pywintypes +import win32com.client.util +from pywintypes import IID +from win32com.client import Dispatch + +# The following 3 lines may need tweaking for the particular server +# Candidates are pythoncom.Missing, .Empty and .ArgNotFound +defaultNamedOptArg=pythoncom.Empty +defaultNamedNotOptArg=pythoncom.Empty +defaultUnnamedArg=pythoncom.Empty + +CLSID = IID('{E891EE9A-D0AE-4CB4-8871-F92C0109F18E}') +MajorVersion = 1 +MinorVersion = 0 +LibraryFlags = 8 +LCID = 0x0 + +class constants: + psAbsolute =2 # from enum PsAdjustmentReference + psRelative =1 # from enum PsAdjustmentReference + psBottomCenter =8 # from enum PsAnchorPosition + psBottomLeft =7 # from enum PsAnchorPosition + psBottomRight =9 # from enum PsAnchorPosition + psMiddleCenter =5 # from enum PsAnchorPosition + psMiddleLeft =4 # from enum PsAnchorPosition + psMiddleRight =6 # from enum PsAnchorPosition + psTopCenter =2 # from enum PsAnchorPosition + psTopLeft =1 # from enum PsAnchorPosition + psTopRight =3 # from enum PsAnchorPosition + psCrisp =3 # from enum PsAntiAlias + psNoAntialias =1 # from enum PsAntiAlias + psSharp =2 # from enum PsAntiAlias + psSmooth =5 # from enum PsAntiAlias + psStrong =4 # from enum PsAntiAlias + psManual =1 # from enum PsAutoKernType + psMetrics =2 # from enum PsAutoKernType + psOptical =3 # from enum PsAutoKernType + psBMP16Bits =16 # from enum PsBMPDepthType + psBMP1Bit =1 # from enum PsBMPDepthType + psBMP24Bits =24 # from enum PsBMPDepthType + psBMP32Bits =32 # from enum PsBMPDepthType + psBMP4Bits =4 # from enum PsBMPDepthType + psBMP8Bits =8 # from enum PsBMPDepthType + psBMP_A1R5G5B5 =61 # from enum PsBMPDepthType + psBMP_A4R4G4B4 =64 # from enum PsBMPDepthType + psBMP_A8R8G8B8 =67 # from enum PsBMPDepthType + psBMP_R5G6B5 =62 # from enum PsBMPDepthType + psBMP_R8G8B8 =65 # from enum PsBMPDepthType + psBMP_X1R5G5B5 =60 # from enum PsBMPDepthType + psBMP_X4R4G4B4 =63 # from enum PsBMPDepthType + psBMP_X8R8G8B8 =66 # from enum PsBMPDepthType + psFolder =3 # from enum PsBatchDestinationType + psNoDestination =1 # from enum PsBatchDestinationType + psSaveAndClose =2 # from enum PsBatchDestinationType + psCustomPattern =5 # from enum PsBitmapConversionType + psDiffusionDither =3 # from enum PsBitmapConversionType + psHalfThreshold =1 # from enum PsBitmapConversionType + psHalftoneScreen =4 # from enum PsBitmapConversionType + psPatternDither =2 # from enum PsBitmapConversionType + psHalftoneCross =6 # from enum PsBitmapHalfToneType + psHalftoneDiamond =2 # from enum PsBitmapHalfToneType + psHalftoneEllipse =3 # from enum PsBitmapHalfToneType + psHalftoneLine =4 # from enum PsBitmapHalfToneType + psHalftoneRound =1 # from enum PsBitmapHalfToneType + psHalftoneSquare =5 # from enum PsBitmapHalfToneType + psDocument16Bits =16 # from enum PsBitsPerChannelType + psDocument1Bit =1 # from enum PsBitsPerChannelType + psDocument32Bits =32 # from enum PsBitsPerChannelType + psDocument8Bits =8 # from enum PsBitsPerChannelType + psColorBlend =22 # from enum PsBlendMode + psColorBurn =6 # from enum PsBlendMode + psColorDodge =10 # from enum PsBlendMode + psDarken =4 # from enum PsBlendMode + psDarkerColor =28 # from enum PsBlendMode + psDifference =18 # from enum PsBlendMode + psDissolve =3 # from enum PsBlendMode + psDivide =30 # from enum PsBlendMode + psExclusion =19 # from enum PsBlendMode + psHardLight =14 # from enum PsBlendMode + psHardMix =26 # from enum PsBlendMode + psHue =20 # from enum PsBlendMode + psLighten =8 # from enum PsBlendMode + psLighterColor =27 # from enum PsBlendMode + psLinearBurn =7 # from enum PsBlendMode + psLinearDodge =11 # from enum PsBlendMode + psLinearLight =16 # from enum PsBlendMode + psLuminosity =23 # from enum PsBlendMode + psMultiply =5 # from enum PsBlendMode + psNormalBlend =2 # from enum PsBlendMode + psOverlay =12 # from enum PsBlendMode + psPassThrough =1 # from enum PsBlendMode + psPinLight =17 # from enum PsBlendMode + psSaturationBlend =21 # from enum PsBlendMode + psScreen =9 # from enum PsBlendMode + psSoftLight =13 # from enum PsBlendMode + psSubtract =29 # from enum PsBlendMode + psVividLight =15 # from enum PsBlendMode + psIBMByteOrder =1 # from enum PsByteOrderType + psMacOSByteOrder =2 # from enum PsByteOrderType + psCameraDefault =0 # from enum PsCameraRAWSettingsType + psCustomSettings =2 # from enum PsCameraRAWSettingsType + psSelectedImage =1 # from enum PsCameraRAWSettingsType + psExtraLargeCameraRAW =4 # from enum PsCameraRAWSize + psLargeCameraRAW =3 # from enum PsCameraRAWSize + psMaximumCameraRAW =5 # from enum PsCameraRAWSize + psMediumCameraRAW =2 # from enum PsCameraRAWSize + psMinimumCameraRAW =0 # from enum PsCameraRAWSize + psSmallCameraRAW =1 # from enum PsCameraRAWSize + psAllCaps =2 # from enum PsCase + psNormalCase =1 # from enum PsCase + psSmallCaps =3 # from enum PsCase + psConvertToBitmap =5 # from enum PsChangeMode + psConvertToCMYK =3 # from enum PsChangeMode + psConvertToGrayscale =1 # from enum PsChangeMode + psConvertToIndexedColor =6 # from enum PsChangeMode + psConvertToLab =4 # from enum PsChangeMode + psConvertToMultiChannel =7 # from enum PsChangeMode + psConvertToRGB =2 # from enum PsChangeMode + psComponentChannel =1 # from enum PsChannelType + psMaskedAreaAlphaChannel =2 # from enum PsChannelType + psSelectedAreaAlphaChannel =3 # from enum PsChannelType + psSpotColorChannel =4 # from enum PsChannelType + PsColorBlendMode =22 # from enum PsColorBlendMode + psBehindBlend =24 # from enum PsColorBlendMode + psClearBlend =25 # from enum PsColorBlendMode + psColorBurnBlend =6 # from enum PsColorBlendMode + psColorDodgeBlend =10 # from enum PsColorBlendMode + psDarkenBlend =4 # from enum PsColorBlendMode + psDarkerColorBlend =28 # from enum PsColorBlendMode + psDifferenceBlend =18 # from enum PsColorBlendMode + psDissolveBlend =3 # from enum PsColorBlendMode + psDivideBlend =30 # from enum PsColorBlendMode + psExclusionBlend =19 # from enum PsColorBlendMode + psHardLightBlend =14 # from enum PsColorBlendMode + psHardMixBlend =26 # from enum PsColorBlendMode + psHueBlend =20 # from enum PsColorBlendMode + psLightenBlend =8 # from enum PsColorBlendMode + psLighterColorBlend =27 # from enum PsColorBlendMode + psLinearBurnBlend =7 # from enum PsColorBlendMode + psLinearDodgeBlend =11 # from enum PsColorBlendMode + psLinearLightBlend =16 # from enum PsColorBlendMode + psLuminosityBlend =23 # from enum PsColorBlendMode + psMultiplyBlend =5 # from enum PsColorBlendMode + psNormalBlendColor =2 # from enum PsColorBlendMode + psOverlayBlend =12 # from enum PsColorBlendMode + psPinLightBlend =17 # from enum PsColorBlendMode + psSaturationBlendColor =21 # from enum PsColorBlendMode + psScreenBlend =9 # from enum PsColorBlendMode + psSoftLightBlend =13 # from enum PsColorBlendMode + psSubtractBlend =29 # from enum PsColorBlendMode + psVividLightBlend =15 # from enum PsColorBlendMode + psCMYKModel =3 # from enum PsColorModel + psGrayscaleModel =1 # from enum PsColorModel + psHSBModel =5 # from enum PsColorModel + psLabModel =4 # from enum PsColorModel + psNoModel =50 # from enum PsColorModel + psRGBModel =2 # from enum PsColorModel + psAdobeColorPicker =1 # from enum PsColorPicker + psAppleColorPicker =2 # from enum PsColorPicker + psPlugInColorPicker =4 # from enum PsColorPicker + psWindowsColorPicker =3 # from enum PsColorPicker + psCustom =3 # from enum PsColorProfileType + psNo =1 # from enum PsColorProfileType + psWorking =2 # from enum PsColorProfileType + psAdaptive =2 # from enum PsColorReductionType + psBlackWhiteReduction =5 # from enum PsColorReductionType + psCustomReduction =4 # from enum PsColorReductionType + psMacintoshColors =7 # from enum PsColorReductionType + psPerceptualReduction =0 # from enum PsColorReductionType + psRestrictive =3 # from enum PsColorReductionType + psSFWGrayscale =6 # from enum PsColorReductionType + psSelective =1 # from enum PsColorReductionType + psWindowsColors =8 # from enum PsColorReductionType + psAdobeRGB =0 # from enum PsColorSpaceType + psColorMatchRGB =1 # from enum PsColorSpaceType + psProPhotoRGB =2 # from enum PsColorSpaceType + psSRGB =3 # from enum PsColorSpaceType + psCopyrightedWork =1 # from enum PsCopyrightedType + psPublicDomain =2 # from enum PsCopyrightedType + psUnmarked =3 # from enum PsCopyrightedType + psDuplication =1 # from enum PsCreateFields + psInterpolation =2 # from enum PsCreateFields + psArtBox =5 # from enum PsCropToType + psBleedBox =3 # from enum PsCropToType + psBoundingBox =0 # from enum PsCropToType + psCropBox =2 # from enum PsCropToType + psMediaBox =1 # from enum PsCropToType + psTrimBox =4 # from enum PsCropToType + psColorComposite =3 # from enum PsDCSType + psGrayscaleComposite =2 # from enum PsDCSType + psNoComposite =1 # from enum PsDCSType + psImageHighlight =4 # from enum PsDepthMapSource + psLayerMask =3 # from enum PsDepthMapSource + psNoSource =1 # from enum PsDepthMapSource + psTransparencyChannel =2 # from enum PsDepthMapSource + psAliasType =11 # from enum PsDescValueType + psBooleanType =5 # from enum PsDescValueType + psClassType =10 # from enum PsDescValueType + psDoubleType =2 # from enum PsDescValueType + psEnumeratedType =8 # from enum PsDescValueType + psIntegerType =1 # from enum PsDescValueType + psLargeIntegerType =13 # from enum PsDescValueType + psListType =6 # from enum PsDescValueType + psObjectType =7 # from enum PsDescValueType + psRawType =12 # from enum PsDescValueType + psReferenceType =9 # from enum PsDescValueType + psStringType =4 # from enum PsDescValueType + psUnitDoubleType =3 # from enum PsDescValueType + psDisplayAllDialogs =1 # from enum PsDialogModes + psDisplayErrorDialogs =2 # from enum PsDialogModes + psDisplayNoDialogs =3 # from enum PsDialogModes + psHorizontal =1 # from enum PsDirection + psVertical =2 # from enum PsDirection + psStretchToFit =1 # from enum PsDisplacementMapType + psTile =2 # from enum PsDisplacementMapType + psDiffusion =2 # from enum PsDitherType + psNoDither =1 # from enum PsDitherType + psNoise =4 # from enum PsDitherType + psPattern =3 # from enum PsDitherType + psBackgroundColor =2 # from enum PsDocumentFill + psTransparent =3 # from enum PsDocumentFill + psWhite =1 # from enum PsDocumentFill + psBitmap =5 # from enum PsDocumentMode + psCMYK =3 # from enum PsDocumentMode + psDuotone =8 # from enum PsDocumentMode + psGrayscale =1 # from enum PsDocumentMode + psIndexedColor =6 # from enum PsDocumentMode + psLab =4 # from enum PsDocumentMode + psMultiChannel =7 # from enum PsDocumentMode + psRGB =2 # from enum PsDocumentMode + psConcise =2 # from enum PsEditLogItemsType + psDetailed =3 # from enum PsEditLogItemsType + psSessionOnly =1 # from enum PsEditLogItemsType + psPlaceAfter =4 # from enum PsElementPlacement + psPlaceAtBeginning =1 # from enum PsElementPlacement + psPlaceAtEnd =2 # from enum PsElementPlacement + psPlaceBefore =3 # from enum PsElementPlacement + psPlaceInside =0 # from enum PsElementPlacement + psEvenFields =2 # from enum PsEliminateFields + psOddFields =1 # from enum PsEliminateFields + psIllustratorPaths =1 # from enum PsExportType + psSaveForWeb =2 # from enum PsExportType + psLowercase =2 # from enum PsExtensionType + psUppercase =3 # from enum PsExtensionType + psDdmm =16 # from enum PsFileNamingType + psDdmmyy =15 # from enum PsFileNamingType + psDocumentNameLower =2 # from enum PsFileNamingType + psDocumentNameMixed =1 # from enum PsFileNamingType + psDocumentNameUpper =3 # from enum PsFileNamingType + psExtensionLower =17 # from enum PsFileNamingType + psExtensionUpper =18 # from enum PsFileNamingType + psMmdd =11 # from enum PsFileNamingType + psMmddyy =10 # from enum PsFileNamingType + psSerialLetterLower =8 # from enum PsFileNamingType + psSerialLetterUpper =9 # from enum PsFileNamingType + psSerialNumber1 =4 # from enum PsFileNamingType + psSerialNumber2 =5 # from enum PsFileNamingType + psSerialNumber3 =6 # from enum PsFileNamingType + psSerialNumber4 =7 # from enum PsFileNamingType + psYyddmm =14 # from enum PsFileNamingType + psYymmdd =13 # from enum PsFileNamingType + psYyyymmdd =12 # from enum PsFileNamingType + psFontPreviewExtraLarge =4 # from enum PsFontPreviewType + psFontPreviewHuge =5 # from enum PsFontPreviewType + psFontPreviewLarge =3 # from enum PsFontPreviewType + psFontPreviewMedium =2 # from enum PsFontPreviewType + psFontPreviewNone =0 # from enum PsFontPreviewType + psFontPreviewSmall =1 # from enum PsFontPreviewType + psBlackWhite =2 # from enum PsForcedColors + psNoForced =1 # from enum PsForcedColors + psPrimaries =3 # from enum PsForcedColors + psWeb =4 # from enum PsForcedColors + psOptimizedBaseline =2 # from enum PsFormatOptionsType + psProgressive =3 # from enum PsFormatOptionsType + psStandardBaseline =1 # from enum PsFormatOptionsType + psConstrainBoth =3 # from enum PsGalleryConstrainType + psConstrainHeight =2 # from enum PsGalleryConstrainType + psConstrainWidth =1 # from enum PsGalleryConstrainType + psArial =1 # from enum PsGalleryFontType + psCourierNew =2 # from enum PsGalleryFontType + psHelvetica =3 # from enum PsGalleryFontType + psTimesNewRoman =4 # from enum PsGalleryFontType + psBlackText =1 # from enum PsGallerySecurityTextColorType + psCustomText =3 # from enum PsGallerySecurityTextColorType + psWhiteText =2 # from enum PsGallerySecurityTextColorType + psCentered =1 # from enum PsGallerySecurityTextPositionType + psLowerLeft =3 # from enum PsGallerySecurityTextPositionType + psLowerRight =5 # from enum PsGallerySecurityTextPositionType + psUpperLeft =2 # from enum PsGallerySecurityTextPositionType + psUpperRight =4 # from enum PsGallerySecurityTextPositionType + psClockwise45 =2 # from enum PsGallerySecurityTextRotateType + psClockwise90 =3 # from enum PsGallerySecurityTextRotateType + psCounterClockwise45 =4 # from enum PsGallerySecurityTextRotateType + psCounterClockwise90 =5 # from enum PsGallerySecurityTextRotateType + psZero =1 # from enum PsGallerySecurityTextRotateType + psCaption =5 # from enum PsGallerySecurityType + psCopyright =4 # from enum PsGallerySecurityType + psCredit =6 # from enum PsGallerySecurityType + psCustomSecurityText =2 # from enum PsGallerySecurityType + psFilename =3 # from enum PsGallerySecurityType + psNoSecurity =1 # from enum PsGallerySecurityType + psTitle =7 # from enum PsGallerySecurityType + psCustomThumbnail =4 # from enum PsGalleryThumbSizeType + psLarge =3 # from enum PsGalleryThumbSizeType + psMedium =2 # from enum PsGalleryThumbSizeType + psSmall =1 # from enum PsGalleryThumbSizeType + psHeptagon =4 # from enum PsGeometry + psHexagon =2 # from enum PsGeometry + psOctagon =5 # from enum PsGeometry + psPentagon =1 # from enum PsGeometry + psSquareGeometry =3 # from enum PsGeometry + psTriangle =0 # from enum PsGeometry + psGridDashedLine =2 # from enum PsGridLineStyle + psGridDottedLine =3 # from enum PsGridLineStyle + psGridSolidLine =1 # from enum PsGridLineStyle + psLargeGrid =4 # from enum PsGridSize + psMediumGrid =3 # from enum PsGridSize + psNoGrid =1 # from enum PsGridSize + psSmallGrid =2 # from enum PsGridSize + psGuideDashedLine =2 # from enum PsGuideLineStyle + psGuideSolidLine =1 # from enum PsGuideLineStyle + psAllPaths =2 # from enum PsIllustratorPathType + psDocumentBounds =1 # from enum PsIllustratorPathType + psNamedPath =3 # from enum PsIllustratorPathType + psAbsoluteColorimetric =4 # from enum PsIntent + psPerceptual =1 # from enum PsIntent + psRelativeColorimetric =3 # from enum PsIntent + psSaturation =2 # from enum PsIntent + psBeforeRunning =3 # from enum PsJavaScriptExecutionMode + psDebuggerOnError =2 # from enum PsJavaScriptExecutionMode + psNeverShowDebugger =1 # from enum PsJavaScriptExecutionMode + psCenter =2 # from enum PsJustification + psCenterJustified =5 # from enum PsJustification + psFullyJustified =7 # from enum PsJustification + psLeft =1 # from enum PsJustification + psLeftJustified =4 # from enum PsJustification + psRight =3 # from enum PsJustification + psRightJustified =6 # from enum PsJustification + psBrazillianPortuguese =13 # from enum PsLanguage + psCanadianFrench =4 # from enum PsLanguage + psDanish =17 # from enum PsLanguage + psDutch =16 # from enum PsLanguage + psEnglishUK =2 # from enum PsLanguage + psEnglishUSA =1 # from enum PsLanguage + psFinnish =5 # from enum PsLanguage + psFrench =3 # from enum PsLanguage + psGerman =6 # from enum PsLanguage + psItalian =9 # from enum PsLanguage + psNorwegian =10 # from enum PsLanguage + psNynorskNorwegian =11 # from enum PsLanguage + psOldGerman =7 # from enum PsLanguage + psPortuguese =12 # from enum PsLanguage + psSpanish =14 # from enum PsLanguage + psSwedish =15 # from enum PsLanguage + psSwissGerman =8 # from enum PsLanguage + psRLELayerCompression =1 # from enum PsLayerCompressionType + psZIPLayerCompression =2 # from enum PsLayerCompressionType + psBlackAndWhiteLayer =22 # from enum PsLayerKind + psBrightnessContrastLayer =9 # from enum PsLayerKind + psChannelMixerLayer =12 # from enum PsLayerKind + psColorBalanceLayer =8 # from enum PsLayerKind + psColorLookup =24 # from enum PsLayerKind + psCurvesLayer =7 # from enum PsLayerKind + psExposureLayer =19 # from enum PsLayerKind + psGradientFillLayer =4 # from enum PsLayerKind + psGradientMapLayer =13 # from enum PsLayerKind + psHueSaturationLayer =10 # from enum PsLayerKind + psInversionLayer =14 # from enum PsLayerKind + psLayer3D =20 # from enum PsLayerKind + psLevelsLayer =6 # from enum PsLayerKind + psNormalLayer =1 # from enum PsLayerKind + psPatternFillLayer =5 # from enum PsLayerKind + psPhotoFilterLayer =18 # from enum PsLayerKind + psPosterizeLayer =16 # from enum PsLayerKind + psSelectiveColorLayer =11 # from enum PsLayerKind + psSmartObjectLayer =17 # from enum PsLayerKind + psSolidFillLayer =3 # from enum PsLayerKind + psTextLayer =2 # from enum PsLayerKind + psThresholdLayer =15 # from enum PsLayerKind + psVibrance =23 # from enum PsLayerKind + psVideoLayer =21 # from enum PsLayerKind + psArtLayer =1 # from enum PsLayerType + psLayerSet =2 # from enum PsLayerType + psMoviePrime =5 # from enum PsLensType + psPrime105 =3 # from enum PsLensType + psPrime35 =2 # from enum PsLensType + psZoomLens =1 # from enum PsLensType + psActualSize =0 # from enum PsMagnificationType + psFitPage =1 # from enum PsMagnificationType + psBackgroundColorMatte =3 # from enum PsMatteType + psBlackMatte =5 # from enum PsMatteType + psForegroundColorMatte =2 # from enum PsMatteType + psNetscapeGrayMatte =7 # from enum PsMatteType + psNoMatte =1 # from enum PsMatteType + psSemiGray =6 # from enum PsMatteType + psWhiteMatte =4 # from enum PsMatteType + psActiveMeasurements =2 # from enum PsMeasurementRange + psAllMeasurements =1 # from enum PsMeasurementRange + psMeasureCountTool =2 # from enum PsMeasurementSource + psMeasureRulerTool =3 # from enum PsMeasurementSource + psMeasureSelection =1 # from enum PsMeasurementSource + psNewBitmap =5 # from enum PsNewDocumentMode + psNewCMYK =3 # from enum PsNewDocumentMode + psNewGray =1 # from enum PsNewDocumentMode + psNewLab =4 # from enum PsNewDocumentMode + psNewRGB =2 # from enum PsNewDocumentMode + psGaussianNoise =2 # from enum PsNoiseDistribution + psUniformNoise =1 # from enum PsNoiseDistribution + psOffsetRepeatEdgePixels =3 # from enum PsOffsetUndefinedAreas + psOffsetSetToLayerFill =1 # from enum PsOffsetUndefinedAreas + psOffsetWrapAround =2 # from enum PsOffsetUndefinedAreas + psOpenCMYK =3 # from enum PsOpenDocumentMode + psOpenGray =1 # from enum PsOpenDocumentMode + psOpenLab =4 # from enum PsOpenDocumentMode + psOpenRGB =2 # from enum PsOpenDocumentMode + psAliasPIXOpen =25 # from enum PsOpenDocumentType + psBMPOpen =2 # from enum PsOpenDocumentType + psCameraRAWOpen =32 # from enum PsOpenDocumentType + psCompuServeGIFOpen =3 # from enum PsOpenDocumentType + psDICOMOpen =33 # from enum PsOpenDocumentType + psEPSOpen =22 # from enum PsOpenDocumentType + psEPSPICTPreviewOpen =23 # from enum PsOpenDocumentType + psEPSTIFFPreviewOpen =24 # from enum PsOpenDocumentType + psElectricImageOpen =26 # from enum PsOpenDocumentType + psFilmstripOpen =5 # from enum PsOpenDocumentType + psJPEGOpen =6 # from enum PsOpenDocumentType + psPCXOpen =7 # from enum PsOpenDocumentType + psPDFOpen =21 # from enum PsOpenDocumentType + psPICTFileFormatOpen =10 # from enum PsOpenDocumentType + psPICTResourceFormatOpen =11 # from enum PsOpenDocumentType + psPNGOpen =13 # from enum PsOpenDocumentType + psPhotoCDOpen =9 # from enum PsOpenDocumentType + psPhotoshopDCS_1Open =18 # from enum PsOpenDocumentType + psPhotoshopDCS_2Open =19 # from enum PsOpenDocumentType + psPhotoshopEPSOpen =4 # from enum PsOpenDocumentType + psPhotoshopOpen =1 # from enum PsOpenDocumentType + psPhotoshopPDFOpen =8 # from enum PsOpenDocumentType + psPixarOpen =12 # from enum PsOpenDocumentType + psPortableBitmapOpen =27 # from enum PsOpenDocumentType + psRawOpen =14 # from enum PsOpenDocumentType + psSGIRGBOpen =29 # from enum PsOpenDocumentType + psScitexCTOpen =15 # from enum PsOpenDocumentType + psSoftImageOpen =30 # from enum PsOpenDocumentType + psTIFFOpen =17 # from enum PsOpenDocumentType + psTargaOpen =16 # from enum PsOpenDocumentType + psWavefrontRLAOpen =28 # from enum PsOpenDocumentType + psWirelessBitmapOpen =31 # from enum PsOpenDocumentType + psOS2 =1 # from enum PsOperatingSystem + psWindows =2 # from enum PsOperatingSystem + psLandscape =1 # from enum PsOrientation + psPortrait =2 # from enum PsOrientation + psPreciseOther =2 # from enum PsOtherPaintingCursors + psStandardOther =1 # from enum PsOtherPaintingCursors + psPDF13 =1 # from enum PsPDFCompatibilityType + psPDF14 =2 # from enum PsPDFCompatibilityType + psPDF15 =3 # from enum PsPDFCompatibilityType + psPDF16 =4 # from enum PsPDFCompatibilityType + psPDF17 =5 # from enum PsPDFCompatibilityType + psPDFJPEG =2 # from enum PsPDFEncodingType + psPDFJPEG2000HIGH =9 # from enum PsPDFEncodingType + psPDFJPEG2000LOSSLESS =14 # from enum PsPDFEncodingType + psPDFJPEG2000LOW =13 # from enum PsPDFEncodingType + psPDFJPEG2000MED =11 # from enum PsPDFEncodingType + psPDFJPEG2000MEDHIGH =10 # from enum PsPDFEncodingType + psPDFJPEG2000MEDLOW =12 # from enum PsPDFEncodingType + psPDFJPEGHIGH =4 # from enum PsPDFEncodingType + psPDFJPEGLOW =8 # from enum PsPDFEncodingType + psPDFJPEGMED =6 # from enum PsPDFEncodingType + psPDFJPEGMEDHIGH =5 # from enum PsPDFEncodingType + psPDFJPEGMEDLOW =7 # from enum PsPDFEncodingType + psPDFNone =0 # from enum PsPDFEncodingType + psPDFZip =1 # from enum PsPDFEncodingType + psPDFZip4Bit =3 # from enum PsPDFEncodingType + psNoResample =0 # from enum PsPDFResampleType + psPDFAverage =1 # from enum PsPDFResampleType + psPDFBicubic =3 # from enum PsPDFResampleType + psPDFSubSample =2 # from enum PsPDFResampleType + psNoStandard =0 # from enum PsPDFStandardType + psPDFX1A2001 =1 # from enum PsPDFStandardType + psPDFX1A2003 =2 # from enum PsPDFStandardType + psPDFX32002 =3 # from enum PsPDFStandardType + psPDFX32003 =4 # from enum PsPDFStandardType + psPDFX42008 =5 # from enum PsPDFStandardType + psPICT16Bits =16 # from enum PsPICTBitsPerPixels + psPICT2Bits =2 # from enum PsPICTBitsPerPixels + psPICT32Bits =32 # from enum PsPICTBitsPerPixels + psPICT4Bits =4 # from enum PsPICTBitsPerPixels + psPICT8Bits =8 # from enum PsPICTBitsPerPixels + psJPEGHighPICT =5 # from enum PsPICTCompression + psJPEGLowPICT =2 # from enum PsPICTCompression + psJPEGMaximumPICT =6 # from enum PsPICTCompression + psJPEGMediumPICT =4 # from enum PsPICTCompression + psNoPICTCompression =1 # from enum PsPICTCompression + psBrushSize =3 # from enum PsPaintingCursors + psPrecise =2 # from enum PsPaintingCursors + psStandard =1 # from enum PsPaintingCursors + psExact =1 # from enum PsPaletteType + psLocalAdaptive =8 # from enum PsPaletteType + psLocalPerceptual =6 # from enum PsPaletteType + psLocalSelective =7 # from enum PsPaletteType + psMacOSPalette =2 # from enum PsPaletteType + psMasterAdaptive =11 # from enum PsPaletteType + psMasterPerceptual =9 # from enum PsPaletteType + psMasterSelective =10 # from enum PsPaletteType + psPreviousPalette =12 # from enum PsPaletteType + psUniform =5 # from enum PsPaletteType + psWebPalette =4 # from enum PsPaletteType + psWindowsPalette =3 # from enum PsPaletteType + psClippingPath =2 # from enum PsPathKind + psNormalPath =1 # from enum PsPathKind + psTextMask =5 # from enum PsPathKind + psVectorMask =4 # from enum PsPathKind + psWorkPath =3 # from enum PsPathKind + psLab16 =4 # from enum PsPhotoCDColorSpace + psLab8 =3 # from enum PsPhotoCDColorSpace + psRGB16 =2 # from enum PsPhotoCDColorSpace + psRGB8 =1 # from enum PsPhotoCDColorSpace + psExtraLargePhotoCD =5 # from enum PsPhotoCDSize + psLargePhotoCD =4 # from enum PsPhotoCDSize + psMaximumPhotoCD =6 # from enum PsPhotoCDSize + psMediumPhotoCD =3 # from enum PsPhotoCDSize + psMinimumPhotoCD =1 # from enum PsPhotoCDSize + psSmallPhotoCD =2 # from enum PsPhotoCDSize + psCaptionText =5 # from enum PsPicturePackageTextType + psCopyrightText =4 # from enum PsPicturePackageTextType + psCreditText =6 # from enum PsPicturePackageTextType + psFilenameText =3 # from enum PsPicturePackageTextType + psNoText =1 # from enum PsPicturePackageTextType + psOriginText =7 # from enum PsPicturePackageTextType + psUserText =2 # from enum PsPicturePackageTextType + psCornerPoint =2 # from enum PsPointKind + psSmoothPoint =1 # from enum PsPointKind + psPostScriptPoints =1 # from enum PsPointType + psTraditionalPoints =2 # from enum PsPointType + psPolarToRectangular =2 # from enum PsPolarConversionType + psRectangularToPolar =1 # from enum PsPolarConversionType + psEightBitTIFF =3 # from enum PsPreviewType + psMonochromeTIFF =2 # from enum PsPreviewType + psNoPreview =1 # from enum PsPreviewType + psAllCaches =4 # from enum PsPurgeTarget + psClipboardCache =3 # from enum PsPurgeTarget + psHistoryCaches =2 # from enum PsPurgeTarget + psUndoCaches =1 # from enum PsPurgeTarget + psAlways =1 # from enum PsQueryStateType + psAsk =2 # from enum PsQueryStateType + psNever =3 # from enum PsQueryStateType + psSpin =1 # from enum PsRadialBlurMethod + psZoom =2 # from enum PsRadialBlurMethod + psRadialBlurBest =3 # from enum PsRadialBlurQuality + psRadialBlurDraft =1 # from enum PsRadialBlurQuality + psRadialBlurGood =2 # from enum PsRadialBlurQuality + psEntireLayer =5 # from enum PsRasterizeType + psFillContent =3 # from enum PsRasterizeType + psLayerClippingPath =4 # from enum PsRasterizeType + psLinkedLayers =6 # from enum PsRasterizeType + psShape =2 # from enum PsRasterizeType + psTextContents =1 # from enum PsRasterizeType + psReferenceClassType =7 # from enum PsReferenceFormType + psReferenceEnumeratedType =5 # from enum PsReferenceFormType + psReferenceIdentifierType =3 # from enum PsReferenceFormType + psReferenceIndexType =2 # from enum PsReferenceFormType + psReferenceNameType =1 # from enum PsReferenceFormType + psReferenceOffsetType =4 # from enum PsReferenceFormType + psReferencePropertyType =6 # from enum PsReferenceFormType + psAutomatic =8 # from enum PsResampleMethod + psBicubic =4 # from enum PsResampleMethod + psBicubicAutomatic =7 # from enum PsResampleMethod + psBicubicSharper =5 # from enum PsResampleMethod + psBicubicSmoother =6 # from enum PsResampleMethod + psBilinear =3 # from enum PsResampleMethod + psNearestNeighbor =2 # from enum PsResampleMethod + psNoResampling =1 # from enum PsResampleMethod + psPreserveDetails =9 # from enum PsResampleMethod + psAllTools =2 # from enum PsResetTarget + psAllWarnings =1 # from enum PsResetTarget + psEverything =3 # from enum PsResetTarget + psLargeRipple =3 # from enum PsRippleSize + psMediumRipple =2 # from enum PsRippleSize + psSmallRipple =1 # from enum PsRippleSize + psAlwaysSave =2 # from enum PsSaveBehavior + psAskWhenSaving =3 # from enum PsSaveBehavior + psNeverSave =1 # from enum PsSaveBehavior + psAliasPIXSave =25 # from enum PsSaveDocumentType + psBMPSave =2 # from enum PsSaveDocumentType + psCompuServeGIFSave =3 # from enum PsSaveDocumentType + psElectricImageSave =26 # from enum PsSaveDocumentType + psJPEGSave =6 # from enum PsSaveDocumentType + psPCXSave =7 # from enum PsSaveDocumentType + psPICTFileFormatSave =10 # from enum PsSaveDocumentType + psPICTResourceFormatSave =11 # from enum PsSaveDocumentType + psPNGSave =13 # from enum PsSaveDocumentType + psPhotoshopDCS_1Save =18 # from enum PsSaveDocumentType + psPhotoshopDCS_2Save =19 # from enum PsSaveDocumentType + psPhotoshopEPSSave =4 # from enum PsSaveDocumentType + psPhotoshopPDFSave =8 # from enum PsSaveDocumentType + psPhotoshopSave =1 # from enum PsSaveDocumentType + psPixarSave =12 # from enum PsSaveDocumentType + psPortableBitmapSave =27 # from enum PsSaveDocumentType + psRawSave =14 # from enum PsSaveDocumentType + psSGIRGBSave =29 # from enum PsSaveDocumentType + psScitexCTSave =15 # from enum PsSaveDocumentType + psSoftImageSave =30 # from enum PsSaveDocumentType + psTIFFSave =17 # from enum PsSaveDocumentType + psTargaSave =16 # from enum PsSaveDocumentType + psWavefrontRLASave =28 # from enum PsSaveDocumentType + psWirelessBitmapSave =31 # from enum PsSaveDocumentType + psAscii =3 # from enum PsSaveEncoding + psBinary =1 # from enum PsSaveEncoding + psJPEGHigh =5 # from enum PsSaveEncoding + psJPEGLow =2 # from enum PsSaveEncoding + psJPEGMaximum =6 # from enum PsSaveEncoding + psJPEGMedium =4 # from enum PsSaveEncoding + psLogFile =2 # from enum PsSaveLogItemsType + psLogFileAndMetadata =3 # from enum PsSaveLogItemsType + psMetadata =1 # from enum PsSaveLogItemsType + psDoNotSaveChanges =2 # from enum PsSaveOptions + psPromptToSaveChanges =3 # from enum PsSaveOptions + psSaveChanges =1 # from enum PsSaveOptions + psDiminishSelection =3 # from enum PsSelectionType + psExtendSelection =2 # from enum PsSelectionType + psIntersectSelection =4 # from enum PsSelectionType + psReplaceSelection =1 # from enum PsSelectionType + psShapeAdd =1 # from enum PsShapeOperation + psShapeIntersect =3 # from enum PsShapeOperation + psShapeSubtract =4 # from enum PsShapeOperation + psShapeXOR =2 # from enum PsShapeOperation + psSmartBlurEdgeOnly =2 # from enum PsSmartBlurMode + psSmartBlurNormal =1 # from enum PsSmartBlurMode + psSmartBlurOverlayEdge =3 # from enum PsSmartBlurMode + psSmartBlurHigh =3 # from enum PsSmartBlurQuality + psSmartBlurLow =1 # from enum PsSmartBlurQuality + psSmartBlurMedium =2 # from enum PsSmartBlurQuality + psDocumentSpace =1 # from enum PsSourceSpaceType + psProofSpace =2 # from enum PsSourceSpaceType + psHorizontalSpherize =2 # from enum PsSpherizeMode + psNormalSpherize =1 # from enum PsSpherizeMode + psVerticalSpherize =3 # from enum PsSpherizeMode + psStrikeBox =3 # from enum PsStrikeThruType + psStrikeHeight =2 # from enum PsStrikeThruType + psStrikeOff =1 # from enum PsStrikeThruType + psCenterStroke =2 # from enum PsStrokeLocation + psInsideStroke =1 # from enum PsStrokeLocation + psOutsideStroke =3 # from enum PsStrokeLocation + psTarga16Bits =16 # from enum PsTargaBitsPerPixels + psTarga24Bits =24 # from enum PsTargaBitsPerPixels + psTarga32Bits =32 # from enum PsTargaBitsPerPixels + psAdobeEveryLine =2 # from enum PsTextComposer + psAdobeSingleLine =1 # from enum PsTextComposer + psParagraphText =2 # from enum PsTextType + psPointText =1 # from enum PsTextType + psBlocksTexture =1 # from enum PsTextureType + psCanvasTexture =2 # from enum PsTextureType + psFrostedTexture =3 # from enum PsTextureType + psTextureFile =5 # from enum PsTextureType + psTinyLensTexture =4 # from enum PsTextureType + psNoTIFFCompression =1 # from enum PsTiffEncodingType + psTiffJPEG =3 # from enum PsTiffEncodingType + psTiffLZW =2 # from enum PsTiffEncodingType + psTiffZIP =4 # from enum PsTiffEncodingType + psArtHistoryBrush =9 # from enum PsToolType + psBackgroundEraser =4 # from enum PsToolType + psBlur =11 # from enum PsToolType + psBrush =2 # from enum PsToolType + psBurn =14 # from enum PsToolType + psCloneStamp =5 # from enum PsToolType + psColorReplacementTool =16 # from enum PsToolType + psDodge =13 # from enum PsToolType + psEraser =3 # from enum PsToolType + psHealingBrush =7 # from enum PsToolType + psHistoryBrush =8 # from enum PsToolType + psPatternStamp =6 # from enum PsToolType + psPencil =1 # from enum PsToolType + psSharpen =12 # from enum PsToolType + psSmudge =10 # from enum PsToolType + psSponge =15 # from enum PsToolType + psBlindsHorizontal =1 # from enum PsTransitionType + psBlindsVertical =2 # from enum PsTransitionType + psBoxIn =4 # from enum PsTransitionType + psBoxOut =5 # from enum PsTransitionType + psDissolveTransition =3 # from enum PsTransitionType + psGlitterDown =6 # from enum PsTransitionType + psGlitterRight =7 # from enum PsTransitionType + psGlitterRightDown =8 # from enum PsTransitionType + psNoTrasition =9 # from enum PsTransitionType + psRandom =10 # from enum PsTransitionType + psSplitHorizontalIn =11 # from enum PsTransitionType + psSplitHorizontalOut =12 # from enum PsTransitionType + psSplitVerticalIn =13 # from enum PsTransitionType + psSplitVerticalOut =14 # from enum PsTransitionType + psWipeDown =15 # from enum PsTransitionType + psWipeLeft =16 # from enum PsTransitionType + psWipeRight =17 # from enum PsTransitionType + psWipeUp =18 # from enum PsTransitionType + psBottomRightPixel =9 # from enum PsTrimType + psTopLeftPixel =1 # from enum PsTrimType + psTransparentPixels =0 # from enum PsTrimType + psTypeMM =4 # from enum PsTypeUnits + psTypePixels =1 # from enum PsTypeUnits + psTypePoints =5 # from enum PsTypeUnits + psRepeatEdgePixels =2 # from enum PsUndefinedAreas + psWrapAround =1 # from enum PsUndefinedAreas + psUnderlineLeft =3 # from enum PsUnderlineType + psUnderlineOff =1 # from enum PsUnderlineType + psUnderlineRight =2 # from enum PsUnderlineType + psCM =3 # from enum PsUnits + psInches =2 # from enum PsUnits + psMM =4 # from enum PsUnits + psPercent =7 # from enum PsUnits + psPicas =6 # from enum PsUnits + psPixels =1 # from enum PsUnits + psPoints =5 # from enum PsUnits + psFour =4 # from enum PsUrgency + psHigh =8 # from enum PsUrgency + psLow =1 # from enum PsUrgency + psNone =0 # from enum PsUrgency + psNormal =5 # from enum PsUrgency + psSeven =7 # from enum PsUrgency + psSix =6 # from enum PsUrgency + psThree =3 # from enum PsUrgency + psTwo =2 # from enum PsUrgency + psArc =2 # from enum PsWarpStyle + psArcLower =3 # from enum PsWarpStyle + psArcUpper =4 # from enum PsWarpStyle + psArch =5 # from enum PsWarpStyle + psBulge =6 # from enum PsWarpStyle + psFish =11 # from enum PsWarpStyle + psFishEye =13 # from enum PsWarpStyle + psFlag =9 # from enum PsWarpStyle + psInflate =14 # from enum PsWarpStyle + psNoWarp =1 # from enum PsWarpStyle + psRise =12 # from enum PsWarpStyle + psShellLower =7 # from enum PsWarpStyle + psShellUpper =8 # from enum PsWarpStyle + psSqueeze =15 # from enum PsWarpStyle + psTwist =16 # from enum PsWarpStyle + psWave =10 # from enum PsWarpStyle + psSine =1 # from enum PsWaveType + psSquare =3 # from enum PsWaveType + psTriangular =2 # from enum PsWaveType + psAsShot =0 # from enum PsWhiteBalanceType + psAuto =1 # from enum PsWhiteBalanceType + psCloudy =3 # from enum PsWhiteBalanceType + psCustomCameraSettings =8 # from enum PsWhiteBalanceType + psDaylight =2 # from enum PsWhiteBalanceType + psFlash =7 # from enum PsWhiteBalanceType + psFluorescent =6 # from enum PsWhiteBalanceType + psShade =4 # from enum PsWhiteBalanceType + psTungsten =5 # from enum PsWhiteBalanceType + psAroundCenter =1 # from enum PsZigZagType + psOutFromCenter =2 # from enum PsZigZagType + psPondRipples =3 # from enum PsZigZagType + +from win32com.client import DispatchBaseClass +class ArtLayer(DispatchBaseClass): + 'any layer that can contain data' + CLSID = IID('{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}') + coclass_clsid = None + + def AdjustBrightnessContrast(self, Brightness=defaultNamedNotOptArg, Contrast=defaultNamedNotOptArg): + 'adjust brightness and constrast' + return self._oleobj_.InvokeTypes(1097084980, LCID, 1, (24, 0), ((3, 1), (3, 1)),Brightness + , Contrast) + + def AdjustColorBalance(self, Shadows=defaultNamedOptArg, Midtones=defaultNamedOptArg, Highlights=defaultNamedOptArg, PreserveLuminosity=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1097084981, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17), (12, 17)),Shadows + , Midtones, Highlights, PreserveLuminosity) + + def AdjustCurves(self, CurveShape=defaultNamedNotOptArg): + 'adjust curves of the selected channels' + return self._oleobj_.InvokeTypes(1097084979, LCID, 1, (24, 0), ((12, 1),),CurveShape + ) + + def AdjustLevels(self, InputRangeStart=defaultNamedNotOptArg, InputRangeEnd=defaultNamedNotOptArg, InputRangeGamma=defaultNamedNotOptArg, OutputRangeStart=defaultNamedNotOptArg + , OutputRangeEnd=defaultNamedNotOptArg): + 'adjust levels of the selected channels' + return self._oleobj_.InvokeTypes(1097084977, LCID, 1, (24, 0), ((3, 1), (3, 1), (5, 1), (3, 1), (3, 1)),InputRangeStart + , InputRangeEnd, InputRangeGamma, OutputRangeStart, OutputRangeEnd) + + def ApplyAddNoise(self, Amount=defaultNamedNotOptArg, Distribution=defaultNamedNotOptArg, Monochromatic=defaultNamedNotOptArg): + 'apply the add noise filter' + return self._oleobj_.InvokeTypes(1177563448, LCID, 1, (24, 0), ((5, 1), (3, 1), (11, 1)),Amount + , Distribution, Monochromatic) + + def ApplyAverage(self): + 'apply the average filter' + return self._oleobj_.InvokeTypes(1177563959, LCID, 1, (24, 0), (),) + + def ApplyBlur(self): + 'apply the blur filter' + return self._oleobj_.InvokeTypes(1177563185, LCID, 1, (24, 0), (),) + + def ApplyBlurMore(self): + 'apply the blur more filter' + return self._oleobj_.InvokeTypes(1177563186, LCID, 1, (24, 0), (),) + + def ApplyClouds(self): + 'apply the clouds filter' + return self._oleobj_.InvokeTypes(1177563953, LCID, 1, (24, 0), (),) + + def ApplyCustomFilter(self, Characteristics=defaultNamedNotOptArg, Scale=defaultNamedNotOptArg, Offset=defaultNamedNotOptArg): + 'apply the custom filter' + return self._oleobj_.InvokeTypes(1177563702, LCID, 1, (24, 0), ((12, 1), (3, 1), (3, 1)),Characteristics + , Scale, Offset) + + def ApplyDeInterlace(self, EliminateFields=defaultNamedNotOptArg, CreateFields=defaultNamedNotOptArg): + 'apply the de-interlace filter' + return self._oleobj_.InvokeTypes(1177563957, LCID, 1, (24, 0), ((3, 1), (3, 1)),EliminateFields + , CreateFields) + + def ApplyDespeckle(self): + 'apply the despeckle filter' + return self._oleobj_.InvokeTypes(1177563449, LCID, 1, (24, 0), (),) + + def ApplyDifferenceClouds(self): + 'apply the difference clouds filter' + return self._oleobj_.InvokeTypes(1177563954, LCID, 1, (24, 0), (),) + + def ApplyDiffuseGlow(self, Graininess=defaultNamedNotOptArg, GlowAmount=defaultNamedNotOptArg, ClearAmount=defaultNamedNotOptArg): + 'apply the diffuse glow filter' + return self._oleobj_.InvokeTypes(1177563190, LCID, 1, (24, 0), ((3, 1), (3, 1), (3, 1)),Graininess + , GlowAmount, ClearAmount) + + def ApplyDisplace(self, HorizontalScale=defaultNamedNotOptArg, VerticalScale=defaultNamedNotOptArg, DisplacementType=defaultNamedNotOptArg, UndefinedAreas=defaultNamedNotOptArg + , DisplacementMapFile=defaultNamedNotOptArg): + 'apply the displace filter' + return self._oleobj_.InvokeTypes(1177563445, LCID, 1, (24, 0), ((3, 1), (3, 1), (3, 1), (3, 1), (8, 1)),HorizontalScale + , VerticalScale, DisplacementType, UndefinedAreas, DisplacementMapFile) + + def ApplyDustAndScratches(self, Radius=defaultNamedNotOptArg, Threshold=defaultNamedNotOptArg): + 'apply the dust and scratches filter' + return self._oleobj_.InvokeTypes(1177563696, LCID, 1, (24, 0), ((3, 1), (3, 1)),Radius + , Threshold) + + def ApplyGaussianBlur(self, Radius=defaultNamedNotOptArg): + 'apply the gaussian blur filter' + return self._oleobj_.InvokeTypes(1195535474, LCID, 1, (24, 0), ((5, 1),),Radius + ) + + def ApplyGlassEffect(self, Distortion=defaultNamedNotOptArg, Smoothness=defaultNamedNotOptArg, Scaling=defaultNamedNotOptArg, Invert=defaultNamedOptArg + , Texture=defaultNamedOptArg, TextureFile=defaultNamedOptArg): + 'apply the glass filter' + return self._oleobj_.InvokeTypes(1177563191, LCID, 1, (24, 0), ((3, 1), (3, 1), (3, 1), (12, 17), (12, 17), (12, 17)),Distortion + , Smoothness, Scaling, Invert, Texture, TextureFile + ) + + def ApplyHighPass(self, Radius=defaultNamedNotOptArg): + 'apply the high pass filter' + return self._oleobj_.InvokeTypes(1177563952, LCID, 1, (24, 0), ((5, 1),),Radius + ) + + def ApplyLensBlur(self, Source=defaultNamedOptArg, FocalDistance=defaultNamedOptArg, InvertDepthMap=defaultNamedOptArg, Shape=defaultNamedOptArg + , Radius=defaultNamedOptArg, BladeCurvature=defaultNamedOptArg, Rotation=defaultNamedOptArg, Brightness=defaultNamedOptArg, Threshold=defaultNamedOptArg + , Amount=defaultNamedOptArg, Distribution=defaultNamedOptArg, Monochromatic=defaultNamedOptArg): + 'apply the lens blur filter' + return self._oleobj_.InvokeTypes(1282294380, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17)),Source + , FocalDistance, InvertDepthMap, Shape, Radius, BladeCurvature + , Rotation, Brightness, Threshold, Amount, Distribution + , Monochromatic) + + def ApplyLensFlare(self, Brightness=defaultNamedNotOptArg, FlareCenter=defaultNamedNotOptArg, LensType=defaultNamedNotOptArg): + 'apply the lens flare filter' + return self._oleobj_.InvokeTypes(1177563955, LCID, 1, (24, 0), ((3, 1), (12, 1), (3, 1)),Brightness + , FlareCenter, LensType) + + def ApplyMaximum(self, Radius=defaultNamedNotOptArg): + 'apply the maximum filter' + return self._oleobj_.InvokeTypes(1177563703, LCID, 1, (24, 0), ((5, 1),),Radius + ) + + def ApplyMedianNoise(self, Radius=defaultNamedNotOptArg): + 'apply the median noise filter' + return self._oleobj_.InvokeTypes(1177563697, LCID, 1, (24, 0), ((5, 1),),Radius + ) + + def ApplyMinimum(self, Radius=defaultNamedNotOptArg): + 'apply the minimum filter' + return self._oleobj_.InvokeTypes(1177563704, LCID, 1, (24, 0), ((5, 1),),Radius + ) + + def ApplyMotionBlur(self, Angle=defaultNamedNotOptArg, Radius=defaultNamedNotOptArg): + 'apply the motion blur filter' + return self._oleobj_.InvokeTypes(1177563187, LCID, 1, (24, 0), ((3, 1), (5, 1)),Angle + , Radius) + + def ApplyNTSC(self): + 'apply the NTSC colors filter' + return self._oleobj_.InvokeTypes(1177563958, LCID, 1, (24, 0), (),) + + def ApplyOceanRipple(self, Size=defaultNamedNotOptArg, Magnitude=defaultNamedNotOptArg): + 'apply the ocean ripple filter' + return self._oleobj_.InvokeTypes(1177563192, LCID, 1, (24, 0), ((3, 1), (3, 1)),Size + , Magnitude) + + def ApplyOffset(self, Horizontal=defaultNamedNotOptArg, Vertical=defaultNamedNotOptArg, UndefinedAreas=defaultNamedNotOptArg): + 'apply the offset filter' + return self._oleobj_.InvokeTypes(1177563705, LCID, 1, (24, 0), ((5, 1), (5, 1), (3, 1)),Horizontal + , Vertical, UndefinedAreas) + + def ApplyPinch(self, Amount=defaultNamedNotOptArg): + 'apply the pinch filter' + return self._oleobj_.InvokeTypes(1177563193, LCID, 1, (24, 0), ((3, 1),),Amount + ) + + def ApplyPolarCoordinates(self, Conversion=defaultNamedNotOptArg): + 'apply the polar coordinates filter' + return self._oleobj_.InvokeTypes(1177563440, LCID, 1, (24, 0), ((3, 1),),Conversion + ) + + def ApplyRadialBlur(self, Amount=defaultNamedNotOptArg, BlurMethod=defaultNamedNotOptArg, BlurQuality=defaultNamedNotOptArg, BlurCenter=defaultNamedOptArg): + 'apply the radial blur filter' + return self._oleobj_.InvokeTypes(1177563188, LCID, 1, (24, 0), ((3, 1), (3, 1), (3, 1), (12, 17)),Amount + , BlurMethod, BlurQuality, BlurCenter) + + def ApplyRipple(self, Amount=defaultNamedNotOptArg, Size=defaultNamedNotOptArg): + 'apply the ripple filter' + return self._oleobj_.InvokeTypes(1177563441, LCID, 1, (24, 0), ((3, 1), (3, 1)),Amount + , Size) + + def ApplySharpen(self): + 'apply the sharpen filter' + return self._oleobj_.InvokeTypes(1177563698, LCID, 1, (24, 0), (),) + + def ApplySharpenEdges(self): + 'apply the sharpen edges filter' + return self._oleobj_.InvokeTypes(1177563699, LCID, 1, (24, 0), (),) + + def ApplySharpenMore(self): + 'apply the sharpen more filter' + return self._oleobj_.InvokeTypes(1177563700, LCID, 1, (24, 0), (),) + + def ApplyShear(self, Curve=defaultNamedNotOptArg, UndefinedAreas=defaultNamedNotOptArg): + 'apply the shear filter' + return self._oleobj_.InvokeTypes(1177563442, LCID, 1, (24, 0), ((12, 1), (3, 1)),Curve + , UndefinedAreas) + + def ApplySmartBlur(self, Radius=defaultNamedNotOptArg, Threshold=defaultNamedNotOptArg, BlurQuality=defaultNamedNotOptArg, Mode=defaultNamedNotOptArg): + 'apply the smart blur filter' + return self._oleobj_.InvokeTypes(1177563189, LCID, 1, (24, 0), ((5, 1), (5, 1), (3, 1), (3, 1)),Radius + , Threshold, BlurQuality, Mode) + + def ApplySpherize(self, Amount=defaultNamedNotOptArg, Mode=defaultNamedNotOptArg): + 'apply the spherize filter' + return self._oleobj_.InvokeTypes(1177563443, LCID, 1, (24, 0), ((3, 1), (3, 1)),Amount + , Mode) + + def ApplyStyle(self, StyleName=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1097878643, LCID, 1, (24, 0), ((8, 1),),StyleName + ) + + def ApplyTextureFill(self, TextureFile=defaultNamedNotOptArg): + 'apply the texture fill filter' + return self._oleobj_.InvokeTypes(1177563956, LCID, 1, (24, 0), ((8, 1),),TextureFile + ) + + def ApplyTwirl(self, Angle=defaultNamedNotOptArg): + 'apply the twirl filter' + return self._oleobj_.InvokeTypes(1177563444, LCID, 1, (24, 0), ((3, 1),),Angle + ) + + def ApplyUnSharpMask(self, Amount=defaultNamedNotOptArg, Radius=defaultNamedNotOptArg, Threshold=defaultNamedNotOptArg): + 'apply the unsharp mask filter' + return self._oleobj_.InvokeTypes(1177563701, LCID, 1, (24, 0), ((5, 1), (5, 1), (3, 1)),Amount + , Radius, Threshold) + + def ApplyWave(self, GeneratorNumber=defaultNamedNotOptArg, MinimumWavelength=defaultNamedNotOptArg, MaximumWavelength=defaultNamedNotOptArg, MinimumAmplitude=defaultNamedNotOptArg + , MaximumAmplitude=defaultNamedNotOptArg, HorizontalScale=defaultNamedNotOptArg, VerticalScale=defaultNamedNotOptArg, WaveType=defaultNamedNotOptArg, UndefinedAreas=defaultNamedNotOptArg + , RandomSeed=defaultNamedNotOptArg): + 'apply the wave filter' + return self._oleobj_.InvokeTypes(1177563446, LCID, 1, (24, 0), ((3, 1), (3, 1), (3, 1), (3, 1), (3, 1), (3, 1), (3, 1), (3, 1), (3, 1), (3, 1)),GeneratorNumber + , MinimumWavelength, MaximumWavelength, MinimumAmplitude, MaximumAmplitude, HorizontalScale + , VerticalScale, WaveType, UndefinedAreas, RandomSeed) + + def ApplyZigZag(self, Amount=defaultNamedNotOptArg, Ridges=defaultNamedNotOptArg, Style=defaultNamedNotOptArg): + 'apply the zigzag filter' + return self._oleobj_.InvokeTypes(1177563447, LCID, 1, (24, 0), ((3, 1), (3, 1), (3, 1)),Amount + , Ridges, Style) + + def AutoContrast(self): + 'adjust contrast of the selected channels automatically' + return self._oleobj_.InvokeTypes(1097084978, LCID, 1, (24, 0), (),) + + def AutoLevels(self): + 'adjust levels of the selected channels using auto levels option' + return self._oleobj_.InvokeTypes(1094856753, LCID, 1, (24, 0), (),) + + def Clear(self): + return self._oleobj_.InvokeTypes(1296117809, LCID, 1, (24, 0), (),) + + def Copy(self, Merge=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1668247673, LCID, 1, (24, 0), ((12, 17),),Merge + ) + + def Cut(self): + return self._oleobj_.InvokeTypes(1668641824, LCID, 1, (24, 0), (),) + + def Delete(self): + 'delete the object' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), (),) + + def Desaturate(self): + return self._oleobj_.InvokeTypes(1097084982, LCID, 1, (24, 0), (),) + + def Duplicate(self, RelativeObject=defaultNamedOptArg, InsertionLocation=defaultNamedOptArg): + 'create a duplicate of the object' + ret = self._oleobj_.InvokeTypes(1668050798, LCID, 1, (9, 0), ((12, 17), (12, 17)),RelativeObject + , InsertionLocation) + if ret is not None: + ret = Dispatch(ret, u'Duplicate', None) + return ret + + def Equalize(self): + 'equalize the levels' + return self._oleobj_.InvokeTypes(1097084985, LCID, 1, (24, 0), (),) + + def Invert(self): + 'inverts the currently selected layer or channels' + return self._oleobj_.InvokeTypes(1767272302, LCID, 1, (24, 0), (),) + + def Link(self, With=defaultNamedNotOptArg): + 'link the layer with another layer' + return self._oleobj_.InvokeTypes(1818973295, LCID, 1, (24, 0), ((9, 1),),With + ) + + # Result is of type ArtLayer + def Merge(self): + 'merges the layer down. This will remove the layer from the document. The method returns a reference to the art layer that this layer is merged into' + ret = self._oleobj_.InvokeTypes(1298615386, LCID, 1, (9, 0), (),) + if ret is not None: + ret = Dispatch(ret, u'Merge', '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}') + return ret + + def MixChannels(self, OutputChannels=defaultNamedNotOptArg, Monochrome=defaultNamedOptArg): + 'only valid for RGB or CMYK documents' + return self._oleobj_.InvokeTypes(1097084984, LCID, 1, (24, 0), ((12, 1), (12, 17)),OutputChannels + , Monochrome) + + def Move(self, RelativeObject=defaultNamedNotOptArg, InsertionLocation=defaultNamedNotOptArg): + 'move the object' + return self._oleobj_.InvokeTypes(1836021349, LCID, 1, (24, 0), ((9, 1), (3, 1)),RelativeObject + , InsertionLocation) + + def MoveAfter(self, RelativeObject=defaultNamedNotOptArg): + 'Move the PageItem in behind object' + return self._oleobj_.InvokeTypes(1299596641, LCID, 1, (24, 0), ((9, 1),),RelativeObject + ) + + def MoveBefore(self, RelativeObject=defaultNamedNotOptArg): + 'Move the PageItem in front of object' + return self._oleobj_.InvokeTypes(1299596642, LCID, 1, (24, 0), ((9, 1),),RelativeObject + ) + + def MoveToBeginning(self, Container=defaultNamedNotOptArg): + 'Move the PageItem to beginning of container' + return self._oleobj_.InvokeTypes(1299596646, LCID, 1, (24, 0), ((9, 1),),Container + ) + + def MoveToEnd(self, Container=defaultNamedNotOptArg): + 'Move the PageItem to end of container' + return self._oleobj_.InvokeTypes(1299596645, LCID, 1, (24, 0), ((9, 1),),Container + ) + + def PhotoFilter(self, FillColor=defaultNamedOptArg, Density=defaultNamedOptArg, PreserveLuminosity=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1097085234, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17)),FillColor + , Density, PreserveLuminosity) + + def Posterize(self, Levels=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1097085232, LCID, 1, (24, 0), ((3, 1),),Levels + ) + + def Rasterize(self, Target=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1383298162, LCID, 1, (24, 0), ((3, 1),),Target + ) + + def Resize(self, Horizontal=defaultNamedOptArg, Vertical=defaultNamedOptArg, Anchor=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1399024741, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17)),Horizontal + , Vertical, Anchor) + + def Rotate(self, Angle=defaultNamedNotOptArg, Anchor=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1383036001, LCID, 1, (24, 0), ((5, 1), (12, 17)),Angle + , Anchor) + + def SelectiveColor(self, SelectionMethod=defaultNamedNotOptArg, Reds=defaultNamedOptArg, Yellows=defaultNamedOptArg, Greens=defaultNamedOptArg + , Cyans=defaultNamedOptArg, Blues=defaultNamedOptArg, Magentas=defaultNamedOptArg, Whites=defaultNamedOptArg, Neutrals=defaultNamedOptArg + , Blacks=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1097084983, LCID, 1, (24, 0), ((3, 1), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17)),SelectionMethod + , Reds, Yellows, Greens, Cyans, Blues + , Magentas, Whites, Neutrals, Blacks) + + def ShadowHighlight(self, ShadowAmount=defaultNamedOptArg, ShadowWidth=defaultNamedOptArg, ShadowRaduis=defaultNamedOptArg, HighlightAmount=defaultNamedOptArg + , HighlightWidth=defaultNamedOptArg, HighlightRaduis=defaultNamedOptArg, ColorCorrection=defaultNamedOptArg, MidtoneContrast=defaultNamedOptArg, BlackClip=defaultNamedOptArg + , WhiteClip=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1397239857, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17)),ShadowAmount + , ShadowWidth, ShadowRaduis, HighlightAmount, HighlightWidth, HighlightRaduis + , ColorCorrection, MidtoneContrast, BlackClip, WhiteClip) + + def Threshold(self, Level=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1097085233, LCID, 1, (24, 0), ((3, 1),),Level + ) + + def Translate(self, DeltaX=defaultNamedOptArg, DeltaY=defaultNamedOptArg): + 'moves the position relative to its current position' + return self._oleobj_.InvokeTypes(1299599475, LCID, 1, (24, 0), ((12, 17), (12, 17)),DeltaX + , DeltaY) + + def Unlink(self): + 'unlink the layer' + return self._oleobj_.InvokeTypes(1433169515, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + "AllLocked": (1097616483, 2, (11, 0), (), "AllLocked", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + # Method 'ArtLayer' returns object of type 'ArtLayer' + "ArtLayer": (1279358028, 2, (9, 0), (), "ArtLayer", '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}'), + "BlendMode": (1114393956, 2, (3, 0), (), "BlendMode", None), + "Bounds": (1114530931, 2, (12, 0), (), "Bounds", None), + "FillOpacity": (1179611235, 2, (5, 0), (), "FillOpacity", None), + "Grouped": (1883731792, 2, (11, 0), (), "Grouped", None), + "IsBackgroundLayer": (1147292786, 2, (11, 0), (), "IsBackgroundLayer", None), + "ItemIndex": (1886603640, 2, (3, 0), (), "ItemIndex", None), + "Kind": (1265200740, 2, (3, 0), (), "Kind", None), + "Layer": (1396927603, 2, (9, 0), (), "Layer", None), + # Method 'LayerSet' returns object of type 'LayerSet' + "LayerSet": (1279358042, 2, (9, 0), (), "LayerSet", '{C1C35524-2AA4-4630-80B9-011EFE3D5779}'), + "LayerType": (1954115685, 2, (3, 0), (), "LayerType", None), + "LinkedLayers": (1282106724, 2, (12, 0), (), "LinkedLayers", None), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + "Opacity": (1332765556, 2, (5, 0), (), "Opacity", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "PixelsLocked": (1350061155, 2, (11, 0), (), "PixelsLocked", None), + "PositionLocked": (1349799011, 2, (11, 0), (), "PositionLocked", None), + # Method 'TextItem' returns object of type 'TextItem' + "TextItem": (1884058196, 2, (9, 0), (), "TextItem", '{E7A940CD-9AC7-4D76-975D-24D6BA0FDD16}'), + "TransparentPixelsLocked": (1416645731, 2, (11, 0), (), "TransparentPixelsLocked", None), + "Visible": (1884705634, 2, (11, 0), (), "Visible", None), + "id": (1229201440, 2, (3, 0), (), "id", None), + } + _prop_map_put_ = { + "AllLocked": ((1097616483, LCID, 4, 0),()), + "BlendMode": ((1114393956, LCID, 4, 0),()), + "FillOpacity": ((1179611235, LCID, 4, 0),()), + "Grouped": ((1883731792, LCID, 4, 0),()), + "IsBackgroundLayer": ((1147292786, LCID, 4, 0),()), + "Kind": ((1265200740, LCID, 4, 0),()), + "Name": ((1886282093, LCID, 4, 0),()), + "Opacity": ((1332765556, LCID, 4, 0),()), + "PixelsLocked": ((1350061155, LCID, 4, 0),()), + "PositionLocked": ((1349799011, LCID, 4, 0),()), + "TransparentPixelsLocked": ((1416645731, LCID, 4, 0),()), + "Visible": ((1884705634, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class ArtLayers(DispatchBaseClass): + CLSID = IID('{EC6A366C-F901-488D-A2C3-9E2E78B72DC6}') + coclass_clsid = None + + # Result is of type ArtLayer + def Add(self): + 'create a new object' + ret = self._oleobj_.InvokeTypes(1665354858, LCID, 1, (9, 0), (),) + if ret is not None: + ret = Dispatch(ret, u'Add', '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}') + return ret + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type ArtLayer + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}') + return ret + + def Remove(self, Item=defaultNamedNotOptArg): + 'Delete an element from the collection' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), ((9, 1),),Item + ) + + def RemoveAll(self): + return self._oleobj_.InvokeTypes(1380009324, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class Channel(DispatchBaseClass): + 'A channel in a document. Can be either a component channel representing a color of the document color model or an alpha channel' + CLSID = IID('{4B9E6B85-0613-4873-8AB7-575CD2226768}') + coclass_clsid = None + + def Delete(self): + 'delete the object' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), (),) + + # Result is of type Channel + def Duplicate(self, TargetDocument=defaultNamedOptArg): + 'duplicate the channel' + ret = self._oleobj_.InvokeTypes(1148207976, LCID, 1, (9, 0), ((12, 17),),TargetDocument + ) + if ret is not None: + ret = Dispatch(ret, u'Duplicate', '{4B9E6B85-0613-4873-8AB7-575CD2226768}') + return ret + + def Merge(self): + 'merge a spot channel into the component channels' + return self._oleobj_.InvokeTypes(1296849475, LCID, 1, (24, 0), (),) + + def SetColor(self, arg0=defaultUnnamedArg): + 'color of the channel (not valid for component channels)' + return self._oleobj_.InvokeTypes(1883456323, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + # Method 'Color' returns object of type '_SolidColor' + "Color": (1883456323, 2, (9, 0), (), "Color", '{D2D1665E-C1B9-4CA0-8AC9-529F6A3D9002}'), + "Histogram": (1214870388, 2, (12, 0), (), "Histogram", None), + "Kind": (1265200740, 2, (3, 0), (), "Kind", None), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + "Opacity": (1332765556, 2, (5, 0), (), "Opacity", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "Visible": (1884705634, 2, (11, 0), (), "Visible", None), + } + _prop_map_put_ = { + "Color": ((1883456323, LCID, 4, 0),()), + "Kind": ((1265200740, LCID, 4, 0),()), + "Name": ((1886282093, LCID, 4, 0),()), + "Opacity": ((1332765556, LCID, 4, 0),()), + "Visible": ((1884705634, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class Channels(DispatchBaseClass): + 'Channels of the document' + CLSID = IID('{2DC64F97-8C69-4016-A8EB-89A00217291F}') + coclass_clsid = None + + # Result is of type Channel + def Add(self): + 'create a new object' + ret = self._oleobj_.InvokeTypes(1665353838, LCID, 1, (9, 0), (),) + if ret is not None: + ret = Dispatch(ret, u'Add', '{4B9E6B85-0613-4873-8AB7-575CD2226768}') + return ret + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type Channel + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{4B9E6B85-0613-4873-8AB7-575CD2226768}') + return ret + + def Remove(self, Item=defaultNamedNotOptArg): + 'Delete an element from the collection' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), ((9, 1),),Item + ) + + def RemoveAll(self): + return self._oleobj_.InvokeTypes(1380009324, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{4B9E6B85-0613-4873-8AB7-575CD2226768}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{4B9E6B85-0613-4873-8AB7-575CD2226768}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class ColorSampler(DispatchBaseClass): + 'A color sampler in a document. See the color sampler tool.' + CLSID = IID('{B125A66B-4C94-4E55-AF2F-57EC4DCB484B}') + coclass_clsid = None + + def Delete(self): + 'delete the object' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), (),) + + def Move(self, Position=defaultNamedNotOptArg): + 'move the color sampler to a new location' + return self._oleobj_.InvokeTypes(1129534261, LCID, 1, (24, 0), ((12, 1),),Position + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + # Method 'Color' returns object of type '_SolidColor' + "Color": (1883456323, 2, (9, 0), (), "Color", '{D2D1665E-C1B9-4CA0-8AC9-529F6A3D9002}'), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "Position": (1332897646, 2, (12, 0), (), "Position", None), + } + _prop_map_put_ = { + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class ColorSamplers(DispatchBaseClass): + 'A collection of color samplers' + CLSID = IID('{97C81476-3F5D-4934-8CAA-1ED0242105B0}') + coclass_clsid = None + + # Result is of type ColorSampler + def Add(self, Position=defaultNamedNotOptArg): + 'a color sampler' + ret = self._oleobj_.InvokeTypes(1129534256, LCID, 1, (9, 0), ((12, 1),),Position + ) + if ret is not None: + ret = Dispatch(ret, u'Add', '{B125A66B-4C94-4E55-AF2F-57EC4DCB484B}') + return ret + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type ColorSampler + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{B125A66B-4C94-4E55-AF2F-57EC4DCB484B}') + return ret + + def RemoveAll(self): + return self._oleobj_.InvokeTypes(1380009324, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{B125A66B-4C94-4E55-AF2F-57EC4DCB484B}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{B125A66B-4C94-4E55-AF2F-57EC4DCB484B}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class CountItem(DispatchBaseClass): + 'A counted item in a document. See the counting tool.' + CLSID = IID('{66869370-9672-492D-93AC-0ADD62F427F1}') + coclass_clsid = None + + def Delete(self): + 'delete the object' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "Position": (1332897646, 2, (12, 0), (), "Position", None), + } + _prop_map_put_ = { + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class CountItems(DispatchBaseClass): + 'A collection of count items' + CLSID = IID('{9E01C1DA-DF69-4C2C-85EC-616370DF1CF0}') + coclass_clsid = None + + # Result is of type CountItem + def Add(self, Position=defaultNamedNotOptArg): + 'a count item' + ret = self._oleobj_.InvokeTypes(1129590835, LCID, 1, (9, 0), ((12, 1),),Position + ) + if ret is not None: + ret = Dispatch(ret, u'Add', '{66869370-9672-492D-93AC-0ADD62F427F1}') + return ret + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type CountItem + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{66869370-9672-492D-93AC-0ADD62F427F1}') + return ret + + def RemoveAll(self): + return self._oleobj_.InvokeTypes(1380009324, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{66869370-9672-492D-93AC-0ADD62F427F1}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{66869370-9672-492D-93AC-0ADD62F427F1}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class Document(DispatchBaseClass): + 'A document' + CLSID = IID('{B1ADEFB6-C536-42D6-8A83-397354A769F8}') + coclass_clsid = None + + def AutoCount(self, Channel=defaultNamedNotOptArg, Threshold=defaultNamedNotOptArg): + 'automatically counts the objects in an image' + return self._oleobj_.InvokeTypes(1129590837, LCID, 1, (24, 0), ((9, 1), (3, 1)),Channel + , Threshold) + + def ChangeMode(self, DestinationMode=defaultNamedNotOptArg, Options=defaultNamedOptArg): + 'change the mode of the document' + return self._oleobj_.InvokeTypes(1130906483, LCID, 1, (24, 0), ((3, 1), (12, 17)),DestinationMode + , Options) + + def Close(self, Saving=defaultNamedOptArg): + 'close the document' + return self._oleobj_.InvokeTypes(1668050803, LCID, 1, (24, 0), ((12, 17),),Saving + ) + + def ConvertProfile(self, DestinationProfile=defaultNamedNotOptArg, Intent=defaultNamedNotOptArg, BlackPointCompensation=defaultNamedOptArg, Dither=defaultNamedOptArg): + 'convert the document from using one color profile to using an other' + return self._oleobj_.InvokeTypes(1131827314, LCID, 1, (24, 0), ((8, 1), (3, 1), (12, 17), (12, 17)),DestinationProfile + , Intent, BlackPointCompensation, Dither) + + def Crop(self, Bounds=defaultNamedNotOptArg, Angle=defaultNamedOptArg, Width=defaultNamedOptArg, Height=defaultNamedOptArg): + 'crop the document' + return self._oleobj_.InvokeTypes(1131573104, LCID, 1, (24, 0), ((12, 1), (12, 17), (12, 17), (12, 17)),Bounds + , Angle, Width, Height) + + # Result is of type Document + def Duplicate(self, Name=defaultNamedOptArg, MergeLayersOnly=defaultNamedOptArg): + 'duplicate this document with parameters' + ret = self._oleobj_.InvokeTypes(1684235381, LCID, 1, (9, 0), ((12, 17), (12, 17)),Name + , MergeLayersOnly) + if ret is not None: + ret = Dispatch(ret, u'Duplicate', '{B1ADEFB6-C536-42D6-8A83-397354A769F8}') + return ret + + def Export(self, ExportIn=defaultNamedNotOptArg, ExportAs=defaultNamedOptArg, Options=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1165521010, LCID, 1, (24, 0), ((8, 1), (12, 17), (12, 17)),ExportIn + , ExportAs, Options) + + def Flatten(self): + 'Flattens all visible layers in the document.' + return self._oleobj_.InvokeTypes(1181512814, LCID, 1, (24, 0), (),) + + def FlipCanvas(self, Direction=defaultNamedNotOptArg): + 'flip the canvas horizontally or vertically' + return self._oleobj_.InvokeTypes(1181500278, LCID, 1, (24, 0), ((3, 1),),Direction + ) + + def ImportAnnotations(self, File=defaultNamedNotOptArg): + 'import annotations into the document' + return self._oleobj_.InvokeTypes(1232093550, LCID, 1, (24, 0), ((8, 1),),File + ) + + def MergeVisibleLayers(self): + 'flatten all visible layers in the document' + return self._oleobj_.InvokeTypes(1299608418, LCID, 1, (24, 0), (),) + + # Result is of type ArtLayer + def Paste(self, IntoSelection=defaultNamedOptArg): + 'paste contents of clipboard into the document' + ret = self._oleobj_.InvokeTypes(1885434740, LCID, 1, (9, 0), ((12, 17),),IntoSelection + ) + if ret is not None: + ret = Dispatch(ret, u'Paste', '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}') + return ret + + def PrintOut(self, SourceSpace=defaultNamedOptArg, PrintSpace=defaultNamedOptArg, Intent=defaultNamedOptArg, BlackPointCompensation=defaultNamedOptArg): + 'print the document' + return self._oleobj_.InvokeTypes(1349731152, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17), (12, 17)),SourceSpace + , PrintSpace, Intent, BlackPointCompensation) + + def RasterizeAllLayers(self): + 'rasterize all layers' + return self._oleobj_.InvokeTypes(1383743852, LCID, 1, (24, 0), (),) + + def RecordMeasurements(self, Source=defaultNamedOptArg, DataPoints=defaultNamedOptArg): + 'record measurements of document' + return self._oleobj_.InvokeTypes(1296379956, LCID, 1, (24, 0), ((12, 17), (12, 17)),Source + , DataPoints) + + def ResizeCanvas(self, Width=defaultNamedOptArg, Height=defaultNamedOptArg, Anchor=defaultNamedOptArg): + 'change the size of the canvas' + return self._oleobj_.InvokeTypes(1383744374, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17)),Width + , Height, Anchor) + + def ResizeImage(self, Width=defaultNamedOptArg, Height=defaultNamedOptArg, Resolution=defaultNamedOptArg, ResampleMethod=defaultNamedOptArg + , Amount=defaultNamedOptArg): + 'change the size of the image' + return self._oleobj_.InvokeTypes(1383745901, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17), (12, 17), (12, 17)),Width + , Height, Resolution, ResampleMethod, Amount) + + def RevealAll(self): + 'expand document to show clipped sections' + return self._oleobj_.InvokeTypes(1383481708, LCID, 1, (24, 0), (),) + + def RotateCanvas(self, Angle=defaultNamedNotOptArg): + 'rotate canvas of document' + return self._oleobj_.InvokeTypes(1383351158, LCID, 1, (24, 0), ((5, 1),),Angle + ) + + def Save(self): + 'save the document' + return self._oleobj_.InvokeTypes(1346589558, LCID, 1, (24, 0), (),) + + def SaveAs(self, SaveIn=defaultNamedNotOptArg, Options=defaultNamedOptArg, AsCopy=defaultNamedOptArg, ExtensionType=defaultNamedOptArg): + 'save the document with specific save options' + return self._oleobj_.InvokeTypes(1400258931, LCID, 1, (24, 0), ((8, 1), (12, 17), (12, 17), (12, 17)),SaveIn + , Options, AsCopy, ExtensionType) + + def SplitChannels(self): + 'split channels of the document' + return self._ApplyTypes_(1399866216, 1, (12, 0), (), u'SplitChannels', None,) + + def Trap(self, Width=defaultNamedNotOptArg): + 'apply trap to a CMYK document' + return self._oleobj_.InvokeTypes(1416782192, LCID, 1, (24, 0), ((3, 1),),Width + ) + + def Trim(self, Type=defaultNamedOptArg, Top=defaultNamedOptArg, Left=defaultNamedOptArg, Bottom=defaultNamedOptArg + , Right=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1416784237, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17), (12, 17), (12, 17)),Type + , Top, Left, Bottom, Right) + + _prop_map_get_ = { + "ActiveChannels": (1145269868, 2, (12, 0), (), "ActiveChannels", None), + # Method 'ActiveHistoryBrushSource' returns object of type 'HistoryState' + "ActiveHistoryBrushSource": (1145266802, 2, (9, 0), (), "ActiveHistoryBrushSource", '{EDC373C3-FE30-40BA-A31C-0251CA7456F1}'), + # Method 'ActiveHistoryState' returns object of type 'HistoryState' + "ActiveHistoryState": (1145268339, 2, (9, 0), (), "ActiveHistoryState", '{EDC373C3-FE30-40BA-A31C-0251CA7456F1}'), + "ActiveLayer": (1668435058, 2, (9, 0), (), "ActiveLayer", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + # Method 'ArtLayers' returns object of type 'ArtLayers' + "ArtLayers": (1665354866, 2, (9, 0), (), "ArtLayers", '{EC6A366C-F901-488D-A2C3-9E2E78B72DC6}'), + # Method 'BackgroundLayer' returns object of type 'ArtLayer' + "BackgroundLayer": (1147292786, 2, (9, 0), (), "BackgroundLayer", '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}'), + "BitsPerChannel": (1145201512, 2, (3, 0), (), "BitsPerChannel", None), + # Method 'Channels' returns object of type 'Channels' + "Channels": (1665353838, 2, (9, 0), (), "Channels", '{2DC64F97-8C69-4016-A8EB-89A00217291F}'), + "ColorProfileName": (1147367502, 2, (8, 0), (), "ColorProfileName", None), + "ColorProfileType": (1147367508, 2, (3, 0), (), "ColorProfileType", None), + # Method 'ColorSamplers' returns object of type 'ColorSamplers' + "ColorSamplers": (1129534256, 2, (9, 0), (), "ColorSamplers", '{97C81476-3F5D-4934-8CAA-1ED0242105B0}'), + "ComponentChannels": (1128493171, 2, (12, 0), (), "ComponentChannels", None), + # Method 'CountItems' returns object of type 'CountItems' + "CountItems": (1129590835, 2, (9, 0), (), "CountItems", '{9E01C1DA-DF69-4C2C-85EC-616370DF1CF0}'), + "FullName": (1148220520, 2, (8, 0), (), "FullName", None), + "Height": (1214736500, 2, (5, 0), (), "Height", None), + "Histogram": (1214870388, 2, (12, 0), (), "Histogram", None), + # Method 'HistoryStates' returns object of type 'HistoryStates' + "HistoryStates": (1665692532, 2, (9, 0), (), "HistoryStates", '{69172A3F-E06E-42E6-B733-4DC36E2AC948}'), + # Method 'Info' returns object of type 'DocumentInfo' + "Info": (1147760230, 2, (9, 0), (), "Info", '{746FEF90-A182-4BD0-A4F6-BB6BBAE87A78}'), + # Method 'LayerComps' returns object of type 'LayerComps' + "LayerComps": (1279471665, 2, (9, 0), (), "LayerComps", '{726B458C-74B0-47AE-B390-99753B55DF2E}'), + # Method 'LayerSets' returns object of type 'LayerSets' + "LayerSets": (1665948276, 2, (9, 0), (), "LayerSets", '{323DD2BC-0205-4A44-9F8E-0CF2556F00DF}'), + # Method 'Layers' returns object of type 'Layers' + "Layers": (1665956210, 2, (9, 0), (), "Layers", '{DDA16C46-15B2-472D-A659-41AA7BFDC4FD}'), + "Managed": (1682794340, 2, (11, 0), (), "Managed", None), + # Method 'MeasurementScale' returns object of type 'MeasurementScale' + "MeasurementScale": (1666012003, 2, (9, 0), (), "MeasurementScale", '{632F36B3-1D76-48BE-ADC3-D7FB62A0C2FB}'), + "Mode": (1330472037, 2, (3, 0), (), "Mode", None), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "Path": (1146123368, 2, (8, 0), (), "Path", None), + # Method 'PathItems' returns object of type 'PathItems' + "PathItems": (1347694643, 2, (9, 0), (), "PathItems", '{91B5F8AE-3CC5-4775-BCD3-FF1E0724BB01}'), + "PixelAspectRatio": (1147744822, 2, (5, 0), (), "PixelAspectRatio", None), + "QuickMaskMode": (1364020580, 2, (11, 0), (), "QuickMaskMode", None), + "Resolution": (1382380364, 2, (5, 0), (), "Resolution", None), + "Saved": (1146320484, 2, (11, 0), (), "Saved", None), + # Method 'Selection' returns object of type 'Selection' + "Selection": (1936026725, 2, (9, 0), (), "Selection", '{09DA6B10-9684-44EE-A575-01F54660BDDC}'), + "Width": (1466201192, 2, (5, 0), (), "Width", None), + # Method 'XMPMetadata' returns object of type 'XMPMetadata' + "XMPMetadata": (1666731364, 2, (9, 0), (), "XMPMetadata", '{DC865034-A587-4CC4-8A5A-453032562BE4}'), + "id": (1229201440, 2, (3, 0), (), "id", None), + } + _prop_map_put_ = { + "ActiveChannels": ((1145269868, LCID, 4, 0),()), + "ActiveHistoryBrushSource": ((1145266802, LCID, 4, 0),()), + "ActiveHistoryState": ((1145268339, LCID, 4, 0),()), + "ActiveLayer": ((1668435058, LCID, 4, 0),()), + "BitsPerChannel": ((1145201512, LCID, 4, 0),()), + "ColorProfileName": ((1147367502, LCID, 4, 0),()), + "ColorProfileType": ((1147367508, LCID, 4, 0),()), + "PixelAspectRatio": ((1147744822, LCID, 4, 0),()), + "QuickMaskMode": ((1364020580, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class DocumentInfo(DispatchBaseClass): + 'Document information' + CLSID = IID('{746FEF90-A182-4BD0-A4F6-BB6BBAE87A78}') + coclass_clsid = None + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Author": (1147744817, 2, (8, 0), (), "Author", None), + "AuthorPosition": (1147744819, 2, (8, 0), (), "AuthorPosition", None), + "Caption": (1147744305, 2, (8, 0), (), "Caption", None), + "CaptionWriter": (1147744306, 2, (8, 0), (), "CaptionWriter", None), + "Category": (1147744310, 2, (8, 0), (), "Category", None), + "City": (1147744565, 2, (8, 0), (), "City", None), + "CopyrightNotice": (1147744816, 2, (8, 0), (), "CopyrightNotice", None), + "Copyrighted": (1147744569, 2, (3, 0), (), "Copyrighted", None), + "Country": (1147744567, 2, (8, 0), (), "Country", None), + "CreationDate": (1147744564, 2, (8, 0), (), "CreationDate", None), + "Credit": (1147744561, 2, (8, 0), (), "Credit", None), + "EXIF": (1147744821, 2, (12, 0), (), "EXIF", None), + "Headline": (1147744307, 2, (8, 0), (), "Headline", None), + "Instructions": (1147744308, 2, (8, 0), (), "Instructions", None), + "JobName": (1147744820, 2, (8, 0), (), "JobName", None), + "Keywords": (1147744309, 2, (12, 0), (), "Keywords", None), + "OwnerUrl": (1884648044, 2, (8, 0), (), "OwnerUrl", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "ProvinceState": (1147744566, 2, (8, 0), (), "ProvinceState", None), + "Source": (1147744562, 2, (8, 0), (), "Source", None), + "SupplementalCategories": (1147744311, 2, (12, 0), (), "SupplementalCategories", None), + "Title": (1147744818, 2, (8, 0), (), "Title", None), + "TransmissionReference": (1147744568, 2, (8, 0), (), "TransmissionReference", None), + "Urgency": (1147744312, 2, (3, 0), (), "Urgency", None), + } + _prop_map_put_ = { + "Author": ((1147744817, LCID, 4, 0),()), + "AuthorPosition": ((1147744819, LCID, 4, 0),()), + "Caption": ((1147744305, LCID, 4, 0),()), + "CaptionWriter": ((1147744306, LCID, 4, 0),()), + "Category": ((1147744310, LCID, 4, 0),()), + "City": ((1147744565, LCID, 4, 0),()), + "CopyrightNotice": ((1147744816, LCID, 4, 0),()), + "Copyrighted": ((1147744569, LCID, 4, 0),()), + "Country": ((1147744567, LCID, 4, 0),()), + "CreationDate": ((1147744564, LCID, 4, 0),()), + "Credit": ((1147744561, LCID, 4, 0),()), + "Headline": ((1147744307, LCID, 4, 0),()), + "Instructions": ((1147744308, LCID, 4, 0),()), + "JobName": ((1147744820, LCID, 4, 0),()), + "Keywords": ((1147744309, LCID, 4, 0),()), + "OwnerUrl": ((1884648044, LCID, 4, 0),()), + "ProvinceState": ((1147744566, LCID, 4, 0),()), + "Source": ((1147744562, LCID, 4, 0),()), + "SupplementalCategories": ((1147744311, LCID, 4, 0),()), + "Title": ((1147744818, LCID, 4, 0),()), + "TransmissionReference": ((1147744568, LCID, 4, 0),()), + "Urgency": ((1147744312, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class Documents(DispatchBaseClass): + 'A collection of documents' + CLSID = IID('{662506C7-6AAE-4422-ACA4-C63627CB1868}') + coclass_clsid = None + + # Result is of type Document + def Add(self, Width=defaultNamedOptArg, Height=defaultNamedOptArg, Resolution=defaultNamedOptArg, Name=defaultNamedOptArg + , Mode=defaultNamedOptArg, InitialFill=defaultNamedOptArg, PixelAspectRatio=defaultNamedOptArg, BitsPerChannel=defaultNamedOptArg, ColorProfileName=defaultNamedOptArg): + 'a document' + ret = self._oleobj_.InvokeTypes(1685021557, LCID, 1, (9, 0), ((12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17)),Width + , Height, Resolution, Name, Mode, InitialFill + , PixelAspectRatio, BitsPerChannel, ColorProfileName) + if ret is not None: + ret = Dispatch(ret, u'Add', '{B1ADEFB6-C536-42D6-8A83-397354A769F8}') + return ret + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type Document + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{B1ADEFB6-C536-42D6-8A83-397354A769F8}') + return ret + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{B1ADEFB6-C536-42D6-8A83-397354A769F8}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{B1ADEFB6-C536-42D6-8A83-397354A769F8}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class HistoryState(DispatchBaseClass): + 'A history state for the document' + CLSID = IID('{EDC373C3-FE30-40BA-A31C-0251CA7456F1}') + coclass_clsid = None + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "Snapshot": (1213425780, 2, (11, 0), (), "Snapshot", None), + } + _prop_map_put_ = { + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class HistoryStates(DispatchBaseClass): + 'History states associated with the document' + CLSID = IID('{69172A3F-E06E-42E6-B733-4DC36E2AC948}') + coclass_clsid = None + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type HistoryState + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{EDC373C3-FE30-40BA-A31C-0251CA7456F1}') + return ret + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{EDC373C3-FE30-40BA-A31C-0251CA7456F1}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{EDC373C3-FE30-40BA-A31C-0251CA7456F1}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class LayerComp(DispatchBaseClass): + 'A layer composition in a document' + CLSID = IID('{9A37A0AC-E951-4B16-A548-886B77338DE0}') + coclass_clsid = None + + def Apply(self): + 'apply the layer comp to the document' + return self._oleobj_.InvokeTypes(1346842673, LCID, 1, (24, 0), (),) + + def Delete(self): + 'delete the object' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), (),) + + def Recapture(self): + 'recapture the current layer state(s) for this layer comp' + return self._oleobj_.InvokeTypes(1346842674, LCID, 1, (24, 0), (),) + + def ResetFromComp(self): + 'reset the layer comp state to the document state' + return self._oleobj_.InvokeTypes(1346844210, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + "Appearance": (1279471667, 2, (11, 0), (), "Appearance", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "ChildLayerCompState": (1279471671, 2, (11, 0), (), "ChildLayerCompState", None), + "Comment": (1279471666, 2, (12, 0), (), "Comment", None), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "Position": (1332897646, 2, (11, 0), (), "Position", None), + "Selected": (1279471670, 2, (11, 0), (), "Selected", None), + "Visibility": (1279471669, 2, (11, 0), (), "Visibility", None), + } + _prop_map_put_ = { + "Appearance": ((1279471667, LCID, 4, 0),()), + "ChildLayerCompState": ((1279471671, LCID, 4, 0),()), + "Comment": ((1279471666, LCID, 4, 0),()), + "Name": ((1886282093, LCID, 4, 0),()), + "Position": ((1332897646, LCID, 4, 0),()), + "Visibility": ((1279471669, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class LayerComps(DispatchBaseClass): + 'Layer compositions associated with the document' + CLSID = IID('{726B458C-74B0-47AE-B390-99753B55DF2E}') + coclass_clsid = None + + # Result is of type LayerComp + def Add(self, Name=defaultNamedNotOptArg, Comment=defaultNamedOptArg, Appearance=defaultNamedOptArg, Position=defaultNamedOptArg + , Visibility=defaultNamedOptArg, ChildLayerCompState=defaultNamedOptArg): + 'a layer comp' + ret = self._oleobj_.InvokeTypes(1279471665, LCID, 1, (9, 0), ((8, 1), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17)),Name + , Comment, Appearance, Position, Visibility, ChildLayerCompState + ) + if ret is not None: + ret = Dispatch(ret, u'Add', '{9A37A0AC-E951-4B16-A548-886B77338DE0}') + return ret + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type LayerComp + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{9A37A0AC-E951-4B16-A548-886B77338DE0}') + return ret + + def RemoveAll(self): + return self._oleobj_.InvokeTypes(1380009324, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{9A37A0AC-E951-4B16-A548-886B77338DE0}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{9A37A0AC-E951-4B16-A548-886B77338DE0}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class LayerSet(DispatchBaseClass): + 'Layer set' + CLSID = IID('{C1C35524-2AA4-4630-80B9-011EFE3D5779}') + coclass_clsid = None + + def Delete(self): + 'delete the object' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), (),) + + def Duplicate(self, RelativeObject=defaultNamedOptArg, InsertionLocation=defaultNamedOptArg): + 'create a duplicate of the object' + ret = self._oleobj_.InvokeTypes(1668050798, LCID, 1, (9, 0), ((12, 17), (12, 17)),RelativeObject + , InsertionLocation) + if ret is not None: + ret = Dispatch(ret, u'Duplicate', None) + return ret + + def Link(self, With=defaultNamedNotOptArg): + 'link the layer with another layer' + return self._oleobj_.InvokeTypes(1818973295, LCID, 1, (24, 0), ((9, 1),),With + ) + + # Result is of type ArtLayer + def Merge(self): + 'merge layerset. Returns a reference to the art layer that is created by this method' + ret = self._oleobj_.InvokeTypes(1298615386, LCID, 1, (9, 0), (),) + if ret is not None: + ret = Dispatch(ret, u'Merge', '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}') + return ret + + def Move(self, RelativeObject=defaultNamedNotOptArg, InsertionLocation=defaultNamedNotOptArg): + 'move the object' + return self._oleobj_.InvokeTypes(1836021349, LCID, 1, (24, 0), ((9, 1), (3, 1)),RelativeObject + , InsertionLocation) + + def MoveAfter(self, RelativeObject=defaultNamedNotOptArg): + 'Move the PageItem in behind object' + return self._oleobj_.InvokeTypes(1299596641, LCID, 1, (24, 0), ((9, 1),),RelativeObject + ) + + def MoveBefore(self, RelativeObject=defaultNamedNotOptArg): + 'Move the PageItem in front of object' + return self._oleobj_.InvokeTypes(1299596642, LCID, 1, (24, 0), ((9, 1),),RelativeObject + ) + + def MoveToBeginning(self, Container=defaultNamedNotOptArg): + 'Move the PageItem to beginning of container' + return self._oleobj_.InvokeTypes(1299596646, LCID, 1, (24, 0), ((9, 1),),Container + ) + + def MoveToEnd(self, Container=defaultNamedNotOptArg): + 'Move the PageItem to end of container' + return self._oleobj_.InvokeTypes(1299596645, LCID, 1, (24, 0), ((9, 1),),Container + ) + + def Resize(self, Horizontal=defaultNamedOptArg, Vertical=defaultNamedOptArg, Anchor=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1399024741, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17)),Horizontal + , Vertical, Anchor) + + def Rotate(self, Angle=defaultNamedNotOptArg, Anchor=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1383036001, LCID, 1, (24, 0), ((5, 1), (12, 17)),Angle + , Anchor) + + def Translate(self, DeltaX=defaultNamedOptArg, DeltaY=defaultNamedOptArg): + 'moves the position relative to its current position' + return self._oleobj_.InvokeTypes(1299599475, LCID, 1, (24, 0), ((12, 17), (12, 17)),DeltaX + , DeltaY) + + def Unlink(self): + 'unlink the layer' + return self._oleobj_.InvokeTypes(1433169515, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + "AllLocked": (1097616483, 2, (11, 0), (), "AllLocked", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + # Method 'ArtLayer' returns object of type 'ArtLayer' + "ArtLayer": (1279358028, 2, (9, 0), (), "ArtLayer", '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}'), + # Method 'ArtLayers' returns object of type 'ArtLayers' + "ArtLayers": (1665354866, 2, (9, 0), (), "ArtLayers", '{EC6A366C-F901-488D-A2C3-9E2E78B72DC6}'), + "BlendMode": (1114393956, 2, (3, 0), (), "BlendMode", None), + "Bounds": (1114530931, 2, (12, 0), (), "Bounds", None), + "EnabledChannels": (1164854120, 2, (12, 0), (), "EnabledChannels", None), + "ItemIndex": (1886603640, 2, (3, 0), (), "ItemIndex", None), + "Layer": (1396927603, 2, (9, 0), (), "Layer", None), + # Method 'LayerSet' returns object of type 'LayerSet' + "LayerSet": (1279358042, 2, (9, 0), (), "LayerSet", '{C1C35524-2AA4-4630-80B9-011EFE3D5779}'), + # Method 'LayerSets' returns object of type 'LayerSets' + "LayerSets": (1665948276, 2, (9, 0), (), "LayerSets", '{323DD2BC-0205-4A44-9F8E-0CF2556F00DF}'), + "LayerType": (1954115685, 2, (3, 0), (), "LayerType", None), + # Method 'Layers' returns object of type 'Layers' + "Layers": (1665956210, 2, (9, 0), (), "Layers", '{DDA16C46-15B2-472D-A659-41AA7BFDC4FD}'), + "LinkedLayers": (1282106724, 2, (12, 0), (), "LinkedLayers", None), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + "Opacity": (1332765556, 2, (5, 0), (), "Opacity", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "Visible": (1884705634, 2, (11, 0), (), "Visible", None), + "id": (1229201440, 2, (3, 0), (), "id", None), + } + _prop_map_put_ = { + "AllLocked": ((1097616483, LCID, 4, 0),()), + "BlendMode": ((1114393956, LCID, 4, 0),()), + "EnabledChannels": ((1164854120, LCID, 4, 0),()), + "Name": ((1886282093, LCID, 4, 0),()), + "Opacity": ((1332765556, LCID, 4, 0),()), + "Visible": ((1884705634, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class LayerSets(DispatchBaseClass): + CLSID = IID('{323DD2BC-0205-4A44-9F8E-0CF2556F00DF}') + coclass_clsid = None + + # Result is of type LayerSet + def Add(self): + 'create a new object' + ret = self._oleobj_.InvokeTypes(1665948266, LCID, 1, (9, 0), (),) + if ret is not None: + ret = Dispatch(ret, u'Add', '{C1C35524-2AA4-4630-80B9-011EFE3D5779}') + return ret + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type LayerSet + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{C1C35524-2AA4-4630-80B9-011EFE3D5779}') + return ret + + def Remove(self, Item=defaultNamedNotOptArg): + 'Delete an element from the collection' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), ((9, 1),),Item + ) + + def RemoveAll(self): + return self._oleobj_.InvokeTypes(1380009324, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{C1C35524-2AA4-4630-80B9-011EFE3D5779}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{C1C35524-2AA4-4630-80B9-011EFE3D5779}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class Layers(DispatchBaseClass): + CLSID = IID('{DDA16C46-15B2-472D-A659-41AA7BFDC4FD}') + coclass_clsid = None + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', None) + return ret + + def Remove(self, Item=defaultNamedNotOptArg): + 'Delete an element from the collection' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), ((9, 1),),Item + ) + + def RemoveAll(self): + return self._oleobj_.InvokeTypes(1380009324, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', None) + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class MeasurementLog(DispatchBaseClass): + 'the log of measurements taken' + CLSID = IID('{84ADBF06-8354-4B5C-9CB1-EA2565B66C7C}') + coclass_clsid = None + + def DeleteMeasurements(self, Range=defaultNamedOptArg): + 'delete measurements' + return self._oleobj_.InvokeTypes(1296838710, LCID, 1, (24, 0), ((12, 17),),Range + ) + + def ExportMeasurements(self, File=defaultNamedNotOptArg, Range=defaultNamedOptArg, DataPoints=defaultNamedOptArg): + 'export measurements' + return self._oleobj_.InvokeTypes(1296838709, LCID, 1, (24, 0), ((8, 1), (12, 17), (12, 17)),File + , Range, DataPoints) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class MeasurementScale(DispatchBaseClass): + 'Document Measurement Scale' + CLSID = IID('{632F36B3-1D76-48BE-ADC3-D7FB62A0C2FB}') + coclass_clsid = None + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "LogicalLength": (1836280940, 2, (5, 0), (), "LogicalLength", None), + "LogicalUnits": (1836280949, 2, (8, 0), (), "LogicalUnits", None), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "PixelLength": (1836281964, 2, (3, 0), (), "PixelLength", None), + } + _prop_map_put_ = { + "LogicalLength": ((1836280940, LCID, 4, 0),()), + "LogicalUnits": ((1836280949, LCID, 4, 0),()), + "Name": ((1886282093, LCID, 4, 0),()), + "PixelLength": ((1836281964, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class Notifier(DispatchBaseClass): + 'The parameters of the notifie' + CLSID = IID('{8B4F1F1E-4ED7-4291-AE61-76ADF4D1D50B}') + coclass_clsid = None + + def Delete(self): + 'delete the object' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Event": (1162752052, 2, (8, 0), (), "Event", None), + "EventClass": (1162752055, 2, (8, 0), (), "EventClass", None), + "EventFile": (1162752053, 2, (8, 0), (), "EventFile", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class Notifiers(DispatchBaseClass): + 'A collection of notifiers' + CLSID = IID('{861C9290-2A0C-4614-8606-706B31BFD45B}') + coclass_clsid = None + + # Result is of type Notifier + def Add(self, Event=defaultNamedNotOptArg, EventFile=defaultNamedNotOptArg, EventClass=defaultNamedOptArg): + 'a notifier' + ret = self._oleobj_.InvokeTypes(1162752050, LCID, 1, (9, 0), ((8, 1), (8, 1), (12, 17)),Event + , EventFile, EventClass) + if ret is not None: + ret = Dispatch(ret, u'Add', '{8B4F1F1E-4ED7-4291-AE61-76ADF4D1D50B}') + return ret + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type Notifier + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{8B4F1F1E-4ED7-4291-AE61-76ADF4D1D50B}') + return ret + + def RemoveAll(self): + return self._oleobj_.InvokeTypes(1380009324, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{8B4F1F1E-4ED7-4291-AE61-76ADF4D1D50B}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{8B4F1F1E-4ED7-4291-AE61-76ADF4D1D50B}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class PathItem(DispatchBaseClass): + 'An artwork path item' + CLSID = IID('{8B0CB532-4ACC-4BF3-9E42-0949B679D120}') + coclass_clsid = None + + def Delete(self): + 'delete the object' + return self._oleobj_.InvokeTypes(1684368495, LCID, 1, (24, 0), (),) + + def Deselect(self): + 'unselect this path item, no paths items are selected' + return self._oleobj_.InvokeTypes(1148415092, LCID, 1, (24, 0), (),) + + # Result is of type PathItem + def Duplicate(self, Name=defaultNamedOptArg): + 'duplicate this path' + ret = self._oleobj_.InvokeTypes(1668050798, LCID, 1, (9, 0), ((12, 17),),Name + ) + if ret is not None: + ret = Dispatch(ret, u'Duplicate', '{8B0CB532-4ACC-4BF3-9E42-0949B679D120}') + return ret + + def FillPath(self, FillColor=defaultNamedOptArg, Mode=defaultNamedOptArg, Opacity=defaultNamedOptArg, PreserveTransparency=defaultNamedOptArg + , Feather=defaultNamedOptArg, AntiAlias=defaultNamedOptArg, WholePath=defaultNamedOptArg): + 'fill the path with the following information' + return self._oleobj_.InvokeTypes(1347694900, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17), (12, 17)),FillColor + , Mode, Opacity, PreserveTransparency, Feather, AntiAlias + , WholePath) + + def MakeClippingPath(self, Flatness=defaultNamedOptArg): + 'make this path item the clipping path for this document' + return self._oleobj_.InvokeTypes(1347694903, LCID, 1, (24, 0), ((12, 17),),Flatness + ) + + def MakeSelection(self, Feather=defaultNamedOptArg, AntiAlias=defaultNamedOptArg, Operation=defaultNamedOptArg): + 'make a selection from this path' + return self._oleobj_.InvokeTypes(1347694899, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17)),Feather + , AntiAlias, Operation) + + def Select(self): + 'make this path item the active or selected path item' + return self._oleobj_.InvokeTypes(1936483188, LCID, 1, (24, 0), (),) + + def StrokePath(self, Tool=defaultNamedOptArg, SimulatePressure=defaultNamedOptArg): + 'stroke the path with the following information' + return self._oleobj_.InvokeTypes(1347694901, LCID, 1, (24, 0), ((12, 17), (12, 17)),Tool + , SimulatePressure) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Kind": (1265200740, 2, (3, 0), (), "Kind", None), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + # Method 'SubPathItems' returns object of type 'SubPathItems' + "SubPathItems": (1347695667, 2, (9, 0), (), "SubPathItems", '{B7283EEC-23B1-49A6-B151-0E97E4AF353C}'), + } + _prop_map_put_ = { + "Kind": ((1265200740, LCID, 4, 0),()), + "Name": ((1886282093, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class PathItems(DispatchBaseClass): + 'art paths associated with this document' + CLSID = IID('{91B5F8AE-3CC5-4775-BCD3-FF1E0724BB01}') + coclass_clsid = None + + # Result is of type PathItem + def Add(self, Name=defaultNamedNotOptArg, EntirePath=defaultNamedNotOptArg): + 'create a new path item' + ret = self._oleobj_.InvokeTypes(1347694643, LCID, 1, (9, 0), ((8, 1), (12, 1)),Name + , EntirePath) + if ret is not None: + ret = Dispatch(ret, u'Add', '{8B0CB532-4ACC-4BF3-9E42-0949B679D120}') + return ret + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type PathItem + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{8B0CB532-4ACC-4BF3-9E42-0949B679D120}') + return ret + + def RemoveAll(self): + return self._oleobj_.InvokeTypes(1380009324, LCID, 1, (24, 0), (),) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{8B0CB532-4ACC-4BF3-9E42-0949B679D120}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{8B0CB532-4ACC-4BF3-9E42-0949B679D120}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class PathPoint(DispatchBaseClass): + 'A point on a path' + CLSID = IID('{7D14BA29-1672-482F-8F48-9DA1E94800FD}') + coclass_clsid = None + + _prop_map_get_ = { + "Anchor": (1347694904, 2, (12, 0), (), "Anchor", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Kind": (1265200740, 2, (3, 0), (), "Kind", None), + "LeftDirection": (1347694905, 2, (12, 0), (), "LeftDirection", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "RightDirection": (1347695152, 2, (12, 0), (), "RightDirection", None), + } + _prop_map_put_ = { + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class PathPoints(DispatchBaseClass): + 'A collection of path points' + CLSID = IID('{8214A53C-0E67-49D4-A65A-D56F07B17D37}') + coclass_clsid = None + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type PathPoint + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{7D14BA29-1672-482F-8F48-9DA1E94800FD}') + return ret + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{7D14BA29-1672-482F-8F48-9DA1E94800FD}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{7D14BA29-1672-482F-8F48-9DA1E94800FD}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class Preferences(DispatchBaseClass): + 'Preferences for Photoshop' + CLSID = IID('{288BC58E-AB6A-467C-B244-D225349E3EB3}') + coclass_clsid = None + + _prop_map_get_ = { + "AdditionalPluginFolder": (1349661493, 2, (8, 0), (), "AdditionalPluginFolder", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "AskBeforeSavingLayeredTIFF": (1349660980, 2, (11, 0), (), "AskBeforeSavingLayeredTIFF", None), + "AutoUpdateOpenDocuments": (1349660724, 2, (11, 0), (), "AutoUpdateOpenDocuments", None), + "BeepWhenDone": (1349660726, 2, (11, 0), (), "BeepWhenDone", None), + "ColorChannelsInColor": (1349660982, 2, (11, 0), (), "ColorChannelsInColor", None), + "ColorPicker": (1129343858, 2, (3, 0), (), "ColorPicker", None), + "ColumnGutter": (1349661240, 2, (5, 0), (), "ColumnGutter", None), + "ColumnWidth": (1349661239, 2, (5, 0), (), "ColumnWidth", None), + "CreateFirstSnapshot": (1349661497, 2, (11, 0), (), "CreateFirstSnapshot", None), + "DynamicColorSliders": (1349660727, 2, (11, 0), (), "DynamicColorSliders", None), + "EditLogItems": (1349661751, 2, (3, 0), (), "EditLogItems", None), + "ExportClipboard": (1349660721, 2, (11, 0), (), "ExportClipboard", None), + "FontPreviewSize": (1179660340, 2, (3, 0), (), "FontPreviewSize", None), + "GamutWarningOpacity": (1349661236, 2, (5, 0), (), "GamutWarningOpacity", None), + "GridSize": (1349661233, 2, (3, 0), (), "GridSize", None), + "GridStyle": (1349661489, 2, (3, 0), (), "GridStyle", None), + "GridSubDivisions": (1349661491, 2, (3, 0), (), "GridSubDivisions", None), + "GuideStyle": (1349661488, 2, (3, 0), (), "GuideStyle", None), + "ImageCacheForHistograms": (1349661496, 2, (11, 0), (), "ImageCacheForHistograms", None), + "ImageCacheLevels": (1349661495, 2, (3, 0), (), "ImageCacheLevels", None), + "ImagePreviews": (1349660978, 2, (3, 0), (), "ImagePreviews", None), + "Interpolation": (1232104545, 2, (3, 0), (), "Interpolation", None), + "KeyboardZoomResizesWindows": (1349661747, 2, (11, 0), (), "KeyboardZoomResizesWindows", None), + "MaxRAMuse": (1349661748, 2, (3, 0), (), "MaxRAMuse", None), + "MaximizeCompatibility": (1884125251, 2, (3, 0), (), "MaximizeCompatibility", None), + "NonLinearHistory": (1349661744, 2, (11, 0), (), "NonLinearHistory", None), + "NumberOfHistoryStates": (1349660977, 2, (3, 0), (), "NumberOfHistoryStates", None), + "OtherCursors": (1349661232, 2, (3, 0), (), "OtherCursors", None), + "PaintingCursors": (1349660985, 2, (3, 0), (), "PaintingCursors", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "PixelDoubling": (1349660984, 2, (11, 0), (), "PixelDoubling", None), + "PointSize": (1349661241, 2, (3, 0), (), "PointSize", None), + "RecentFileListLength": (1349660981, 2, (3, 0), (), "RecentFileListLength", None), + "RulerUnits": (1349661237, 2, (3, 0), (), "RulerUnits", None), + "SaveLogItems": (1349661750, 2, (3, 0), (), "SaveLogItems", None), + "SaveLogItemsFile": (1349661752, 2, (8, 0), (), "SaveLogItemsFile", None), + "SavePaletteLocations": (1349660728, 2, (11, 0), (), "SavePaletteLocations", None), + "ShowAsianTextOptions": (1349660725, 2, (11, 0), (), "ShowAsianTextOptions", None), + "ShowEnglishFontNames": (1349660729, 2, (11, 0), (), "ShowEnglishFontNames", None), + "ShowSliceNumber": (1349661492, 2, (11, 0), (), "ShowSliceNumber", None), + "ShowToolTips": (1349660723, 2, (11, 0), (), "ShowToolTips", None), + "SmartQuotes": (1349661745, 2, (11, 0), (), "SmartQuotes", None), + "TypeUnits": (1349661238, 2, (3, 0), (), "TypeUnits", None), + "UseAdditionalPluginFolder": (1349661746, 2, (11, 0), (), "UseAdditionalPluginFolder", None), + "UseDiffusionDither": (1349660983, 2, (11, 0), (), "UseDiffusionDither", None), + "UseHistoryLog": (1349661749, 2, (11, 0), (), "UseHistoryLog", None), + "UseLowerCaseExtension": (1884507235, 2, (11, 0), (), "UseLowerCaseExtension", None), + "UseShiftKeyForToolSwitch": (1349660976, 2, (11, 0), (), "UseShiftKeyForToolSwitch", None), + "UseVideoAlpha": (1349661235, 2, (11, 0), (), "UseVideoAlpha", None), + } + _prop_map_put_ = { + "AdditionalPluginFolder": ((1349661493, LCID, 4, 0),()), + "AskBeforeSavingLayeredTIFF": ((1349660980, LCID, 4, 0),()), + "AutoUpdateOpenDocuments": ((1349660724, LCID, 4, 0),()), + "BeepWhenDone": ((1349660726, LCID, 4, 0),()), + "ColorChannelsInColor": ((1349660982, LCID, 4, 0),()), + "ColorPicker": ((1129343858, LCID, 4, 0),()), + "ColumnGutter": ((1349661240, LCID, 4, 0),()), + "ColumnWidth": ((1349661239, LCID, 4, 0),()), + "CreateFirstSnapshot": ((1349661497, LCID, 4, 0),()), + "DynamicColorSliders": ((1349660727, LCID, 4, 0),()), + "EditLogItems": ((1349661751, LCID, 4, 0),()), + "ExportClipboard": ((1349660721, LCID, 4, 0),()), + "FontPreviewSize": ((1179660340, LCID, 4, 0),()), + "GamutWarningOpacity": ((1349661236, LCID, 4, 0),()), + "GridSize": ((1349661233, LCID, 4, 0),()), + "GridStyle": ((1349661489, LCID, 4, 0),()), + "GridSubDivisions": ((1349661491, LCID, 4, 0),()), + "GuideStyle": ((1349661488, LCID, 4, 0),()), + "ImageCacheForHistograms": ((1349661496, LCID, 4, 0),()), + "ImageCacheLevels": ((1349661495, LCID, 4, 0),()), + "ImagePreviews": ((1349660978, LCID, 4, 0),()), + "Interpolation": ((1232104545, LCID, 4, 0),()), + "KeyboardZoomResizesWindows": ((1349661747, LCID, 4, 0),()), + "MaxRAMuse": ((1349661748, LCID, 4, 0),()), + "MaximizeCompatibility": ((1884125251, LCID, 4, 0),()), + "NonLinearHistory": ((1349661744, LCID, 4, 0),()), + "NumberOfHistoryStates": ((1349660977, LCID, 4, 0),()), + "OtherCursors": ((1349661232, LCID, 4, 0),()), + "PaintingCursors": ((1349660985, LCID, 4, 0),()), + "PixelDoubling": ((1349660984, LCID, 4, 0),()), + "PointSize": ((1349661241, LCID, 4, 0),()), + "RecentFileListLength": ((1349660981, LCID, 4, 0),()), + "RulerUnits": ((1349661237, LCID, 4, 0),()), + "SaveLogItems": ((1349661750, LCID, 4, 0),()), + "SaveLogItemsFile": ((1349661752, LCID, 4, 0),()), + "SavePaletteLocations": ((1349660728, LCID, 4, 0),()), + "ShowAsianTextOptions": ((1349660725, LCID, 4, 0),()), + "ShowEnglishFontNames": ((1349660729, LCID, 4, 0),()), + "ShowSliceNumber": ((1349661492, LCID, 4, 0),()), + "ShowToolTips": ((1349660723, LCID, 4, 0),()), + "SmartQuotes": ((1349661745, LCID, 4, 0),()), + "TypeUnits": ((1349661238, LCID, 4, 0),()), + "UseAdditionalPluginFolder": ((1349661746, LCID, 4, 0),()), + "UseDiffusionDither": ((1349660983, LCID, 4, 0),()), + "UseHistoryLog": ((1349661749, LCID, 4, 0),()), + "UseLowerCaseExtension": ((1884507235, LCID, 4, 0),()), + "UseShiftKeyForToolSwitch": ((1349660976, LCID, 4, 0),()), + "UseVideoAlpha": ((1349661235, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class Selection(DispatchBaseClass): + 'The selection of the document' + CLSID = IID('{09DA6B10-9684-44EE-A575-01F54660BDDC}') + coclass_clsid = None + + def Clear(self): + 'clear selection' + return self._oleobj_.InvokeTypes(1296117809, LCID, 1, (24, 0), (),) + + def Contract(self, By=defaultNamedNotOptArg): + 'contracts the selection' + return self._oleobj_.InvokeTypes(1396929650, LCID, 1, (24, 0), ((5, 1),),By + ) + + def Copy(self, Merge=defaultNamedOptArg): + 'copy selection to the clipboard' + return self._oleobj_.InvokeTypes(1668247673, LCID, 1, (24, 0), ((12, 17),),Merge + ) + + def Cut(self): + 'cut current selection to the clipboard' + return self._oleobj_.InvokeTypes(1668641824, LCID, 1, (24, 0), (),) + + def Deselect(self): + return self._oleobj_.InvokeTypes(1148415092, LCID, 1, (24, 0), (),) + + def Expand(self, By=defaultNamedNotOptArg): + 'expand selection' + return self._oleobj_.InvokeTypes(1483763300, LCID, 1, (24, 0), ((5, 1),),By + ) + + def Feather(self, By=defaultNamedNotOptArg): + 'feather edges of selection' + return self._oleobj_.InvokeTypes(1182034034, LCID, 1, (24, 0), ((5, 1),),By + ) + + def Fill(self, FillType=defaultNamedNotOptArg, Mode=defaultNamedOptArg, Opacity=defaultNamedOptArg, PreserveTransparency=defaultNamedOptArg): + 'fills the selection' + return self._oleobj_.InvokeTypes(1181314156, LCID, 1, (24, 0), ((12, 1), (12, 17), (12, 17), (12, 17)),FillType + , Mode, Opacity, PreserveTransparency) + + def Grow(self, Tolerance=defaultNamedNotOptArg, AntiAlias=defaultNamedNotOptArg): + 'grow selection to include all adjacent pixels falling within the specified tolerance range' + return self._oleobj_.InvokeTypes(1198681975, LCID, 1, (24, 0), ((3, 1), (11, 1)),Tolerance + , AntiAlias) + + def Invert(self): + 'invert the selection' + return self._oleobj_.InvokeTypes(1232491372, LCID, 1, (24, 0), (),) + + def Load(self, From=defaultNamedNotOptArg, Combination=defaultNamedOptArg, Inverting=defaultNamedOptArg): + 'load the selection from a channel' + return self._oleobj_.InvokeTypes(1281643372, LCID, 1, (24, 0), ((9, 1), (12, 17), (12, 17)),From + , Combination, Inverting) + + def MakeWorkPath(self, Tolerance=defaultNamedOptArg): + 'make this selection item the work path for this document' + return self._oleobj_.InvokeTypes(1347694902, LCID, 1, (24, 0), ((12, 17),),Tolerance + ) + + def Resize(self, Horizontal=defaultNamedOptArg, Vertical=defaultNamedOptArg, Anchor=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1399024741, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17)),Horizontal + , Vertical, Anchor) + + def ResizeBoundary(self, Horizontal=defaultNamedOptArg, Vertical=defaultNamedOptArg, Anchor=defaultNamedOptArg): + 'scale the boundary of selection' + return self._oleobj_.InvokeTypes(1399013988, LCID, 1, (24, 0), ((12, 17), (12, 17), (12, 17)),Horizontal + , Vertical, Anchor) + + def Rotate(self, Angle=defaultNamedNotOptArg, Anchor=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1383036001, LCID, 1, (24, 0), ((5, 1), (12, 17)),Angle + , Anchor) + + def RotateBoundary(self, Angle=defaultNamedNotOptArg, Anchor=defaultNamedOptArg): + 'rotates the boundary of selection' + return self._oleobj_.InvokeTypes(1383035970, LCID, 1, (24, 0), ((5, 1), (12, 17)),Angle + , Anchor) + + def Select(self, Region=defaultNamedNotOptArg, Type=defaultNamedOptArg, Feather=defaultNamedOptArg, AntiAlias=defaultNamedOptArg): + return self._oleobj_.InvokeTypes(1936483188, LCID, 1, (24, 0), ((12, 1), (12, 17), (12, 17), (12, 17)),Region + , Type, Feather, AntiAlias) + + def SelectAll(self): + return self._oleobj_.InvokeTypes(1399013740, LCID, 1, (24, 0), (),) + + def SelectBorder(self, Width=defaultNamedNotOptArg): + 'select the border of the selection' + return self._oleobj_.InvokeTypes(1114793074, LCID, 1, (24, 0), ((5, 1),),Width + ) + + def Similar(self, Tolerance=defaultNamedNotOptArg, AntiAlias=defaultNamedNotOptArg): + 'grow selection to include pixels throughout the image falling within the tolerance range' + return self._oleobj_.InvokeTypes(1399680114, LCID, 1, (24, 0), ((3, 1), (11, 1)),Tolerance + , AntiAlias) + + def Smooth(self, Radius=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1347646568, LCID, 1, (24, 0), ((3, 1),),Radius + ) + + def Store(self, Into=defaultNamedNotOptArg, Combination=defaultNamedOptArg): + 'save the selection as a channel' + return self._oleobj_.InvokeTypes(1400263532, LCID, 1, (24, 0), ((9, 1), (12, 17)),Into + , Combination) + + def Stroke(self, StrokeColor=defaultNamedNotOptArg, Width=defaultNamedNotOptArg, Location=defaultNamedOptArg, Mode=defaultNamedOptArg + , Opacity=defaultNamedOptArg, PreserveTransparency=defaultNamedOptArg): + 'strokes the selection' + return self._oleobj_.InvokeTypes(1400138597, LCID, 1, (24, 0), ((12, 1), (3, 1), (12, 17), (12, 17), (12, 17), (12, 17)),StrokeColor + , Width, Location, Mode, Opacity, PreserveTransparency + ) + + def Translate(self, DeltaX=defaultNamedOptArg, DeltaY=defaultNamedOptArg): + 'moves the position relative to its current position' + return self._oleobj_.InvokeTypes(1299599475, LCID, 1, (24, 0), ((12, 17), (12, 17)),DeltaX + , DeltaY) + + def TranslateBoundary(self, DeltaX=defaultNamedOptArg, DeltaY=defaultNamedOptArg): + 'moves the boundary of selection relative to its current position' + return self._oleobj_.InvokeTypes(1299595876, LCID, 1, (24, 0), ((12, 17), (12, 17)),DeltaX + , DeltaY) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Bounds": (1114530931, 2, (12, 0), (), "Bounds", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "Solid": (1399613796, 2, (11, 0), (), "Solid", None), + } + _prop_map_put_ = { + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class SubPathItem(DispatchBaseClass): + 'An artwork sub path item' + CLSID = IID('{B6D22EB9-EC6D-46DB-B52A-5561433A1217}') + coclass_clsid = None + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Closed": (1347695920, 2, (11, 0), (), "Closed", None), + "Operation": (1347694647, 2, (3, 0), (), "Operation", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + # Method 'PathPoints' returns object of type 'PathPoints' + "PathPoints": (1347694644, 2, (9, 0), (), "PathPoints", '{8214A53C-0E67-49D4-A65A-D56F07B17D37}'), + } + _prop_map_put_ = { + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class SubPathItems(DispatchBaseClass): + 'art sub paths associated with the path item' + CLSID = IID('{B7283EEC-23B1-49A6-B151-0E97E4AF353C}') + coclass_clsid = None + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type SubPathItem + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{B6D22EB9-EC6D-46DB-B52A-5561433A1217}') + return ret + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{B6D22EB9-EC6D-46DB-B52A-5561433A1217}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{B6D22EB9-EC6D-46DB-B52A-5561433A1217}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class TextFont(DispatchBaseClass): + 'An installed font' + CLSID = IID('{C88838E3-5A82-4EE7-A66C-E0360C9B0356}') + coclass_clsid = None + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Family": (1883653710, 2, (8, 0), (), "Family", None), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "PostScriptName": (1884312398, 2, (8, 0), (), "PostScriptName", None), + "Style": (1400142188, 2, (8, 0), (), "Style", None), + } + _prop_map_put_ = { + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class TextFonts(DispatchBaseClass): + 'A collection of fonts' + CLSID = IID('{BBCE52D6-5D4B-4691-99E3-62C174BD2855}') + coclass_clsid = None + + def Index(self, ItemPtr=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1885955192, LCID, 1, (3, 0), ((9, 1),),ItemPtr + ) + + # Result is of type TextFont + # The method Item is actually a property, but must be used as a method to correctly pass the arguments + def Item(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, u'Item', '{C88838E3-5A82-4EE7-A66C-E0360C9B0356}') + return ret + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1668183141, 2, (3, 0), (), "Count", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + } + _prop_map_put_ = { + } + # Default method for this class is 'Item' + def __call__(self, ItemKey=defaultNamedNotOptArg): + 'get an element from the collection' + ret = self._oleobj_.InvokeTypes(0, LCID, 2, (9, 0), ((12, 1),),ItemKey + ) + if ret is not None: + ret = Dispatch(ret, '__call__', '{C88838E3-5A82-4EE7-A66C-E0360C9B0356}') + return ret + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,2,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, '{C88838E3-5A82-4EE7-A66C-E0360C9B0356}') + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1668183141, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class TextItem(DispatchBaseClass): + 'Text object contained in an art layer' + CLSID = IID('{E7A940CD-9AC7-4D76-975D-24D6BA0FDD16}') + coclass_clsid = None + + def ConvertToShape(self): + 'converts the text object and its containing layer to a fill layer with the text changed to a clipping path' + return self._oleobj_.InvokeTypes(1131819635, LCID, 1, (24, 0), (),) + + def CreatePath(self): + 'creates a work path based on the text object' + return self._oleobj_.InvokeTypes(1129803892, LCID, 1, (24, 0), (),) + + def SetColor(self, arg0=defaultUnnamedArg): + 'color of text' + return self._oleobj_.InvokeTypes(1413704771, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AlternateLigatures": (1095529587, 2, (11, 0), (), "AlternateLigatures", None), + "AntiAliasMethod": (1094808688, 2, (3, 0), (), "AntiAliasMethod", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "AutoKerning": (1097560686, 2, (3, 0), (), "AutoKerning", None), + "AutoLeadingAmount": (1097621837, 2, (5, 0), (), "AutoLeadingAmount", None), + "BaselineShift": (1114403688, 2, (5, 0), (), "BaselineShift", None), + "Capitalization": (1130459251, 2, (3, 0), (), "Capitalization", None), + # Method 'Color' returns object of type '_SolidColor' + "Color": (1413704771, 2, (9, 0), (), "Color", '{D2D1665E-C1B9-4CA0-8AC9-529F6A3D9002}'), + "Contents": (1885564532, 2, (8, 0), (), "Contents", None), + "DesiredGlyphScaling": (1148405619, 2, (5, 0), (), "DesiredGlyphScaling", None), + "DesiredLetterScaling": (1148406899, 2, (5, 0), (), "DesiredLetterScaling", None), + "DesiredWordScaling": (1148409715, 2, (5, 0), (), "DesiredWordScaling", None), + "Direction": (1413769586, 2, (3, 0), (), "Direction", None), + "FauxBold": (1182286444, 2, (11, 0), (), "FauxBold", None), + "FauxItalic": (1182288244, 2, (11, 0), (), "FauxItalic", None), + "FirstLineIndent": (1413900644, 2, (5, 0), (), "FirstLineIndent", None), + "Font": (1665560180, 2, (8, 0), (), "Font", None), + "HangingPunctuation": (1213227875, 2, (11, 0), (), "HangingPunctuation", None), + "HangingPuntuation": (1213227892, 2, (11, 0), (), "HangingPuntuation", None), + "Height": (1214736500, 2, (5, 0), (), "Height", None), + "HorizontalScale": (1215452003, 2, (3, 0), (), "HorizontalScale", None), + "HyphenLimit": (1212968308, 2, (3, 0), (), "HyphenLimit", None), + "HyphenateAfterFirst": (1212245620, 2, (3, 0), (), "HyphenateAfterFirst", None), + "HyphenateBeforeLast": (1212311154, 2, (3, 0), (), "HyphenateBeforeLast", None), + "HyphenateCapitalWords": (1212379251, 2, (11, 0), (), "HyphenateCapitalWords", None), + "HyphenateWordsLongerThan": (1212970094, 2, (3, 0), (), "HyphenateWordsLongerThan", None), + "Hyphenation": (1430810728, 2, (11, 0), (), "Hyphenation", None), + "HyphenationZone": (1213886053, 2, (5, 0), (), "HyphenationZone", None), + "Justification": (1886024564, 2, (3, 0), (), "Justification", None), + "Kind": (1265200740, 2, (3, 0), (), "Kind", None), + "Language": (1281453671, 2, (3, 0), (), "Language", None), + "Leading": (1414292583, 2, (5, 0), (), "Leading", None), + "LeftIndent": (1414293860, 2, (5, 0), (), "LeftIndent", None), + "Ligatures": (1282699891, 2, (11, 0), (), "Ligatures", None), + "MaximumGlyphScaling": (1299400563, 2, (5, 0), (), "MaximumGlyphScaling", None), + "MaximumLetterScaling": (1298222195, 2, (5, 0), (), "MaximumLetterScaling", None), + "MaximumWordScaling": (1298225011, 2, (5, 0), (), "MaximumWordScaling", None), + "MinimumGlyphScaling": (1298745203, 2, (5, 0), (), "MinimumGlyphScaling", None), + "MinimumLetterScaling": (1298746483, 2, (5, 0), (), "MinimumLetterScaling", None), + "MinimumWordScaling": (1298749299, 2, (5, 0), (), "MinimumWordScaling", None), + "NoBreak": (1315922539, 2, (11, 0), (), "NoBreak", None), + "OldStyle": (1331975028, 2, (11, 0), (), "OldStyle", None), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "Position": (1332897646, 2, (12, 0), (), "Position", None), + "RightIndent": (1414687076, 2, (5, 0), (), "RightIndent", None), + "Size": (1886679930, 2, (5, 0), (), "Size", None), + "SpaceAfter": (1414750566, 2, (5, 0), (), "SpaceAfter", None), + "SpaceBefore": (1414742630, 2, (5, 0), (), "SpaceBefore", None), + "StrikeThru": (1347711605, 2, (3, 0), (), "StrikeThru", None), + "TextComposer": (1413705843, 2, (3, 0), (), "TextComposer", None), + "Tracking": (1416784750, 2, (5, 0), (), "Tracking", None), + "Underline": (1433168238, 2, (3, 0), (), "Underline", None), + "UseAutoLeading": (1097622631, 2, (11, 0), (), "UseAutoLeading", None), + "VerticalScale": (1450464099, 2, (3, 0), (), "VerticalScale", None), + "WarpBend": (1463971428, 2, (5, 0), (), "WarpBend", None), + "WarpDirection": (1464101234, 2, (3, 0), (), "WarpDirection", None), + "WarpHorizontalDistortion": (1464353907, 2, (5, 0), (), "WarpHorizontalDistortion", None), + "WarpStyle": (1465087084, 2, (3, 0), (), "WarpStyle", None), + "WarpVerticalDistortion": (1465271411, 2, (5, 0), (), "WarpVerticalDistortion", None), + "Width": (1466201192, 2, (5, 0), (), "Width", None), + } + _prop_map_put_ = { + "AlternateLigatures": ((1095529587, LCID, 4, 0),()), + "AntiAliasMethod": ((1094808688, LCID, 4, 0),()), + "AutoKerning": ((1097560686, LCID, 4, 0),()), + "AutoLeadingAmount": ((1097621837, LCID, 4, 0),()), + "BaselineShift": ((1114403688, LCID, 4, 0),()), + "Capitalization": ((1130459251, LCID, 4, 0),()), + "Color": ((1413704771, LCID, 4, 0),()), + "Contents": ((1885564532, LCID, 4, 0),()), + "DesiredGlyphScaling": ((1148405619, LCID, 4, 0),()), + "DesiredLetterScaling": ((1148406899, LCID, 4, 0),()), + "DesiredWordScaling": ((1148409715, LCID, 4, 0),()), + "Direction": ((1413769586, LCID, 4, 0),()), + "FauxBold": ((1182286444, LCID, 4, 0),()), + "FauxItalic": ((1182288244, LCID, 4, 0),()), + "FirstLineIndent": ((1413900644, LCID, 4, 0),()), + "Font": ((1665560180, LCID, 4, 0),()), + "HangingPunctuation": ((1213227875, LCID, 4, 0),()), + "HangingPuntuation": ((1213227892, LCID, 4, 0),()), + "Height": ((1214736500, LCID, 4, 0),()), + "HorizontalScale": ((1215452003, LCID, 4, 0),()), + "HyphenLimit": ((1212968308, LCID, 4, 0),()), + "HyphenateAfterFirst": ((1212245620, LCID, 4, 0),()), + "HyphenateBeforeLast": ((1212311154, LCID, 4, 0),()), + "HyphenateCapitalWords": ((1212379251, LCID, 4, 0),()), + "HyphenateWordsLongerThan": ((1212970094, LCID, 4, 0),()), + "Hyphenation": ((1430810728, LCID, 4, 0),()), + "HyphenationZone": ((1213886053, LCID, 4, 0),()), + "Justification": ((1886024564, LCID, 4, 0),()), + "Kind": ((1265200740, LCID, 4, 0),()), + "Language": ((1281453671, LCID, 4, 0),()), + "Leading": ((1414292583, LCID, 4, 0),()), + "LeftIndent": ((1414293860, LCID, 4, 0),()), + "Ligatures": ((1282699891, LCID, 4, 0),()), + "MaximumGlyphScaling": ((1299400563, LCID, 4, 0),()), + "MaximumLetterScaling": ((1298222195, LCID, 4, 0),()), + "MaximumWordScaling": ((1298225011, LCID, 4, 0),()), + "MinimumGlyphScaling": ((1298745203, LCID, 4, 0),()), + "MinimumLetterScaling": ((1298746483, LCID, 4, 0),()), + "MinimumWordScaling": ((1298749299, LCID, 4, 0),()), + "NoBreak": ((1315922539, LCID, 4, 0),()), + "OldStyle": ((1331975028, LCID, 4, 0),()), + "Position": ((1332897646, LCID, 4, 0),()), + "RightIndent": ((1414687076, LCID, 4, 0),()), + "Size": ((1886679930, LCID, 4, 0),()), + "SpaceAfter": ((1414750566, LCID, 4, 0),()), + "SpaceBefore": ((1414742630, LCID, 4, 0),()), + "StrikeThru": ((1347711605, LCID, 4, 0),()), + "TextComposer": ((1413705843, LCID, 4, 0),()), + "Tracking": ((1416784750, LCID, 4, 0),()), + "Underline": ((1433168238, LCID, 4, 0),()), + "UseAutoLeading": ((1097622631, LCID, 4, 0),()), + "VerticalScale": ((1450464099, LCID, 4, 0),()), + "WarpBend": ((1463971428, LCID, 4, 0),()), + "WarpDirection": ((1464101234, LCID, 4, 0),()), + "WarpHorizontalDistortion": ((1464353907, LCID, 4, 0),()), + "WarpStyle": ((1465087084, LCID, 4, 0),()), + "WarpVerticalDistortion": ((1465271411, LCID, 4, 0),()), + "Width": ((1466201192, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class XMPMetadata(DispatchBaseClass): + CLSID = IID('{DC865034-A587-4CC4-8A5A-453032562BE4}') + coclass_clsid = None + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Parent": (1668574834, 2, (9, 0), (), "Parent", None), + "RawData": (1884441956, 2, (8, 0), (), "RawData", None), + } + _prop_map_put_ = { + "RawData": ((1884441956, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _ActionDescriptor(DispatchBaseClass): + CLSID = IID('{70A60330-E866-46AA-A715-ABF418C41453}') + coclass_clsid = IID('{E0B09E62-C974-4CF0-B236-1F82F34F81E1}') + + def Clear(self): + 'Clear the descriptor' + return self._oleobj_.InvokeTypes(1296117809, LCID, 1, (24, 0), (),) + + def Erase(self, Key=defaultNamedNotOptArg): + 'Erase a key from the descriptor' + return self._oleobj_.InvokeTypes(1296117810, LCID, 1, (24, 0), ((3, 1),),Key + ) + + def GetBoolean(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type boolean' + return self._oleobj_.InvokeTypes(1296117811, LCID, 1, (11, 0), ((3, 1),),Key + ) + + def GetClass(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type class' + return self._oleobj_.InvokeTypes(1296117812, LCID, 1, (3, 0), ((3, 1),),Key + ) + + def GetDouble(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type double' + return self._oleobj_.InvokeTypes(1296117814, LCID, 1, (5, 0), ((3, 1),),Key + ) + + def GetEnumerationType(self, Key=defaultNamedNotOptArg): + 'Get the enumeration type of a key' + return self._oleobj_.InvokeTypes(1296117815, LCID, 1, (3, 0), ((3, 1),),Key + ) + + def GetEnumerationValue(self, Key=defaultNamedNotOptArg): + 'Get the enumeration value of a key' + return self._oleobj_.InvokeTypes(1296117816, LCID, 1, (3, 0), ((3, 1),),Key + ) + + def GetInteger(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type integer' + return self._oleobj_.InvokeTypes(1296117817, LCID, 1, (3, 0), ((3, 1),),Key + ) + + def GetKey(self, Index=defaultNamedNotOptArg): + 'Get ID of the Nth key' + return self._oleobj_.InvokeTypes(1296118064, LCID, 1, (3, 0), ((3, 1),),Index + ) + + def GetLargeInteger(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type large integer' + return self._oleobj_.InvokeTypes(1296119094, LCID, 1, (3, 0), ((3, 1),),Key + ) + + # Result is of type _ActionList + def GetList(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type list' + ret = self._oleobj_.InvokeTypes(1296118065, LCID, 1, (9, 0), ((3, 1),),Key + ) + if ret is not None: + ret = Dispatch(ret, u'GetList', '{55031766-E456-4E54-A0D0-8E545601A2D8}') + return ret + + def GetObjectType(self, Key=defaultNamedNotOptArg): + 'Get the class ID of an object in a key of type object' + return self._oleobj_.InvokeTypes(1296118066, LCID, 1, (3, 0), ((3, 1),),Key + ) + + # Result is of type _ActionDescriptor + def GetObjectValue(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type object' + ret = self._oleobj_.InvokeTypes(1296118067, LCID, 1, (9, 0), ((3, 1),),Key + ) + if ret is not None: + ret = Dispatch(ret, u'GetObjectValue', '{70A60330-E866-46AA-A715-ABF418C41453}') + return ret + + def GetPath(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type Alias' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1296118068, LCID, 1, (8, 0), ((3, 1),),Key + ) + + # Result is of type _ActionReference + def GetReference(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type ActionReference' + ret = self._oleobj_.InvokeTypes(1296118069, LCID, 1, (9, 0), ((3, 1),),Key + ) + if ret is not None: + ret = Dispatch(ret, u'GetReference', '{DFF407C7-3BCC-45AC-B6CC-EE6D52032D85}') + return ret + + def GetString(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type string' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1296118070, LCID, 1, (8, 0), ((3, 1),),Key + ) + + def GetType(self, Key=defaultNamedNotOptArg): + 'Get the type of a key' + return self._oleobj_.InvokeTypes(1296118071, LCID, 1, (3, 0), ((3, 1),),Key + ) + + def GetUnitDoubleType(self, Key=defaultNamedNotOptArg): + 'Get the unit type of a key of type UnitDouble' + return self._oleobj_.InvokeTypes(1296118072, LCID, 1, (3, 0), ((3, 1),),Key + ) + + def GetUnitDoubleValue(self, Key=defaultNamedNotOptArg): + 'Get the value of a key of type UnitDouble' + return self._oleobj_.InvokeTypes(1296118073, LCID, 1, (5, 0), ((3, 1),),Key + ) + + def HasKey(self, Key=defaultNamedNotOptArg): + 'does the descriptor contain the provided key?' + return self._oleobj_.InvokeTypes(1296118320, LCID, 1, (11, 0), ((3, 1),),Key + ) + + def IsEqual(self, OtherDesc=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118321, LCID, 1, (11, 0), ((9, 1),),OtherDesc + ) + + def PutBoolean(self, Key=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118322, LCID, 1, (24, 0), ((3, 1), (11, 1)),Key + , Value) + + def PutClass(self, Key=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118323, LCID, 1, (24, 0), ((3, 1), (3, 1)),Key + , Value) + + def PutDouble(self, Key=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118324, LCID, 1, (24, 0), ((3, 1), (5, 1)),Key + , Value) + + def PutEnumerated(self, Key=defaultNamedNotOptArg, EnumType=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118325, LCID, 1, (24, 0), ((3, 1), (3, 1), (3, 1)),Key + , EnumType, Value) + + def PutInteger(self, Key=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118326, LCID, 1, (24, 0), ((3, 1), (3, 1)),Key + , Value) + + def PutLargeInteger(self, Key=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296119093, LCID, 1, (24, 0), ((3, 1), (3, 1)),Key + , Value) + + def PutList(self, Key=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118327, LCID, 1, (24, 0), ((3, 1), (9, 1)),Key + , Value) + + def PutObject(self, Key=defaultNamedNotOptArg, ClassID=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118328, LCID, 1, (24, 0), ((3, 1), (3, 1), (9, 1)),Key + , ClassID, Value) + + def PutPath(self, Key=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118329, LCID, 1, (24, 0), ((3, 1), (8, 1)),Key + , Value) + + def PutReference(self, Key=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118576, LCID, 1, (24, 0), ((3, 1), (9, 1)),Key + , Value) + + def PutString(self, Key=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118577, LCID, 1, (24, 0), ((3, 1), (8, 1)),Key + , Value) + + def PutUnitDouble(self, Key=defaultNamedNotOptArg, UnitID=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118578, LCID, 1, (24, 0), ((3, 1), (3, 1), (5, 1)),Key + , UnitID, Value) + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1346462580, 2, (3, 0), (), "Count", None), + } + _prop_map_put_ = { + "ObjectValue": ((0, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1346462580, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class _ActionList(DispatchBaseClass): + CLSID = IID('{55031766-E456-4E54-A0D0-8E545601A2D8}') + coclass_clsid = IID('{4232D393-E961-4F42-8DE5-99CAE46A3DD3}') + + def Clear(self): + 'Clear the list' + return self._oleobj_.InvokeTypes(1296117809, LCID, 1, (24, 0), (),) + + def GetBoolean(self, Index=defaultNamedNotOptArg): + 'Get the value of an item of type boolean' + return self._oleobj_.InvokeTypes(1296117811, LCID, 1, (11, 0), ((3, 1),),Index + ) + + def GetClass(self, Index=defaultNamedNotOptArg): + 'Get the value of an item of type class' + return self._oleobj_.InvokeTypes(1296117812, LCID, 1, (3, 0), ((3, 1),),Index + ) + + def GetDouble(self, Index=defaultNamedNotOptArg): + 'Get the value of an item of type double' + return self._oleobj_.InvokeTypes(1296117814, LCID, 1, (5, 0), ((3, 1),),Index + ) + + def GetEnumerationType(self, Index=defaultNamedNotOptArg): + 'Get the enumeration type of an item' + return self._oleobj_.InvokeTypes(1296117815, LCID, 1, (3, 0), ((3, 1),),Index + ) + + def GetEnumerationValue(self, Index=defaultNamedNotOptArg): + 'Get the enumeration value of an item' + return self._oleobj_.InvokeTypes(1296117816, LCID, 1, (3, 0), ((3, 1),),Index + ) + + def GetInteger(self, Index=defaultNamedNotOptArg): + 'Get the value of an item of type integer' + return self._oleobj_.InvokeTypes(1296117817, LCID, 1, (3, 0), ((3, 1),),Index + ) + + def GetLargeInteger(self, Index=defaultNamedNotOptArg): + 'Get the value of an item of type large integer' + return self._oleobj_.InvokeTypes(1296119094, LCID, 1, (3, 0), ((3, 1),),Index + ) + + # Result is of type _ActionList + def GetList(self, Index=defaultNamedNotOptArg): + 'Get the value of an item of type list' + ret = self._oleobj_.InvokeTypes(1296118065, LCID, 1, (9, 0), ((3, 1),),Index + ) + if ret is not None: + ret = Dispatch(ret, u'GetList', '{55031766-E456-4E54-A0D0-8E545601A2D8}') + return ret + + def GetObjectType(self, Index=defaultNamedNotOptArg): + 'Get the class ID of an object in an item of type object' + return self._oleobj_.InvokeTypes(1296118066, LCID, 1, (3, 0), ((3, 1),),Index + ) + + # Result is of type _ActionDescriptor + def GetObjectValue(self, Index=defaultNamedNotOptArg): + 'Get the value of an item of type object' + ret = self._oleobj_.InvokeTypes(1296118067, LCID, 1, (9, 0), ((3, 1),),Index + ) + if ret is not None: + ret = Dispatch(ret, u'GetObjectValue', '{70A60330-E866-46AA-A715-ABF418C41453}') + return ret + + def GetPath(self, Index=defaultNamedNotOptArg): + 'Get the value of an item of type Alias' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1296118068, LCID, 1, (8, 0), ((3, 1),),Index + ) + + # Result is of type _ActionReference + def GetReference(self, Index=defaultNamedNotOptArg): + 'Get the value of an item of type ActionReference' + ret = self._oleobj_.InvokeTypes(1296118069, LCID, 1, (9, 0), ((3, 1),),Index + ) + if ret is not None: + ret = Dispatch(ret, u'GetReference', '{DFF407C7-3BCC-45AC-B6CC-EE6D52032D85}') + return ret + + def GetString(self, Index=defaultNamedNotOptArg): + 'Get the value of an item of type string' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1296118070, LCID, 1, (8, 0), ((3, 1),),Index + ) + + def GetType(self, Index=defaultNamedNotOptArg): + 'Get the type of an item' + return self._oleobj_.InvokeTypes(1296118071, LCID, 1, (3, 0), ((3, 1),),Index + ) + + def GetUnitDoubleType(self, Index=defaultNamedNotOptArg): + 'Get the unit type of an item of type UnitDouble' + return self._oleobj_.InvokeTypes(1296118072, LCID, 1, (3, 0), ((3, 1),),Index + ) + + def GetUnitDoubleValue(self, Index=defaultNamedNotOptArg): + 'Get the value of anm item of type UnitDouble' + return self._oleobj_.InvokeTypes(1296118073, LCID, 1, (5, 0), ((3, 1),),Index + ) + + def PutBoolean(self, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118322, LCID, 1, (24, 0), ((11, 1),),Value + ) + + def PutClass(self, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118323, LCID, 1, (24, 0), ((3, 1),),Value + ) + + def PutDouble(self, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118324, LCID, 1, (24, 0), ((5, 1),),Value + ) + + def PutEnumerated(self, EnumType=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118325, LCID, 1, (24, 0), ((3, 1), (3, 1)),EnumType + , Value) + + def PutInteger(self, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118326, LCID, 1, (24, 0), ((3, 1),),Value + ) + + def PutLargeInteger(self, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296119093, LCID, 1, (24, 0), ((3, 1),),Value + ) + + def PutList(self, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118327, LCID, 1, (24, 0), ((9, 1),),Value + ) + + def PutObject(self, ClassID=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118328, LCID, 1, (24, 0), ((3, 1), (9, 1)),ClassID + , Value) + + def PutPath(self, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118329, LCID, 1, (24, 0), ((8, 1),),Value + ) + + def PutReference(self, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118576, LCID, 1, (24, 0), ((9, 1),),Value + ) + + def PutString(self, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118577, LCID, 1, (24, 0), ((8, 1),),Value + ) + + def PutUnitDouble(self, UnitID=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118578, LCID, 1, (24, 0), ((3, 1), (5, 1)),UnitID + , Value) + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Count": (1346462580, 2, (3, 0), (), "Count", None), + } + _prop_map_put_ = { + "ObjectValue": ((0, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + #This class has Count() property - allow len(ob) to provide this + def __len__(self): + return self._ApplyTypes_(*(1346462580, 2, (3, 0), (), "Count", None)) + #This class has a __len__ - this is needed so 'if object:' always returns TRUE. + def __nonzero__(self): + return True + +class _ActionReference(DispatchBaseClass): + CLSID = IID('{DFF407C7-3BCC-45AC-B6CC-EE6D52032D85}') + coclass_clsid = IID('{B24D3780-2629-4EE6-9F9F-6C0A12554B3A}') + + # Result is of type _ActionReference + def GetContainer(self): + ret = self._oleobj_.InvokeTypes(1296118579, LCID, 1, (9, 0), (),) + if ret is not None: + ret = Dispatch(ret, u'GetContainer', '{DFF407C7-3BCC-45AC-B6CC-EE6D52032D85}') + return ret + + def GetDesiredClass(self): + return self._oleobj_.InvokeTypes(1296118580, LCID, 1, (3, 0), (),) + + def GetEnumeratedType(self): + "Get type of enumeration of an ActionReference whose form is 'Enumerated'" + return self._oleobj_.InvokeTypes(1296118581, LCID, 1, (3, 0), (),) + + def GetEnumeratedValue(self): + "Get value of enumeration of an ActionReference whose form is 'Enumerated'" + return self._oleobj_.InvokeTypes(1296118582, LCID, 1, (3, 0), (),) + + def GetForm(self): + 'Get form of ActionReference' + return self._oleobj_.InvokeTypes(1296118583, LCID, 1, (3, 0), (),) + + def GetIdentifier(self): + "Get identifier value for an ActionReference whoxse form is 'Identifier'" + return self._oleobj_.InvokeTypes(1296118584, LCID, 1, (3, 0), (),) + + def GetIndex(self): + "Get index value for an ActionReference whoxse form is 'Index'" + return self._oleobj_.InvokeTypes(1296118585, LCID, 1, (3, 0), (),) + + def GetName(self): + "Get name value for an ActionReference whoxse form is 'Name'" + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1296118832, LCID, 1, (8, 0), (),) + + def GetOffset(self): + "Get offset value for an ActionReference whoxse form is 'Offset'" + return self._oleobj_.InvokeTypes(1296118833, LCID, 1, (3, 0), (),) + + def GetProperty(self): + "Get property ID value for an ActionReference whoxse form is 'Property'" + return self._oleobj_.InvokeTypes(1296118834, LCID, 1, (3, 0), (),) + + def PutClass(self, DesiredClass=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118835, LCID, 1, (24, 0), ((3, 1),),DesiredClass + ) + + def PutEnumerated(self, DesiredClass=defaultNamedNotOptArg, EnumType=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118836, LCID, 1, (24, 0), ((3, 1), (3, 1), (3, 1)),DesiredClass + , EnumType, Value) + + def PutIdentifier(self, DesiredClass=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118837, LCID, 1, (24, 0), ((3, 1), (3, 1)),DesiredClass + , Value) + + def PutIndex(self, DesiredClass=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118838, LCID, 1, (24, 0), ((3, 1), (3, 1)),DesiredClass + , Value) + + def PutName(self, DesiredClass=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118839, LCID, 1, (24, 0), ((3, 1), (8, 1)),DesiredClass + , Value) + + def PutOffset(self, DesiredClass=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118840, LCID, 1, (24, 0), ((3, 1), (3, 1)),DesiredClass + , Value) + + def PutProperty(self, DesiredClass=defaultNamedNotOptArg, Value=defaultNamedNotOptArg): + return self._oleobj_.InvokeTypes(1296118841, LCID, 1, (24, 0), ((3, 1), (3, 1)),DesiredClass + , Value) + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + } + _prop_map_put_ = { + "ObjectValue": ((0, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _Application(DispatchBaseClass): + 'The Adobe Photoshop application' + CLSID = IID('{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}') + coclass_clsid = IID('{C4C3E2FB-D66C-44E5-96A0-349F951CB3D4}') + + def Batch(self, InputFiles=defaultNamedNotOptArg, Action=defaultNamedNotOptArg, From=defaultNamedNotOptArg, Options=defaultNamedOptArg): + 'run the batch automation routine' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1112813617, LCID, 1, (8, 0), ((12, 1), (8, 1), (8, 1), (12, 17)),InputFiles + , Action, From, Options) + + def ChangeColorSettings(self, Name=defaultNamedOptArg, File=defaultNamedOptArg): + 'set Color Settings to a named set or to the contents of a settings file' + return self._oleobj_.InvokeTypes(1130906490, LCID, 1, (24, 0), ((12, 17), (12, 17)),Name + , File) + + def CharIDToTypeID(self, CharID=defaultNamedNotOptArg): + 'convert from a four character code to a runtime ID' + return self._oleobj_.InvokeTypes(1098002483, LCID, 1, (3, 0), ((8, 1),),CharID + ) + + def DoAction(self, Action=defaultNamedNotOptArg, From=defaultNamedNotOptArg): + 'play an action from the Actions Palette' + return self._oleobj_.InvokeTypes(1148141923, LCID, 1, (24, 0), ((8, 1), (8, 1)),Action + , From) + + def DoJavaScript(self, JavaScriptCode=defaultNamedNotOptArg, Arguments=defaultNamedOptArg, ExecutionMode=defaultNamedOptArg): + 'execute JavaScript code' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1147828311, LCID, 1, (8, 0), ((8, 1), (12, 17), (12, 17)),JavaScriptCode + , Arguments, ExecutionMode) + + def DoJavaScriptFile(self, JavaScriptFile=defaultNamedNotOptArg, Arguments=defaultNamedOptArg, ExecutionMode=defaultNamedOptArg): + 'execute javascript file' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1147823703, LCID, 1, (8, 0), ((8, 1), (12, 17), (12, 17)),JavaScriptFile + , Arguments, ExecutionMode) + + # Result is of type _ActionDescriptor + def ExecuteAction(self, EventID=defaultNamedNotOptArg, Descriptor=defaultNamedOptArg, DisplayDialogs=defaultNamedOptArg): + 'play an ActionManager event' + ret = self._oleobj_.InvokeTypes(1349280121, LCID, 1, (9, 0), ((3, 1), (12, 17), (12, 17)),EventID + , Descriptor, DisplayDialogs) + if ret is not None: + ret = Dispatch(ret, u'ExecuteAction', '{70A60330-E866-46AA-A715-ABF418C41453}') + return ret + + # Result is of type _ActionDescriptor + def ExecuteActionGet(self, Reference=defaultNamedNotOptArg): + 'obtain an action descriptor' + ret = self._oleobj_.InvokeTypes(1095198068, LCID, 1, (9, 0), ((9, 1),),Reference + ) + if ret is not None: + ret = Dispatch(ret, u'ExecuteActionGet', '{70A60330-E866-46AA-A715-ABF418C41453}') + return ret + + def FeatureEnabled(self, Name=defaultNamedNotOptArg): + 'is the feature with the given name enabled?' + return self._oleobj_.InvokeTypes(1718904174, LCID, 1, (11, 0), ((8, 1),),Name + ) + + def Load(self, Document=defaultNamedNotOptArg): + 'load a support document' + return self._oleobj_.InvokeTypes(1281643372, LCID, 1, (24, 0), ((8, 1),),Document + ) + + def MakeContactSheet(self, InputFiles=defaultNamedNotOptArg, Options=defaultNamedOptArg): + 'create a contact sheet from multiple files' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1129599816, LCID, 1, (8, 0), ((12, 1), (12, 17)),InputFiles + , Options) + + def MakePDFPresentation(self, InputFiles=defaultNamedNotOptArg, OutputFile=defaultNamedNotOptArg, Options=defaultNamedOptArg): + 'create a PDF presentation file' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1346651697, LCID, 1, (8, 0), ((12, 1), (8, 1), (12, 17)),InputFiles + , OutputFile, Options) + + def MakePhotoGallery(self, InputFolder=defaultNamedNotOptArg, OutputFolder=defaultNamedNotOptArg, Options=defaultNamedOptArg): + 'Creates a web photo gallery' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(2004316263, LCID, 1, (8, 0), ((12, 1), (8, 1), (12, 17)),InputFolder + , OutputFolder, Options) + + def MakePhotomerge(self, InputFiles=defaultNamedNotOptArg): + 'DEPRECATED. Merges multiple files into one, user interaction required.' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1886678375, LCID, 1, (8, 0), ((12, 1),),InputFiles + ) + + def MakePicturePackage(self, InputFiles=defaultNamedNotOptArg, Options=defaultNamedOptArg): + 'create a picture package from multiple files' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1347702859, LCID, 1, (8, 0), ((12, 1), (12, 17)),InputFiles + , Options) + + # Result is of type Document + def Open(self, Document=defaultNamedNotOptArg, As=defaultNamedOptArg, AsSmartObject=defaultNamedOptArg): + 'open the specified document' + ret = self._oleobj_.InvokeTypes(1349731151, LCID, 1, (9, 0), ((8, 1), (12, 17), (12, 17)),Document + , As, AsSmartObject) + if ret is not None: + ret = Dispatch(ret, u'Open', '{B1ADEFB6-C536-42D6-8A83-397354A769F8}') + return ret + + def OpenDialog(self): + 'use the Photoshop open dialog to select files' + return self._ApplyTypes_(1886613360, 1, (12, 0), (), u'OpenDialog', None,) + + def Purge(self, Target=defaultNamedNotOptArg): + 'purges one or more caches' + return self._oleobj_.InvokeTypes(1349874279, LCID, 1, (24, 0), ((3, 1),),Target + ) + + def Quit(self): + 'quit the application' + return self._oleobj_.InvokeTypes(1903520116, LCID, 1, (24, 0), (),) + + def Refresh(self): + 'pause the script until the application refreshes' + return self._oleobj_.InvokeTypes(1382445928, LCID, 1, (24, 0), (),) + + def SetBackgroundColor(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(1650934627, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetForegroundColor(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(1718043491, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def StringIDToTypeID(self, StringID=defaultNamedNotOptArg): + 'convert from a string ID to a runtime ID' + return self._oleobj_.InvokeTypes(1098002481, LCID, 1, (3, 0), ((8, 1),),StringID + ) + + def TypeIDToCharID(self, TypeID=defaultNamedNotOptArg): + 'convert from a runtime ID to a character ID' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1098002484, LCID, 1, (8, 0), ((3, 1),),TypeID + ) + + def TypeIDToStringID(self, TypeID=defaultNamedNotOptArg): + 'convert from a runtime ID to a string ID' + # Result is a Unicode object + return self._oleobj_.InvokeTypes(1098002482, LCID, 1, (8, 0), ((3, 1),),TypeID + ) + + _prop_map_get_ = { + # Method 'ActiveDocument' returns object of type 'Document' + "ActiveDocument": (1883325539, 2, (9, 0), (), "ActiveDocument", '{B1ADEFB6-C536-42D6-8A83-397354A769F8}'), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + # Method 'BackgroundColor' returns object of type '_SolidColor' + "BackgroundColor": (1650934627, 2, (9, 0), (), "BackgroundColor", '{D2D1665E-C1B9-4CA0-8AC9-529F6A3D9002}'), + "Build": (1114205284, 2, (8, 0), (), "Build", None), + "ColorSettings": (1129988974, 2, (8, 0), (), "ColorSettings", None), + "CurrentTool": (1666477932, 2, (8, 0), (), "CurrentTool", None), + "DisplayDialogs": (1096116556, 2, (3, 0), (), "DisplayDialogs", None), + # Method 'Documents' returns object of type 'Documents' + "Documents": (1685021557, 2, (9, 0), (), "Documents", '{662506C7-6AAE-4422-ACA4-C63627CB1868}'), + # Method 'Fonts' returns object of type 'TextFonts' + "Fonts": (1665560180, 2, (9, 0), (), "Fonts", '{BBCE52D6-5D4B-4691-99E3-62C174BD2855}'), + # Method 'ForegroundColor' returns object of type '_SolidColor' + "ForegroundColor": (1718043491, 2, (9, 0), (), "ForegroundColor", '{D2D1665E-C1B9-4CA0-8AC9-529F6A3D9002}'), + "FreeMemory": (1883655501, 2, (5, 0), (), "FreeMemory", None), + "Locale": (1818452332, 2, (8, 0), (), "Locale", None), + "MacintoshFileTypes": (1836344948, 2, (12, 0), (), "MacintoshFileTypes", None), + # Method 'MeasurementLog' returns object of type 'MeasurementLog' + "MeasurementLog": (1296838707, 2, (9, 0), (), "MeasurementLog", '{84ADBF06-8354-4B5C-9CB1-EA2565B66C7C}'), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + # Method 'Notifiers' returns object of type 'Notifiers' + "Notifiers": (1162752050, 2, (9, 0), (), "Notifiers", '{861C9290-2A0C-4614-8606-706B31BFD45B}'), + "NotifiersEnabled": (1162752054, 2, (11, 0), (), "NotifiersEnabled", None), + "Path": (1884320872, 2, (8, 0), (), "Path", None), + # Method 'Preferences' returns object of type 'Preferences' + "Preferences": (1884320358, 2, (9, 0), (), "Preferences", '{288BC58E-AB6A-467C-B244-D225349E3EB3}'), + "PreferencesFolder": (1886545516, 2, (8, 0), (), "PreferencesFolder", None), + "RecentFiles": (1919116908, 2, (12, 0), (), "RecentFiles", None), + "ScriptingBuildDate": (1935830116, 2, (8, 0), (), "ScriptingBuildDate", None), + "ScriptingVersion": (1884518003, 2, (8, 0), (), "ScriptingVersion", None), + "SystemInformation": (1400468297, 2, (8, 0), (), "SystemInformation", None), + "Version": (1986359923, 2, (8, 0), (), "Version", None), + "Visible": (1884640883, 2, (11, 0), (), "Visible", None), + "WinColorSettings": (1129988973, 2, (8, 0), (), "WinColorSettings", None), + "WindowsFileTypes": (2003723892, 2, (12, 0), (), "WindowsFileTypes", None), + } + _prop_map_put_ = { + "ActiveDocument": ((1883325539, LCID, 4, 0),()), + "BackgroundColor": ((1650934627, LCID, 4, 0),()), + "CurrentTool": ((1666477932, LCID, 4, 0),()), + "DisplayDialogs": ((1096116556, LCID, 4, 0),()), + "ForegroundColor": ((1718043491, LCID, 4, 0),()), + "NotifiersEnabled": ((1162752054, LCID, 4, 0),()), + "Visible": ((1884640883, LCID, 4, 0),()), + } + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _BMPSaveOptions(DispatchBaseClass): + 'Settings related to saving a BMP document' + CLSID = IID('{4D40BE2D-FE11-4060-B52A-DE31C837D51D}') + coclass_clsid = IID('{8E67AC07-6214-490B-A4FC-FD884E6FCDBA}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AlphaChannels": (1884504419, 2, (11, 0), (), "AlphaChannels", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Depth": (1145205613, 2, (3, 0), (), "Depth", None), + "FlipRowOrder": (1181766255, 2, (11, 0), (), "FlipRowOrder", None), + "OSType": (1884573523, 2, (3, 0), (), "OSType", None), + "RLECompression": (1884441669, 2, (11, 0), (), "RLECompression", None), + } + _prop_map_put_ = { + "AlphaChannels": ((1884504419, LCID, 4, 0),()), + "Depth": ((1145205613, LCID, 4, 0),()), + "FlipRowOrder": ((1181766255, LCID, 4, 0),()), + "OSType": ((1884573523, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "RLECompression": ((1884441669, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _BatchOptions(DispatchBaseClass): + 'options for the Batch command' + CLSID = IID('{B0D18870-EAC3-4D35-8612-6F734B3FA656}') + coclass_clsid = IID('{890D9FDC-DF16-43F6-8717-A5F3C7055E59}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Destination": (1112813622, 2, (3, 0), (), "Destination", None), + "DestinationFolder": (1112814391, 2, (8, 0), (), "DestinationFolder", None), + "ErrorFile": (1112813875, 2, (8, 0), (), "ErrorFile", None), + "FileNaming": (1112813624, 2, (12, 0), (), "FileNaming", None), + "MacintoshCompatible": (1112813873, 2, (11, 0), (), "MacintoshCompatible", None), + "OverrideOpen": (1112813619, 2, (11, 0), (), "OverrideOpen", None), + "OverrideSave": (1112813623, 2, (11, 0), (), "OverrideSave", None), + "StartingSerial": (1112813625, 2, (3, 0), (), "StartingSerial", None), + "SuppressOpen": (1112813620, 2, (11, 0), (), "SuppressOpen", None), + "SuppressProfile": (1112813621, 2, (11, 0), (), "SuppressProfile", None), + "UnixCompatible": (1112813874, 2, (11, 0), (), "UnixCompatible", None), + "WindowsCompatible": (1112813872, 2, (11, 0), (), "WindowsCompatible", None), + } + _prop_map_put_ = { + "Destination": ((1112813622, LCID, 4, 0),()), + "DestinationFolder": ((1112814391, LCID, 4, 0),()), + "ErrorFile": ((1112813875, LCID, 4, 0),()), + "FileNaming": ((1112813624, LCID, 4, 0),()), + "MacintoshCompatible": ((1112813873, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "OverrideOpen": ((1112813619, LCID, 4, 0),()), + "OverrideSave": ((1112813623, LCID, 4, 0),()), + "StartingSerial": ((1112813625, LCID, 4, 0),()), + "SuppressOpen": ((1112813620, LCID, 4, 0),()), + "SuppressProfile": ((1112813621, LCID, 4, 0),()), + "UnixCompatible": ((1112813874, LCID, 4, 0),()), + "WindowsCompatible": ((1112813872, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _BitmapConversionOptions(DispatchBaseClass): + 'Settings related to changing the document mode to Bitmap' + CLSID = IID('{643099A1-0B67-4920-9B14-E14BE8F63D5F}') + coclass_clsid = IID('{E159ED38-8580-4119-BB29-97615C72C08B}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "Angle": (1097754476, 2, (5, 0), (), "Angle", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Frequency": (1181836153, 2, (5, 0), (), "Frequency", None), + "Method": (1131826548, 2, (3, 0), (), "Method", None), + "PatternName": (1348554349, 2, (8, 0), (), "PatternName", None), + "Resolution": (1382380364, 2, (5, 0), (), "Resolution", None), + "Shape": (1399018344, 2, (3, 0), (), "Shape", None), + } + _prop_map_put_ = { + "Angle": ((1097754476, LCID, 4, 0),()), + "Frequency": ((1181836153, LCID, 4, 0),()), + "Method": ((1131826548, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "PatternName": ((1348554349, LCID, 4, 0),()), + "Resolution": ((1382380364, LCID, 4, 0),()), + "Shape": ((1399018344, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _CMYKColor(DispatchBaseClass): + 'A CMYK color specification' + CLSID = IID('{29C13F49-BCEF-4FE2-BFC7-6F03B82B726F}') + coclass_clsid = IID('{D8621099-AF41-4E0F-807A-C7C93825B1EC}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Black": (1883458422, 2, (5, 0), (), "Black", None), + "Cyan": (1883456374, 2, (5, 0), (), "Cyan", None), + "Magenta": (1883458934, 2, (5, 0), (), "Magenta", None), + "Yellow": (1883462006, 2, (5, 0), (), "Yellow", None), + } + _prop_map_put_ = { + "Black": ((1883458422, LCID, 4, 0),()), + "Cyan": ((1883456374, LCID, 4, 0),()), + "Magenta": ((1883458934, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Yellow": ((1883462006, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _CameraRAWOpenOptions(DispatchBaseClass): + 'Settings related to opening a camera RAW document' + CLSID = IID('{65D1B010-0D87-481C-B2E6-22EFB5A54129}') + coclass_clsid = IID('{7AAEBA41-590E-45B5-82BE-C8439ED48D1A}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "BitsPerChannel": (1145201512, 2, (3, 0), (), "BitsPerChannel", None), + "BlueHue": (1129460530, 2, (3, 0), (), "BlueHue", None), + "BlueSaturation": (1129460531, 2, (3, 0), (), "BlueSaturation", None), + "Brightness": (1114141806, 2, (3, 0), (), "Brightness", None), + "ChromaticAberrationBY": (1129460276, 2, (3, 0), (), "ChromaticAberrationBY", None), + "ChromaticAberrationRC": (1129460275, 2, (3, 0), (), "ChromaticAberrationRC", None), + "ColorNoiseReduction": (1129460274, 2, (3, 0), (), "ColorNoiseReduction", None), + "ColorSpace": (1131172720, 2, (3, 0), (), "ColorSpace", None), + "Contrast": (1129460025, 2, (3, 0), (), "Contrast", None), + "Exposure": (1129460023, 2, (5, 0), (), "Exposure", None), + "GreenHue": (1129460528, 2, (3, 0), (), "GreenHue", None), + "GreenSaturation": (1129460529, 2, (3, 0), (), "GreenSaturation", None), + "LuminanceSmoothing": (1129460273, 2, (3, 0), (), "LuminanceSmoothing", None), + "RedHue": (1129460280, 2, (3, 0), (), "RedHue", None), + "RedSaturation": (1129460281, 2, (3, 0), (), "RedSaturation", None), + "Resolution": (1382380364, 2, (5, 0), (), "Resolution", None), + "Saturation": (1884512628, 2, (3, 0), (), "Saturation", None), + "Settings": (1884320358, 2, (3, 0), (), "Settings", None), + "ShadowTint": (1129460279, 2, (3, 0), (), "ShadowTint", None), + "Shadows": (1094004785, 2, (3, 0), (), "Shadows", None), + "Sharpness": (1129460272, 2, (3, 0), (), "Sharpness", None), + "Size": (1886679930, 2, (3, 0), (), "Size", None), + "Temperature": (1129460021, 2, (3, 0), (), "Temperature", None), + "Tint": (1129460022, 2, (3, 0), (), "Tint", None), + "VignettingAmount": (1129460277, 2, (3, 0), (), "VignettingAmount", None), + "VignettingMidpoint": (1129460278, 2, (3, 0), (), "VignettingMidpoint", None), + "WhiteBalance": (1129460020, 2, (3, 0), (), "WhiteBalance", None), + } + _prop_map_put_ = { + "BitsPerChannel": ((1145201512, LCID, 4, 0),()), + "BlueHue": ((1129460530, LCID, 4, 0),()), + "BlueSaturation": ((1129460531, LCID, 4, 0),()), + "Brightness": ((1114141806, LCID, 4, 0),()), + "ChromaticAberrationBY": ((1129460276, LCID, 4, 0),()), + "ChromaticAberrationRC": ((1129460275, LCID, 4, 0),()), + "ColorNoiseReduction": ((1129460274, LCID, 4, 0),()), + "ColorSpace": ((1131172720, LCID, 4, 0),()), + "Contrast": ((1129460025, LCID, 4, 0),()), + "Exposure": ((1129460023, LCID, 4, 0),()), + "GreenHue": ((1129460528, LCID, 4, 0),()), + "GreenSaturation": ((1129460529, LCID, 4, 0),()), + "LuminanceSmoothing": ((1129460273, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "RedHue": ((1129460280, LCID, 4, 0),()), + "RedSaturation": ((1129460281, LCID, 4, 0),()), + "Resolution": ((1382380364, LCID, 4, 0),()), + "Saturation": ((1884512628, LCID, 4, 0),()), + "Settings": ((1884320358, LCID, 4, 0),()), + "ShadowTint": ((1129460279, LCID, 4, 0),()), + "Shadows": ((1094004785, LCID, 4, 0),()), + "Sharpness": ((1129460272, LCID, 4, 0),()), + "Size": ((1886679930, LCID, 4, 0),()), + "Temperature": ((1129460021, LCID, 4, 0),()), + "Tint": ((1129460022, LCID, 4, 0),()), + "VignettingAmount": ((1129460277, LCID, 4, 0),()), + "VignettingMidpoint": ((1129460278, LCID, 4, 0),()), + "WhiteBalance": ((1129460020, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _ContactSheetOptions(DispatchBaseClass): + 'Options for the Contact Sheet command' + CLSID = IID('{064BBE94-396D-4B25-9071-AC5B14D0487F}') + coclass_clsid = IID('{3B0F2D60-2770-4933-A1F9-A7FF749BD701}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AcrossFirst": (1129525298, 2, (11, 0), (), "AcrossFirst", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "BestFit": (1129525301, 2, (11, 0), (), "BestFit", None), + "Caption": (1147744305, 2, (11, 0), (), "Caption", None), + "ColumnCount": (1346844471, 2, (3, 0), (), "ColumnCount", None), + "Flatten": (1129525300, 2, (11, 0), (), "Flatten", None), + "Font": (1665560180, 2, (3, 0), (), "Font", None), + "FontSize": (1346844468, 2, (3, 0), (), "FontSize", None), + "Height": (1214736500, 2, (3, 0), (), "Height", None), + "Horizontal": (1215451002, 2, (3, 0), (), "Horizontal", None), + "Mode": (1330472037, 2, (3, 0), (), "Mode", None), + "Resolution": (1382380364, 2, (5, 0), (), "Resolution", None), + "RowCount": (1346844472, 2, (3, 0), (), "RowCount", None), + "UseAutoSpacing": (1129525299, 2, (11, 0), (), "UseAutoSpacing", None), + "Vertical": (1450463098, 2, (3, 0), (), "Vertical", None), + "Width": (1466201192, 2, (3, 0), (), "Width", None), + } + _prop_map_put_ = { + "AcrossFirst": ((1129525298, LCID, 4, 0),()), + "BestFit": ((1129525301, LCID, 4, 0),()), + "Caption": ((1147744305, LCID, 4, 0),()), + "ColumnCount": ((1346844471, LCID, 4, 0),()), + "Flatten": ((1129525300, LCID, 4, 0),()), + "Font": ((1665560180, LCID, 4, 0),()), + "FontSize": ((1346844468, LCID, 4, 0),()), + "Height": ((1214736500, LCID, 4, 0),()), + "Horizontal": ((1215451002, LCID, 4, 0),()), + "Mode": ((1330472037, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Resolution": ((1382380364, LCID, 4, 0),()), + "RowCount": ((1346844472, LCID, 4, 0),()), + "UseAutoSpacing": ((1129525299, LCID, 4, 0),()), + "Vertical": ((1450463098, LCID, 4, 0),()), + "Width": ((1466201192, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _DCS1_SaveOptions(DispatchBaseClass): + 'Settings related to saving a Photoshop DCS 1.0 document' + CLSID = IID('{94C4A25A-2C91-4514-A783-3173AFC48430}') + coclass_clsid = IID('{0A985EC7-5190-4AC2-9564-8C12B86106A0}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "DCS": (1145271139, 2, (3, 0), (), "DCS", None), + "EmbedColorProfile": (1884505424, 2, (11, 0), (), "EmbedColorProfile", None), + "Encoding": (1164854116, 2, (3, 0), (), "Encoding", None), + "HalftoneScreen": (1214665838, 2, (11, 0), (), "HalftoneScreen", None), + "Interpolation": (1231898960, 2, (11, 0), (), "Interpolation", None), + "Preview": (1349997635, 2, (3, 0), (), "Preview", None), + "TransferFunction": (1416849010, 2, (11, 0), (), "TransferFunction", None), + "VectorData": (1449346164, 2, (11, 0), (), "VectorData", None), + } + _prop_map_put_ = { + "DCS": ((1145271139, LCID, 4, 0),()), + "EmbedColorProfile": ((1884505424, LCID, 4, 0),()), + "Encoding": ((1164854116, LCID, 4, 0),()), + "HalftoneScreen": ((1214665838, LCID, 4, 0),()), + "Interpolation": ((1231898960, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Preview": ((1349997635, LCID, 4, 0),()), + "TransferFunction": ((1416849010, LCID, 4, 0),()), + "VectorData": ((1449346164, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _DCS2_SaveOptions(DispatchBaseClass): + 'Settings related to saving a Photoshop DCS 2.0 document' + CLSID = IID('{F1AF982E-2BBD-406D-9FD6-CA6C898A7FFE}') + coclass_clsid = IID('{243FD2FF-E0A6-4925-B3F9-445E6A0B9CE2}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "DCS": (1145271139, 2, (3, 0), (), "DCS", None), + "EmbedColorProfile": (1884505424, 2, (11, 0), (), "EmbedColorProfile", None), + "Encoding": (1164854116, 2, (3, 0), (), "Encoding", None), + "HalftoneScreen": (1214665838, 2, (11, 0), (), "HalftoneScreen", None), + "Interpolation": (1231898960, 2, (11, 0), (), "Interpolation", None), + "MultiFileDCS": (1145269606, 2, (11, 0), (), "MultiFileDCS", None), + "Preview": (1349997635, 2, (3, 0), (), "Preview", None), + "SpotColors": (1884509043, 2, (11, 0), (), "SpotColors", None), + "TransferFunction": (1416849010, 2, (11, 0), (), "TransferFunction", None), + "VectorData": (1449346164, 2, (11, 0), (), "VectorData", None), + } + _prop_map_put_ = { + "DCS": ((1145271139, LCID, 4, 0),()), + "EmbedColorProfile": ((1884505424, LCID, 4, 0),()), + "Encoding": ((1164854116, LCID, 4, 0),()), + "HalftoneScreen": ((1214665838, LCID, 4, 0),()), + "Interpolation": ((1231898960, LCID, 4, 0),()), + "MultiFileDCS": ((1145269606, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Preview": ((1349997635, LCID, 4, 0),()), + "SpotColors": ((1884509043, LCID, 4, 0),()), + "TransferFunction": ((1416849010, LCID, 4, 0),()), + "VectorData": ((1449346164, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _DICOMOpenOptions(DispatchBaseClass): + 'Settings related to opening a DICOM document' + CLSID = IID('{EE8364D9-B811-4C7D-A3A8-97C4EBFAB83A}') + coclass_clsid = IID('{D9156C17-3E0D-426E-B21C-BB4E3CA8A170}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "Anonymize": (1097750893, 2, (11, 0), (), "Anonymize", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Columns": (1131375693, 2, (3, 0), (), "Columns", None), + "Reverse": (1383494469, 2, (11, 0), (), "Reverse", None), + "Rows": (1383028595, 2, (3, 0), (), "Rows", None), + "ShowOverlays": (1333152889, 2, (11, 0), (), "ShowOverlays", None), + "WindowLevel": (1466721622, 2, (3, 0), (), "WindowLevel", None), + "WindowWidth": (1465346388, 2, (3, 0), (), "WindowWidth", None), + } + _prop_map_put_ = { + "Anonymize": ((1097750893, LCID, 4, 0),()), + "Columns": ((1131375693, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Reverse": ((1383494469, LCID, 4, 0),()), + "Rows": ((1383028595, LCID, 4, 0),()), + "ShowOverlays": ((1333152889, LCID, 4, 0),()), + "WindowLevel": ((1466721622, LCID, 4, 0),()), + "WindowWidth": ((1465346388, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _EPSOpenOptions(DispatchBaseClass): + 'Settings related to opening a generic EPS document' + CLSID = IID('{F715C957-54CE-4E55-9856-591D4CD082FD}') + coclass_clsid = IID('{97B95749-BB17-44C0-B79F-4D8D97578C83}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AntiAlias": (1097744748, 2, (11, 0), (), "AntiAlias", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "ConstrainProportions": (1129345616, 2, (11, 0), (), "ConstrainProportions", None), + "Height": (1214736500, 2, (5, 0), (), "Height", None), + "Mode": (1330472037, 2, (3, 0), (), "Mode", None), + "Resolution": (1382380364, 2, (5, 0), (), "Resolution", None), + "Width": (1466201192, 2, (5, 0), (), "Width", None), + } + _prop_map_put_ = { + "AntiAlias": ((1097744748, LCID, 4, 0),()), + "ConstrainProportions": ((1129345616, LCID, 4, 0),()), + "Height": ((1214736500, LCID, 4, 0),()), + "Mode": ((1330472037, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Resolution": ((1382380364, LCID, 4, 0),()), + "Width": ((1466201192, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _EPSSaveOptions(DispatchBaseClass): + 'Settings related to saving an EPS document' + CLSID = IID('{D54491EF-6F09-4DE3-B49A-D57EDB2F40B8}') + coclass_clsid = IID('{FDB3DC93-6FE8-40B9-9922-40D214457F5C}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "EmbedColorProfile": (1884505424, 2, (11, 0), (), "EmbedColorProfile", None), + "Encoding": (1164854116, 2, (3, 0), (), "Encoding", None), + "HalftoneScreen": (1214665838, 2, (11, 0), (), "HalftoneScreen", None), + "Interpolation": (1231898960, 2, (11, 0), (), "Interpolation", None), + "PSColorManagement": (1349731149, 2, (11, 0), (), "PSColorManagement", None), + "Preview": (1349997635, 2, (3, 0), (), "Preview", None), + "TransferFunction": (1416849010, 2, (11, 0), (), "TransferFunction", None), + "TransparentWhites": (1416648552, 2, (11, 0), (), "TransparentWhites", None), + "VectorData": (1449346164, 2, (11, 0), (), "VectorData", None), + } + _prop_map_put_ = { + "EmbedColorProfile": ((1884505424, LCID, 4, 0),()), + "Encoding": ((1164854116, LCID, 4, 0),()), + "HalftoneScreen": ((1214665838, LCID, 4, 0),()), + "Interpolation": ((1231898960, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "PSColorManagement": ((1349731149, LCID, 4, 0),()), + "Preview": ((1349997635, LCID, 4, 0),()), + "TransferFunction": ((1416849010, LCID, 4, 0),()), + "TransparentWhites": ((1416648552, LCID, 4, 0),()), + "VectorData": ((1449346164, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _ExportOptionsIllustrator(DispatchBaseClass): + 'Settings related to exporting Illustrator paths' + CLSID = IID('{FC08B435-5F19-49DF-ABE7-ADCE9F0729FF}') + coclass_clsid = IID('{ADD7C618-7F07-4A45-B1B7-5A253C5577F3}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Path": (1416056948, 2, (3, 0), (), "Path", None), + "PathName": (1414557293, 2, (8, 0), (), "PathName", None), + } + _prop_map_put_ = { + "ObjectValue": ((0, LCID, 4, 0),()), + "Path": ((1416056948, LCID, 4, 0),()), + "PathName": ((1414557293, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _ExportOptionsSaveForWeb(DispatchBaseClass): + 'Settings related to exporting Save For Web files' + CLSID = IID('{91A3D47B-9579-4013-9206-7B6859439DA2}') + coclass_clsid = IID('{351868F2-EC16-4F60-AE21-8F7A9B0BFD38}') + + def SetMatteColor(self, arg0=defaultUnnamedArg): + 'defines colors to blend transparent pixels against' + return self._oleobj_.InvokeTypes(1299477605, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Blur": (1177563185, 2, (5, 0), (), "Blur", None), + "ColorReduction": (1395939124, 2, (3, 0), (), "ColorReduction", None), + "Colors": (1884308302, 2, (3, 0), (), "Colors", None), + "Dither": (1148474480, 2, (3, 0), (), "Dither", None), + "DitherAmount": (1148469613, 2, (3, 0), (), "DitherAmount", None), + "Format": (1718383728, 2, (3, 0), (), "Format", None), + "IncludeProfile": (1395939129, 2, (11, 0), (), "IncludeProfile", None), + "Interlaced": (1383550834, 2, (11, 0), (), "Interlaced", None), + "Lossy": (1395939123, 2, (3, 0), (), "Lossy", None), + # Method 'MatteColor' returns object of type '_RGBColor' + "MatteColor": (1299477605, 2, (9, 0), (), "MatteColor", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + "Optimized": (1395939128, 2, (11, 0), (), "Optimized", None), + "PNG8": (1395939122, 2, (11, 0), (), "PNG8", None), + "Quality": (1366062201, 2, (3, 0), (), "Quality", None), + "Transparency": (1416786019, 2, (11, 0), (), "Transparency", None), + "TransparencyAmount": (1395939126, 2, (3, 0), (), "TransparencyAmount", None), + "TransparencyDither": (1395939125, 2, (3, 0), (), "TransparencyDither", None), + "WebSnap": (1395939127, 2, (3, 0), (), "WebSnap", None), + } + _prop_map_put_ = { + "Blur": ((1177563185, LCID, 4, 0),()), + "ColorReduction": ((1395939124, LCID, 4, 0),()), + "Colors": ((1884308302, LCID, 4, 0),()), + "Dither": ((1148474480, LCID, 4, 0),()), + "DitherAmount": ((1148469613, LCID, 4, 0),()), + "Format": ((1718383728, LCID, 4, 0),()), + "IncludeProfile": ((1395939129, LCID, 4, 0),()), + "Interlaced": ((1383550834, LCID, 4, 0),()), + "Lossy": ((1395939123, LCID, 4, 0),()), + "MatteColor": ((1299477605, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Optimized": ((1395939128, LCID, 4, 0),()), + "PNG8": ((1395939122, LCID, 4, 0),()), + "Quality": ((1366062201, LCID, 4, 0),()), + "Transparency": ((1416786019, LCID, 4, 0),()), + "TransparencyAmount": ((1395939126, LCID, 4, 0),()), + "TransparencyDither": ((1395939125, LCID, 4, 0),()), + "WebSnap": ((1395939127, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _GIFSaveOptions(DispatchBaseClass): + 'Settings related to saving a GIF document' + CLSID = IID('{89417281-E1AF-4800-B82A-9F37ED0478EF}') + coclass_clsid = IID('{08FAD7C2-1393-4572-8764-93908DD5D592}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Colors": (1884308302, 2, (3, 0), (), "Colors", None), + "Dither": (1148474480, 2, (3, 0), (), "Dither", None), + "DitherAmount": (1148469613, 2, (3, 0), (), "DitherAmount", None), + "Forced": (1346790252, 2, (3, 0), (), "Forced", None), + "Interlaced": (1383550834, 2, (11, 0), (), "Interlaced", None), + "Matte": (1299477605, 2, (3, 0), (), "Matte", None), + "Palette": (1347447924, 2, (3, 0), (), "Palette", None), + "PreserveExactColors": (1146119544, 2, (11, 0), (), "PreserveExactColors", None), + "Transparency": (1416786019, 2, (11, 0), (), "Transparency", None), + } + _prop_map_put_ = { + "Colors": ((1884308302, LCID, 4, 0),()), + "Dither": ((1148474480, LCID, 4, 0),()), + "DitherAmount": ((1148469613, LCID, 4, 0),()), + "Forced": ((1346790252, LCID, 4, 0),()), + "Interlaced": ((1383550834, LCID, 4, 0),()), + "Matte": ((1299477605, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Palette": ((1347447924, LCID, 4, 0),()), + "PreserveExactColors": ((1146119544, LCID, 4, 0),()), + "Transparency": ((1416786019, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _GalleryBannerOptions(DispatchBaseClass): + 'Options for the web photo gallery banner options' + CLSID = IID('{5F168D2A-F9EA-4866-8C55-4875E0940622}') + coclass_clsid = IID('{4273D5A4-6142-47EA-BA50-7D66805528EF}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "ContactInfo": (1346843953, 2, (8, 0), (), "ContactInfo", None), + "Date": (1346843954, 2, (8, 0), (), "Date", None), + "Font": (1665560180, 2, (3, 0), (), "Font", None), + "FontSize": (1346844468, 2, (3, 0), (), "FontSize", None), + "Photographer": (1346843952, 2, (8, 0), (), "Photographer", None), + "SiteName": (1346843705, 2, (8, 0), (), "SiteName", None), + } + _prop_map_put_ = { + "ContactInfo": ((1346843953, LCID, 4, 0),()), + "Date": ((1346843954, LCID, 4, 0),()), + "Font": ((1665560180, LCID, 4, 0),()), + "FontSize": ((1346844468, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Photographer": ((1346843952, LCID, 4, 0),()), + "SiteName": ((1346843705, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _GalleryCustomColorOptions(DispatchBaseClass): + 'Options for the web photo gallery colors' + CLSID = IID('{2EB2592D-F02D-4117-A22C-26E5CDFAEEE2}') + coclass_clsid = IID('{D06CC62C-3B85-4E6D-95F5-3DAA872A7C16}') + + def SetActiveLinkColor(self, arg0=defaultUnnamedArg): + 'active link color' + return self._oleobj_.InvokeTypes(1346844723, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetBackgroundColor(self, arg0=defaultUnnamedArg): + 'background color' + return self._oleobj_.InvokeTypes(1114063730, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetBannerColor(self, arg0=defaultUnnamedArg): + 'banner color' + return self._oleobj_.InvokeTypes(1346844721, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetLinkColor(self, arg0=defaultUnnamedArg): + 'link color' + return self._oleobj_.InvokeTypes(1346844724, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetTextColor(self, arg0=defaultUnnamedArg): + 'text color' + return self._oleobj_.InvokeTypes(1346844722, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetVisitedLinkColor(self, arg0=defaultUnnamedArg): + 'visited link color' + return self._oleobj_.InvokeTypes(1346844725, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'ActiveLinkColor' returns object of type '_RGBColor' + "ActiveLinkColor": (1346844723, 2, (9, 0), (), "ActiveLinkColor", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + # Method 'BackgroundColor' returns object of type '_RGBColor' + "BackgroundColor": (1114063730, 2, (9, 0), (), "BackgroundColor", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + # Method 'BannerColor' returns object of type '_RGBColor' + "BannerColor": (1346844721, 2, (9, 0), (), "BannerColor", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + # Method 'LinkColor' returns object of type '_RGBColor' + "LinkColor": (1346844724, 2, (9, 0), (), "LinkColor", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + # Method 'TextColor' returns object of type '_RGBColor' + "TextColor": (1346844722, 2, (9, 0), (), "TextColor", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + # Method 'VisitedLinkColor' returns object of type '_RGBColor' + "VisitedLinkColor": (1346844725, 2, (9, 0), (), "VisitedLinkColor", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + } + _prop_map_put_ = { + "ActiveLinkColor": ((1346844723, LCID, 4, 0),()), + "BackgroundColor": ((1114063730, LCID, 4, 0),()), + "BannerColor": ((1346844721, LCID, 4, 0),()), + "LinkColor": ((1346844724, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "TextColor": ((1346844722, LCID, 4, 0),()), + "VisitedLinkColor": ((1346844725, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _GalleryImagesOptions(DispatchBaseClass): + 'Options for the web photo gallery images' + CLSID = IID('{46AB9A1D-1B32-4C59-8142-B223ECCF1F74}') + coclass_clsid = IID('{27BD8440-38D8-4310-9198-9B718CE44FCA}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Border": (1346844208, 2, (3, 0), (), "Border", None), + "Caption": (1147744305, 2, (11, 0), (), "Caption", None), + "Dimension": (1346843959, 2, (3, 0), (), "Dimension", None), + "Font": (1665560180, 2, (3, 0), (), "Font", None), + "FontSize": (1346844468, 2, (3, 0), (), "FontSize", None), + "ImageQuality": (1346843961, 2, (3, 0), (), "ImageQuality", None), + "IncludeCopyright": (1346844213, 2, (11, 0), (), "IncludeCopyright", None), + "IncludeCredits": (1346844211, 2, (11, 0), (), "IncludeCredits", None), + "IncludeFilename": (1346844209, 2, (11, 0), (), "IncludeFilename", None), + "IncludeTitle": (1346844212, 2, (11, 0), (), "IncludeTitle", None), + "NumericLinks": (1346843957, 2, (11, 0), (), "NumericLinks", None), + "ResizeConstraint": (1346843960, 2, (3, 0), (), "ResizeConstraint", None), + "ResizeImages": (1346843958, 2, (11, 0), (), "ResizeImages", None), + } + _prop_map_put_ = { + "Border": ((1346844208, LCID, 4, 0),()), + "Caption": ((1147744305, LCID, 4, 0),()), + "Dimension": ((1346843959, LCID, 4, 0),()), + "Font": ((1665560180, LCID, 4, 0),()), + "FontSize": ((1346844468, LCID, 4, 0),()), + "ImageQuality": ((1346843961, LCID, 4, 0),()), + "IncludeCopyright": ((1346844213, LCID, 4, 0),()), + "IncludeCredits": ((1346844211, LCID, 4, 0),()), + "IncludeFilename": ((1346844209, LCID, 4, 0),()), + "IncludeTitle": ((1346844212, LCID, 4, 0),()), + "NumericLinks": ((1346843957, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "ResizeConstraint": ((1346843960, LCID, 4, 0),()), + "ResizeImages": ((1346843958, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _GalleryOptions(DispatchBaseClass): + 'Options for the web photo gallery command' + CLSID = IID('{C2783141-B50D-4F0C-9E2E-BF76EA8A4E60}') + coclass_clsid = IID('{12C541DD-665A-4C33-AE0C-1838D14FF83C}') + + def SetBannerOptions(self, arg0=defaultUnnamedArg): + 'options related to banner settings' + return self._oleobj_.InvokeTypes(1346843956, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetCustomColorOptions(self, arg0=defaultUnnamedArg): + 'options related to custom color settings' + return self._oleobj_.InvokeTypes(1346843703, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetImagesOptions(self, arg0=defaultUnnamedArg): + 'options related to images settings' + return self._oleobj_.InvokeTypes(1346843701, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetSecurityOptions(self, arg0=defaultUnnamedArg): + 'options related to security settings' + return self._oleobj_.InvokeTypes(1346843704, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetThumbnailOptions(self, arg0=defaultUnnamedArg): + 'options related to thumbnail settings' + return self._oleobj_.InvokeTypes(1346843702, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AddSizeAttributes": (1346843699, 2, (11, 0), (), "AddSizeAttributes", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + # Method 'BannerOptions' returns object of type '_GalleryBannerOptions' + "BannerOptions": (1346843956, 2, (9, 0), (), "BannerOptions", '{5F168D2A-F9EA-4866-8C55-4875E0940622}'), + # Method 'CustomColorOptions' returns object of type '_GalleryCustomColorOptions' + "CustomColorOptions": (1346843703, 2, (9, 0), (), "CustomColorOptions", '{2EB2592D-F02D-4117-A22C-26E5CDFAEEE2}'), + "EmailAddress": (1346843449, 2, (8, 0), (), "EmailAddress", None), + # Method 'ImagesOptions' returns object of type '_GalleryImagesOptions' + "ImagesOptions": (1346843701, 2, (9, 0), (), "ImagesOptions", '{46AB9A1D-1B32-4C59-8142-B223ECCF1F74}'), + "IncludeSubFolders": (1346843698, 2, (11, 0), (), "IncludeSubFolders", None), + "LayoutStyle": (1346843448, 2, (8, 0), (), "LayoutStyle", None), + "PreserveAllMetadata": (1346843955, 2, (11, 0), (), "PreserveAllMetadata", None), + # Method 'SecurityOptions' returns object of type '_GallerySecurityOptions' + "SecurityOptions": (1346843704, 2, (9, 0), (), "SecurityOptions", '{95D69B63-B319-44D3-8307-C988E96E7E58}'), + # Method 'ThumbnailOptions' returns object of type '_GalleryThumbnailOptions' + "ThumbnailOptions": (1346843702, 2, (9, 0), (), "ThumbnailOptions", '{46DFAF34-75E0-470E-8217-B0C763137DD0}'), + "UseShortExtension": (1346843696, 2, (11, 0), (), "UseShortExtension", None), + "UseUTF8Encoding": (1346843697, 2, (11, 0), (), "UseUTF8Encoding", None), + } + _prop_map_put_ = { + "AddSizeAttributes": ((1346843699, LCID, 4, 0),()), + "BannerOptions": ((1346843956, LCID, 4, 0),()), + "CustomColorOptions": ((1346843703, LCID, 4, 0),()), + "EmailAddress": ((1346843449, LCID, 4, 0),()), + "ImagesOptions": ((1346843701, LCID, 4, 0),()), + "IncludeSubFolders": ((1346843698, LCID, 4, 0),()), + "LayoutStyle": ((1346843448, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "PreserveAllMetadata": ((1346843955, LCID, 4, 0),()), + "SecurityOptions": ((1346843704, LCID, 4, 0),()), + "ThumbnailOptions": ((1346843702, LCID, 4, 0),()), + "UseShortExtension": ((1346843696, LCID, 4, 0),()), + "UseUTF8Encoding": ((1346843697, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _GallerySecurityOptions(DispatchBaseClass): + 'Options for the web photo gallery security' + CLSID = IID('{95D69B63-B319-44D3-8307-C988E96E7E58}') + coclass_clsid = IID('{DC0839A8-9068-4470-98CB-A1A9DA399053}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetTextColor(self, arg0=defaultUnnamedArg): + 'web page security text color' + return self._oleobj_.InvokeTypes(1346844722, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Content": (1346844726, 2, (3, 0), (), "Content", None), + "Font": (1665560180, 2, (3, 0), (), "Font", None), + "FontSize": (1346844468, 2, (3, 0), (), "FontSize", None), + "Opacity": (1332765556, 2, (3, 0), (), "Opacity", None), + "Text": (1346844727, 2, (8, 0), (), "Text", None), + # Method 'TextColor' returns object of type '_RGBColor' + "TextColor": (1346844722, 2, (9, 0), (), "TextColor", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + "TextPosition": (1346844979, 2, (3, 0), (), "TextPosition", None), + "TextRotate": (1346844980, 2, (3, 0), (), "TextRotate", None), + } + _prop_map_put_ = { + "Content": ((1346844726, LCID, 4, 0),()), + "Font": ((1665560180, LCID, 4, 0),()), + "FontSize": ((1346844468, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Opacity": ((1332765556, LCID, 4, 0),()), + "Text": ((1346844727, LCID, 4, 0),()), + "TextColor": ((1346844722, LCID, 4, 0),()), + "TextPosition": ((1346844979, LCID, 4, 0),()), + "TextRotate": ((1346844980, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _GalleryThumbnailOptions(DispatchBaseClass): + 'Options for the web photo gallery thumbnail creation' + CLSID = IID('{46DFAF34-75E0-470E-8217-B0C763137DD0}') + coclass_clsid = IID('{E2499E27-15F2-4FAA-A219-A2C364B3B0CC}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Border": (1346844208, 2, (3, 0), (), "Border", None), + "Caption": (1147744305, 2, (11, 0), (), "Caption", None), + "ColumnCount": (1346844471, 2, (3, 0), (), "ColumnCount", None), + "Dimension": (1346843959, 2, (3, 0), (), "Dimension", None), + "Font": (1665560180, 2, (3, 0), (), "Font", None), + "FontSize": (1346844468, 2, (3, 0), (), "FontSize", None), + "IncludeCopyright": (1346844213, 2, (11, 0), (), "IncludeCopyright", None), + "IncludeCredits": (1346844211, 2, (11, 0), (), "IncludeCredits", None), + "IncludeFilename": (1346844209, 2, (11, 0), (), "IncludeFilename", None), + "IncludeTitle": (1346844212, 2, (11, 0), (), "IncludeTitle", None), + "RowCount": (1346844472, 2, (3, 0), (), "RowCount", None), + "Size": (1886679930, 2, (3, 0), (), "Size", None), + } + _prop_map_put_ = { + "Border": ((1346844208, LCID, 4, 0),()), + "Caption": ((1147744305, LCID, 4, 0),()), + "ColumnCount": ((1346844471, LCID, 4, 0),()), + "Dimension": ((1346843959, LCID, 4, 0),()), + "Font": ((1665560180, LCID, 4, 0),()), + "FontSize": ((1346844468, LCID, 4, 0),()), + "IncludeCopyright": ((1346844213, LCID, 4, 0),()), + "IncludeCredits": ((1346844211, LCID, 4, 0),()), + "IncludeFilename": ((1346844209, LCID, 4, 0),()), + "IncludeTitle": ((1346844212, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "RowCount": ((1346844472, LCID, 4, 0),()), + "Size": ((1886679930, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _GrayColor(DispatchBaseClass): + 'A gray color specification' + CLSID = IID('{1B28B8CD-7578-415F-AC67-DC22A69F4C07}') + coclass_clsid = IID('{2653E14D-985B-43A0-AFC4-D7295CABA55C}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Gray": (1883730550, 2, (5, 0), (), "Gray", None), + } + _prop_map_put_ = { + "Gray": ((1883730550, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _HSBColor(DispatchBaseClass): + 'An HSB color specification' + CLSID = IID('{F91F9C5B-AC34-45B7-AFF2-871D9DD2E8EC}') + coclass_clsid = IID('{4F20C931-5B67-4EA8-9898-5EC1DE95AD26}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Brightness": (1114141806, 2, (5, 0), (), "Brightness", None), + "Hue": (1883796837, 2, (5, 0), (), "Hue", None), + "Saturation": (1884512628, 2, (5, 0), (), "Saturation", None), + } + _prop_map_put_ = { + "Brightness": ((1114141806, LCID, 4, 0),()), + "Hue": ((1883796837, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Saturation": ((1884512628, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _IndexedConversionOptions(DispatchBaseClass): + 'Settings related to changing the document mode to Indexed' + CLSID = IID('{22D0B851-E811-40E2-9A79-E84EA602C9F1}') + coclass_clsid = IID('{11A0CB09-7997-4902-B4DD-7FCFB260C430}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Colors": (1884308302, 2, (3, 0), (), "Colors", None), + "Dither": (1148474480, 2, (3, 0), (), "Dither", None), + "DitherAmount": (1148469613, 2, (3, 0), (), "DitherAmount", None), + "Forced": (1346790252, 2, (3, 0), (), "Forced", None), + "Matte": (1299477605, 2, (3, 0), (), "Matte", None), + "Palette": (1347447924, 2, (3, 0), (), "Palette", None), + "PreserveExactColors": (1146119544, 2, (11, 0), (), "PreserveExactColors", None), + "Transparency": (1416786019, 2, (11, 0), (), "Transparency", None), + } + _prop_map_put_ = { + "Colors": ((1884308302, LCID, 4, 0),()), + "Dither": ((1148474480, LCID, 4, 0),()), + "DitherAmount": ((1148469613, LCID, 4, 0),()), + "Forced": ((1346790252, LCID, 4, 0),()), + "Matte": ((1299477605, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Palette": ((1347447924, LCID, 4, 0),()), + "PreserveExactColors": ((1146119544, LCID, 4, 0),()), + "Transparency": ((1416786019, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _JPEGSaveOptions(DispatchBaseClass): + 'Settings related to saving a JPEG document' + CLSID = IID('{5148663B-F632-4AB0-9484-2DBC197CEA82}') + coclass_clsid = IID('{CFF59FC9-7652-411F-9B2A-83B33C39164F}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "EmbedColorProfile": (1884505424, 2, (11, 0), (), "EmbedColorProfile", None), + "FormatOptions": (1246777200, 2, (3, 0), (), "FormatOptions", None), + "Matte": (1299477605, 2, (3, 0), (), "Matte", None), + "Quality": (1366062201, 2, (3, 0), (), "Quality", None), + "Scans": (1399025267, 2, (3, 0), (), "Scans", None), + } + _prop_map_put_ = { + "EmbedColorProfile": ((1884505424, LCID, 4, 0),()), + "FormatOptions": ((1246777200, LCID, 4, 0),()), + "Matte": ((1299477605, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Quality": ((1366062201, LCID, 4, 0),()), + "Scans": ((1399025267, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _LabColor(DispatchBaseClass): + 'An Lab color specification' + CLSID = IID('{F4D7F5C2-37DB-4DF7-8A7D-528902056596}') + coclass_clsid = IID('{2A98CA9D-5C16-4097-9049-29E2FB27862C}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "A": (1884054113, 2, (5, 0), (), "A", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "B": (1884054114, 2, (5, 0), (), "B", None), + "L": (1884054092, 2, (5, 0), (), "L", None), + } + _prop_map_put_ = { + "A": ((1884054113, LCID, 4, 0),()), + "B": ((1884054114, LCID, 4, 0),()), + "L": ((1884054092, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _NoColor(DispatchBaseClass): + 'represents a missing color' + CLSID = IID('{750824C6-C347-4CDB-AA96-8ABA1EBDF9EA}') + coclass_clsid = IID('{5A90DD6C-60F2-4A1E-88EB-45E7841683D1}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + } + _prop_map_put_ = { + "ObjectValue": ((0, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _PDFOpenOptions(DispatchBaseClass): + 'Settings related to opening a generic PDF document' + CLSID = IID('{50D0174F-484D-4A2B-8BF0-A21B84167D82}') + coclass_clsid = IID('{8C9F92FE-4C6A-4E83-81E1-332BF71ABD79}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AntiAlias": (1097744748, 2, (11, 0), (), "AntiAlias", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "BitsPerChannel": (1145201512, 2, (3, 0), (), "BitsPerChannel", None), + "ConstrainProportions": (1129345616, 2, (11, 0), (), "ConstrainProportions", None), + "CropPage": (1668445295, 2, (3, 0), (), "CropPage", None), + "Height": (1214736500, 2, (5, 0), (), "Height", None), + "Mode": (1330472037, 2, (3, 0), (), "Mode", None), + "Name": (1886282093, 2, (8, 0), (), "Name", None), + "Object": (1884312676, 2, (3, 0), (), "Object", None), + "Page": (1884317518, 2, (3, 0), (), "Page", None), + "Resolution": (1382380364, 2, (5, 0), (), "Resolution", None), + "SuppressWarnings": (1936750450, 2, (11, 0), (), "SuppressWarnings", None), + "Use3DObjectNumber": (1884640356, 2, (11, 0), (), "Use3DObjectNumber", None), + "UsePageNumber": (1884639335, 2, (11, 0), (), "UsePageNumber", None), + "Width": (1466201192, 2, (5, 0), (), "Width", None), + } + _prop_map_put_ = { + "AntiAlias": ((1097744748, LCID, 4, 0),()), + "BitsPerChannel": ((1145201512, LCID, 4, 0),()), + "ConstrainProportions": ((1129345616, LCID, 4, 0),()), + "CropPage": ((1668445295, LCID, 4, 0),()), + "Height": ((1214736500, LCID, 4, 0),()), + "Mode": ((1330472037, LCID, 4, 0),()), + "Name": ((1886282093, LCID, 4, 0),()), + "Object": ((1884312676, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Page": ((1884317518, LCID, 4, 0),()), + "Resolution": ((1382380364, LCID, 4, 0),()), + "SuppressWarnings": ((1936750450, LCID, 4, 0),()), + "Use3DObjectNumber": ((1884640356, LCID, 4, 0),()), + "UsePageNumber": ((1884639335, LCID, 4, 0),()), + "Width": ((1466201192, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _PDFSaveOptions(DispatchBaseClass): + 'Settings related to saving a pdf document' + CLSID = IID('{F867E6C9-B5DB-4C5A-B3BA-63224D08A01B}') + coclass_clsid = IID('{A0ACC985-A5AF-471D-93F8-8361D759440E}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AlphaChannels": (1884504419, 2, (11, 0), (), "AlphaChannels", None), + "Annotations": (1884504430, 2, (11, 0), (), "Annotations", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "ColorConversion": (1346646832, 2, (11, 0), (), "ColorConversion", None), + "ConvertToEightBit": (1346646577, 2, (11, 0), (), "ConvertToEightBit", None), + "Description": (1346646583, 2, (8, 0), (), "Description", None), + "DestinationProfile": (1346646578, 2, (8, 0), (), "DestinationProfile", None), + "DownSample": (1346646325, 2, (3, 0), (), "DownSample", None), + "DownSampleSize": (1346646584, 2, (5, 0), (), "DownSampleSize", None), + "DownSampleSizeLimit": (1346646585, 2, (5, 0), (), "DownSampleSizeLimit", None), + "DowngradeColorProfile": (1883531088, 2, (11, 0), (), "DowngradeColorProfile", None), + "EmbedColorProfile": (1884505424, 2, (11, 0), (), "EmbedColorProfile", None), + "EmbedFonts": (1164789364, 2, (11, 0), (), "EmbedFonts", None), + "EmbedThumbnail": (1346646324, 2, (11, 0), (), "EmbedThumbnail", None), + "Encoding": (1164854116, 2, (3, 0), (), "Encoding", None), + "Interpolation": (1231898960, 2, (11, 0), (), "Interpolation", None), + "JPEGQuality": (1347055719, 2, (3, 0), (), "JPEGQuality", None), + "Layers": (1884507250, 2, (11, 0), (), "Layers", None), + "OptimizeForWeb": (1346646582, 2, (11, 0), (), "OptimizeForWeb", None), + "OutputCondition": (1346646579, 2, (8, 0), (), "OutputCondition", None), + "OutputConditionID": (1346646580, 2, (8, 0), (), "OutputConditionID", None), + "PDFCompatibility": (1346646071, 2, (3, 0), (), "PDFCompatibility", None), + "PDFStandard": (1346646070, 2, (3, 0), (), "PDFStandard", None), + "PreserveEditing": (1346646323, 2, (11, 0), (), "PreserveEditing", None), + "PresetFile": (1885759852, 2, (8, 0), (), "PresetFile", None), + "ProfileInclusionPolicy": (1346646833, 2, (11, 0), (), "ProfileInclusionPolicy", None), + "RegistryName": (1346646581, 2, (8, 0), (), "RegistryName", None), + "SpotColors": (1884509043, 2, (11, 0), (), "SpotColors", None), + "TileSize": (1346646576, 2, (3, 0), (), "TileSize", None), + "Transparency": (1416786019, 2, (11, 0), (), "Transparency", None), + "UseOutlines": (1417170796, 2, (11, 0), (), "UseOutlines", None), + "VectorData": (1449346164, 2, (11, 0), (), "VectorData", None), + "View": (1346651702, 2, (11, 0), (), "View", None), + } + _prop_map_put_ = { + "AlphaChannels": ((1884504419, LCID, 4, 0),()), + "Annotations": ((1884504430, LCID, 4, 0),()), + "ColorConversion": ((1346646832, LCID, 4, 0),()), + "ConvertToEightBit": ((1346646577, LCID, 4, 0),()), + "Description": ((1346646583, LCID, 4, 0),()), + "DestinationProfile": ((1346646578, LCID, 4, 0),()), + "DownSample": ((1346646325, LCID, 4, 0),()), + "DownSampleSize": ((1346646584, LCID, 4, 0),()), + "DownSampleSizeLimit": ((1346646585, LCID, 4, 0),()), + "DowngradeColorProfile": ((1883531088, LCID, 4, 0),()), + "EmbedColorProfile": ((1884505424, LCID, 4, 0),()), + "EmbedFonts": ((1164789364, LCID, 4, 0),()), + "EmbedThumbnail": ((1346646324, LCID, 4, 0),()), + "Encoding": ((1164854116, LCID, 4, 0),()), + "Interpolation": ((1231898960, LCID, 4, 0),()), + "JPEGQuality": ((1347055719, LCID, 4, 0),()), + "Layers": ((1884507250, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "OptimizeForWeb": ((1346646582, LCID, 4, 0),()), + "OutputCondition": ((1346646579, LCID, 4, 0),()), + "OutputConditionID": ((1346646580, LCID, 4, 0),()), + "PDFCompatibility": ((1346646071, LCID, 4, 0),()), + "PDFStandard": ((1346646070, LCID, 4, 0),()), + "PreserveEditing": ((1346646323, LCID, 4, 0),()), + "PresetFile": ((1885759852, LCID, 4, 0),()), + "ProfileInclusionPolicy": ((1346646833, LCID, 4, 0),()), + "RegistryName": ((1346646581, LCID, 4, 0),()), + "SpotColors": ((1884509043, LCID, 4, 0),()), + "TileSize": ((1346646576, LCID, 4, 0),()), + "Transparency": ((1416786019, LCID, 4, 0),()), + "UseOutlines": ((1417170796, LCID, 4, 0),()), + "VectorData": ((1449346164, LCID, 4, 0),()), + "View": ((1346651702, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _PICTFileSaveOptions(DispatchBaseClass): + 'Settings related to saving a PICT document' + CLSID = IID('{D334A509-00F8-4092-A9AF-6E1176D06536}') + coclass_clsid = IID('{BA4E6C6F-F227-42B9-B041-61FA7408B669}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AlphaChannels": (1884504419, 2, (11, 0), (), "AlphaChannels", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Compression": (1883467120, 2, (3, 0), (), "Compression", None), + "EmbedColorProfile": (1884505424, 2, (11, 0), (), "EmbedColorProfile", None), + "Resolution": (1382380364, 2, (3, 0), (), "Resolution", None), + } + _prop_map_put_ = { + "AlphaChannels": ((1884504419, LCID, 4, 0),()), + "Compression": ((1883467120, LCID, 4, 0),()), + "EmbedColorProfile": ((1884505424, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Resolution": ((1382380364, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _PNGSaveOptions(DispatchBaseClass): + 'Settings related to saving a PNG document' + CLSID = IID('{478BF855-E42A-4D63-8C9D-F562DE5FF7A8}') + coclass_clsid = IID('{3F4AD4F4-6642-4764-AB91-FBBA2743A2B6}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Compression": (1883467120, 2, (3, 0), (), "Compression", None), + "Interlaced": (1383550834, 2, (11, 0), (), "Interlaced", None), + } + _prop_map_put_ = { + "Compression": ((1883467120, LCID, 4, 0),()), + "Interlaced": ((1383550834, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _PathPointInfo(DispatchBaseClass): + 'Path point information (returned by entire path dataClassProperty of path item class)' + CLSID = IID('{B3C35001-B625-48D7-9D3B-C9D66D9CF5F1}') + coclass_clsid = IID('{BC97865E-BA04-4700-A006-2A9A1E2D021E}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "Anchor": (1347694904, 2, (12, 0), (), "Anchor", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Kind": (1265200740, 2, (3, 0), (), "Kind", None), + "LeftDirection": (1347694905, 2, (12, 0), (), "LeftDirection", None), + "RightDirection": (1347695152, 2, (12, 0), (), "RightDirection", None), + } + _prop_map_put_ = { + "Anchor": ((1347694904, LCID, 4, 0),()), + "Kind": ((1265200740, LCID, 4, 0),()), + "LeftDirection": ((1347694905, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "RightDirection": ((1347695152, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _PhotoCDOpenOptions(DispatchBaseClass): + 'Settings related to opening a PhotoCD document' + CLSID = IID('{68F15227-7568-47E1-A4F8-5615C24BDD28}') + coclass_clsid = IID('{4096BF2C-7DFF-411E-9D3B-83333337C4CD}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "ColorProfileName": (1147367502, 2, (8, 0), (), "ColorProfileName", None), + "ColorSpace": (1131172720, 2, (3, 0), (), "ColorSpace", None), + "Orientation": (1148154473, 2, (3, 0), (), "Orientation", None), + "PixelSize": (1350069338, 2, (3, 0), (), "PixelSize", None), + "Resolution": (1382380364, 2, (5, 0), (), "Resolution", None), + } + _prop_map_put_ = { + "ColorProfileName": ((1147367502, LCID, 4, 0),()), + "ColorSpace": ((1131172720, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Orientation": ((1148154473, LCID, 4, 0),()), + "PixelSize": ((1350069338, LCID, 4, 0),()), + "Resolution": ((1382380364, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _PhotoshopSaveOptions(DispatchBaseClass): + 'Settings related to saving a Photoshop document' + CLSID = IID('{436CE722-7369-4395-ACC2-2DE7A09269DF}') + coclass_clsid = IID('{0553F558-70DC-4FB4-B084-9193D0F0E46B}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AlphaChannels": (1884504419, 2, (11, 0), (), "AlphaChannels", None), + "Annotations": (1884504430, 2, (11, 0), (), "Annotations", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "EmbedColorProfile": (1884505424, 2, (11, 0), (), "EmbedColorProfile", None), + "Layers": (1884507250, 2, (11, 0), (), "Layers", None), + "SpotColors": (1884509043, 2, (11, 0), (), "SpotColors", None), + } + _prop_map_put_ = { + "AlphaChannels": ((1884504419, LCID, 4, 0),()), + "Annotations": ((1884504430, LCID, 4, 0),()), + "EmbedColorProfile": ((1884505424, LCID, 4, 0),()), + "Layers": ((1884507250, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "SpotColors": ((1884509043, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _PicturePackageOptions(DispatchBaseClass): + 'options for the Picture Package command' + CLSID = IID('{ABD0F9CE-822B-4BB1-A811-3EC852B43C0F}') + coclass_clsid = IID('{822ADB75-BD9B-49D5-BE5B-D5E9B123C36B}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetTextColor(self, arg0=defaultUnnamedArg): + 'text color' + return self._oleobj_.InvokeTypes(1346844722, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Content": (1346844726, 2, (3, 0), (), "Content", None), + "Flatten": (1129525300, 2, (11, 0), (), "Flatten", None), + "Font": (1665560180, 2, (3, 0), (), "Font", None), + "FontSize": (1346844468, 2, (3, 0), (), "FontSize", None), + "Layout": (1347432752, 2, (8, 0), (), "Layout", None), + "Mode": (1330472037, 2, (3, 0), (), "Mode", None), + "Opacity": (1332765556, 2, (3, 0), (), "Opacity", None), + "Resolution": (1382380364, 2, (5, 0), (), "Resolution", None), + "Text": (1346844727, 2, (8, 0), (), "Text", None), + # Method 'TextColor' returns object of type '_RGBColor' + "TextColor": (1346844722, 2, (9, 0), (), "TextColor", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + "TextPosition": (1346844979, 2, (3, 0), (), "TextPosition", None), + "TextRotate": (1346844980, 2, (3, 0), (), "TextRotate", None), + } + _prop_map_put_ = { + "Content": ((1346844726, LCID, 4, 0),()), + "Flatten": ((1129525300, LCID, 4, 0),()), + "Font": ((1665560180, LCID, 4, 0),()), + "FontSize": ((1346844468, LCID, 4, 0),()), + "Layout": ((1347432752, LCID, 4, 0),()), + "Mode": ((1330472037, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Opacity": ((1332765556, LCID, 4, 0),()), + "Resolution": ((1382380364, LCID, 4, 0),()), + "Text": ((1346844727, LCID, 4, 0),()), + "TextColor": ((1346844722, LCID, 4, 0),()), + "TextPosition": ((1346844979, LCID, 4, 0),()), + "TextRotate": ((1346844980, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _PixarSaveOptions(DispatchBaseClass): + 'Settings related to saving a Pixar document' + CLSID = IID('{94C016CD-178F-4FD7-85BB-F5925A34A122}') + coclass_clsid = IID('{4A3A9465-EBF6-417A-AED6-F820726389E1}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AlphaChannels": (1884504419, 2, (11, 0), (), "AlphaChannels", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + } + _prop_map_put_ = { + "AlphaChannels": ((1884504419, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _PresentationOptions(DispatchBaseClass): + 'options for the PDF presentation command' + CLSID = IID('{376C4F3B-0345-440B-90D9-FE78AECA249C}') + coclass_clsid = IID('{4B54536F-EDF4-45EF-900C-8D5516BF3711}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetPDFFileOptions(self, arg0=defaultUnnamedArg): + 'Options used when creating the PDF file' + return self._oleobj_.InvokeTypes(1346651764, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "AutoAdvance": (1346651703, 2, (11, 0), (), "AutoAdvance", None), + "IncludeFilename": (1346844209, 2, (11, 0), (), "IncludeFilename", None), + "Interval": (1346651704, 2, (3, 0), (), "Interval", None), + "Loop": (1346651705, 2, (11, 0), (), "Loop", None), + "Magnification": (1346651765, 2, (3, 0), (), "Magnification", None), + # Method 'PDFFileOptions' returns object of type '_PDFSaveOptions' + "PDFFileOptions": (1346651764, 2, (9, 0), (), "PDFFileOptions", '{F867E6C9-B5DB-4C5A-B3BA-63224D08A01B}'), + "Presentation": (1346651701, 2, (11, 0), (), "Presentation", None), + "Transition": (1346651745, 2, (3, 0), (), "Transition", None), + } + _prop_map_put_ = { + "AutoAdvance": ((1346651703, LCID, 4, 0),()), + "IncludeFilename": ((1346844209, LCID, 4, 0),()), + "Interval": ((1346651704, LCID, 4, 0),()), + "Loop": ((1346651705, LCID, 4, 0),()), + "Magnification": ((1346651765, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "PDFFileOptions": ((1346651764, LCID, 4, 0),()), + "Presentation": ((1346651701, LCID, 4, 0),()), + "Transition": ((1346651745, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _RGBColor(DispatchBaseClass): + 'An RGB color specification' + CLSID = IID('{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}') + coclass_clsid = IID('{31543EF2-5E55-4EC9-8D77-28E2B361B635}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Blue": (1884439158, 2, (5, 0), (), "Blue", None), + "Green": (1884440438, 2, (5, 0), (), "Green", None), + "HexValue": (1884440696, 2, (8, 0), (), "HexValue", None), + "Red": (1884443254, 2, (5, 0), (), "Red", None), + } + _prop_map_put_ = { + "Blue": ((1884439158, LCID, 4, 0),()), + "Green": ((1884440438, LCID, 4, 0),()), + "HexValue": ((1884440696, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Red": ((1884443254, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _RawFormatOpenOptions(DispatchBaseClass): + 'Settings related to opening a raw format document' + CLSID = IID('{6B785D83-5B5F-4402-A712-BAEBD8C5B812}') + coclass_clsid = IID('{CA1F9378-D29D-4DB3-A151-BC5BEDA6DAD1}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "BitsPerChannel": (1145201512, 2, (3, 0), (), "BitsPerChannel", None), + "ByteOrder": (1415987823, 2, (3, 0), (), "ByteOrder", None), + "ChannelNumber": (1130909293, 2, (3, 0), (), "ChannelNumber", None), + "HeaderSize": (1214534522, 2, (3, 0), (), "HeaderSize", None), + "Height": (1214736500, 2, (3, 0), (), "Height", None), + "InterleaveChannels": (1666147442, 2, (11, 0), (), "InterleaveChannels", None), + "RetainHeader": (1383352420, 2, (11, 0), (), "RetainHeader", None), + "Width": (1466201192, 2, (3, 0), (), "Width", None), + } + _prop_map_put_ = { + "BitsPerChannel": ((1145201512, LCID, 4, 0),()), + "ByteOrder": ((1415987823, LCID, 4, 0),()), + "ChannelNumber": ((1130909293, LCID, 4, 0),()), + "HeaderSize": ((1214534522, LCID, 4, 0),()), + "Height": ((1214736500, LCID, 4, 0),()), + "InterleaveChannels": ((1666147442, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "RetainHeader": ((1383352420, LCID, 4, 0),()), + "Width": ((1466201192, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _RawSaveOptions(DispatchBaseClass): + 'Settings related to saving a document in raw format' + CLSID = IID('{D74B820F-AA86-42DD-8D85-F4D67A62F200}') + coclass_clsid = IID('{988C7E0C-869F-48A8-B96C-CEDF114977B7}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AlphaChannels": (1884504419, 2, (11, 0), (), "AlphaChannels", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "SpotColors": (1884509043, 2, (11, 0), (), "SpotColors", None), + } + _prop_map_put_ = { + "AlphaChannels": ((1884504419, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "SpotColors": ((1884509043, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _SGIRGBSaveOptions(DispatchBaseClass): + 'Settings related to saving a document in the SGI RGB format' + CLSID = IID('{01CD87DE-1F53-485D-A096-0D318611AB6D}') + coclass_clsid = IID('{BBBBCA2C-DBC4-4198-B51E-93C534AA7A0F}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AlphaChannels": (1884504419, 2, (11, 0), (), "AlphaChannels", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "SpotColors": (1884509043, 2, (11, 0), (), "SpotColors", None), + } + _prop_map_put_ = { + "AlphaChannels": ((1884504419, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "SpotColors": ((1884509043, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _SolidColor(DispatchBaseClass): + 'A color value' + CLSID = IID('{D2D1665E-C1B9-4CA0-8AC9-529F6A3D9002}') + coclass_clsid = IID('{1635F3F2-1D87-41F7-971E-99DE9EFB17AE}') + + def IsEqual(self, Color=defaultNamedNotOptArg): + 'return true if the provided color is visually equal to this color' + return self._oleobj_.InvokeTypes(1129406828, LCID, 1, (11, 0), ((9, 1),),Color + ) + + def SetCMYK(self, arg0=defaultUnnamedArg): + 'return a grayscale representation of the color' + return self._oleobj_.InvokeTypes(1665355126, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetGray(self, arg0=defaultUnnamedArg): + 'return a grayscale representation of the color' + return self._oleobj_.InvokeTypes(1665626742, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetHSB(self, arg0=defaultUnnamedArg): + 'return a grayscale representation of the color' + return self._oleobj_.InvokeTypes(1665679990, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetLab(self, arg0=defaultUnnamedArg): + 'return a grayscale representation of the color' + return self._oleobj_.InvokeTypes(1665950326, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def SetRGB(self, arg0=defaultUnnamedArg): + 'return an rgb representation of the color' + return self._oleobj_.InvokeTypes(1666336630, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + # Method 'CMYK' returns object of type '_CMYKColor' + "CMYK": (1665355126, 2, (9, 0), (), "CMYK", '{29C13F49-BCEF-4FE2-BFC7-6F03B82B726F}'), + # Method 'Gray' returns object of type '_GrayColor' + "Gray": (1665626742, 2, (9, 0), (), "Gray", '{1B28B8CD-7578-415F-AC67-DC22A69F4C07}'), + # Method 'HSB' returns object of type '_HSBColor' + "HSB": (1665679990, 2, (9, 0), (), "HSB", '{F91F9C5B-AC34-45B7-AFF2-871D9DD2E8EC}'), + # Method 'Lab' returns object of type '_LabColor' + "Lab": (1665950326, 2, (9, 0), (), "Lab", '{F4D7F5C2-37DB-4DF7-8A7D-528902056596}'), + "Model": (1883458916, 2, (3, 0), (), "Model", None), + # Method 'NearestWebColor' returns object of type '_RGBColor' + "NearestWebColor": (1466057580, 2, (9, 0), (), "NearestWebColor", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + # Method 'RGB' returns object of type '_RGBColor' + "RGB": (1666336630, 2, (9, 0), (), "RGB", '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}'), + } + _prop_map_put_ = { + "CMYK": ((1665355126, LCID, 4, 0),()), + "Gray": ((1665626742, LCID, 4, 0),()), + "HSB": ((1665679990, LCID, 4, 0),()), + "Lab": ((1665950326, LCID, 4, 0),()), + "Model": ((1883458916, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "RGB": ((1666336630, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _SubPathInfo(DispatchBaseClass): + 'Sub path information (returned by entire path dataClassProperty of path item class)' + CLSID = IID('{7E8F9046-9F8E-4594-A22C-9F6B4C227CD7}') + coclass_clsid = IID('{B65274C2-B16C-4FD1-B570-3BACDEE10DE3}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "Closed": (1347695920, 2, (11, 0), (), "Closed", None), + "EntireSubPath": (1347695926, 2, (12, 0), (), "EntireSubPath", None), + "Operation": (1347694647, 2, (3, 0), (), "Operation", None), + } + _prop_map_put_ = { + "Closed": ((1347695920, LCID, 4, 0),()), + "EntireSubPath": ((1347695926, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "Operation": ((1347694647, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _TargaSaveOptions(DispatchBaseClass): + 'Settings related to saving a Target document' + CLSID = IID('{F4E21694-AEBF-44FB-90AB-EECD58C1B6F3}') + coclass_clsid = IID('{5F8F79CF-3F58-4663-8F7D-EFC3240F7E19}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AlphaChannels": (1884504419, 2, (11, 0), (), "AlphaChannels", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "RLECompression": (1884441669, 2, (11, 0), (), "RLECompression", None), + "Resolution": (1382380364, 2, (3, 0), (), "Resolution", None), + } + _prop_map_put_ = { + "AlphaChannels": ((1884504419, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "RLECompression": ((1884441669, LCID, 4, 0),()), + "Resolution": ((1382380364, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +class _TiffSaveOptions(DispatchBaseClass): + 'Settings related to saving a TIFF document' + CLSID = IID('{372B4D75-EB10-4D0A-8203-5778D521253D}') + coclass_clsid = IID('{0C51EB93-E408-42C2-BA68-4E15D292ADE1}') + + def SetObjectValue(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + _prop_map_get_ = { + "AlphaChannels": (1884504419, 2, (11, 0), (), "AlphaChannels", None), + "Annotations": (1884504430, 2, (11, 0), (), "Annotations", None), + # Method 'Application' returns object of type '_Application' + "Application": (1667330160, 2, (9, 0), (), "Application", '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}'), + "ByteOrder": (1415987823, 2, (3, 0), (), "ByteOrder", None), + "EmbedColorProfile": (1884505424, 2, (11, 0), (), "EmbedColorProfile", None), + "ImageCompression": (1231897456, 2, (3, 0), (), "ImageCompression", None), + "InterleaveChannels": (1666147442, 2, (11, 0), (), "InterleaveChannels", None), + "JPEGQuality": (1347055719, 2, (3, 0), (), "JPEGQuality", None), + "LayerCompression": (1283015536, 2, (3, 0), (), "LayerCompression", None), + "Layers": (1884507250, 2, (11, 0), (), "Layers", None), + "SaveImagePyramid": (1884313970, 2, (11, 0), (), "SaveImagePyramid", None), + "SpotColors": (1884509043, 2, (11, 0), (), "SpotColors", None), + "Transparency": (1416786019, 2, (11, 0), (), "Transparency", None), + } + _prop_map_put_ = { + "AlphaChannels": ((1884504419, LCID, 4, 0),()), + "Annotations": ((1884504430, LCID, 4, 0),()), + "ByteOrder": ((1415987823, LCID, 4, 0),()), + "EmbedColorProfile": ((1884505424, LCID, 4, 0),()), + "ImageCompression": ((1231897456, LCID, 4, 0),()), + "InterleaveChannels": ((1666147442, LCID, 4, 0),()), + "JPEGQuality": ((1347055719, LCID, 4, 0),()), + "LayerCompression": ((1283015536, LCID, 4, 0),()), + "Layers": ((1884507250, LCID, 4, 0),()), + "ObjectValue": ((0, LCID, 4, 0),()), + "SaveImagePyramid": ((1884313970, LCID, 4, 0),()), + "SpotColors": ((1884509043, LCID, 4, 0),()), + "Transparency": ((1416786019, LCID, 4, 0),()), + } + # Default method for this class is 'ObjectValue' + def __call__(self, arg0=defaultUnnamedArg): + return self._oleobj_.InvokeTypes(0, LCID, 8, (24, 0), ((9, 0),),arg0 + ) + + def __unicode__(self, *args): + try: + return unicode(self.__call__(*args)) + except pythoncom.com_error: + return repr(self) + def __str__(self, *args): + return str(self.__unicode__(*args)) + def __int__(self, *args): + return int(self.__call__(*args)) + def __iter__(self): + "Return a Python iterator for this object" + try: + ob = self._oleobj_.InvokeTypes(-4,LCID,3,(13, 10),()) + except pythoncom.error: + raise TypeError("This object does not support enumeration") + return win32com.client.util.Iterator(ob, None) + +from win32com.client import CoClassBaseClass +# This CoClass is known by the name 'Photoshop.ActionDescriptor.140' +class ActionDescriptor(CoClassBaseClass): # A CoClass + CLSID = IID('{E0B09E62-C974-4CF0-B236-1F82F34F81E1}') + coclass_sources = [ + ] + coclass_interfaces = [ + _ActionDescriptor, + ] + default_interface = _ActionDescriptor + +# This CoClass is known by the name 'Photoshop.ActionList.140' +class ActionList(CoClassBaseClass): # A CoClass + CLSID = IID('{4232D393-E961-4F42-8DE5-99CAE46A3DD3}') + coclass_sources = [ + ] + coclass_interfaces = [ + _ActionList, + ] + default_interface = _ActionList + +# This CoClass is known by the name 'Photoshop.ActionReference.140' +class ActionReference(CoClassBaseClass): # A CoClass + CLSID = IID('{B24D3780-2629-4EE6-9F9F-6C0A12554B3A}') + coclass_sources = [ + ] + coclass_interfaces = [ + _ActionReference, + ] + default_interface = _ActionReference + +# This CoClass is known by the name 'Photoshop.Application.140' +class Application(CoClassBaseClass): # A CoClass + # The Adobe Photoshop application + CLSID = IID('{C4C3E2FB-D66C-44E5-96A0-349F951CB3D4}') + coclass_sources = [ + ] + coclass_interfaces = [ + _Application, + ] + default_interface = _Application + +# This CoClass is known by the name 'Photoshop.BMPSaveOptions.140' +class BMPSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a BMP document + CLSID = IID('{8E67AC07-6214-490B-A4FC-FD884E6FCDBA}') + coclass_sources = [ + ] + coclass_interfaces = [ + _BMPSaveOptions, + ] + default_interface = _BMPSaveOptions + +# This CoClass is known by the name 'Photoshop.BatchOptions.140' +class BatchOptions(CoClassBaseClass): # A CoClass + # options for the Batch command + CLSID = IID('{890D9FDC-DF16-43F6-8717-A5F3C7055E59}') + coclass_sources = [ + ] + coclass_interfaces = [ + _BatchOptions, + ] + default_interface = _BatchOptions + +# This CoClass is known by the name 'Photoshop.BitmapConversionOptions.140' +class BitmapConversionOptions(CoClassBaseClass): # A CoClass + # Settings related to changing the document mode to Bitmap + CLSID = IID('{E159ED38-8580-4119-BB29-97615C72C08B}') + coclass_sources = [ + ] + coclass_interfaces = [ + _BitmapConversionOptions, + ] + default_interface = _BitmapConversionOptions + +# This CoClass is known by the name 'Photoshop.CMYKColor.140' +class CMYKColor(CoClassBaseClass): # A CoClass + # A CMYK color specification + CLSID = IID('{D8621099-AF41-4E0F-807A-C7C93825B1EC}') + coclass_sources = [ + ] + coclass_interfaces = [ + _CMYKColor, + ] + default_interface = _CMYKColor + +# This CoClass is known by the name 'Photoshop.CameraRAWOpenOptions.140' +class CameraRAWOpenOptions(CoClassBaseClass): # A CoClass + # Settings related to opening a camera RAW document + CLSID = IID('{7AAEBA41-590E-45B5-82BE-C8439ED48D1A}') + coclass_sources = [ + ] + coclass_interfaces = [ + _CameraRAWOpenOptions, + ] + default_interface = _CameraRAWOpenOptions + +# This CoClass is known by the name 'Photoshop.ContactSheetOptions.140' +class ContactSheetOptions(CoClassBaseClass): # A CoClass + # Options for the Contact Sheet command + CLSID = IID('{3B0F2D60-2770-4933-A1F9-A7FF749BD701}') + coclass_sources = [ + ] + coclass_interfaces = [ + _ContactSheetOptions, + ] + default_interface = _ContactSheetOptions + +# This CoClass is known by the name 'Photoshop.DCS1_SaveOptions.140' +class DCS1_SaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a Photoshop DCS 1.0 document + CLSID = IID('{0A985EC7-5190-4AC2-9564-8C12B86106A0}') + coclass_sources = [ + ] + coclass_interfaces = [ + _DCS1_SaveOptions, + ] + default_interface = _DCS1_SaveOptions + +# This CoClass is known by the name 'Photoshop.DCS2_SaveOptions.140' +class DCS2_SaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a Photoshop DCS 2.0 document + CLSID = IID('{243FD2FF-E0A6-4925-B3F9-445E6A0B9CE2}') + coclass_sources = [ + ] + coclass_interfaces = [ + _DCS2_SaveOptions, + ] + default_interface = _DCS2_SaveOptions + +# This CoClass is known by the name 'Photoshop.DICOMOpenOptions.140' +class DICOMOpenOptions(CoClassBaseClass): # A CoClass + # Settings related to opening a DICOM document + CLSID = IID('{D9156C17-3E0D-426E-B21C-BB4E3CA8A170}') + coclass_sources = [ + ] + coclass_interfaces = [ + _DICOMOpenOptions, + ] + default_interface = _DICOMOpenOptions + +# This CoClass is known by the name 'Photoshop.EPSOpenOptions.140' +class EPSOpenOptions(CoClassBaseClass): # A CoClass + # Settings related to opening a generic EPS document + CLSID = IID('{97B95749-BB17-44C0-B79F-4D8D97578C83}') + coclass_sources = [ + ] + coclass_interfaces = [ + _EPSOpenOptions, + ] + default_interface = _EPSOpenOptions + +# This CoClass is known by the name 'Photoshop.EPSSaveOptions.140' +class EPSSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving an EPS document + CLSID = IID('{FDB3DC93-6FE8-40B9-9922-40D214457F5C}') + coclass_sources = [ + ] + coclass_interfaces = [ + _EPSSaveOptions, + ] + default_interface = _EPSSaveOptions + +# This CoClass is known by the name 'Photoshop.ExportOptionsIllustrator.140' +class ExportOptionsIllustrator(CoClassBaseClass): # A CoClass + # Settings related to exporting Illustrator paths + CLSID = IID('{ADD7C618-7F07-4A45-B1B7-5A253C5577F3}') + coclass_sources = [ + ] + coclass_interfaces = [ + _ExportOptionsIllustrator, + ] + default_interface = _ExportOptionsIllustrator + +# This CoClass is known by the name 'Photoshop.ExportOptionsSaveForWeb.140' +class ExportOptionsSaveForWeb(CoClassBaseClass): # A CoClass + # Settings related to exporting Save For Web files + CLSID = IID('{351868F2-EC16-4F60-AE21-8F7A9B0BFD38}') + coclass_sources = [ + ] + coclass_interfaces = [ + _ExportOptionsSaveForWeb, + ] + default_interface = _ExportOptionsSaveForWeb + +# This CoClass is known by the name 'Photoshop.GIFSaveOptions.140' +class GIFSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a GIF document + CLSID = IID('{08FAD7C2-1393-4572-8764-93908DD5D592}') + coclass_sources = [ + ] + coclass_interfaces = [ + _GIFSaveOptions, + ] + default_interface = _GIFSaveOptions + +# This CoClass is known by the name 'Photoshop.GalleryBannerOptions.140' +class GalleryBannerOptions(CoClassBaseClass): # A CoClass + # Options for the web photo gallery banner options + CLSID = IID('{4273D5A4-6142-47EA-BA50-7D66805528EF}') + coclass_sources = [ + ] + coclass_interfaces = [ + _GalleryBannerOptions, + ] + default_interface = _GalleryBannerOptions + +# This CoClass is known by the name 'Photoshop.GalleryCustomColorOptions.140' +class GalleryCustomColorOptions(CoClassBaseClass): # A CoClass + # Options for the web photo gallery colors + CLSID = IID('{D06CC62C-3B85-4E6D-95F5-3DAA872A7C16}') + coclass_sources = [ + ] + coclass_interfaces = [ + _GalleryCustomColorOptions, + ] + default_interface = _GalleryCustomColorOptions + +# This CoClass is known by the name 'Photoshop.GalleryImagesOptions.140' +class GalleryImagesOptions(CoClassBaseClass): # A CoClass + # Options for the web photo gallery images + CLSID = IID('{27BD8440-38D8-4310-9198-9B718CE44FCA}') + coclass_sources = [ + ] + coclass_interfaces = [ + _GalleryImagesOptions, + ] + default_interface = _GalleryImagesOptions + +# This CoClass is known by the name 'Photoshop.GalleryOptions.140' +class GalleryOptions(CoClassBaseClass): # A CoClass + # Options for the web photo gallery command + CLSID = IID('{12C541DD-665A-4C33-AE0C-1838D14FF83C}') + coclass_sources = [ + ] + coclass_interfaces = [ + _GalleryOptions, + ] + default_interface = _GalleryOptions + +# This CoClass is known by the name 'Photoshop.GallerySecurityOptions.140' +class GallerySecurityOptions(CoClassBaseClass): # A CoClass + # Options for the web photo gallery security + CLSID = IID('{DC0839A8-9068-4470-98CB-A1A9DA399053}') + coclass_sources = [ + ] + coclass_interfaces = [ + _GallerySecurityOptions, + ] + default_interface = _GallerySecurityOptions + +# This CoClass is known by the name 'Photoshop.GalleryThumbnailOptions.140' +class GalleryThumbnailOptions(CoClassBaseClass): # A CoClass + # Options for the web photo gallery thumbnail creation + CLSID = IID('{E2499E27-15F2-4FAA-A219-A2C364B3B0CC}') + coclass_sources = [ + ] + coclass_interfaces = [ + _GalleryThumbnailOptions, + ] + default_interface = _GalleryThumbnailOptions + +# This CoClass is known by the name 'Photoshop.GrayColor.140' +class GrayColor(CoClassBaseClass): # A CoClass + # A gray color specification + CLSID = IID('{2653E14D-985B-43A0-AFC4-D7295CABA55C}') + coclass_sources = [ + ] + coclass_interfaces = [ + _GrayColor, + ] + default_interface = _GrayColor + +# This CoClass is known by the name 'Photoshop.HSBColor.140' +class HSBColor(CoClassBaseClass): # A CoClass + # An HSB color specification + CLSID = IID('{4F20C931-5B67-4EA8-9898-5EC1DE95AD26}') + coclass_sources = [ + ] + coclass_interfaces = [ + _HSBColor, + ] + default_interface = _HSBColor + +# This CoClass is known by the name 'Photoshop.IndexedConversionOptions.140' +class IndexedConversionOptions(CoClassBaseClass): # A CoClass + # Settings related to changing the document mode to Indexed + CLSID = IID('{11A0CB09-7997-4902-B4DD-7FCFB260C430}') + coclass_sources = [ + ] + coclass_interfaces = [ + _IndexedConversionOptions, + ] + default_interface = _IndexedConversionOptions + +# This CoClass is known by the name 'Photoshop.JPEGSaveOptions.140' +class JPEGSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a JPEG document + CLSID = IID('{CFF59FC9-7652-411F-9B2A-83B33C39164F}') + coclass_sources = [ + ] + coclass_interfaces = [ + _JPEGSaveOptions, + ] + default_interface = _JPEGSaveOptions + +# This CoClass is known by the name 'Photoshop.LabColor.140' +class LabColor(CoClassBaseClass): # A CoClass + # An Lab color specification + CLSID = IID('{2A98CA9D-5C16-4097-9049-29E2FB27862C}') + coclass_sources = [ + ] + coclass_interfaces = [ + _LabColor, + ] + default_interface = _LabColor + +# This CoClass is known by the name 'Photoshop.NoColor.140' +class NoColor(CoClassBaseClass): # A CoClass + # represents a missing color + CLSID = IID('{5A90DD6C-60F2-4A1E-88EB-45E7841683D1}') + coclass_sources = [ + ] + coclass_interfaces = [ + _NoColor, + ] + default_interface = _NoColor + +# This CoClass is known by the name 'Photoshop.PDFOpenOptions.140' +class PDFOpenOptions(CoClassBaseClass): # A CoClass + # Settings related to opening a generic PDF document + CLSID = IID('{8C9F92FE-4C6A-4E83-81E1-332BF71ABD79}') + coclass_sources = [ + ] + coclass_interfaces = [ + _PDFOpenOptions, + ] + default_interface = _PDFOpenOptions + +# This CoClass is known by the name 'Photoshop.PDFSaveOptions.140' +class PDFSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a pdf document + CLSID = IID('{A0ACC985-A5AF-471D-93F8-8361D759440E}') + coclass_sources = [ + ] + coclass_interfaces = [ + _PDFSaveOptions, + ] + default_interface = _PDFSaveOptions + +# This CoClass is known by the name 'Photoshop.PICTFileSaveOptions.140' +class PICTFileSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a PICT document + CLSID = IID('{BA4E6C6F-F227-42B9-B041-61FA7408B669}') + coclass_sources = [ + ] + coclass_interfaces = [ + _PICTFileSaveOptions, + ] + default_interface = _PICTFileSaveOptions + +# This CoClass is known by the name 'Photoshop.PNGSaveOptions.140' +class PNGSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a PNG document + CLSID = IID('{3F4AD4F4-6642-4764-AB91-FBBA2743A2B6}') + coclass_sources = [ + ] + coclass_interfaces = [ + _PNGSaveOptions, + ] + default_interface = _PNGSaveOptions + +# This CoClass is known by the name 'Photoshop.PathPointInfo.140' +class PathPointInfo(CoClassBaseClass): # A CoClass + # Path point information (returned by entire path dataClassProperty of path item class) + CLSID = IID('{BC97865E-BA04-4700-A006-2A9A1E2D021E}') + coclass_sources = [ + ] + coclass_interfaces = [ + _PathPointInfo, + ] + default_interface = _PathPointInfo + +# This CoClass is known by the name 'Photoshop.PhotoCDOpenOptions.140' +class PhotoCDOpenOptions(CoClassBaseClass): # A CoClass + # Settings related to opening a PhotoCD document + CLSID = IID('{4096BF2C-7DFF-411E-9D3B-83333337C4CD}') + coclass_sources = [ + ] + coclass_interfaces = [ + _PhotoCDOpenOptions, + ] + default_interface = _PhotoCDOpenOptions + +# This CoClass is known by the name 'Photoshop.PhotoshopSaveOptions.140' +class PhotoshopSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a Photoshop document + CLSID = IID('{0553F558-70DC-4FB4-B084-9193D0F0E46B}') + coclass_sources = [ + ] + coclass_interfaces = [ + _PhotoshopSaveOptions, + ] + default_interface = _PhotoshopSaveOptions + +# This CoClass is known by the name 'Photoshop.PicturePackageOptions.140' +class PicturePackageOptions(CoClassBaseClass): # A CoClass + # options for the Picture Package command + CLSID = IID('{822ADB75-BD9B-49D5-BE5B-D5E9B123C36B}') + coclass_sources = [ + ] + coclass_interfaces = [ + _PicturePackageOptions, + ] + default_interface = _PicturePackageOptions + +# This CoClass is known by the name 'Photoshop.PixarSaveOptions.140' +class PixarSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a Pixar document + CLSID = IID('{4A3A9465-EBF6-417A-AED6-F820726389E1}') + coclass_sources = [ + ] + coclass_interfaces = [ + _PixarSaveOptions, + ] + default_interface = _PixarSaveOptions + +# This CoClass is known by the name 'Photoshop.PresentationOptions.140' +class PresentationOptions(CoClassBaseClass): # A CoClass + # options for the PDF presentation command + CLSID = IID('{4B54536F-EDF4-45EF-900C-8D5516BF3711}') + coclass_sources = [ + ] + coclass_interfaces = [ + _PresentationOptions, + ] + default_interface = _PresentationOptions + +# This CoClass is known by the name 'Photoshop.RGBColor.140' +class RGBColor(CoClassBaseClass): # A CoClass + # An RGB color specification + CLSID = IID('{31543EF2-5E55-4EC9-8D77-28E2B361B635}') + coclass_sources = [ + ] + coclass_interfaces = [ + _RGBColor, + ] + default_interface = _RGBColor + +# This CoClass is known by the name 'Photoshop.RawFormatOpenOptions.140' +class RawFormatOpenOptions(CoClassBaseClass): # A CoClass + # Settings related to opening a raw format document + CLSID = IID('{CA1F9378-D29D-4DB3-A151-BC5BEDA6DAD1}') + coclass_sources = [ + ] + coclass_interfaces = [ + _RawFormatOpenOptions, + ] + default_interface = _RawFormatOpenOptions + +# This CoClass is known by the name 'Photoshop.RawSaveOptions.140' +class RawSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a document in raw format + CLSID = IID('{988C7E0C-869F-48A8-B96C-CEDF114977B7}') + coclass_sources = [ + ] + coclass_interfaces = [ + _RawSaveOptions, + ] + default_interface = _RawSaveOptions + +# This CoClass is known by the name 'Photoshop.SGIRGBSaveOptions.140' +class SGIRGBSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a document in the SGI RGB format + CLSID = IID('{BBBBCA2C-DBC4-4198-B51E-93C534AA7A0F}') + coclass_sources = [ + ] + coclass_interfaces = [ + _SGIRGBSaveOptions, + ] + default_interface = _SGIRGBSaveOptions + +# This CoClass is known by the name 'Photoshop.SolidColor.140' +class SolidColor(CoClassBaseClass): # A CoClass + # A color value + CLSID = IID('{1635F3F2-1D87-41F7-971E-99DE9EFB17AE}') + coclass_sources = [ + ] + coclass_interfaces = [ + _SolidColor, + ] + default_interface = _SolidColor + +# This CoClass is known by the name 'Photoshop.SubPathInfo.140' +class SubPathInfo(CoClassBaseClass): # A CoClass + # Sub path information (returned by entire path dataClassProperty of path item class) + CLSID = IID('{B65274C2-B16C-4FD1-B570-3BACDEE10DE3}') + coclass_sources = [ + ] + coclass_interfaces = [ + _SubPathInfo, + ] + default_interface = _SubPathInfo + +# This CoClass is known by the name 'Photoshop.TargaSaveOptions.140' +class TargaSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a Target document + CLSID = IID('{5F8F79CF-3F58-4663-8F7D-EFC3240F7E19}') + coclass_sources = [ + ] + coclass_interfaces = [ + _TargaSaveOptions, + ] + default_interface = _TargaSaveOptions + +# This CoClass is known by the name 'Photoshop.TiffSaveOptions.140' +class TiffSaveOptions(CoClassBaseClass): # A CoClass + # Settings related to saving a TIFF document + CLSID = IID('{0C51EB93-E408-42C2-BA68-4E15D292ADE1}') + coclass_sources = [ + ] + coclass_interfaces = [ + _TiffSaveOptions, + ] + default_interface = _TiffSaveOptions + +RecordMap = { +} + +CLSIDToClassMap = { + '{3F4AD4F4-6642-4764-AB91-FBBA2743A2B6}' : PNGSaveOptions, + '{ADD7C618-7F07-4A45-B1B7-5A253C5577F3}' : ExportOptionsIllustrator, + '{8E67AC07-6214-490B-A4FC-FD884E6FCDBA}' : BMPSaveOptions, + '{7D14BA29-1672-482F-8F48-9DA1E94800FD}' : PathPoint, + '{1635F3F2-1D87-41F7-971E-99DE9EFB17AE}' : SolidColor, + '{9A37A0AC-E951-4B16-A548-886B77338DE0}' : LayerComp, + '{B6D22EB9-EC6D-46DB-B52A-5561433A1217}' : SubPathItem, + '{D334A509-00F8-4092-A9AF-6E1176D06536}' : _PICTFileSaveOptions, + '{FDB3DC93-6FE8-40B9-9922-40D214457F5C}' : EPSSaveOptions, + '{F4D7F5C2-37DB-4DF7-8A7D-528902056596}' : _LabColor, + '{726B458C-74B0-47AE-B390-99753B55DF2E}' : LayerComps, + '{B3C35001-B625-48D7-9D3B-C9D66D9CF5F1}' : _PathPointInfo, + '{B7283EEC-23B1-49A6-B151-0E97E4AF353C}' : SubPathItems, + '{27BD8440-38D8-4310-9198-9B718CE44FCA}' : GalleryImagesOptions, + '{4B54536F-EDF4-45EF-900C-8D5516BF3711}' : PresentationOptions, + '{632F36B3-1D76-48BE-ADC3-D7FB62A0C2FB}' : MeasurementScale, + '{F4E21694-AEBF-44FB-90AB-EECD58C1B6F3}' : _TargaSaveOptions, + '{2A98CA9D-5C16-4097-9049-29E2FB27862C}' : LabColor, + '{890D9FDC-DF16-43F6-8717-A5F3C7055E59}' : BatchOptions, + '{12C541DD-665A-4C33-AE0C-1838D14FF83C}' : GalleryOptions, + '{351868F2-EC16-4F60-AE21-8F7A9B0BFD38}' : ExportOptionsSaveForWeb, + '{8B0CB532-4ACC-4BF3-9E42-0949B679D120}' : PathItem, + '{861C9290-2A0C-4614-8606-706B31BFD45B}' : Notifiers, + '{B24D3780-2629-4EE6-9F9F-6C0A12554B3A}' : ActionReference, + '{84ADBF06-8354-4B5C-9CB1-EA2565B66C7C}' : MeasurementLog, + '{5A90DD6C-60F2-4A1E-88EB-45E7841683D1}' : NoColor, + '{7AAEBA41-590E-45B5-82BE-C8439ED48D1A}' : CameraRAWOpenOptions, + '{746FEF90-A182-4BD0-A4F6-BB6BBAE87A78}' : DocumentInfo, + '{988C7E0C-869F-48A8-B96C-CEDF114977B7}' : RawSaveOptions, + '{DC865034-A587-4CC4-8A5A-453032562BE4}' : XMPMetadata, + '{EE8364D9-B811-4C7D-A3A8-97C4EBFAB83A}' : _DICOMOpenOptions, + '{4A3A9465-EBF6-417A-AED6-F820726389E1}' : PixarSaveOptions, + '{822ADB75-BD9B-49D5-BE5B-D5E9B123C36B}' : PicturePackageOptions, + '{EC6A366C-F901-488D-A2C3-9E2E78B72DC6}' : ArtLayers, + '{643099A1-0B67-4920-9B14-E14BE8F63D5F}' : _BitmapConversionOptions, + '{243FD2FF-E0A6-4925-B3F9-445E6A0B9CE2}' : DCS2_SaveOptions, + '{C4C3E2FB-D66C-44E5-96A0-349F951CB3D4}' : Application, + '{FC08B435-5F19-49DF-ABE7-ADCE9F0729FF}' : _ExportOptionsIllustrator, + '{D74B820F-AA86-42DD-8D85-F4D67A62F200}' : _RawSaveOptions, + '{22D0B851-E811-40E2-9A79-E84EA602C9F1}' : _IndexedConversionOptions, + '{CA1F9378-D29D-4DB3-A151-BC5BEDA6DAD1}' : RawFormatOpenOptions, + '{0A985EC7-5190-4AC2-9564-8C12B86106A0}' : DCS1_SaveOptions, + '{2DC64F97-8C69-4016-A8EB-89A00217291F}' : Channels, + '{50D0174F-484D-4A2B-8BF0-A21B84167D82}' : _PDFOpenOptions, + '{323DD2BC-0205-4A44-9F8E-0CF2556F00DF}' : LayerSets, + '{436CE722-7369-4395-ACC2-2DE7A09269DF}' : _PhotoshopSaveOptions, + '{BA4E6C6F-F227-42B9-B041-61FA7408B669}' : PICTFileSaveOptions, + '{4D40BE2D-FE11-4060-B52A-DE31C837D51D}' : _BMPSaveOptions, + '{376C4F3B-0345-440B-90D9-FE78AECA249C}' : _PresentationOptions, + '{B65274C2-B16C-4FD1-B570-3BACDEE10DE3}' : SubPathInfo, + '{7E8F9046-9F8E-4594-A22C-9F6B4C227CD7}' : _SubPathInfo, + '{2EB2592D-F02D-4117-A22C-26E5CDFAEEE2}' : _GalleryCustomColorOptions, + '{E159ED38-8580-4119-BB29-97615C72C08B}' : BitmapConversionOptions, + '{69172A3F-E06E-42E6-B733-4DC36E2AC948}' : HistoryStates, + '{66869370-9672-492D-93AC-0ADD62F427F1}' : CountItem, + '{BBBBCA2C-DBC4-4198-B51E-93C534AA7A0F}' : SGIRGBSaveOptions, + '{E0B09E62-C974-4CF0-B236-1F82F34F81E1}' : ActionDescriptor, + '{E7A940CD-9AC7-4D76-975D-24D6BA0FDD16}' : TextItem, + '{95D69B63-B319-44D3-8307-C988E96E7E58}' : _GallerySecurityOptions, + '{750824C6-C347-4CDB-AA96-8ABA1EBDF9EA}' : _NoColor, + '{B0D18870-EAC3-4D35-8612-6F734B3FA656}' : _BatchOptions, + '{11A0CB09-7997-4902-B4DD-7FCFB260C430}' : IndexedConversionOptions, + '{F715C957-54CE-4E55-9856-591D4CD082FD}' : _EPSOpenOptions, + '{D2D1665E-C1B9-4CA0-8AC9-529F6A3D9002}' : _SolidColor, + '{4F20C931-5B67-4EA8-9898-5EC1DE95AD26}' : HSBColor, + '{D9156C17-3E0D-426E-B21C-BB4E3CA8A170}' : DICOMOpenOptions, + '{F1AF982E-2BBD-406D-9FD6-CA6C898A7FFE}' : _DCS2_SaveOptions, + '{C88838E3-5A82-4EE7-A66C-E0360C9B0356}' : TextFont, + '{DDA16C46-15B2-472D-A659-41AA7BFDC4FD}' : Layers, + '{5148663B-F632-4AB0-9484-2DBC197CEA82}' : _JPEGSaveOptions, + '{E2499E27-15F2-4FAA-A219-A2C364B3B0CC}' : GalleryThumbnailOptions, + '{4273D5A4-6142-47EA-BA50-7D66805528EF}' : GalleryBannerOptions, + '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}' : ArtLayer, + '{0C51EB93-E408-42C2-BA68-4E15D292ADE1}' : TiffSaveOptions, + '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}' : _RGBColor, + '{31543EF2-5E55-4EC9-8D77-28E2B361B635}' : RGBColor, + '{BBCE52D6-5D4B-4691-99E3-62C174BD2855}' : TextFonts, + '{91B5F8AE-3CC5-4775-BCD3-FF1E0724BB01}' : PathItems, + '{9E01C1DA-DF69-4C2C-85EC-616370DF1CF0}' : CountItems, + '{94C4A25A-2C91-4514-A783-3173AFC48430}' : _DCS1_SaveOptions, + '{C1C35524-2AA4-4630-80B9-011EFE3D5779}' : LayerSet, + '{662506C7-6AAE-4422-ACA4-C63627CB1868}' : Documents, + '{8214A53C-0E67-49D4-A65A-D56F07B17D37}' : PathPoints, + '{70A60330-E866-46AA-A715-ABF418C41453}' : _ActionDescriptor, + '{01CD87DE-1F53-485D-A096-0D318611AB6D}' : _SGIRGBSaveOptions, + '{EDC373C3-FE30-40BA-A31C-0251CA7456F1}' : HistoryState, + '{6B785D83-5B5F-4402-A712-BAEBD8C5B812}' : _RawFormatOpenOptions, + '{94C016CD-178F-4FD7-85BB-F5925A34A122}' : _PixarSaveOptions, + '{4232D393-E961-4F42-8DE5-99CAE46A3DD3}' : ActionList, + '{BC97865E-BA04-4700-A006-2A9A1E2D021E}' : PathPointInfo, + '{08FAD7C2-1393-4572-8764-93908DD5D592}' : GIFSaveOptions, + '{09DA6B10-9684-44EE-A575-01F54660BDDC}' : Selection, + '{5F168D2A-F9EA-4866-8C55-4875E0940622}' : _GalleryBannerOptions, + '{DC0839A8-9068-4470-98CB-A1A9DA399053}' : GallerySecurityOptions, + '{97C81476-3F5D-4934-8CAA-1ED0242105B0}' : ColorSamplers, + '{D54491EF-6F09-4DE3-B49A-D57EDB2F40B8}' : _EPSSaveOptions, + '{8B4F1F1E-4ED7-4291-AE61-76ADF4D1D50B}' : Notifier, + '{D8621099-AF41-4E0F-807A-C7C93825B1EC}' : CMYKColor, + '{1B28B8CD-7578-415F-AC67-DC22A69F4C07}' : _GrayColor, + '{DFF407C7-3BCC-45AC-B6CC-EE6D52032D85}' : _ActionReference, + '{A0ACC985-A5AF-471D-93F8-8361D759440E}' : PDFSaveOptions, + '{F867E6C9-B5DB-4C5A-B3BA-63224D08A01B}' : _PDFSaveOptions, + '{064BBE94-396D-4B25-9071-AC5B14D0487F}' : _ContactSheetOptions, + '{97B95749-BB17-44C0-B79F-4D8D97578C83}' : EPSOpenOptions, + '{29C13F49-BCEF-4FE2-BFC7-6F03B82B726F}' : _CMYKColor, + '{55031766-E456-4E54-A0D0-8E545601A2D8}' : _ActionList, + '{2653E14D-985B-43A0-AFC4-D7295CABA55C}' : GrayColor, + '{0553F558-70DC-4FB4-B084-9193D0F0E46B}' : PhotoshopSaveOptions, + '{46AB9A1D-1B32-4C59-8142-B223ECCF1F74}' : _GalleryImagesOptions, + '{B1ADEFB6-C536-42D6-8A83-397354A769F8}' : Document, + '{D06CC62C-3B85-4E6D-95F5-3DAA872A7C16}' : GalleryCustomColorOptions, + '{89417281-E1AF-4800-B82A-9F37ED0478EF}' : _GIFSaveOptions, + '{C2783141-B50D-4F0C-9E2E-BF76EA8A4E60}' : _GalleryOptions, + '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}' : _Application, + '{5F8F79CF-3F58-4663-8F7D-EFC3240F7E19}' : TargaSaveOptions, + '{F91F9C5B-AC34-45B7-AFF2-871D9DD2E8EC}' : _HSBColor, + '{372B4D75-EB10-4D0A-8203-5778D521253D}' : _TiffSaveOptions, + '{288BC58E-AB6A-467C-B244-D225349E3EB3}' : Preferences, + '{91A3D47B-9579-4013-9206-7B6859439DA2}' : _ExportOptionsSaveForWeb, + '{8C9F92FE-4C6A-4E83-81E1-332BF71ABD79}' : PDFOpenOptions, + '{B125A66B-4C94-4E55-AF2F-57EC4DCB484B}' : ColorSampler, + '{3B0F2D60-2770-4933-A1F9-A7FF749BD701}' : ContactSheetOptions, + '{478BF855-E42A-4D63-8C9D-F562DE5FF7A8}' : _PNGSaveOptions, + '{CFF59FC9-7652-411F-9B2A-83B33C39164F}' : JPEGSaveOptions, + '{ABD0F9CE-822B-4BB1-A811-3EC852B43C0F}' : _PicturePackageOptions, + '{4B9E6B85-0613-4873-8AB7-575CD2226768}' : Channel, + '{68F15227-7568-47E1-A4F8-5615C24BDD28}' : _PhotoCDOpenOptions, + '{46DFAF34-75E0-470E-8217-B0C763137DD0}' : _GalleryThumbnailOptions, + '{4096BF2C-7DFF-411E-9D3B-83333337C4CD}' : PhotoCDOpenOptions, + '{65D1B010-0D87-481C-B2E6-22EFB5A54129}' : _CameraRAWOpenOptions, +} +CLSIDToPackageMap = {} +win32com.client.CLSIDToClass.RegisterCLSIDsFromDict( CLSIDToClassMap ) +VTablesToPackageMap = {} +VTablesToClassMap = { +} + + +NamesToIIDMap = { + 'Layers' : '{DDA16C46-15B2-472D-A659-41AA7BFDC4FD}', + '_PhotoshopSaveOptions' : '{436CE722-7369-4395-ACC2-2DE7A09269DF}', + 'TextFont' : '{C88838E3-5A82-4EE7-A66C-E0360C9B0356}', + 'HistoryStates' : '{69172A3F-E06E-42E6-B733-4DC36E2AC948}', + 'SubPathItem' : '{B6D22EB9-EC6D-46DB-B52A-5561433A1217}', + '_SubPathInfo' : '{7E8F9046-9F8E-4594-A22C-9F6B4C227CD7}', + '_PresentationOptions' : '{376C4F3B-0345-440B-90D9-FE78AECA249C}', + 'PathItem' : '{8B0CB532-4ACC-4BF3-9E42-0949B679D120}', + '_GalleryBannerOptions' : '{5F168D2A-F9EA-4866-8C55-4875E0940622}', + 'ColorSamplers' : '{97C81476-3F5D-4934-8CAA-1ED0242105B0}', + '_ActionReference' : '{DFF407C7-3BCC-45AC-B6CC-EE6D52032D85}', + '_GrayColor' : '{1B28B8CD-7578-415F-AC67-DC22A69F4C07}', + 'TextItem' : '{E7A940CD-9AC7-4D76-975D-24D6BA0FDD16}', + '_PixarSaveOptions' : '{94C016CD-178F-4FD7-85BB-F5925A34A122}', + 'XMPMetadata' : '{DC865034-A587-4CC4-8A5A-453032562BE4}', + 'PathPoints' : '{8214A53C-0E67-49D4-A65A-D56F07B17D37}', + '_GIFSaveOptions' : '{89417281-E1AF-4800-B82A-9F37ED0478EF}', + '_LabColor' : '{F4D7F5C2-37DB-4DF7-8A7D-528902056596}', + 'Document' : '{B1ADEFB6-C536-42D6-8A83-397354A769F8}', + 'Documents' : '{662506C7-6AAE-4422-ACA4-C63627CB1868}', + '_CMYKColor' : '{29C13F49-BCEF-4FE2-BFC7-6F03B82B726F}', + 'Channel' : '{4B9E6B85-0613-4873-8AB7-575CD2226768}', + '_PDFSaveOptions' : '{F867E6C9-B5DB-4C5A-B3BA-63224D08A01B}', + '_BMPSaveOptions' : '{4D40BE2D-FE11-4060-B52A-DE31C837D51D}', + 'LayerComp' : '{9A37A0AC-E951-4B16-A548-886B77338DE0}', + '_GalleryImagesOptions' : '{46AB9A1D-1B32-4C59-8142-B223ECCF1F74}', + '_SolidColor' : '{D2D1665E-C1B9-4CA0-8AC9-529F6A3D9002}', + '_GalleryThumbnailOptions' : '{46DFAF34-75E0-470E-8217-B0C763137DD0}', + '_BatchOptions' : '{B0D18870-EAC3-4D35-8612-6F734B3FA656}', + '_BitmapConversionOptions' : '{643099A1-0B67-4920-9B14-E14BE8F63D5F}', + '_PNGSaveOptions' : '{478BF855-E42A-4D63-8C9D-F562DE5FF7A8}', + 'HistoryState' : '{EDC373C3-FE30-40BA-A31C-0251CA7456F1}', + '_ActionList' : '{55031766-E456-4E54-A0D0-8E545601A2D8}', + 'DocumentInfo' : '{746FEF90-A182-4BD0-A4F6-BB6BBAE87A78}', + '_RawSaveOptions' : '{D74B820F-AA86-42DD-8D85-F4D67A62F200}', + 'MeasurementScale' : '{632F36B3-1D76-48BE-ADC3-D7FB62A0C2FB}', + 'ArtLayers' : '{EC6A366C-F901-488D-A2C3-9E2E78B72DC6}', + '_IndexedConversionOptions' : '{22D0B851-E811-40E2-9A79-E84EA602C9F1}', + '_NoColor' : '{750824C6-C347-4CDB-AA96-8ABA1EBDF9EA}', + 'CountItems' : '{9E01C1DA-DF69-4C2C-85EC-616370DF1CF0}', + '_ContactSheetOptions' : '{064BBE94-396D-4B25-9071-AC5B14D0487F}', + '_TargaSaveOptions' : '{F4E21694-AEBF-44FB-90AB-EECD58C1B6F3}', + '_EPSSaveOptions' : '{D54491EF-6F09-4DE3-B49A-D57EDB2F40B8}', + '_TiffSaveOptions' : '{372B4D75-EB10-4D0A-8203-5778D521253D}', + 'ArtLayer' : '{16BE80A3-57B1-4871-83AC-7F844EEEB1CA}', + '_ExportOptionsSaveForWeb' : '{91A3D47B-9579-4013-9206-7B6859439DA2}', + '_PDFOpenOptions' : '{50D0174F-484D-4A2B-8BF0-A21B84167D82}', + 'Preferences' : '{288BC58E-AB6A-467C-B244-D225349E3EB3}', + '_RGBColor' : '{45F1195F-3554-4B3F-A00A-E1D189C0DC3E}', + '_SGIRGBSaveOptions' : '{01CD87DE-1F53-485D-A096-0D318611AB6D}', + '_ActionDescriptor' : '{70A60330-E866-46AA-A715-ABF418C41453}', + '_DICOMOpenOptions' : '{EE8364D9-B811-4C7D-A3A8-97C4EBFAB83A}', + 'SubPathItems' : '{B7283EEC-23B1-49A6-B151-0E97E4AF353C}', + '_GalleryCustomColorOptions' : '{2EB2592D-F02D-4117-A22C-26E5CDFAEEE2}', + '_DCS2_SaveOptions' : '{F1AF982E-2BBD-406D-9FD6-CA6C898A7FFE}', + '_PathPointInfo' : '{B3C35001-B625-48D7-9D3B-C9D66D9CF5F1}', + '_DCS1_SaveOptions' : '{94C4A25A-2C91-4514-A783-3173AFC48430}', + 'Notifier' : '{8B4F1F1E-4ED7-4291-AE61-76ADF4D1D50B}', + '_PicturePackageOptions' : '{ABD0F9CE-822B-4BB1-A811-3EC852B43C0F}', + '_EPSOpenOptions' : '{F715C957-54CE-4E55-9856-591D4CD082FD}', + 'CountItem' : '{66869370-9672-492D-93AC-0ADD62F427F1}', + '_CameraRAWOpenOptions' : '{65D1B010-0D87-481C-B2E6-22EFB5A54129}', + 'Selection' : '{09DA6B10-9684-44EE-A575-01F54660BDDC}', + 'TextFonts' : '{BBCE52D6-5D4B-4691-99E3-62C174BD2855}', + '_JPEGSaveOptions' : '{5148663B-F632-4AB0-9484-2DBC197CEA82}', + '_PICTFileSaveOptions' : '{D334A509-00F8-4092-A9AF-6E1176D06536}', + 'ColorSampler' : '{B125A66B-4C94-4E55-AF2F-57EC4DCB484B}', + 'PathPoint' : '{7D14BA29-1672-482F-8F48-9DA1E94800FD}', + '_RawFormatOpenOptions' : '{6B785D83-5B5F-4402-A712-BAEBD8C5B812}', + '_HSBColor' : '{F91F9C5B-AC34-45B7-AFF2-871D9DD2E8EC}', + '_PhotoCDOpenOptions' : '{68F15227-7568-47E1-A4F8-5615C24BDD28}', + 'Channels' : '{2DC64F97-8C69-4016-A8EB-89A00217291F}', + '_GalleryOptions' : '{C2783141-B50D-4F0C-9E2E-BF76EA8A4E60}', + '_GallerySecurityOptions' : '{95D69B63-B319-44D3-8307-C988E96E7E58}', + 'LayerComps' : '{726B458C-74B0-47AE-B390-99753B55DF2E}', + '_Application' : '{5DE90358-4D0B-4FA1-BA3E-C91BBA863F32}', + 'LayerSets' : '{323DD2BC-0205-4A44-9F8E-0CF2556F00DF}', + 'Notifiers' : '{861C9290-2A0C-4614-8606-706B31BFD45B}', + 'LayerSet' : '{C1C35524-2AA4-4630-80B9-011EFE3D5779}', + 'PathItems' : '{91B5F8AE-3CC5-4775-BCD3-FF1E0724BB01}', + 'MeasurementLog' : '{84ADBF06-8354-4B5C-9CB1-EA2565B66C7C}', + '_ExportOptionsIllustrator' : '{FC08B435-5F19-49DF-ABE7-ADCE9F0729FF}', +} + +win32com.client.constants.__dicts__.append(constants.__dict__) diff --git a/avalon/photoshop/extension.zxp b/avalon/photoshop/extension.zxp new file mode 100644 index 000000000..06bbd8b12 Binary files /dev/null and b/avalon/photoshop/extension.zxp differ diff --git a/avalon/photoshop/extension/CSXS/manifest.xml b/avalon/photoshop/extension/CSXS/manifest.xml new file mode 100644 index 000000000..5f1e86b40 --- /dev/null +++ b/avalon/photoshop/extension/CSXS/manifest.xml @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + ./index.html + + + true + + + Panel + Avalon + + + 150 + 100 + + + 300 + 200 + + + + ./icons/avalon-logo-48.png + + + + + + diff --git a/avalon/photoshop/extension/icons/avalon-logo-48.png b/avalon/photoshop/extension/icons/avalon-logo-48.png new file mode 100644 index 000000000..33fe2a606 Binary files /dev/null and b/avalon/photoshop/extension/icons/avalon-logo-48.png differ diff --git a/avalon/photoshop/extension/index.html b/avalon/photoshop/extension/index.html new file mode 100644 index 000000000..a36a766ce --- /dev/null +++ b/avalon/photoshop/extension/index.html @@ -0,0 +1,19 @@ + + + + + + + + + + diff --git a/avalon/photoshop/lib.py b/avalon/photoshop/lib.py new file mode 100644 index 000000000..e5605d3d2 --- /dev/null +++ b/avalon/photoshop/lib.py @@ -0,0 +1,337 @@ +import json +import contextlib +import subprocess +import os +import time + +from ..tools import html_server +from ..tools import workfiles + + +def get_com_objects(): + """Wrapped com objects. + + This could later query whether the platform is Windows or Mac. + """ + from . import com_objects + return com_objects + + +def Dispatch(application): + """Wrapped Dispatch function. + + This could later query whether the platform is Windows or Mac. + + Args: + application (str): Application to dispatch. + """ + from win32com.client import Dispatch + return Dispatch(application) + + +def app(): + """Convenience function to get the Photoshop app. + + This could later query whether the platform is Windows or Mac. + + This needs to be a function call because when calling Dispatch directly + from a different thread will result in "CoInitialize has not been called" + which can be fixed with pythoncom.CoInitialize(). However even then it will + still error with "The application called an interface that was marshalled + for a different thread" + """ + return Dispatch("Photoshop.Application") + + +def launch(application): + """Starts the web server that will be hosted in the Photoshop extension. + """ + from avalon import api, photoshop + + api.install(photoshop) + + # Launch Photoshop and the html server. + process = subprocess.Popen(application, stdout=subprocess.PIPE) + server = html_server.app.start_server(5000) + + # Wait for application launch to show Workfiles. + time.sleep(8) + if os.environ.get("AVALON_PHOTOSHOP_WORKFILES_ON_LAUNCH", False): + workfiles.show(save=False) + + # Wait on Photoshop to close before closing the html server. + process.wait() + server.shutdown() + + +def imprint(layer, data): + """Write `data` to the active document "headline" field as json. + + Arguments: + layer (win32com.client.CDispatch): COMObject of the layer. + data (dict): Dictionary of key/value pairs. + + Example: + >>> from avalon.photoshop import lib + >>> layer = app.ActiveDocument.ArtLayers.Add() + >>> data = {"str": "someting", "int": 1, "float": 0.32, "bool": True} + >>> lib.imprint(layer, data) + """ + _app = app() + + layers_data = {} + try: + layers_data = json.loads(_app.ActiveDocument.Info.Headline) + except json.decoder.JSONDecodeError: + pass + + # json.dumps writes integer values in a dictionary to string, so + # anticipating it here. + if str(layer.id) in layers_data: + layers_data[str(layer.id)].update(data) + else: + layers_data[str(layer.id)] = data + + # Ensure only valid ids are stored. + layer_ids = [] + for layer in get_layers_in_document(): + layer_ids.append(layer.id) + + cleaned_data = {} + for id in layers_data: + if int(id) in layer_ids: + cleaned_data[id] = layers_data[id] + + # Write date to FileInfo headline. + _app.ActiveDocument.Info.Headline = json.dumps(cleaned_data, indent=4) + + +def read(layer): + """Read the layer metadata in to a dict + + Args: + layer (win32com.client.CDispatch): COMObject of the layer. + + Returns: + dict + """ + layers_data = {} + try: + layers_data = json.loads(app().ActiveDocument.Info.Headline) + except json.decoder.JSONDecodeError: + pass + + return layers_data.get(str(layer.id)) + + +@contextlib.contextmanager +def maintained_selection(): + """Maintain selection during context.""" + selection = get_selected_layers() + try: + yield selection + finally: + select_layers(selection) + + +@contextlib.contextmanager +def maintained_visibility(): + """Maintain visibility during context.""" + visibility = {} + layers = get_layers_in_document(app().ActiveDocument) + for layer in layers: + visibility[layer.id] = layer.Visible + try: + yield + finally: + for layer in layers: + layer.Visible = visibility[layer.id] + + +def group_selected_layers(): + """Create a group and adds the selected layers. + + Returns: + LayerSet: Created group. + """ + + _app = app() + + ref = Dispatch("Photoshop.ActionReference") + ref.PutClass(_app.StringIDToTypeID("layerSection")) + + lref = Dispatch("Photoshop.ActionReference") + lref.PutEnumerated( + _app.CharIDToTypeID("Lyr "), + _app.CharIDToTypeID("Ordn"), + _app.CharIDToTypeID("Trgt") + ) + + desc = Dispatch("Photoshop.ActionDescriptor") + desc.PutReference(_app.CharIDToTypeID("null"), ref) + desc.PutReference(_app.CharIDToTypeID("From"), lref) + + _app.ExecuteAction( + _app.CharIDToTypeID("Mk "), + desc, + get_com_objects().constants().psDisplayNoDialogs + ) + + return _app.ActiveDocument.ActiveLayer + + +def get_selected_layers(): + """Get the selected layers + + Returns: + list + """ + _app = app() + + group_selected_layers() + + selection = list(_app.ActiveDocument.ActiveLayer.Layers) + + _app.ExecuteAction( + _app.CharIDToTypeID("undo"), + None, + get_com_objects().constants().psDisplayNoDialogs + ) + + return selection + + +def get_layers_by_ids(ids): + return [x for x in app().ActiveDocument.Layers if x.id in ids] + + +def select_layers(layers): + """Selects multiple layers + + Args: + layers (list): List of COMObjects. + """ + _app = app() + + ref = Dispatch("Photoshop.ActionReference") + for id in [x.id for x in layers]: + ref.PutIdentifier(_app.CharIDToTypeID("Lyr "), id) + + desc = Dispatch("Photoshop.ActionDescriptor") + desc.PutReference(_app.CharIDToTypeID("null"), ref) + desc.PutBoolean(_app.CharIDToTypeID("MkVs"), False) + + _app.ExecuteAction( + _app.CharIDToTypeID("slct"), + desc, + get_com_objects().constants().psDisplayNoDialogs + ) + + +def _recurse_layers(layers): + """Recursively get layers in provided layers. + + Args: + layers (list): List of COMObjects. + + Returns: + List of COMObjects. + """ + result = {} + for layer in layers: + result[layer.id] = layer + if layer.LayerType == get_com_objects().constants().psLayerSet: + result.update(_recurse_layers(list(layer.Layers))) + + return result + + +def get_layers_in_layers(layers): + """Get all layers in layers. + + Args: + layers (list of COMObjects): layers to get layers within. Typically + LayerSets. + + Return: + list: Top-down recursive list of layers. + """ + return list(_recurse_layers(layers).values()) + + +def get_layers_in_document(document=None): + """Get all layers in a document. + + Args: + document (win32com.client.CDispatch): COMObject of the document. If + None is supplied the ActiveDocument is used. + + Return: + list: Top-down recursive list of layers. + """ + document = document or app().ActiveDocument + return list(_recurse_layers(list(x for x in document.Layers)).values()) + + +def import_smart_object(path): + """Import the file at `path` as a smart object to active document. + + Args: + path (str): File path to import. + + Return: + COMObject: Smart object layer. + """ + _app = app() + + desc1 = Dispatch("Photoshop.ActionDescriptor") + desc1.PutPath(_app.CharIDToTypeID("null"), path) + desc1.PutEnumerated( + _app.CharIDToTypeID("FTcs"), + _app.CharIDToTypeID("QCSt"), + _app.CharIDToTypeID("Qcsa") + ) + + desc2 = Dispatch("Photoshop.ActionDescriptor") + desc2.PutUnitDouble( + _app.CharIDToTypeID("Hrzn"), _app.CharIDToTypeID("#Pxl"), 0.0 + ) + desc2.PutUnitDouble( + _app.CharIDToTypeID("Vrtc"), _app.CharIDToTypeID("#Pxl"), 0.0 + ) + + desc1.PutObject( + _app.CharIDToTypeID("Ofst"), _app.CharIDToTypeID("Ofst"), desc2 + ) + + _app.ExecuteAction( + _app.CharIDToTypeID("Plc "), + desc1, + get_com_objects().constants().psDisplayNoDialogs + ) + layer = get_selected_layers()[0] + layer.MoveToBeginning(_app.ActiveDocument) + + return layer + + +def replace_smart_object(layer, path): + """Replace the smart object `layer` with file at `path` + + Args: + layer (win32com.client.CDispatch): COMObject of the layer. + path (str): File to import. + """ + _app = app() + + _app.ActiveDocument.ActiveLayer = layer + + desc = Dispatch("Photoshop.ActionDescriptor") + desc.PutPath(_app.CharIDToTypeID("null"), path.replace("\\", "/")) + desc.PutInteger(_app.CharIDToTypeID("PgNm"), 1) + + _app.ExecuteAction( + _app.StringIDToTypeID("placedLayerReplaceContents"), + desc, + get_com_objects().constants().psDisplayNoDialogs + ) diff --git a/avalon/photoshop/panel.PNG b/avalon/photoshop/panel.PNG new file mode 100644 index 000000000..be5db3b8d Binary files /dev/null and b/avalon/photoshop/panel.PNG differ diff --git a/avalon/photoshop/panel_failure.PNG b/avalon/photoshop/panel_failure.PNG new file mode 100644 index 000000000..67afc4e21 Binary files /dev/null and b/avalon/photoshop/panel_failure.PNG differ diff --git a/avalon/photoshop/pipeline.py b/avalon/photoshop/pipeline.py new file mode 100644 index 000000000..e0eafbc67 --- /dev/null +++ b/avalon/photoshop/pipeline.py @@ -0,0 +1,117 @@ +from .. import api, pipeline +from . import lib +from ..vendor import Qt + +import pyblish.api + + +def install(): + """Install Photoshop-specific functionality of avalon-core. + + This function is called automatically on calling `api.install(photoshop)`. + """ + print("Installing Avalon Photoshop...") + pyblish.api.register_host("photoshop") + + +def ls(): + """Yields containers from active Photoshop document + + This is the host-equivalent of api.ls(), but instead of listing + assets on disk, it lists assets already loaded in Photoshop; once loaded + they are called 'containers' + + Yields: + dict: container + + """ + for layer in lib.get_layers_in_document(): + data = lib.read(layer) + + # Skip non-tagged layers. + if not data: + continue + + # Filter to only containers. + if "container" not in data["id"]: + continue + + # Append transient data + data["layer"] = layer + + yield data + + +class Creator(api.Creator): + """Creator plugin to create instances in Photoshop + + A LayerSet is created to support any number of layers in an instance. If + the selection is used, these layers will be added to the LayerSet. + """ + + def process(self): + # Photoshop can have multiple LayerSets with the same name, which does + # not work with Avalon. + msg = "Instance with name \"{}\" already exists.".format(self.name) + for layer in lib.get_layers_in_document(): + if self.name.lower() == layer.Name.lower(): + msg = Qt.QtWidgets.QMessageBox() + msg.setIcon(Qt.QtWidgets.QMessageBox.Warning) + msg.setText(msg) + msg.exec_() + return False + + group = None + # Store selection because adding a group will change selection. + with lib.maintained_selection(): + + # Add selection to group. + if (self.options or {}).get("useSelection"): + group = lib.group_selected_layers() + else: + group = lib.app().ActiveDocument.LayerSets.Add() + + # Create group/layer relationship. + group.Name = self.name + + lib.imprint(group, self.data) + + return group + + +def containerise(name, + namespace, + layer, + context, + loader=None, + suffix="_CON"): + """Imprint layer with metadata + + Containerisation enables a tracking of version, author and origin + for loaded assets. + + Arguments: + name (str): Name of resulting assembly + namespace (str): Namespace under which to host container + layer (COMObject): Layer to containerise + context (dict): Asset information + loader (str, optional): Name of loader used to produce this container. + suffix (str, optional): Suffix of container, defaults to `_CON`. + + Returns: + container (str): Name of container assembly + """ + layer.Name = name + suffix + + data = { + "schema": "avalon-core:container-2.0", + "id": pipeline.AVALON_CONTAINER_ID, + "name": name, + "namespace": namespace, + "loader": str(loader), + "representation": str(context["representation"]["_id"]), + } + + lib.imprint(layer, data) + + return layer diff --git a/avalon/photoshop/workio.py b/avalon/photoshop/workio.py new file mode 100644 index 000000000..d26c6d840 --- /dev/null +++ b/avalon/photoshop/workio.py @@ -0,0 +1,43 @@ +"""Host API required Work Files tool""" +import os + +from . import lib + + +def _active_document(): + if len(lib.app().Documents) < 1: + return None + + return lib.app().ActiveDocument + + +def file_extensions(): + return [".psd"] + + +def has_unsaved_changes(): + if _active_document(): + return not _active_document().Saved + + return False + + +def save_file(filepath): + _active_document().SaveAs(filepath) + + +def open_file(filepath): + lib.app().Open(filepath) + + return True + + +def current_file(): + try: + return os.path.normpath(_active_document().FullName).replace("\\", "/") + except Exception: + return None + + +def work_root(session): + return os.path.normpath(session["AVALON_WORKDIR"]).replace("\\", "/") diff --git a/avalon/tools/html_server/__init__.py b/avalon/tools/html_server/__init__.py new file mode 100644 index 000000000..87b717d73 --- /dev/null +++ b/avalon/tools/html_server/__init__.py @@ -0,0 +1,3 @@ +from . import app + +__all__ = ["app"] diff --git a/avalon/tools/html_server/app.py b/avalon/tools/html_server/app.py new file mode 100644 index 000000000..5a0167dde --- /dev/null +++ b/avalon/tools/html_server/app.py @@ -0,0 +1,101 @@ +import importlib +from wsgiref.simple_server import make_server +import sys + +from avalon.vendor.bottle import route, template, run, WSGIRefServer +from threading import Thread +from ...vendor.Qt import QtWidgets + +self = sys.modules[__name__] +self.app = None + + +@route("/") +def index(): + """The entry point when accessing 'http://localhost:{port}'""" + + scripts_html = "" + buttons_html = "" + tools = { + "workfiles": "workfiles", + "creator": "create...", + "loader": "load...", + "publish": "publish...", + "sceneinventory": "manage...", + "projectmanager": "project manager", + } + for name, label in tools.items(): + scripts_html += """ + +""".format(name=name) + buttons_html += ( + "".format( + name, label.title() + ) + ) + + html = """ + + + + + + {0} + + + {1} + + +""".format(scripts_html, buttons_html) + + return template(html) + + +@route("/_route") +def tool_route(tool_name): + """The address accessed when clicking on the buttons.""" + # Need to have an existing QApplication. + app = QtWidgets.QApplication.instance() + if not app: + app = QtWidgets.QApplication(sys.argv) + + # Import and show tool. + tool_module = importlib.import_module("avalon.tools." + tool_name) + tool_module.show() + + # QApplication needs to always execute. + app.exec_() + + # Required return statement. + return "nothing" + + +class thread_server(WSGIRefServer): + def run(self, app): + self.server = make_server(self.host, self.port, app) + self.server.serve_forever() + + def shutdown(self): + self.server.shutdown() + + +def start_server(port): + """Starts the Bottle server at 'http://localhost:{port}'""" + server = thread_server(host="localhost", port=port) + Thread(target=run, kwargs={"server": server}).start() + return server diff --git a/avalon/vendor/bottle.py b/avalon/vendor/bottle.py new file mode 100644 index 000000000..96ca3e4a6 --- /dev/null +++ b/avalon/vendor/bottle.py @@ -0,0 +1,3771 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +""" +Bottle is a fast and simple micro-framework for small web applications. It +offers request dispatching (Routes) with url parameter support, templates, +a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and +template engines - all in a single file and with no dependencies other than the +Python Standard Library. + +Homepage and documentation: http://bottlepy.org/ + +Copyright (c) 2016, Marcel Hellkamp. +License: MIT (see LICENSE for details) +""" + +from __future__ import with_statement + +__author__ = 'Marcel Hellkamp' +__version__ = '0.12.18' +__license__ = 'MIT' + +# The gevent server adapter needs to patch some modules before they are imported +# This is why we parse the commandline parameters here but handle them later +if __name__ == '__main__': + from optparse import OptionParser + _cmd_parser = OptionParser(usage="usage: %prog [options] package.module:app") + _opt = _cmd_parser.add_option + _opt("--version", action="store_true", help="show version number.") + _opt("-b", "--bind", metavar="ADDRESS", help="bind socket to ADDRESS.") + _opt("-s", "--server", default='wsgiref', help="use SERVER as backend.") + _opt("-p", "--plugin", action="append", help="install additional plugin/s.") + _opt("--debug", action="store_true", help="start server in debug mode.") + _opt("--reload", action="store_true", help="auto-reload on file changes.") + _cmd_options, _cmd_args = _cmd_parser.parse_args() + if _cmd_options.server and _cmd_options.server.startswith('gevent'): + import gevent.monkey; gevent.monkey.patch_all() + +import base64, cgi, email.utils, functools, hmac, itertools, mimetypes,\ + os, re, subprocess, sys, tempfile, threading, time, warnings, hashlib + +from datetime import date as datedate, datetime, timedelta +from tempfile import TemporaryFile +from traceback import format_exc, print_exc +from inspect import getargspec +from unicodedata import normalize + + +try: from simplejson import dumps as json_dumps, loads as json_lds +except ImportError: # pragma: no cover + try: from json import dumps as json_dumps, loads as json_lds + except ImportError: + try: from django.utils.simplejson import dumps as json_dumps, loads as json_lds + except ImportError: + def json_dumps(data): + raise ImportError("JSON support requires Python 2.6 or simplejson.") + json_lds = json_dumps + + + +# We now try to fix 2.5/2.6/3.1/3.2 incompatibilities. +# It ain't pretty but it works... Sorry for the mess. + +py = sys.version_info +py3k = py >= (3, 0, 0) +py25 = py < (2, 6, 0) +py31 = (3, 1, 0) <= py < (3, 2, 0) + +# Workaround for the missing "as" keyword in py3k. +def _e(): return sys.exc_info()[1] + +# Workaround for the "print is a keyword/function" Python 2/3 dilemma +# and a fallback for mod_wsgi (resticts stdout/err attribute access) +try: + _stdout, _stderr = sys.stdout.write, sys.stderr.write +except IOError: + _stdout = lambda x: sys.stdout.write(x) + _stderr = lambda x: sys.stderr.write(x) + +# Lots of stdlib and builtin differences. +if py3k: + import http.client as httplib + import _thread as thread + from urllib.parse import urljoin, SplitResult as UrlSplitResult + from urllib.parse import urlencode, quote as urlquote, unquote as urlunquote + urlunquote = functools.partial(urlunquote, encoding='latin1') + from http.cookies import SimpleCookie + if py >= (3, 3, 0): + from collections.abc import MutableMapping as DictMixin + from types import ModuleType as new_module + else: + from collections import MutableMapping as DictMixin + from imp import new_module + import pickle + from io import BytesIO + from configparser import ConfigParser + basestring = str + unicode = str + json_loads = lambda s: json_lds(touni(s)) + callable = lambda x: hasattr(x, '__call__') + imap = map + def _raise(*a): raise a[0](a[1]).with_traceback(a[2]) +else: # 2.x + import httplib + import thread + from urlparse import urljoin, SplitResult as UrlSplitResult + from urllib import urlencode, quote as urlquote, unquote as urlunquote + from Cookie import SimpleCookie + from itertools import imap + import cPickle as pickle + from imp import new_module + from StringIO import StringIO as BytesIO + from ConfigParser import SafeConfigParser as ConfigParser + if py25: + msg = "Python 2.5 support may be dropped in future versions of Bottle." + warnings.warn(msg, DeprecationWarning) + from UserDict import DictMixin + def next(it): return it.next() + bytes = str + else: # 2.6, 2.7 + from collections import MutableMapping as DictMixin + unicode = unicode + json_loads = json_lds + eval(compile('def _raise(*a): raise a[0], a[1], a[2]', '', 'exec')) + +# Some helpers for string/byte handling +def tob(s, enc='utf8'): + return s.encode(enc) if isinstance(s, unicode) else bytes(s) +def touni(s, enc='utf8', err='strict'): + return s.decode(enc, err) if isinstance(s, bytes) else unicode(s) +tonat = touni if py3k else tob + +# 3.2 fixes cgi.FieldStorage to accept bytes (which makes a lot of sense). +# 3.1 needs a workaround. +if py31: + from io import TextIOWrapper + class NCTextIOWrapper(TextIOWrapper): + def close(self): pass # Keep wrapped buffer open. + + +# A bug in functools causes it to break if the wrapper is an instance method +def update_wrapper(wrapper, wrapped, *a, **ka): + try: functools.update_wrapper(wrapper, wrapped, *a, **ka) + except AttributeError: pass + + + +# These helpers are used at module level and need to be defined first. +# And yes, I know PEP-8, but sometimes a lower-case classname makes more sense. + +def depr(message, hard=False): + warnings.warn(message, DeprecationWarning, stacklevel=3) + +def makelist(data): # This is just to handy + if isinstance(data, (tuple, list, set, dict)): return list(data) + elif data: return [data] + else: return [] + + +class DictProperty(object): + ''' Property that maps to a key in a local dict-like attribute. ''' + def __init__(self, attr, key=None, read_only=False): + self.attr, self.key, self.read_only = attr, key, read_only + + def __call__(self, func): + functools.update_wrapper(self, func, updated=[]) + self.getter, self.key = func, self.key or func.__name__ + return self + + def __get__(self, obj, cls): + if obj is None: return self + key, storage = self.key, getattr(obj, self.attr) + if key not in storage: storage[key] = self.getter(obj) + return storage[key] + + def __set__(self, obj, value): + if self.read_only: raise AttributeError("Read-Only property.") + getattr(obj, self.attr)[self.key] = value + + def __delete__(self, obj): + if self.read_only: raise AttributeError("Read-Only property.") + del getattr(obj, self.attr)[self.key] + + +class cached_property(object): + ''' A property that is only computed once per instance and then replaces + itself with an ordinary attribute. Deleting the attribute resets the + property. ''' + + def __init__(self, func): + self.__doc__ = getattr(func, '__doc__') + self.func = func + + def __get__(self, obj, cls): + if obj is None: return self + value = obj.__dict__[self.func.__name__] = self.func(obj) + return value + + +class lazy_attribute(object): + ''' A property that caches itself to the class object. ''' + def __init__(self, func): + functools.update_wrapper(self, func, updated=[]) + self.getter = func + + def __get__(self, obj, cls): + value = self.getter(cls) + setattr(cls, self.__name__, value) + return value + + + + + + +############################################################################### +# Exceptions and Events ######################################################## +############################################################################### + + +class BottleException(Exception): + """ A base class for exceptions used by bottle. """ + pass + + + + + + +############################################################################### +# Routing ###################################################################### +############################################################################### + + +class RouteError(BottleException): + """ This is a base class for all routing related exceptions """ + + +class RouteReset(BottleException): + """ If raised by a plugin or request handler, the route is reset and all + plugins are re-applied. """ + +class RouterUnknownModeError(RouteError): pass + + +class RouteSyntaxError(RouteError): + """ The route parser found something not supported by this router. """ + + +class RouteBuildError(RouteError): + """ The route could not be built. """ + + +def _re_flatten(p): + ''' Turn all capturing groups in a regular expression pattern into + non-capturing groups. ''' + if '(' not in p: return p + return re.sub(r'(\\*)(\(\?P<[^>]+>|\((?!\?))', + lambda m: m.group(0) if len(m.group(1)) % 2 else m.group(1) + '(?:', p) + + +class Router(object): + ''' A Router is an ordered collection of route->target pairs. It is used to + efficiently match WSGI requests against a number of routes and return + the first target that satisfies the request. The target may be anything, + usually a string, ID or callable object. A route consists of a path-rule + and a HTTP method. + + The path-rule is either a static path (e.g. `/contact`) or a dynamic + path that contains wildcards (e.g. `/wiki/`). The wildcard syntax + and details on the matching order are described in docs:`routing`. + ''' + + default_pattern = '[^/]+' + default_filter = 're' + + #: The current CPython regexp implementation does not allow more + #: than 99 matching groups per regular expression. + _MAX_GROUPS_PER_PATTERN = 99 + + def __init__(self, strict=False): + self.rules = [] # All rules in order + self._groups = {} # index of regexes to find them in dyna_routes + self.builder = {} # Data structure for the url builder + self.static = {} # Search structure for static routes + self.dyna_routes = {} + self.dyna_regexes = {} # Search structure for dynamic routes + #: If true, static routes are no longer checked first. + self.strict_order = strict + self.filters = { + 're': lambda conf: + (_re_flatten(conf or self.default_pattern), None, None), + 'int': lambda conf: (r'-?\d+', int, lambda x: str(int(x))), + 'float': lambda conf: (r'-?[\d.]+', float, lambda x: str(float(x))), + 'path': lambda conf: (r'.+?', None, None)} + + def add_filter(self, name, func): + ''' Add a filter. The provided function is called with the configuration + string as parameter and must return a (regexp, to_python, to_url) tuple. + The first element is a string, the last two are callables or None. ''' + self.filters[name] = func + + rule_syntax = re.compile('(\\\\*)'\ + '(?:(?::([a-zA-Z_][a-zA-Z_0-9]*)?()(?:#(.*?)#)?)'\ + '|(?:<([a-zA-Z_][a-zA-Z_0-9]*)?(?::([a-zA-Z_]*)'\ + '(?::((?:\\\\.|[^\\\\>]+)+)?)?)?>))') + + def _itertokens(self, rule): + offset, prefix = 0, '' + for match in self.rule_syntax.finditer(rule): + prefix += rule[offset:match.start()] + g = match.groups() + if len(g[0])%2: # Escaped wildcard + prefix += match.group(0)[len(g[0]):] + offset = match.end() + continue + if prefix: + yield prefix, None, None + name, filtr, conf = g[4:7] if g[2] is None else g[1:4] + yield name, filtr or 'default', conf or None + offset, prefix = match.end(), '' + if offset <= len(rule) or prefix: + yield prefix+rule[offset:], None, None + + def add(self, rule, method, target, name=None): + ''' Add a new rule or replace the target for an existing rule. ''' + anons = 0 # Number of anonymous wildcards found + keys = [] # Names of keys + pattern = '' # Regular expression pattern with named groups + filters = [] # Lists of wildcard input filters + builder = [] # Data structure for the URL builder + is_static = True + + for key, mode, conf in self._itertokens(rule): + if mode: + is_static = False + if mode == 'default': mode = self.default_filter + mask, in_filter, out_filter = self.filters[mode](conf) + if not key: + pattern += '(?:%s)' % mask + key = 'anon%d' % anons + anons += 1 + else: + pattern += '(?P<%s>%s)' % (key, mask) + keys.append(key) + if in_filter: filters.append((key, in_filter)) + builder.append((key, out_filter or str)) + elif key: + pattern += re.escape(key) + builder.append((None, key)) + + self.builder[rule] = builder + if name: self.builder[name] = builder + + if is_static and not self.strict_order: + self.static.setdefault(method, {}) + self.static[method][self.build(rule)] = (target, None) + return + + try: + re_pattern = re.compile('^(%s)$' % pattern) + re_match = re_pattern.match + except re.error: + raise RouteSyntaxError("Could not add Route: %s (%s)" % (rule, _e())) + + if filters: + def getargs(path): + url_args = re_match(path).groupdict() + for name, wildcard_filter in filters: + try: + url_args[name] = wildcard_filter(url_args[name]) + except ValueError: + raise HTTPError(400, 'Path has wrong format.') + return url_args + elif re_pattern.groupindex: + def getargs(path): + return re_match(path).groupdict() + else: + getargs = None + + flatpat = _re_flatten(pattern) + whole_rule = (rule, flatpat, target, getargs) + + if (flatpat, method) in self._groups: + if DEBUG: + msg = 'Route <%s %s> overwrites a previously defined route' + warnings.warn(msg % (method, rule), RuntimeWarning) + self.dyna_routes[method][self._groups[flatpat, method]] = whole_rule + else: + self.dyna_routes.setdefault(method, []).append(whole_rule) + self._groups[flatpat, method] = len(self.dyna_routes[method]) - 1 + + self._compile(method) + + def _compile(self, method): + all_rules = self.dyna_routes[method] + comborules = self.dyna_regexes[method] = [] + maxgroups = self._MAX_GROUPS_PER_PATTERN + for x in range(0, len(all_rules), maxgroups): + some = all_rules[x:x+maxgroups] + combined = (flatpat for (_, flatpat, _, _) in some) + combined = '|'.join('(^%s$)' % flatpat for flatpat in combined) + combined = re.compile(combined).match + rules = [(target, getargs) for (_, _, target, getargs) in some] + comborules.append((combined, rules)) + + def build(self, _name, *anons, **query): + ''' Build an URL by filling the wildcards in a rule. ''' + builder = self.builder.get(_name) + if not builder: raise RouteBuildError("No route with that name.", _name) + try: + for i, value in enumerate(anons): query['anon%d'%i] = value + url = ''.join([f(query.pop(n)) if n else f for (n,f) in builder]) + return url if not query else url+'?'+urlencode(query) + except KeyError: + raise RouteBuildError('Missing URL argument: %r' % _e().args[0]) + + def match(self, environ): + ''' Return a (target, url_agrs) tuple or raise HTTPError(400/404/405). ''' + verb = environ['REQUEST_METHOD'].upper() + path = environ['PATH_INFO'] or '/' + target = None + if verb == 'HEAD': + methods = ['PROXY', verb, 'GET', 'ANY'] + else: + methods = ['PROXY', verb, 'ANY'] + + for method in methods: + if method in self.static and path in self.static[method]: + target, getargs = self.static[method][path] + return target, getargs(path) if getargs else {} + elif method in self.dyna_regexes: + for combined, rules in self.dyna_regexes[method]: + match = combined(path) + if match: + target, getargs = rules[match.lastindex - 1] + return target, getargs(path) if getargs else {} + + # No matching route found. Collect alternative methods for 405 response + allowed = set([]) + nocheck = set(methods) + for method in set(self.static) - nocheck: + if path in self.static[method]: + allowed.add(verb) + for method in set(self.dyna_regexes) - allowed - nocheck: + for combined, rules in self.dyna_regexes[method]: + match = combined(path) + if match: + allowed.add(method) + if allowed: + allow_header = ",".join(sorted(allowed)) + raise HTTPError(405, "Method not allowed.", Allow=allow_header) + + # No matching route and no alternative method found. We give up + raise HTTPError(404, "Not found: " + repr(path)) + + + + + + +class Route(object): + ''' This class wraps a route callback along with route specific metadata and + configuration and applies Plugins on demand. It is also responsible for + turing an URL path rule into a regular expression usable by the Router. + ''' + + def __init__(self, app, rule, method, callback, name=None, + plugins=None, skiplist=None, **config): + #: The application this route is installed to. + self.app = app + #: The path-rule string (e.g. ``/wiki/:page``). + self.rule = rule + #: The HTTP method as a string (e.g. ``GET``). + self.method = method + #: The original callback with no plugins applied. Useful for introspection. + self.callback = callback + #: The name of the route (if specified) or ``None``. + self.name = name or None + #: A list of route-specific plugins (see :meth:`Bottle.route`). + self.plugins = plugins or [] + #: A list of plugins to not apply to this route (see :meth:`Bottle.route`). + self.skiplist = skiplist or [] + #: Additional keyword arguments passed to the :meth:`Bottle.route` + #: decorator are stored in this dictionary. Used for route-specific + #: plugin configuration and meta-data. + self.config = ConfigDict().load_dict(config, make_namespaces=True) + + def __call__(self, *a, **ka): + depr("Some APIs changed to return Route() instances instead of"\ + " callables. Make sure to use the Route.call method and not to"\ + " call Route instances directly.") #0.12 + return self.call(*a, **ka) + + @cached_property + def call(self): + ''' The route callback with all plugins applied. This property is + created on demand and then cached to speed up subsequent requests.''' + return self._make_callback() + + def reset(self): + ''' Forget any cached values. The next time :attr:`call` is accessed, + all plugins are re-applied. ''' + self.__dict__.pop('call', None) + + def prepare(self): + ''' Do all on-demand work immediately (useful for debugging).''' + self.call + + @property + def _context(self): + depr('Switch to Plugin API v2 and access the Route object directly.') #0.12 + return dict(rule=self.rule, method=self.method, callback=self.callback, + name=self.name, app=self.app, config=self.config, + apply=self.plugins, skip=self.skiplist) + + def all_plugins(self): + ''' Yield all Plugins affecting this route. ''' + unique = set() + for p in reversed(self.app.plugins + self.plugins): + if True in self.skiplist: break + name = getattr(p, 'name', False) + if name and (name in self.skiplist or name in unique): continue + if p in self.skiplist or type(p) in self.skiplist: continue + if name: unique.add(name) + yield p + + def _make_callback(self): + callback = self.callback + for plugin in self.all_plugins(): + try: + if hasattr(plugin, 'apply'): + api = getattr(plugin, 'api', 1) + context = self if api > 1 else self._context + callback = plugin.apply(callback, context) + else: + callback = plugin(callback) + except RouteReset: # Try again with changed configuration. + return self._make_callback() + if not callback is self.callback: + update_wrapper(callback, self.callback) + return callback + + def get_undecorated_callback(self): + ''' Return the callback. If the callback is a decorated function, try to + recover the original function. ''' + func = self.callback + func = getattr(func, '__func__' if py3k else 'im_func', func) + closure_attr = '__closure__' if py3k else 'func_closure' + while hasattr(func, closure_attr) and getattr(func, closure_attr): + func = getattr(func, closure_attr)[0].cell_contents + return func + + def get_callback_args(self): + ''' Return a list of argument names the callback (most likely) accepts + as keyword arguments. If the callback is a decorated function, try + to recover the original function before inspection. ''' + return getargspec(self.get_undecorated_callback())[0] + + def get_config(self, key, default=None): + ''' Lookup a config field and return its value, first checking the + route.config, then route.app.config.''' + for conf in (self.config, self.app.conifg): + if key in conf: return conf[key] + return default + + def __repr__(self): + cb = self.get_undecorated_callback() + return '<%s %r %r>' % (self.method, self.rule, cb) + + + + + + +############################################################################### +# Application Object ########################################################### +############################################################################### + + +class Bottle(object): + """ Each Bottle object represents a single, distinct web application and + consists of routes, callbacks, plugins, resources and configuration. + Instances are callable WSGI applications. + + :param catchall: If true (default), handle all exceptions. Turn off to + let debugging middleware handle exceptions. + """ + + def __init__(self, catchall=True, autojson=True): + + #: A :class:`ConfigDict` for app specific configuration. + self.config = ConfigDict() + self.config._on_change = functools.partial(self.trigger_hook, 'config') + self.config.meta_set('autojson', 'validate', bool) + self.config.meta_set('catchall', 'validate', bool) + self.config['catchall'] = catchall + self.config['autojson'] = autojson + + #: A :class:`ResourceManager` for application files + self.resources = ResourceManager() + + self.routes = [] # List of installed :class:`Route` instances. + self.router = Router() # Maps requests to :class:`Route` instances. + self.error_handler = {} + + # Core plugins + self.plugins = [] # List of installed plugins. + if self.config['autojson']: + self.install(JSONPlugin()) + self.install(TemplatePlugin()) + + #: If true, most exceptions are caught and returned as :exc:`HTTPError` + catchall = DictProperty('config', 'catchall') + + __hook_names = 'before_request', 'after_request', 'app_reset', 'config' + __hook_reversed = 'after_request' + + @cached_property + def _hooks(self): + return dict((name, []) for name in self.__hook_names) + + def add_hook(self, name, func): + ''' Attach a callback to a hook. Three hooks are currently implemented: + + before_request + Executed once before each request. The request context is + available, but no routing has happened yet. + after_request + Executed once after each request regardless of its outcome. + app_reset + Called whenever :meth:`Bottle.reset` is called. + ''' + if name in self.__hook_reversed: + self._hooks[name].insert(0, func) + else: + self._hooks[name].append(func) + + def remove_hook(self, name, func): + ''' Remove a callback from a hook. ''' + if name in self._hooks and func in self._hooks[name]: + self._hooks[name].remove(func) + return True + + def trigger_hook(self, __name, *args, **kwargs): + ''' Trigger a hook and return a list of results. ''' + return [hook(*args, **kwargs) for hook in self._hooks[__name][:]] + + def hook(self, name): + """ Return a decorator that attaches a callback to a hook. See + :meth:`add_hook` for details.""" + def decorator(func): + self.add_hook(name, func) + return func + return decorator + + def mount(self, prefix, app, **options): + ''' Mount an application (:class:`Bottle` or plain WSGI) to a specific + URL prefix. Example:: + + root_app.mount('/admin/', admin_app) + + :param prefix: path prefix or `mount-point`. If it ends in a slash, + that slash is mandatory. + :param app: an instance of :class:`Bottle` or a WSGI application. + + All other parameters are passed to the underlying :meth:`route` call. + ''' + if isinstance(app, basestring): + depr('Parameter order of Bottle.mount() changed.', True) # 0.10 + + segments = [p for p in prefix.split('/') if p] + if not segments: raise ValueError('Empty path prefix.') + path_depth = len(segments) + + def mountpoint_wrapper(): + try: + request.path_shift(path_depth) + rs = HTTPResponse([]) + def start_response(status, headerlist, exc_info=None): + if exc_info: + try: + _raise(*exc_info) + finally: + exc_info = None + rs.status = status + for name, value in headerlist: rs.add_header(name, value) + return rs.body.append + body = app(request.environ, start_response) + if body and rs.body: body = itertools.chain(rs.body, body) + rs.body = body or rs.body + return rs + finally: + request.path_shift(-path_depth) + + options.setdefault('skip', True) + options.setdefault('method', 'PROXY') + options.setdefault('mountpoint', {'prefix': prefix, 'target': app}) + options['callback'] = mountpoint_wrapper + + self.route('/%s/<:re:.*>' % '/'.join(segments), **options) + if not prefix.endswith('/'): + self.route('/' + '/'.join(segments), **options) + + def merge(self, routes): + ''' Merge the routes of another :class:`Bottle` application or a list of + :class:`Route` objects into this application. The routes keep their + 'owner', meaning that the :data:`Route.app` attribute is not + changed. ''' + if isinstance(routes, Bottle): + routes = routes.routes + for route in routes: + self.add_route(route) + + def install(self, plugin): + ''' Add a plugin to the list of plugins and prepare it for being + applied to all routes of this application. A plugin may be a simple + decorator or an object that implements the :class:`Plugin` API. + ''' + if hasattr(plugin, 'setup'): plugin.setup(self) + if not callable(plugin) and not hasattr(plugin, 'apply'): + raise TypeError("Plugins must be callable or implement .apply()") + self.plugins.append(plugin) + self.reset() + return plugin + + def uninstall(self, plugin): + ''' Uninstall plugins. Pass an instance to remove a specific plugin, a type + object to remove all plugins that match that type, a string to remove + all plugins with a matching ``name`` attribute or ``True`` to remove all + plugins. Return the list of removed plugins. ''' + removed, remove = [], plugin + for i, plugin in list(enumerate(self.plugins))[::-1]: + if remove is True or remove is plugin or remove is type(plugin) \ + or getattr(plugin, 'name', True) == remove: + removed.append(plugin) + del self.plugins[i] + if hasattr(plugin, 'close'): plugin.close() + if removed: self.reset() + return removed + + def reset(self, route=None): + ''' Reset all routes (force plugins to be re-applied) and clear all + caches. If an ID or route object is given, only that specific route + is affected. ''' + if route is None: routes = self.routes + elif isinstance(route, Route): routes = [route] + else: routes = [self.routes[route]] + for route in routes: route.reset() + if DEBUG: + for route in routes: route.prepare() + self.trigger_hook('app_reset') + + def close(self): + ''' Close the application and all installed plugins. ''' + for plugin in self.plugins: + if hasattr(plugin, 'close'): plugin.close() + self.stopped = True + + def run(self, **kwargs): + ''' Calls :func:`run` with the same parameters. ''' + run(self, **kwargs) + + def match(self, environ): + """ Search for a matching route and return a (:class:`Route` , urlargs) + tuple. The second value is a dictionary with parameters extracted + from the URL. Raise :exc:`HTTPError` (404/405) on a non-match.""" + return self.router.match(environ) + + def get_url(self, routename, **kargs): + """ Return a string that matches a named route """ + scriptname = request.environ.get('SCRIPT_NAME', '').strip('/') + '/' + location = self.router.build(routename, **kargs).lstrip('/') + return urljoin(urljoin('/', scriptname), location) + + def add_route(self, route): + ''' Add a route object, but do not change the :data:`Route.app` + attribute.''' + self.routes.append(route) + self.router.add(route.rule, route.method, route, name=route.name) + if DEBUG: route.prepare() + + def route(self, path=None, method='GET', callback=None, name=None, + apply=None, skip=None, **config): + """ A decorator to bind a function to a request URL. Example:: + + @app.route('/hello/:name') + def hello(name): + return 'Hello %s' % name + + The ``:name`` part is a wildcard. See :class:`Router` for syntax + details. + + :param path: Request path or a list of paths to listen to. If no + path is specified, it is automatically generated from the + signature of the function. + :param method: HTTP method (`GET`, `POST`, `PUT`, ...) or a list of + methods to listen to. (default: `GET`) + :param callback: An optional shortcut to avoid the decorator + syntax. ``route(..., callback=func)`` equals ``route(...)(func)`` + :param name: The name for this route. (default: None) + :param apply: A decorator or plugin or a list of plugins. These are + applied to the route callback in addition to installed plugins. + :param skip: A list of plugins, plugin classes or names. Matching + plugins are not installed to this route. ``True`` skips all. + + Any additional keyword arguments are stored as route-specific + configuration and passed to plugins (see :meth:`Plugin.apply`). + """ + if callable(path): path, callback = None, path + plugins = makelist(apply) + skiplist = makelist(skip) + def decorator(callback): + # TODO: Documentation and tests + if isinstance(callback, basestring): callback = load(callback) + for rule in makelist(path) or yieldroutes(callback): + for verb in makelist(method): + verb = verb.upper() + route = Route(self, rule, verb, callback, name=name, + plugins=plugins, skiplist=skiplist, **config) + self.add_route(route) + return callback + return decorator(callback) if callback else decorator + + def get(self, path=None, method='GET', **options): + """ Equals :meth:`route`. """ + return self.route(path, method, **options) + + def post(self, path=None, method='POST', **options): + """ Equals :meth:`route` with a ``POST`` method parameter. """ + return self.route(path, method, **options) + + def put(self, path=None, method='PUT', **options): + """ Equals :meth:`route` with a ``PUT`` method parameter. """ + return self.route(path, method, **options) + + def delete(self, path=None, method='DELETE', **options): + """ Equals :meth:`route` with a ``DELETE`` method parameter. """ + return self.route(path, method, **options) + + def error(self, code=500): + """ Decorator: Register an output handler for a HTTP error code""" + def wrapper(handler): + self.error_handler[int(code)] = handler + return handler + return wrapper + + def default_error_handler(self, res): + return tob(template(ERROR_PAGE_TEMPLATE, e=res)) + + def _handle(self, environ): + path = environ['bottle.raw_path'] = environ['PATH_INFO'] + if py3k: + try: + environ['PATH_INFO'] = path.encode('latin1').decode('utf8') + except UnicodeError: + return HTTPError(400, 'Invalid path string. Expected UTF-8') + + try: + environ['bottle.app'] = self + request.bind(environ) + response.bind() + try: + self.trigger_hook('before_request') + route, args = self.router.match(environ) + environ['route.handle'] = route + environ['bottle.route'] = route + environ['route.url_args'] = args + return route.call(**args) + finally: + self.trigger_hook('after_request') + + except HTTPResponse: + return _e() + except RouteReset: + route.reset() + return self._handle(environ) + except (KeyboardInterrupt, SystemExit, MemoryError): + raise + except Exception: + if not self.catchall: raise + stacktrace = format_exc() + environ['wsgi.errors'].write(stacktrace) + return HTTPError(500, "Internal Server Error", _e(), stacktrace) + + def _cast(self, out, peek=None): + """ Try to convert the parameter into something WSGI compatible and set + correct HTTP headers when possible. + Support: False, str, unicode, dict, HTTPResponse, HTTPError, file-like, + iterable of strings and iterable of unicodes + """ + + # Empty output is done here + if not out: + if 'Content-Length' not in response: + response['Content-Length'] = 0 + return [] + # Join lists of byte or unicode strings. Mixed lists are NOT supported + if isinstance(out, (tuple, list))\ + and isinstance(out[0], (bytes, unicode)): + out = out[0][0:0].join(out) # b'abc'[0:0] -> b'' + # Encode unicode strings + if isinstance(out, unicode): + out = out.encode(response.charset) + # Byte Strings are just returned + if isinstance(out, bytes): + if 'Content-Length' not in response: + response['Content-Length'] = len(out) + return [out] + # HTTPError or HTTPException (recursive, because they may wrap anything) + # TODO: Handle these explicitly in handle() or make them iterable. + if isinstance(out, HTTPError): + out.apply(response) + out = self.error_handler.get(out.status_code, self.default_error_handler)(out) + return self._cast(out) + if isinstance(out, HTTPResponse): + out.apply(response) + return self._cast(out.body) + + # File-like objects. + if hasattr(out, 'read'): + if 'wsgi.file_wrapper' in request.environ: + return request.environ['wsgi.file_wrapper'](out) + elif hasattr(out, 'close') or not hasattr(out, '__iter__'): + return WSGIFileWrapper(out) + + # Handle Iterables. We peek into them to detect their inner type. + try: + iout = iter(out) + first = next(iout) + while not first: + first = next(iout) + except StopIteration: + return self._cast('') + except HTTPResponse: + first = _e() + except (KeyboardInterrupt, SystemExit, MemoryError): + raise + except Exception: + if not self.catchall: raise + first = HTTPError(500, 'Unhandled exception', _e(), format_exc()) + + # These are the inner types allowed in iterator or generator objects. + if isinstance(first, HTTPResponse): + return self._cast(first) + elif isinstance(first, bytes): + new_iter = itertools.chain([first], iout) + elif isinstance(first, unicode): + encoder = lambda x: x.encode(response.charset) + new_iter = imap(encoder, itertools.chain([first], iout)) + else: + msg = 'Unsupported response type: %s' % type(first) + return self._cast(HTTPError(500, msg)) + if hasattr(out, 'close'): + new_iter = _closeiter(new_iter, out.close) + return new_iter + + def wsgi(self, environ, start_response): + """ The bottle WSGI-interface. """ + try: + out = self._cast(self._handle(environ)) + # rfc2616 section 4.3 + if response._status_code in (100, 101, 204, 304)\ + or environ['REQUEST_METHOD'] == 'HEAD': + if hasattr(out, 'close'): out.close() + out = [] + start_response(response._status_line, response.headerlist) + return out + except (KeyboardInterrupt, SystemExit, MemoryError): + raise + except Exception: + if not self.catchall: raise + err = '

Critical error while processing request: %s

' \ + % html_escape(environ.get('PATH_INFO', '/')) + if DEBUG: + err += '

Error:

\n
\n%s\n
\n' \ + '

Traceback:

\n
\n%s\n
\n' \ + % (html_escape(repr(_e())), html_escape(format_exc())) + environ['wsgi.errors'].write(err) + headers = [('Content-Type', 'text/html; charset=UTF-8')] + start_response('500 INTERNAL SERVER ERROR', headers, sys.exc_info()) + return [tob(err)] + + def __call__(self, environ, start_response): + ''' Each instance of :class:'Bottle' is a WSGI application. ''' + return self.wsgi(environ, start_response) + + + + + + +############################################################################### +# HTTP and WSGI Tools ########################################################## +############################################################################### + +class BaseRequest(object): + """ A wrapper for WSGI environment dictionaries that adds a lot of + convenient access methods and properties. Most of them are read-only. + + Adding new attributes to a request actually adds them to the environ + dictionary (as 'bottle.request.ext.'). This is the recommended + way to store and access request-specific data. + """ + + __slots__ = ('environ') + + #: Maximum size of memory buffer for :attr:`body` in bytes. + MEMFILE_MAX = 102400 + + def __init__(self, environ=None): + """ Wrap a WSGI environ dictionary. """ + #: The wrapped WSGI environ dictionary. This is the only real attribute. + #: All other attributes actually are read-only properties. + self.environ = {} if environ is None else environ + self.environ['bottle.request'] = self + + @DictProperty('environ', 'bottle.app', read_only=True) + def app(self): + ''' Bottle application handling this request. ''' + raise RuntimeError('This request is not connected to an application.') + + @DictProperty('environ', 'bottle.route', read_only=True) + def route(self): + """ The bottle :class:`Route` object that matches this request. """ + raise RuntimeError('This request is not connected to a route.') + + @DictProperty('environ', 'route.url_args', read_only=True) + def url_args(self): + """ The arguments extracted from the URL. """ + raise RuntimeError('This request is not connected to a route.') + + @property + def path(self): + ''' The value of ``PATH_INFO`` with exactly one prefixed slash (to fix + broken clients and avoid the "empty path" edge case). ''' + return '/' + self.environ.get('PATH_INFO','').lstrip('/') + + @property + def method(self): + ''' The ``REQUEST_METHOD`` value as an uppercase string. ''' + return self.environ.get('REQUEST_METHOD', 'GET').upper() + + @DictProperty('environ', 'bottle.request.headers', read_only=True) + def headers(self): + ''' A :class:`WSGIHeaderDict` that provides case-insensitive access to + HTTP request headers. ''' + return WSGIHeaderDict(self.environ) + + def get_header(self, name, default=None): + ''' Return the value of a request header, or a given default value. ''' + return self.headers.get(name, default) + + @DictProperty('environ', 'bottle.request.cookies', read_only=True) + def cookies(self): + """ Cookies parsed into a :class:`FormsDict`. Signed cookies are NOT + decoded. Use :meth:`get_cookie` if you expect signed cookies. """ + cookies = SimpleCookie(self.environ.get('HTTP_COOKIE','')).values() + return FormsDict((c.key, c.value) for c in cookies) + + def get_cookie(self, key, default=None, secret=None): + """ Return the content of a cookie. To read a `Signed Cookie`, the + `secret` must match the one used to create the cookie (see + :meth:`BaseResponse.set_cookie`). If anything goes wrong (missing + cookie or wrong signature), return a default value. """ + value = self.cookies.get(key) + if secret and value: + dec = cookie_decode(value, secret) # (key, value) tuple or None + return dec[1] if dec and dec[0] == key else default + return value or default + + @DictProperty('environ', 'bottle.request.query', read_only=True) + def query(self): + ''' The :attr:`query_string` parsed into a :class:`FormsDict`. These + values are sometimes called "URL arguments" or "GET parameters", but + not to be confused with "URL wildcards" as they are provided by the + :class:`Router`. ''' + get = self.environ['bottle.get'] = FormsDict() + pairs = _parse_qsl(self.environ.get('QUERY_STRING', '')) + for key, value in pairs: + get[key] = value + return get + + @DictProperty('environ', 'bottle.request.forms', read_only=True) + def forms(self): + """ Form values parsed from an `url-encoded` or `multipart/form-data` + encoded POST or PUT request body. The result is returned as a + :class:`FormsDict`. All keys and values are strings. File uploads + are stored separately in :attr:`files`. """ + forms = FormsDict() + for name, item in self.POST.allitems(): + if not isinstance(item, FileUpload): + forms[name] = item + return forms + + @DictProperty('environ', 'bottle.request.params', read_only=True) + def params(self): + """ A :class:`FormsDict` with the combined values of :attr:`query` and + :attr:`forms`. File uploads are stored in :attr:`files`. """ + params = FormsDict() + for key, value in self.query.allitems(): + params[key] = value + for key, value in self.forms.allitems(): + params[key] = value + return params + + @DictProperty('environ', 'bottle.request.files', read_only=True) + def files(self): + """ File uploads parsed from `multipart/form-data` encoded POST or PUT + request body. The values are instances of :class:`FileUpload`. + + """ + files = FormsDict() + for name, item in self.POST.allitems(): + if isinstance(item, FileUpload): + files[name] = item + return files + + @DictProperty('environ', 'bottle.request.json', read_only=True) + def json(self): + ''' If the ``Content-Type`` header is ``application/json``, this + property holds the parsed content of the request body. Only requests + smaller than :attr:`MEMFILE_MAX` are processed to avoid memory + exhaustion. ''' + ctype = self.environ.get('CONTENT_TYPE', '').lower().split(';')[0] + if ctype == 'application/json': + b = self._get_body_string() + if not b: + return None + return json_loads(b) + return None + + def _iter_body(self, read, bufsize): + maxread = max(0, self.content_length) + while maxread: + part = read(min(maxread, bufsize)) + if not part: break + yield part + maxread -= len(part) + + def _iter_chunked(self, read, bufsize): + err = HTTPError(400, 'Error while parsing chunked transfer body.') + rn, sem, bs = tob('\r\n'), tob(';'), tob('') + while True: + header = read(1) + while header[-2:] != rn: + c = read(1) + header += c + if not c: raise err + if len(header) > bufsize: raise err + size, _, _ = header.partition(sem) + try: + maxread = int(tonat(size.strip()), 16) + except ValueError: + raise err + if maxread == 0: break + buff = bs + while maxread > 0: + if not buff: + buff = read(min(maxread, bufsize)) + part, buff = buff[:maxread], buff[maxread:] + if not part: raise err + yield part + maxread -= len(part) + if read(2) != rn: + raise err + + @DictProperty('environ', 'bottle.request.body', read_only=True) + def _body(self): + body_iter = self._iter_chunked if self.chunked else self._iter_body + read_func = self.environ['wsgi.input'].read + body, body_size, is_temp_file = BytesIO(), 0, False + for part in body_iter(read_func, self.MEMFILE_MAX): + body.write(part) + body_size += len(part) + if not is_temp_file and body_size > self.MEMFILE_MAX: + body, tmp = TemporaryFile(mode='w+b'), body + body.write(tmp.getvalue()) + del tmp + is_temp_file = True + self.environ['wsgi.input'] = body + body.seek(0) + return body + + def _get_body_string(self): + ''' read body until content-length or MEMFILE_MAX into a string. Raise + HTTPError(413) on requests that are to large. ''' + clen = self.content_length + if clen > self.MEMFILE_MAX: + raise HTTPError(413, 'Request to large') + if clen < 0: clen = self.MEMFILE_MAX + 1 + data = self.body.read(clen) + if len(data) > self.MEMFILE_MAX: # Fail fast + raise HTTPError(413, 'Request to large') + return data + + @property + def body(self): + """ The HTTP request body as a seek-able file-like object. Depending on + :attr:`MEMFILE_MAX`, this is either a temporary file or a + :class:`io.BytesIO` instance. Accessing this property for the first + time reads and replaces the ``wsgi.input`` environ variable. + Subsequent accesses just do a `seek(0)` on the file object. """ + self._body.seek(0) + return self._body + + @property + def chunked(self): + ''' True if Chunked transfer encoding was. ''' + return 'chunked' in self.environ.get('HTTP_TRANSFER_ENCODING', '').lower() + + #: An alias for :attr:`query`. + GET = query + + @DictProperty('environ', 'bottle.request.post', read_only=True) + def POST(self): + """ The values of :attr:`forms` and :attr:`files` combined into a single + :class:`FormsDict`. Values are either strings (form values) or + instances of :class:`cgi.FieldStorage` (file uploads). + """ + post = FormsDict() + # We default to application/x-www-form-urlencoded for everything that + # is not multipart and take the fast path (also: 3.1 workaround) + if not self.content_type.startswith('multipart/'): + pairs = _parse_qsl(tonat(self._get_body_string(), 'latin1')) + for key, value in pairs: + post[key] = value + return post + + safe_env = {'QUERY_STRING':''} # Build a safe environment for cgi + for key in ('REQUEST_METHOD', 'CONTENT_TYPE', 'CONTENT_LENGTH'): + if key in self.environ: safe_env[key] = self.environ[key] + args = dict(fp=self.body, environ=safe_env, keep_blank_values=True) + if py31: + args['fp'] = NCTextIOWrapper(args['fp'], encoding='utf8', + newline='\n') + elif py3k: + args['encoding'] = 'utf8' + data = cgi.FieldStorage(**args) + self['_cgi.FieldStorage'] = data #http://bugs.python.org/issue18394#msg207958 + data = data.list or [] + for item in data: + if item.filename: + post[item.name] = FileUpload(item.file, item.name, + item.filename, item.headers) + else: + post[item.name] = item.value + return post + + @property + def url(self): + """ The full request URI including hostname and scheme. If your app + lives behind a reverse proxy or load balancer and you get confusing + results, make sure that the ``X-Forwarded-Host`` header is set + correctly. """ + return self.urlparts.geturl() + + @DictProperty('environ', 'bottle.request.urlparts', read_only=True) + def urlparts(self): + ''' The :attr:`url` string as an :class:`urlparse.SplitResult` tuple. + The tuple contains (scheme, host, path, query_string and fragment), + but the fragment is always empty because it is not visible to the + server. ''' + env = self.environ + http = env.get('HTTP_X_FORWARDED_PROTO') or env.get('wsgi.url_scheme', 'http') + host = env.get('HTTP_X_FORWARDED_HOST') or env.get('HTTP_HOST') + if not host: + # HTTP 1.1 requires a Host-header. This is for HTTP/1.0 clients. + host = env.get('SERVER_NAME', '127.0.0.1') + port = env.get('SERVER_PORT') + if port and port != ('80' if http == 'http' else '443'): + host += ':' + port + path = urlquote(self.fullpath) + return UrlSplitResult(http, host, path, env.get('QUERY_STRING'), '') + + @property + def fullpath(self): + """ Request path including :attr:`script_name` (if present). """ + return urljoin(self.script_name, self.path.lstrip('/')) + + @property + def query_string(self): + """ The raw :attr:`query` part of the URL (everything in between ``?`` + and ``#``) as a string. """ + return self.environ.get('QUERY_STRING', '') + + @property + def script_name(self): + ''' The initial portion of the URL's `path` that was removed by a higher + level (server or routing middleware) before the application was + called. This script path is returned with leading and tailing + slashes. ''' + script_name = self.environ.get('SCRIPT_NAME', '').strip('/') + return '/' + script_name + '/' if script_name else '/' + + def path_shift(self, shift=1): + ''' Shift path segments from :attr:`path` to :attr:`script_name` and + vice versa. + + :param shift: The number of path segments to shift. May be negative + to change the shift direction. (default: 1) + ''' + script = self.environ.get('SCRIPT_NAME','/') + self['SCRIPT_NAME'], self['PATH_INFO'] = path_shift(script, self.path, shift) + + @property + def content_length(self): + ''' The request body length as an integer. The client is responsible to + set this header. Otherwise, the real length of the body is unknown + and -1 is returned. In this case, :attr:`body` will be empty. ''' + return int(self.environ.get('CONTENT_LENGTH') or -1) + + @property + def content_type(self): + ''' The Content-Type header as a lowercase-string (default: empty). ''' + return self.environ.get('CONTENT_TYPE', '').lower() + + @property + def is_xhr(self): + ''' True if the request was triggered by a XMLHttpRequest. This only + works with JavaScript libraries that support the `X-Requested-With` + header (most of the popular libraries do). ''' + requested_with = self.environ.get('HTTP_X_REQUESTED_WITH','') + return requested_with.lower() == 'xmlhttprequest' + + @property + def is_ajax(self): + ''' Alias for :attr:`is_xhr`. "Ajax" is not the right term. ''' + return self.is_xhr + + @property + def auth(self): + """ HTTP authentication data as a (user, password) tuple. This + implementation currently supports basic (not digest) authentication + only. If the authentication happened at a higher level (e.g. in the + front web-server or a middleware), the password field is None, but + the user field is looked up from the ``REMOTE_USER`` environ + variable. On any errors, None is returned. """ + basic = parse_auth(self.environ.get('HTTP_AUTHORIZATION','')) + if basic: return basic + ruser = self.environ.get('REMOTE_USER') + if ruser: return (ruser, None) + return None + + @property + def remote_route(self): + """ A list of all IPs that were involved in this request, starting with + the client IP and followed by zero or more proxies. This does only + work if all proxies support the ```X-Forwarded-For`` header. Note + that this information can be forged by malicious clients. """ + proxy = self.environ.get('HTTP_X_FORWARDED_FOR') + if proxy: return [ip.strip() for ip in proxy.split(',')] + remote = self.environ.get('REMOTE_ADDR') + return [remote] if remote else [] + + @property + def remote_addr(self): + """ The client IP as a string. Note that this information can be forged + by malicious clients. """ + route = self.remote_route + return route[0] if route else None + + def copy(self): + """ Return a new :class:`Request` with a shallow :attr:`environ` copy. """ + return Request(self.environ.copy()) + + def get(self, value, default=None): return self.environ.get(value, default) + def __getitem__(self, key): return self.environ[key] + def __delitem__(self, key): self[key] = ""; del(self.environ[key]) + def __iter__(self): return iter(self.environ) + def __len__(self): return len(self.environ) + def keys(self): return self.environ.keys() + def __setitem__(self, key, value): + """ Change an environ value and clear all caches that depend on it. """ + + if self.environ.get('bottle.request.readonly'): + raise KeyError('The environ dictionary is read-only.') + + self.environ[key] = value + todelete = () + + if key == 'wsgi.input': + todelete = ('body', 'forms', 'files', 'params', 'post', 'json') + elif key == 'QUERY_STRING': + todelete = ('query', 'params') + elif key.startswith('HTTP_'): + todelete = ('headers', 'cookies') + + for key in todelete: + self.environ.pop('bottle.request.'+key, None) + + def __repr__(self): + return '<%s: %s %s>' % (self.__class__.__name__, self.method, self.url) + + def __getattr__(self, name): + ''' Search in self.environ for additional user defined attributes. ''' + try: + var = self.environ['bottle.request.ext.%s'%name] + return var.__get__(self) if hasattr(var, '__get__') else var + except KeyError: + raise AttributeError('Attribute %r not defined.' % name) + + def __setattr__(self, name, value): + if name == 'environ': return object.__setattr__(self, name, value) + self.environ['bottle.request.ext.%s'%name] = value + + +def _hkey(key): + if '\n' in key or '\r' in key or '\0' in key: + raise ValueError("Header names must not contain control characters: %r" % key) + return key.title().replace('_', '-') + + +def _hval(value): + value = tonat(value) + if '\n' in value or '\r' in value or '\0' in value: + raise ValueError("Header value must not contain control characters: %r" % value) + return value + + + +class HeaderProperty(object): + def __init__(self, name, reader=None, writer=None, default=''): + self.name, self.default = name, default + self.reader, self.writer = reader, writer + self.__doc__ = 'Current value of the %r header.' % name.title() + + def __get__(self, obj, cls): + if obj is None: return self + value = obj.get_header(self.name, self.default) + return self.reader(value) if self.reader else value + + def __set__(self, obj, value): + obj[self.name] = self.writer(value) if self.writer else value + + def __delete__(self, obj): + del obj[self.name] + + +class BaseResponse(object): + """ Storage class for a response body as well as headers and cookies. + + This class does support dict-like case-insensitive item-access to + headers, but is NOT a dict. Most notably, iterating over a response + yields parts of the body and not the headers. + + :param body: The response body as one of the supported types. + :param status: Either an HTTP status code (e.g. 200) or a status line + including the reason phrase (e.g. '200 OK'). + :param headers: A dictionary or a list of name-value pairs. + + Additional keyword arguments are added to the list of headers. + Underscores in the header name are replaced with dashes. + """ + + default_status = 200 + default_content_type = 'text/html; charset=UTF-8' + + # Header blacklist for specific response codes + # (rfc2616 section 10.2.3 and 10.3.5) + bad_headers = { + 204: set(('Content-Type',)), + 304: set(('Allow', 'Content-Encoding', 'Content-Language', + 'Content-Length', 'Content-Range', 'Content-Type', + 'Content-Md5', 'Last-Modified'))} + + def __init__(self, body='', status=None, headers=None, **more_headers): + self._cookies = None + self._headers = {} + self.body = body + self.status = status or self.default_status + if headers: + if isinstance(headers, dict): + headers = headers.items() + for name, value in headers: + self.add_header(name, value) + if more_headers: + for name, value in more_headers.items(): + self.add_header(name, value) + + def copy(self, cls=None): + ''' Returns a copy of self. ''' + cls = cls or BaseResponse + assert issubclass(cls, BaseResponse) + copy = cls() + copy.status = self.status + copy._headers = dict((k, v[:]) for (k, v) in self._headers.items()) + if self._cookies: + copy._cookies = SimpleCookie() + copy._cookies.load(self._cookies.output(header='')) + return copy + + def __iter__(self): + return iter(self.body) + + def close(self): + if hasattr(self.body, 'close'): + self.body.close() + + @property + def status_line(self): + ''' The HTTP status line as a string (e.g. ``404 Not Found``).''' + return self._status_line + + @property + def status_code(self): + ''' The HTTP status code as an integer (e.g. 404).''' + return self._status_code + + def _set_status(self, status): + if isinstance(status, int): + code, status = status, _HTTP_STATUS_LINES.get(status) + elif ' ' in status: + status = status.strip() + code = int(status.split()[0]) + else: + raise ValueError('String status line without a reason phrase.') + if not 100 <= code <= 999: raise ValueError('Status code out of range.') + self._status_code = code + self._status_line = str(status or ('%d Unknown' % code)) + + def _get_status(self): + return self._status_line + + status = property(_get_status, _set_status, None, + ''' A writeable property to change the HTTP response status. It accepts + either a numeric code (100-999) or a string with a custom reason + phrase (e.g. "404 Brain not found"). Both :data:`status_line` and + :data:`status_code` are updated accordingly. The return value is + always a status string. ''') + del _get_status, _set_status + + @property + def headers(self): + ''' An instance of :class:`HeaderDict`, a case-insensitive dict-like + view on the response headers. ''' + hdict = HeaderDict() + hdict.dict = self._headers + return hdict + + def __contains__(self, name): return _hkey(name) in self._headers + def __delitem__(self, name): del self._headers[_hkey(name)] + def __getitem__(self, name): return self._headers[_hkey(name)][-1] + def __setitem__(self, name, value): self._headers[_hkey(name)] = [_hval(value)] + + def get_header(self, name, default=None): + ''' Return the value of a previously defined header. If there is no + header with that name, return a default value. ''' + return self._headers.get(_hkey(name), [default])[-1] + + def set_header(self, name, value): + ''' Create a new response header, replacing any previously defined + headers with the same name. ''' + self._headers[_hkey(name)] = [_hval(value)] + + def add_header(self, name, value): + ''' Add an additional response header, not removing duplicates. ''' + self._headers.setdefault(_hkey(name), []).append(_hval(value)) + + def iter_headers(self): + ''' Yield (header, value) tuples, skipping headers that are not + allowed with the current response status code. ''' + return self.headerlist + + @property + def headerlist(self): + """ WSGI conform list of (header, value) tuples. """ + out = [] + headers = list(self._headers.items()) + if 'Content-Type' not in self._headers: + headers.append(('Content-Type', [self.default_content_type])) + if self._status_code in self.bad_headers: + bad_headers = self.bad_headers[self._status_code] + headers = [h for h in headers if h[0] not in bad_headers] + out += [(name, val) for (name, vals) in headers for val in vals] + if self._cookies: + for c in self._cookies.values(): + out.append(('Set-Cookie', _hval(c.OutputString()))) + if py3k: + out = [(k, v.encode('utf8').decode('latin1')) for (k, v) in out] + return out + + content_type = HeaderProperty('Content-Type') + content_length = HeaderProperty('Content-Length', reader=int) + expires = HeaderProperty('Expires', + reader=lambda x: datetime.utcfromtimestamp(parse_date(x)), + writer=lambda x: http_date(x)) + + @property + def charset(self, default='UTF-8'): + """ Return the charset specified in the content-type header (default: utf8). """ + if 'charset=' in self.content_type: + return self.content_type.split('charset=')[-1].split(';')[0].strip() + return default + + def set_cookie(self, name, value, secret=None, **options): + ''' Create a new cookie or replace an old one. If the `secret` parameter is + set, create a `Signed Cookie` (described below). + + :param name: the name of the cookie. + :param value: the value of the cookie. + :param secret: a signature key required for signed cookies. + + Additionally, this method accepts all RFC 2109 attributes that are + supported by :class:`cookie.Morsel`, including: + + :param max_age: maximum age in seconds. (default: None) + :param expires: a datetime object or UNIX timestamp. (default: None) + :param domain: the domain that is allowed to read the cookie. + (default: current domain) + :param path: limits the cookie to a given path (default: current path) + :param secure: limit the cookie to HTTPS connections (default: off). + :param httponly: prevents client-side javascript to read this cookie + (default: off, requires Python 2.6 or newer). + + If neither `expires` nor `max_age` is set (default), the cookie will + expire at the end of the browser session (as soon as the browser + window is closed). + + Signed cookies may store any pickle-able object and are + cryptographically signed to prevent manipulation. Keep in mind that + cookies are limited to 4kb in most browsers. + + Warning: Signed cookies are not encrypted (the client can still see + the content) and not copy-protected (the client can restore an old + cookie). The main intention is to make pickling and unpickling + save, not to store secret information at client side. + ''' + if not self._cookies: + self._cookies = SimpleCookie() + + if secret: + value = touni(cookie_encode((name, value), secret)) + elif not isinstance(value, basestring): + raise TypeError('Secret key missing for non-string Cookie.') + + if len(value) > 4096: raise ValueError('Cookie value to long.') + self._cookies[name] = value + + for key, value in options.items(): + if key == 'max_age': + if isinstance(value, timedelta): + value = value.seconds + value.days * 24 * 3600 + if key == 'expires': + if isinstance(value, (datedate, datetime)): + value = value.timetuple() + elif isinstance(value, (int, float)): + value = time.gmtime(value) + value = time.strftime("%a, %d %b %Y %H:%M:%S GMT", value) + self._cookies[name][key.replace('_', '-')] = value + + def delete_cookie(self, key, **kwargs): + ''' Delete a cookie. Be sure to use the same `domain` and `path` + settings as used to create the cookie. ''' + kwargs['max_age'] = -1 + kwargs['expires'] = 0 + self.set_cookie(key, '', **kwargs) + + def __repr__(self): + out = '' + for name, value in self.headerlist: + out += '%s: %s\n' % (name.title(), value.strip()) + return out + + +def local_property(name=None): + if name: depr('local_property() is deprecated and will be removed.') #0.12 + ls = threading.local() + def fget(self): + try: return ls.var + except AttributeError: + raise RuntimeError("Request context not initialized.") + def fset(self, value): ls.var = value + def fdel(self): del ls.var + return property(fget, fset, fdel, 'Thread-local property') + + +class LocalRequest(BaseRequest): + ''' A thread-local subclass of :class:`BaseRequest` with a different + set of attributes for each thread. There is usually only one global + instance of this class (:data:`request`). If accessed during a + request/response cycle, this instance always refers to the *current* + request (even on a multithreaded server). ''' + bind = BaseRequest.__init__ + environ = local_property() + + +class LocalResponse(BaseResponse): + ''' A thread-local subclass of :class:`BaseResponse` with a different + set of attributes for each thread. There is usually only one global + instance of this class (:data:`response`). Its attributes are used + to build the HTTP response at the end of the request/response cycle. + ''' + bind = BaseResponse.__init__ + _status_line = local_property() + _status_code = local_property() + _cookies = local_property() + _headers = local_property() + body = local_property() + + +Request = BaseRequest +Response = BaseResponse + + +class HTTPResponse(Response, BottleException): + def __init__(self, body='', status=None, headers=None, **more_headers): + super(HTTPResponse, self).__init__(body, status, headers, **more_headers) + + def apply(self, response): + response._status_code = self._status_code + response._status_line = self._status_line + response._headers = self._headers + response._cookies = self._cookies + response.body = self.body + + +class HTTPError(HTTPResponse): + default_status = 500 + def __init__(self, status=None, body=None, exception=None, traceback=None, + **options): + self.exception = exception + self.traceback = traceback + super(HTTPError, self).__init__(body, status, **options) + + + + + +############################################################################### +# Plugins ###################################################################### +############################################################################### + +class PluginError(BottleException): pass + + +class JSONPlugin(object): + name = 'json' + api = 2 + + def __init__(self, json_dumps=json_dumps): + self.json_dumps = json_dumps + + def apply(self, callback, route): + dumps = self.json_dumps + if not dumps: return callback + def wrapper(*a, **ka): + try: + rv = callback(*a, **ka) + except HTTPError: + rv = _e() + + if isinstance(rv, dict): + #Attempt to serialize, raises exception on failure + json_response = dumps(rv) + #Set content type only if serialization succesful + response.content_type = 'application/json' + return json_response + elif isinstance(rv, HTTPResponse) and isinstance(rv.body, dict): + rv.body = dumps(rv.body) + rv.content_type = 'application/json' + return rv + + return wrapper + + +class TemplatePlugin(object): + ''' This plugin applies the :func:`view` decorator to all routes with a + `template` config parameter. If the parameter is a tuple, the second + element must be a dict with additional options (e.g. `template_engine`) + or default variables for the template. ''' + name = 'template' + api = 2 + + def apply(self, callback, route): + conf = route.config.get('template') + if isinstance(conf, (tuple, list)) and len(conf) == 2: + return view(conf[0], **conf[1])(callback) + elif isinstance(conf, str): + return view(conf)(callback) + else: + return callback + + +#: Not a plugin, but part of the plugin API. TODO: Find a better place. +class _ImportRedirect(object): + def __init__(self, name, impmask): + ''' Create a virtual package that redirects imports (see PEP 302). ''' + self.name = name + self.impmask = impmask + self.module = sys.modules.setdefault(name, new_module(name)) + self.module.__dict__.update({'__file__': __file__, '__path__': [], + '__all__': [], '__loader__': self}) + sys.meta_path.append(self) + + def find_module(self, fullname, path=None): + if '.' not in fullname: return + packname = fullname.rsplit('.', 1)[0] + if packname != self.name: return + return self + + def load_module(self, fullname): + if fullname in sys.modules: return sys.modules[fullname] + modname = fullname.rsplit('.', 1)[1] + realname = self.impmask % modname + __import__(realname) + module = sys.modules[fullname] = sys.modules[realname] + setattr(self.module, modname, module) + module.__loader__ = self + return module + + + + + + +############################################################################### +# Common Utilities ############################################################# +############################################################################### + + +class MultiDict(DictMixin): + """ This dict stores multiple values per key, but behaves exactly like a + normal dict in that it returns only the newest value for any given key. + There are special methods available to access the full list of values. + """ + + def __init__(self, *a, **k): + self.dict = dict((k, [v]) for (k, v) in dict(*a, **k).items()) + + def __len__(self): return len(self.dict) + def __iter__(self): return iter(self.dict) + def __contains__(self, key): return key in self.dict + def __delitem__(self, key): del self.dict[key] + def __getitem__(self, key): return self.dict[key][-1] + def __setitem__(self, key, value): self.append(key, value) + def keys(self): return self.dict.keys() + + if py3k: + def values(self): return (v[-1] for v in self.dict.values()) + def items(self): return ((k, v[-1]) for k, v in self.dict.items()) + def allitems(self): + return ((k, v) for k, vl in self.dict.items() for v in vl) + iterkeys = keys + itervalues = values + iteritems = items + iterallitems = allitems + + else: + def values(self): return [v[-1] for v in self.dict.values()] + def items(self): return [(k, v[-1]) for k, v in self.dict.items()] + def iterkeys(self): return self.dict.iterkeys() + def itervalues(self): return (v[-1] for v in self.dict.itervalues()) + def iteritems(self): + return ((k, v[-1]) for k, v in self.dict.iteritems()) + def iterallitems(self): + return ((k, v) for k, vl in self.dict.iteritems() for v in vl) + def allitems(self): + return [(k, v) for k, vl in self.dict.iteritems() for v in vl] + + def get(self, key, default=None, index=-1, type=None): + ''' Return the most recent value for a key. + + :param default: The default value to be returned if the key is not + present or the type conversion fails. + :param index: An index for the list of available values. + :param type: If defined, this callable is used to cast the value + into a specific type. Exception are suppressed and result in + the default value to be returned. + ''' + try: + val = self.dict[key][index] + return type(val) if type else val + except Exception: + pass + return default + + def append(self, key, value): + ''' Add a new value to the list of values for this key. ''' + self.dict.setdefault(key, []).append(value) + + def replace(self, key, value): + ''' Replace the list of values with a single value. ''' + self.dict[key] = [value] + + def getall(self, key): + ''' Return a (possibly empty) list of values for a key. ''' + return self.dict.get(key) or [] + + #: Aliases for WTForms to mimic other multi-dict APIs (Django) + getone = get + getlist = getall + + +class FormsDict(MultiDict): + ''' This :class:`MultiDict` subclass is used to store request form data. + Additionally to the normal dict-like item access methods (which return + unmodified data as native strings), this container also supports + attribute-like access to its values. Attributes are automatically de- + or recoded to match :attr:`input_encoding` (default: 'utf8'). Missing + attributes default to an empty string. ''' + + #: Encoding used for attribute values. + input_encoding = 'utf8' + #: If true (default), unicode strings are first encoded with `latin1` + #: and then decoded to match :attr:`input_encoding`. + recode_unicode = True + + def _fix(self, s, encoding=None): + if isinstance(s, unicode) and self.recode_unicode: # Python 3 WSGI + return s.encode('latin1').decode(encoding or self.input_encoding) + elif isinstance(s, bytes): # Python 2 WSGI + return s.decode(encoding or self.input_encoding) + else: + return s + + def decode(self, encoding=None): + ''' Returns a copy with all keys and values de- or recoded to match + :attr:`input_encoding`. Some libraries (e.g. WTForms) want a + unicode dictionary. ''' + copy = FormsDict() + enc = copy.input_encoding = encoding or self.input_encoding + copy.recode_unicode = False + for key, value in self.allitems(): + copy.append(self._fix(key, enc), self._fix(value, enc)) + return copy + + def getunicode(self, name, default=None, encoding=None): + ''' Return the value as a unicode string, or the default. ''' + try: + return self._fix(self[name], encoding) + except (UnicodeError, KeyError): + return default + + def __getattr__(self, name, default=unicode()): + # Without this guard, pickle generates a cryptic TypeError: + if name.startswith('__') and name.endswith('__'): + return super(FormsDict, self).__getattr__(name) + return self.getunicode(name, default=default) + +class HeaderDict(MultiDict): + """ A case-insensitive version of :class:`MultiDict` that defaults to + replace the old value instead of appending it. """ + + def __init__(self, *a, **ka): + self.dict = {} + if a or ka: self.update(*a, **ka) + + def __contains__(self, key): return _hkey(key) in self.dict + def __delitem__(self, key): del self.dict[_hkey(key)] + def __getitem__(self, key): return self.dict[_hkey(key)][-1] + def __setitem__(self, key, value): self.dict[_hkey(key)] = [_hval(value)] + def append(self, key, value): self.dict.setdefault(_hkey(key), []).append(_hval(value)) + def replace(self, key, value): self.dict[_hkey(key)] = [_hval(value)] + def getall(self, key): return self.dict.get(_hkey(key)) or [] + def get(self, key, default=None, index=-1): + return MultiDict.get(self, _hkey(key), default, index) + def filter(self, names): + for name in (_hkey(n) for n in names): + if name in self.dict: + del self.dict[name] + + +class WSGIHeaderDict(DictMixin): + ''' This dict-like class wraps a WSGI environ dict and provides convenient + access to HTTP_* fields. Keys and values are native strings + (2.x bytes or 3.x unicode) and keys are case-insensitive. If the WSGI + environment contains non-native string values, these are de- or encoded + using a lossless 'latin1' character set. + + The API will remain stable even on changes to the relevant PEPs. + Currently PEP 333, 444 and 3333 are supported. (PEP 444 is the only one + that uses non-native strings.) + ''' + #: List of keys that do not have a ``HTTP_`` prefix. + cgikeys = ('CONTENT_TYPE', 'CONTENT_LENGTH') + + def __init__(self, environ): + self.environ = environ + + def _ekey(self, key): + ''' Translate header field name to CGI/WSGI environ key. ''' + key = key.replace('-','_').upper() + if key in self.cgikeys: + return key + return 'HTTP_' + key + + def raw(self, key, default=None): + ''' Return the header value as is (may be bytes or unicode). ''' + return self.environ.get(self._ekey(key), default) + + def __getitem__(self, key): + return tonat(self.environ[self._ekey(key)], 'latin1') + + def __setitem__(self, key, value): + raise TypeError("%s is read-only." % self.__class__) + + def __delitem__(self, key): + raise TypeError("%s is read-only." % self.__class__) + + def __iter__(self): + for key in self.environ: + if key[:5] == 'HTTP_': + yield key[5:].replace('_', '-').title() + elif key in self.cgikeys: + yield key.replace('_', '-').title() + + def keys(self): return [x for x in self] + def __len__(self): return len(self.keys()) + def __contains__(self, key): return self._ekey(key) in self.environ + + + +class ConfigDict(dict): + ''' A dict-like configuration storage with additional support for + namespaces, validators, meta-data, on_change listeners and more. + + This storage is optimized for fast read access. Retrieving a key + or using non-altering dict methods (e.g. `dict.get()`) has no overhead + compared to a native dict. + ''' + __slots__ = ('_meta', '_on_change') + + class Namespace(DictMixin): + + def __init__(self, config, namespace): + self._config = config + self._prefix = namespace + + def __getitem__(self, key): + depr('Accessing namespaces as dicts is discouraged. ' + 'Only use flat item access: ' + 'cfg["names"]["pace"]["key"] -> cfg["name.space.key"]') #0.12 + return self._config[self._prefix + '.' + key] + + def __setitem__(self, key, value): + self._config[self._prefix + '.' + key] = value + + def __delitem__(self, key): + del self._config[self._prefix + '.' + key] + + def __iter__(self): + ns_prefix = self._prefix + '.' + for key in self._config: + ns, dot, name = key.rpartition('.') + if ns == self._prefix and name: + yield name + + def keys(self): return [x for x in self] + def __len__(self): return len(self.keys()) + def __contains__(self, key): return self._prefix + '.' + key in self._config + def __repr__(self): return '' % self._prefix + def __str__(self): return '' % self._prefix + + # Deprecated ConfigDict features + def __getattr__(self, key): + depr('Attribute access is deprecated.') #0.12 + if key not in self and key[0].isupper(): + self[key] = ConfigDict.Namespace(self._config, self._prefix + '.' + key) + if key not in self and key.startswith('__'): + raise AttributeError(key) + return self.get(key) + + def __setattr__(self, key, value): + if key in ('_config', '_prefix'): + self.__dict__[key] = value + return + depr('Attribute assignment is deprecated.') #0.12 + if hasattr(DictMixin, key): + raise AttributeError('Read-only attribute.') + if key in self and self[key] and isinstance(self[key], self.__class__): + raise AttributeError('Non-empty namespace attribute.') + self[key] = value + + def __delattr__(self, key): + if key in self: + val = self.pop(key) + if isinstance(val, self.__class__): + prefix = key + '.' + for key in self: + if key.startswith(prefix): + del self[prefix+key] + + def __call__(self, *a, **ka): + depr('Calling ConfDict is deprecated. Use the update() method.') #0.12 + self.update(*a, **ka) + return self + + def __init__(self, *a, **ka): + self._meta = {} + self._on_change = lambda name, value: None + if a or ka: + depr('Constructor does no longer accept parameters.') #0.12 + self.update(*a, **ka) + + def load_config(self, filename): + ''' Load values from an *.ini style config file. + + If the config file contains sections, their names are used as + namespaces for the values within. The two special sections + ``DEFAULT`` and ``bottle`` refer to the root namespace (no prefix). + ''' + conf = ConfigParser() + conf.read(filename) + for section in conf.sections(): + for key, value in conf.items(section): + if section not in ('DEFAULT', 'bottle'): + key = section + '.' + key + self[key] = value + return self + + def load_dict(self, source, namespace='', make_namespaces=False): + ''' Import values from a dictionary structure. Nesting can be used to + represent namespaces. + + >>> ConfigDict().load_dict({'name': {'space': {'key': 'value'}}}) + {'name.space.key': 'value'} + ''' + stack = [(namespace, source)] + while stack: + prefix, source = stack.pop() + if not isinstance(source, dict): + raise TypeError('Source is not a dict (r)' % type(key)) + for key, value in source.items(): + if not isinstance(key, basestring): + raise TypeError('Key is not a string (%r)' % type(key)) + full_key = prefix + '.' + key if prefix else key + if isinstance(value, dict): + stack.append((full_key, value)) + if make_namespaces: + self[full_key] = self.Namespace(self, full_key) + else: + self[full_key] = value + return self + + def update(self, *a, **ka): + ''' If the first parameter is a string, all keys are prefixed with this + namespace. Apart from that it works just as the usual dict.update(). + Example: ``update('some.namespace', key='value')`` ''' + prefix = '' + if a and isinstance(a[0], basestring): + prefix = a[0].strip('.') + '.' + a = a[1:] + for key, value in dict(*a, **ka).items(): + self[prefix+key] = value + + def setdefault(self, key, value): + if key not in self: + self[key] = value + return self[key] + + def __setitem__(self, key, value): + if not isinstance(key, basestring): + raise TypeError('Key has type %r (not a string)' % type(key)) + + value = self.meta_get(key, 'filter', lambda x: x)(value) + if key in self and self[key] is value: + return + self._on_change(key, value) + dict.__setitem__(self, key, value) + + def __delitem__(self, key): + dict.__delitem__(self, key) + + def clear(self): + for key in self: + del self[key] + + def meta_get(self, key, metafield, default=None): + ''' Return the value of a meta field for a key. ''' + return self._meta.get(key, {}).get(metafield, default) + + def meta_set(self, key, metafield, value): + ''' Set the meta field for a key to a new value. This triggers the + on-change handler for existing keys. ''' + self._meta.setdefault(key, {})[metafield] = value + if key in self: + self[key] = self[key] + + def meta_list(self, key): + ''' Return an iterable of meta field names defined for a key. ''' + return self._meta.get(key, {}).keys() + + # Deprecated ConfigDict features + def __getattr__(self, key): + depr('Attribute access is deprecated.') #0.12 + if key not in self and key[0].isupper(): + self[key] = self.Namespace(self, key) + if key not in self and key.startswith('__'): + raise AttributeError(key) + return self.get(key) + + def __setattr__(self, key, value): + if key in self.__slots__: + return dict.__setattr__(self, key, value) + depr('Attribute assignment is deprecated.') #0.12 + if hasattr(dict, key): + raise AttributeError('Read-only attribute.') + if key in self and self[key] and isinstance(self[key], self.Namespace): + raise AttributeError('Non-empty namespace attribute.') + self[key] = value + + def __delattr__(self, key): + if key in self: + val = self.pop(key) + if isinstance(val, self.Namespace): + prefix = key + '.' + for key in self: + if key.startswith(prefix): + del self[prefix+key] + + def __call__(self, *a, **ka): + depr('Calling ConfDict is deprecated. Use the update() method.') #0.12 + self.update(*a, **ka) + return self + + + +class AppStack(list): + """ A stack-like list. Calling it returns the head of the stack. """ + + def __call__(self): + """ Return the current default application. """ + return self[-1] + + def push(self, value=None): + """ Add a new :class:`Bottle` instance to the stack """ + if not isinstance(value, Bottle): + value = Bottle() + self.append(value) + return value + + +class WSGIFileWrapper(object): + + def __init__(self, fp, buffer_size=1024*64): + self.fp, self.buffer_size = fp, buffer_size + for attr in ('fileno', 'close', 'read', 'readlines', 'tell', 'seek'): + if hasattr(fp, attr): setattr(self, attr, getattr(fp, attr)) + + def __iter__(self): + buff, read = self.buffer_size, self.read + while True: + part = read(buff) + if not part: return + yield part + + +class _closeiter(object): + ''' This only exists to be able to attach a .close method to iterators that + do not support attribute assignment (most of itertools). ''' + + def __init__(self, iterator, close=None): + self.iterator = iterator + self.close_callbacks = makelist(close) + + def __iter__(self): + return iter(self.iterator) + + def close(self): + for func in self.close_callbacks: + func() + + +class ResourceManager(object): + ''' This class manages a list of search paths and helps to find and open + application-bound resources (files). + + :param base: default value for :meth:`add_path` calls. + :param opener: callable used to open resources. + :param cachemode: controls which lookups are cached. One of 'all', + 'found' or 'none'. + ''' + + def __init__(self, base='./', opener=open, cachemode='all'): + self.opener = open + self.base = base + self.cachemode = cachemode + + #: A list of search paths. See :meth:`add_path` for details. + self.path = [] + #: A cache for resolved paths. ``res.cache.clear()`` clears the cache. + self.cache = {} + + def add_path(self, path, base=None, index=None, create=False): + ''' Add a new path to the list of search paths. Return False if the + path does not exist. + + :param path: The new search path. Relative paths are turned into + an absolute and normalized form. If the path looks like a file + (not ending in `/`), the filename is stripped off. + :param base: Path used to absolutize relative search paths. + Defaults to :attr:`base` which defaults to ``os.getcwd()``. + :param index: Position within the list of search paths. Defaults + to last index (appends to the list). + + The `base` parameter makes it easy to reference files installed + along with a python module or package:: + + res.add_path('./resources/', __file__) + ''' + base = os.path.abspath(os.path.dirname(base or self.base)) + path = os.path.abspath(os.path.join(base, os.path.dirname(path))) + path += os.sep + if path in self.path: + self.path.remove(path) + if create and not os.path.isdir(path): + os.makedirs(path) + if index is None: + self.path.append(path) + else: + self.path.insert(index, path) + self.cache.clear() + return os.path.exists(path) + + def __iter__(self): + ''' Iterate over all existing files in all registered paths. ''' + search = self.path[:] + while search: + path = search.pop() + if not os.path.isdir(path): continue + for name in os.listdir(path): + full = os.path.join(path, name) + if os.path.isdir(full): search.append(full) + else: yield full + + def lookup(self, name): + ''' Search for a resource and return an absolute file path, or `None`. + + The :attr:`path` list is searched in order. The first match is + returend. Symlinks are followed. The result is cached to speed up + future lookups. ''' + if name not in self.cache or DEBUG: + for path in self.path: + fpath = os.path.join(path, name) + if os.path.isfile(fpath): + if self.cachemode in ('all', 'found'): + self.cache[name] = fpath + return fpath + if self.cachemode == 'all': + self.cache[name] = None + return self.cache[name] + + def open(self, name, mode='r', *args, **kwargs): + ''' Find a resource and return a file object, or raise IOError. ''' + fname = self.lookup(name) + if not fname: raise IOError("Resource %r not found." % name) + return self.opener(fname, mode=mode, *args, **kwargs) + + +class FileUpload(object): + + def __init__(self, fileobj, name, filename, headers=None): + ''' Wrapper for file uploads. ''' + #: Open file(-like) object (BytesIO buffer or temporary file) + self.file = fileobj + #: Name of the upload form field + self.name = name + #: Raw filename as sent by the client (may contain unsafe characters) + self.raw_filename = filename + #: A :class:`HeaderDict` with additional headers (e.g. content-type) + self.headers = HeaderDict(headers) if headers else HeaderDict() + + content_type = HeaderProperty('Content-Type') + content_length = HeaderProperty('Content-Length', reader=int, default=-1) + + def get_header(self, name, default=None): + """ Return the value of a header within the mulripart part. """ + return self.headers.get(name, default) + + @cached_property + def filename(self): + ''' Name of the file on the client file system, but normalized to ensure + file system compatibility. An empty filename is returned as 'empty'. + + Only ASCII letters, digits, dashes, underscores and dots are + allowed in the final filename. Accents are removed, if possible. + Whitespace is replaced by a single dash. Leading or tailing dots + or dashes are removed. The filename is limited to 255 characters. + ''' + fname = self.raw_filename + if not isinstance(fname, unicode): + fname = fname.decode('utf8', 'ignore') + fname = normalize('NFKD', fname).encode('ASCII', 'ignore').decode('ASCII') + fname = os.path.basename(fname.replace('\\', os.path.sep)) + fname = re.sub(r'[^a-zA-Z0-9-_.\s]', '', fname).strip() + fname = re.sub(r'[-\s]+', '-', fname).strip('.-') + return fname[:255] or 'empty' + + def _copy_file(self, fp, chunk_size=2**16): + read, write, offset = self.file.read, fp.write, self.file.tell() + while 1: + buf = read(chunk_size) + if not buf: break + write(buf) + self.file.seek(offset) + + def save(self, destination, overwrite=False, chunk_size=2**16): + ''' Save file to disk or copy its content to an open file(-like) object. + If *destination* is a directory, :attr:`filename` is added to the + path. Existing files are not overwritten by default (IOError). + + :param destination: File path, directory or file(-like) object. + :param overwrite: If True, replace existing files. (default: False) + :param chunk_size: Bytes to read at a time. (default: 64kb) + ''' + if isinstance(destination, basestring): # Except file-likes here + if os.path.isdir(destination): + destination = os.path.join(destination, self.filename) + if not overwrite and os.path.exists(destination): + raise IOError('File exists.') + with open(destination, 'wb') as fp: + self._copy_file(fp, chunk_size) + else: + self._copy_file(destination, chunk_size) + + + + + + +############################################################################### +# Application Helper ########################################################### +############################################################################### + + +def abort(code=500, text='Unknown Error.'): + """ Aborts execution and causes a HTTP error. """ + raise HTTPError(code, text) + + +def redirect(url, code=None): + """ Aborts execution and causes a 303 or 302 redirect, depending on + the HTTP protocol version. """ + if not code: + code = 303 if request.get('SERVER_PROTOCOL') == "HTTP/1.1" else 302 + res = response.copy(cls=HTTPResponse) + res.status = code + res.body = "" + res.set_header('Location', urljoin(request.url, url)) + raise res + + +def _file_iter_range(fp, offset, bytes, maxread=1024*1024): + ''' Yield chunks from a range in a file. No chunk is bigger than maxread.''' + fp.seek(offset) + while bytes > 0: + part = fp.read(min(bytes, maxread)) + if not part: break + bytes -= len(part) + yield part + + +def static_file(filename, root, mimetype='auto', download=False, charset='UTF-8'): + """ Open a file in a safe way and return :exc:`HTTPResponse` with status + code 200, 305, 403 or 404. The ``Content-Type``, ``Content-Encoding``, + ``Content-Length`` and ``Last-Modified`` headers are set if possible. + Special support for ``If-Modified-Since``, ``Range`` and ``HEAD`` + requests. + + :param filename: Name or path of the file to send. + :param root: Root path for file lookups. Should be an absolute directory + path. + :param mimetype: Defines the content-type header (default: guess from + file extension) + :param download: If True, ask the browser to open a `Save as...` dialog + instead of opening the file with the associated program. You can + specify a custom filename as a string. If not specified, the + original filename is used (default: False). + :param charset: The charset to use for files with a ``text/*`` + mime-type. (default: UTF-8) + """ + + root = os.path.abspath(root) + os.sep + filename = os.path.abspath(os.path.join(root, filename.strip('/\\'))) + headers = dict() + + if not filename.startswith(root): + return HTTPError(403, "Access denied.") + if not os.path.exists(filename) or not os.path.isfile(filename): + return HTTPError(404, "File does not exist.") + if not os.access(filename, os.R_OK): + return HTTPError(403, "You do not have permission to access this file.") + + if mimetype == 'auto': + mimetype, encoding = mimetypes.guess_type(filename) + if encoding: headers['Content-Encoding'] = encoding + + if mimetype: + if mimetype[:5] == 'text/' and charset and 'charset' not in mimetype: + mimetype += '; charset=%s' % charset + headers['Content-Type'] = mimetype + + if download: + download = os.path.basename(filename if download == True else download) + headers['Content-Disposition'] = 'attachment; filename="%s"' % download + + stats = os.stat(filename) + headers['Content-Length'] = clen = stats.st_size + lm = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime(stats.st_mtime)) + headers['Last-Modified'] = lm + + ims = request.environ.get('HTTP_IF_MODIFIED_SINCE') + if ims: + ims = parse_date(ims.split(";")[0].strip()) + if ims is not None and ims >= int(stats.st_mtime): + headers['Date'] = time.strftime("%a, %d %b %Y %H:%M:%S GMT", time.gmtime()) + return HTTPResponse(status=304, **headers) + + body = '' if request.method == 'HEAD' else open(filename, 'rb') + + headers["Accept-Ranges"] = "bytes" + ranges = request.environ.get('HTTP_RANGE') + if 'HTTP_RANGE' in request.environ: + ranges = list(parse_range_header(request.environ['HTTP_RANGE'], clen)) + if not ranges: + return HTTPError(416, "Requested Range Not Satisfiable") + offset, end = ranges[0] + headers["Content-Range"] = "bytes %d-%d/%d" % (offset, end-1, clen) + headers["Content-Length"] = str(end-offset) + if body: body = _file_iter_range(body, offset, end-offset) + return HTTPResponse(body, status=206, **headers) + return HTTPResponse(body, **headers) + + + + + + +############################################################################### +# HTTP Utilities and MISC (TODO) ############################################### +############################################################################### + + +def debug(mode=True): + """ Change the debug level. + There is only one debug level supported at the moment.""" + global DEBUG + if mode: warnings.simplefilter('default') + DEBUG = bool(mode) + +def http_date(value): + if isinstance(value, (datedate, datetime)): + value = value.utctimetuple() + elif isinstance(value, (int, float)): + value = time.gmtime(value) + if not isinstance(value, basestring): + value = time.strftime("%a, %d %b %Y %H:%M:%S GMT", value) + return value + +def parse_date(ims): + """ Parse rfc1123, rfc850 and asctime timestamps and return UTC epoch. """ + try: + ts = email.utils.parsedate_tz(ims) + return time.mktime(ts[:8] + (0,)) - (ts[9] or 0) - time.timezone + except (TypeError, ValueError, IndexError, OverflowError): + return None + +def parse_auth(header): + """ Parse rfc2617 HTTP authentication header string (basic) and return (user,pass) tuple or None""" + try: + method, data = header.split(None, 1) + if method.lower() == 'basic': + user, pwd = touni(base64.b64decode(tob(data))).split(':',1) + return user, pwd + except (KeyError, ValueError): + return None + +def parse_range_header(header, maxlen=0): + ''' Yield (start, end) ranges parsed from a HTTP Range header. Skip + unsatisfiable ranges. The end index is non-inclusive.''' + if not header or header[:6] != 'bytes=': return + ranges = [r.split('-', 1) for r in header[6:].split(',') if '-' in r] + for start, end in ranges: + try: + if not start: # bytes=-100 -> last 100 bytes + start, end = max(0, maxlen-int(end)), maxlen + elif not end: # bytes=100- -> all but the first 99 bytes + start, end = int(start), maxlen + else: # bytes=100-200 -> bytes 100-200 (inclusive) + start, end = int(start), min(int(end)+1, maxlen) + if 0 <= start < end <= maxlen: + yield start, end + except ValueError: + pass + +def _parse_qsl(qs): + r = [] + for pair in qs.replace(';','&').split('&'): + if not pair: continue + nv = pair.split('=', 1) + if len(nv) != 2: nv.append('') + key = urlunquote(nv[0].replace('+', ' ')) + value = urlunquote(nv[1].replace('+', ' ')) + r.append((key, value)) + return r + +def _lscmp(a, b): + ''' Compares two strings in a cryptographically safe way: + Runtime is not affected by length of common prefix. ''' + return not sum(0 if x==y else 1 for x, y in zip(a, b)) and len(a) == len(b) + + +def cookie_encode(data, key): + ''' Encode and sign a pickle-able object. Return a (byte) string ''' + msg = base64.b64encode(pickle.dumps(data, -1)) + sig = base64.b64encode(hmac.new(tob(key), msg, digestmod=hashlib.md5).digest()) + return tob('!') + sig + tob('?') + msg + + +def cookie_decode(data, key): + ''' Verify and decode an encoded string. Return an object or None.''' + data = tob(data) + if cookie_is_encoded(data): + sig, msg = data.split(tob('?'), 1) + if _lscmp(sig[1:], base64.b64encode(hmac.new(tob(key), msg, digestmod=hashlib.md5).digest())): + return pickle.loads(base64.b64decode(msg)) + return None + + +def cookie_is_encoded(data): + ''' Return True if the argument looks like a encoded cookie.''' + return bool(data.startswith(tob('!')) and tob('?') in data) + + +def html_escape(string): + ''' Escape HTML special characters ``&<>`` and quotes ``'"``. ''' + return string.replace('&','&').replace('<','<').replace('>','>')\ + .replace('"','"').replace("'",''') + + +def html_quote(string): + ''' Escape and quote a string to be used as an HTTP attribute.''' + return '"%s"' % html_escape(string).replace('\n',' ')\ + .replace('\r',' ').replace('\t',' ') + + +def yieldroutes(func): + """ Return a generator for routes that match the signature (name, args) + of the func parameter. This may yield more than one route if the function + takes optional keyword arguments. The output is best described by example:: + + a() -> '/a' + b(x, y) -> '/b//' + c(x, y=5) -> '/c/' and '/c//' + d(x=5, y=6) -> '/d' and '/d/' and '/d//' + """ + path = '/' + func.__name__.replace('__','/').lstrip('/') + spec = getargspec(func) + argc = len(spec[0]) - len(spec[3] or []) + path += ('/<%s>' * argc) % tuple(spec[0][:argc]) + yield path + for arg in spec[0][argc:]: + path += '/<%s>' % arg + yield path + + +def path_shift(script_name, path_info, shift=1): + ''' Shift path fragments from PATH_INFO to SCRIPT_NAME and vice versa. + + :return: The modified paths. + :param script_name: The SCRIPT_NAME path. + :param script_name: The PATH_INFO path. + :param shift: The number of path fragments to shift. May be negative to + change the shift direction. (default: 1) + ''' + if shift == 0: return script_name, path_info + pathlist = path_info.strip('/').split('/') + scriptlist = script_name.strip('/').split('/') + if pathlist and pathlist[0] == '': pathlist = [] + if scriptlist and scriptlist[0] == '': scriptlist = [] + if shift > 0 and shift <= len(pathlist): + moved = pathlist[:shift] + scriptlist = scriptlist + moved + pathlist = pathlist[shift:] + elif shift < 0 and shift >= -len(scriptlist): + moved = scriptlist[shift:] + pathlist = moved + pathlist + scriptlist = scriptlist[:shift] + else: + empty = 'SCRIPT_NAME' if shift < 0 else 'PATH_INFO' + raise AssertionError("Cannot shift. Nothing left from %s" % empty) + new_script_name = '/' + '/'.join(scriptlist) + new_path_info = '/' + '/'.join(pathlist) + if path_info.endswith('/') and pathlist: new_path_info += '/' + return new_script_name, new_path_info + + +def auth_basic(check, realm="private", text="Access denied"): + ''' Callback decorator to require HTTP auth (basic). + TODO: Add route(check_auth=...) parameter. ''' + def decorator(func): + def wrapper(*a, **ka): + user, password = request.auth or (None, None) + if user is None or not check(user, password): + err = HTTPError(401, text) + err.add_header('WWW-Authenticate', 'Basic realm="%s"' % realm) + return err + return func(*a, **ka) + return wrapper + return decorator + + +# Shortcuts for common Bottle methods. +# They all refer to the current default application. + +def make_default_app_wrapper(name): + ''' Return a callable that relays calls to the current default app. ''' + @functools.wraps(getattr(Bottle, name)) + def wrapper(*a, **ka): + return getattr(app(), name)(*a, **ka) + return wrapper + +route = make_default_app_wrapper('route') +get = make_default_app_wrapper('get') +post = make_default_app_wrapper('post') +put = make_default_app_wrapper('put') +delete = make_default_app_wrapper('delete') +error = make_default_app_wrapper('error') +mount = make_default_app_wrapper('mount') +hook = make_default_app_wrapper('hook') +install = make_default_app_wrapper('install') +uninstall = make_default_app_wrapper('uninstall') +url = make_default_app_wrapper('get_url') + + + + + + + +############################################################################### +# Server Adapter ############################################################### +############################################################################### + + +class ServerAdapter(object): + quiet = False + def __init__(self, host='127.0.0.1', port=8080, **options): + self.options = options + self.host = host + self.port = int(port) + + def run(self, handler): # pragma: no cover + pass + + def __repr__(self): + args = ', '.join(['%s=%s'%(k,repr(v)) for k, v in self.options.items()]) + return "%s(%s)" % (self.__class__.__name__, args) + + +class CGIServer(ServerAdapter): + quiet = True + def run(self, handler): # pragma: no cover + from wsgiref.handlers import CGIHandler + def fixed_environ(environ, start_response): + environ.setdefault('PATH_INFO', '') + return handler(environ, start_response) + CGIHandler().run(fixed_environ) + + +class FlupFCGIServer(ServerAdapter): + def run(self, handler): # pragma: no cover + import flup.server.fcgi + self.options.setdefault('bindAddress', (self.host, self.port)) + flup.server.fcgi.WSGIServer(handler, **self.options).run() + + +class WSGIRefServer(ServerAdapter): + def run(self, app): # pragma: no cover + from wsgiref.simple_server import WSGIRequestHandler, WSGIServer + from wsgiref.simple_server import make_server + import socket + + class FixedHandler(WSGIRequestHandler): + def address_string(self): # Prevent reverse DNS lookups please. + return self.client_address[0] + def log_request(*args, **kw): + if not self.quiet: + return WSGIRequestHandler.log_request(*args, **kw) + + handler_cls = self.options.get('handler_class', FixedHandler) + server_cls = self.options.get('server_class', WSGIServer) + + if ':' in self.host: # Fix wsgiref for IPv6 addresses. + if getattr(server_cls, 'address_family') == socket.AF_INET: + class server_cls(server_cls): + address_family = socket.AF_INET6 + + srv = make_server(self.host, self.port, app, server_cls, handler_cls) + srv.serve_forever() + + +class CherryPyServer(ServerAdapter): + def run(self, handler): # pragma: no cover + from cherrypy import wsgiserver + self.options['bind_addr'] = (self.host, self.port) + self.options['wsgi_app'] = handler + + certfile = self.options.get('certfile') + if certfile: + del self.options['certfile'] + keyfile = self.options.get('keyfile') + if keyfile: + del self.options['keyfile'] + + server = wsgiserver.CherryPyWSGIServer(**self.options) + if certfile: + server.ssl_certificate = certfile + if keyfile: + server.ssl_private_key = keyfile + + try: + server.start() + finally: + server.stop() + + +class WaitressServer(ServerAdapter): + def run(self, handler): + from waitress import serve + serve(handler, host=self.host, port=self.port) + + +class PasteServer(ServerAdapter): + def run(self, handler): # pragma: no cover + from paste import httpserver + from paste.translogger import TransLogger + handler = TransLogger(handler, setup_console_handler=(not self.quiet)) + httpserver.serve(handler, host=self.host, port=str(self.port), + **self.options) + + +class MeinheldServer(ServerAdapter): + def run(self, handler): + from meinheld import server + server.listen((self.host, self.port)) + server.run(handler) + + +class FapwsServer(ServerAdapter): + """ Extremely fast webserver using libev. See http://www.fapws.org/ """ + def run(self, handler): # pragma: no cover + import fapws._evwsgi as evwsgi + from fapws import base, config + port = self.port + if float(config.SERVER_IDENT[-2:]) > 0.4: + # fapws3 silently changed its API in 0.5 + port = str(port) + evwsgi.start(self.host, port) + # fapws3 never releases the GIL. Complain upstream. I tried. No luck. + if 'BOTTLE_CHILD' in os.environ and not self.quiet: + _stderr("WARNING: Auto-reloading does not work with Fapws3.\n") + _stderr(" (Fapws3 breaks python thread support)\n") + evwsgi.set_base_module(base) + def app(environ, start_response): + environ['wsgi.multiprocess'] = False + return handler(environ, start_response) + evwsgi.wsgi_cb(('', app)) + evwsgi.run() + + +class TornadoServer(ServerAdapter): + """ The super hyped asynchronous server by facebook. Untested. """ + def run(self, handler): # pragma: no cover + import tornado.wsgi, tornado.httpserver, tornado.ioloop + container = tornado.wsgi.WSGIContainer(handler) + server = tornado.httpserver.HTTPServer(container) + server.listen(port=self.port,address=self.host) + tornado.ioloop.IOLoop.instance().start() + + +class AppEngineServer(ServerAdapter): + """ Adapter for Google App Engine. """ + quiet = True + def run(self, handler): + from google.appengine.ext.webapp import util + # A main() function in the handler script enables 'App Caching'. + # Lets makes sure it is there. This _really_ improves performance. + module = sys.modules.get('__main__') + if module and not hasattr(module, 'main'): + module.main = lambda: util.run_wsgi_app(handler) + util.run_wsgi_app(handler) + + +class TwistedServer(ServerAdapter): + """ Untested. """ + def run(self, handler): + from twisted.web import server, wsgi + from twisted.python.threadpool import ThreadPool + from twisted.internet import reactor + thread_pool = ThreadPool() + thread_pool.start() + reactor.addSystemEventTrigger('after', 'shutdown', thread_pool.stop) + factory = server.Site(wsgi.WSGIResource(reactor, thread_pool, handler)) + reactor.listenTCP(self.port, factory, interface=self.host) + reactor.run() + + +class DieselServer(ServerAdapter): + """ Untested. """ + def run(self, handler): + from diesel.protocols.wsgi import WSGIApplication + app = WSGIApplication(handler, port=self.port) + app.run() + + +class GeventServer(ServerAdapter): + """ Untested. Options: + + * `fast` (default: False) uses libevent's http server, but has some + issues: No streaming, no pipelining, no SSL. + * See gevent.wsgi.WSGIServer() documentation for more options. + """ + def run(self, handler): + from gevent import pywsgi, local + if not isinstance(threading.local(), local.local): + msg = "Bottle requires gevent.monkey.patch_all() (before import)" + raise RuntimeError(msg) + if self.options.pop('fast', None): + depr('The "fast" option has been deprecated and removed by Gevent.') + if self.quiet: + self.options['log'] = None + address = (self.host, self.port) + server = pywsgi.WSGIServer(address, handler, **self.options) + if 'BOTTLE_CHILD' in os.environ: + import signal + signal.signal(signal.SIGINT, lambda s, f: server.stop()) + server.serve_forever() + + +class GeventSocketIOServer(ServerAdapter): + def run(self,handler): + from socketio import server + address = (self.host, self.port) + server.SocketIOServer(address, handler, **self.options).serve_forever() + + +class GunicornServer(ServerAdapter): + """ Untested. See http://gunicorn.org/configure.html for options. """ + def run(self, handler): + from gunicorn.app.base import Application + + config = {'bind': "%s:%d" % (self.host, int(self.port))} + config.update(self.options) + + class GunicornApplication(Application): + def init(self, parser, opts, args): + return config + + def load(self): + return handler + + GunicornApplication().run() + + +class EventletServer(ServerAdapter): + """ Untested """ + def run(self, handler): + from eventlet import wsgi, listen + try: + wsgi.server(listen((self.host, self.port)), handler, + log_output=(not self.quiet)) + except TypeError: + # Fallback, if we have old version of eventlet + wsgi.server(listen((self.host, self.port)), handler) + + +class RocketServer(ServerAdapter): + """ Untested. """ + def run(self, handler): + from rocket import Rocket + server = Rocket((self.host, self.port), 'wsgi', { 'wsgi_app' : handler }) + server.start() + + +class BjoernServer(ServerAdapter): + """ Fast server written in C: https://github.com/jonashaag/bjoern """ + def run(self, handler): + from bjoern import run + run(handler, self.host, self.port) + + +class AutoServer(ServerAdapter): + """ Untested. """ + adapters = [WaitressServer, PasteServer, TwistedServer, CherryPyServer, WSGIRefServer] + def run(self, handler): + for sa in self.adapters: + try: + return sa(self.host, self.port, **self.options).run(handler) + except ImportError: + pass + +server_names = { + 'cgi': CGIServer, + 'flup': FlupFCGIServer, + 'wsgiref': WSGIRefServer, + 'waitress': WaitressServer, + 'cherrypy': CherryPyServer, + 'paste': PasteServer, + 'fapws3': FapwsServer, + 'tornado': TornadoServer, + 'gae': AppEngineServer, + 'twisted': TwistedServer, + 'diesel': DieselServer, + 'meinheld': MeinheldServer, + 'gunicorn': GunicornServer, + 'eventlet': EventletServer, + 'gevent': GeventServer, + 'geventSocketIO':GeventSocketIOServer, + 'rocket': RocketServer, + 'bjoern' : BjoernServer, + 'auto': AutoServer, +} + + + + + + +############################################################################### +# Application Control ########################################################## +############################################################################### + + +def load(target, **namespace): + """ Import a module or fetch an object from a module. + + * ``package.module`` returns `module` as a module object. + * ``pack.mod:name`` returns the module variable `name` from `pack.mod`. + * ``pack.mod:func()`` calls `pack.mod.func()` and returns the result. + + The last form accepts not only function calls, but any type of + expression. Keyword arguments passed to this function are available as + local variables. Example: ``import_string('re:compile(x)', x='[a-z]')`` + """ + module, target = target.split(":", 1) if ':' in target else (target, None) + if module not in sys.modules: __import__(module) + if not target: return sys.modules[module] + if target.isalnum(): return getattr(sys.modules[module], target) + package_name = module.split('.')[0] + namespace[package_name] = sys.modules[package_name] + return eval('%s.%s' % (module, target), namespace) + + +def load_app(target): + """ Load a bottle application from a module and make sure that the import + does not affect the current default application, but returns a separate + application object. See :func:`load` for the target parameter. """ + global NORUN; NORUN, nr_old = True, NORUN + try: + tmp = default_app.push() # Create a new "default application" + rv = load(target) # Import the target module + return rv if callable(rv) else tmp + finally: + default_app.remove(tmp) # Remove the temporary added default application + NORUN = nr_old + +_debug = debug +def run(app=None, server='wsgiref', host='127.0.0.1', port=8080, + interval=1, reloader=False, quiet=False, plugins=None, + debug=None, **kargs): + """ Start a server instance. This method blocks until the server terminates. + + :param app: WSGI application or target string supported by + :func:`load_app`. (default: :func:`default_app`) + :param server: Server adapter to use. See :data:`server_names` keys + for valid names or pass a :class:`ServerAdapter` subclass. + (default: `wsgiref`) + :param host: Server address to bind to. Pass ``0.0.0.0`` to listens on + all interfaces including the external one. (default: 127.0.0.1) + :param port: Server port to bind to. Values below 1024 require root + privileges. (default: 8080) + :param reloader: Start auto-reloading server? (default: False) + :param interval: Auto-reloader interval in seconds (default: 1) + :param quiet: Suppress output to stdout and stderr? (default: False) + :param options: Options passed to the server adapter. + """ + if NORUN: return + if reloader and not os.environ.get('BOTTLE_CHILD'): + try: + lockfile = None + fd, lockfile = tempfile.mkstemp(prefix='bottle.', suffix='.lock') + os.close(fd) # We only need this file to exist. We never write to it + while os.path.exists(lockfile): + args = [sys.executable] + sys.argv + environ = os.environ.copy() + environ['BOTTLE_CHILD'] = 'true' + environ['BOTTLE_LOCKFILE'] = lockfile + p = subprocess.Popen(args, env=environ) + while p.poll() is None: # Busy wait... + os.utime(lockfile, None) # I am alive! + time.sleep(interval) + if p.poll() != 3: + if os.path.exists(lockfile): os.unlink(lockfile) + sys.exit(p.poll()) + except KeyboardInterrupt: + pass + finally: + if os.path.exists(lockfile): + os.unlink(lockfile) + return + + try: + if debug is not None: _debug(debug) + app = app or default_app() + if isinstance(app, basestring): + app = load_app(app) + if not callable(app): + raise ValueError("Application is not callable: %r" % app) + + for plugin in plugins or []: + app.install(plugin) + + if server in server_names: + server = server_names.get(server) + if isinstance(server, basestring): + server = load(server) + if isinstance(server, type): + server = server(host=host, port=port, **kargs) + if not isinstance(server, ServerAdapter): + raise ValueError("Unknown or unsupported server: %r" % server) + + server.quiet = server.quiet or quiet + if not server.quiet: + _stderr("Bottle v%s server starting up (using %s)...\n" % (__version__, repr(server))) + _stderr("Listening on http://%s:%d/\n" % (server.host, server.port)) + _stderr("Hit Ctrl-C to quit.\n\n") + + if reloader: + lockfile = os.environ.get('BOTTLE_LOCKFILE') + bgcheck = FileCheckerThread(lockfile, interval) + with bgcheck: + server.run(app) + if bgcheck.status == 'reload': + sys.exit(3) + else: + server.run(app) + except KeyboardInterrupt: + pass + except (SystemExit, MemoryError): + raise + except: + if not reloader: raise + if not getattr(server, 'quiet', quiet): + print_exc() + time.sleep(interval) + sys.exit(3) + + + +class FileCheckerThread(threading.Thread): + ''' Interrupt main-thread as soon as a changed module file is detected, + the lockfile gets deleted or gets to old. ''' + + def __init__(self, lockfile, interval): + threading.Thread.__init__(self) + self.lockfile, self.interval = lockfile, interval + #: Is one of 'reload', 'error' or 'exit' + self.status = None + + def run(self): + exists = os.path.exists + mtime = lambda path: os.stat(path).st_mtime + files = dict() + + for module in list(sys.modules.values()): + path = getattr(module, '__file__', '') or '' + if path[-4:] in ('.pyo', '.pyc'): path = path[:-1] + if path and exists(path): files[path] = mtime(path) + + while not self.status: + if not exists(self.lockfile)\ + or mtime(self.lockfile) < time.time() - self.interval - 5: + self.status = 'error' + thread.interrupt_main() + for path, lmtime in list(files.items()): + if not exists(path) or mtime(path) > lmtime: + self.status = 'reload' + thread.interrupt_main() + break + time.sleep(self.interval) + + def __enter__(self): + self.start() + + def __exit__(self, exc_type, exc_val, exc_tb): + if not self.status: self.status = 'exit' # silent exit + self.join() + return exc_type is not None and issubclass(exc_type, KeyboardInterrupt) + + + + + +############################################################################### +# Template Adapters ############################################################ +############################################################################### + + +class TemplateError(HTTPError): + def __init__(self, message): + HTTPError.__init__(self, 500, message) + + +class BaseTemplate(object): + """ Base class and minimal API for template adapters """ + extensions = ['tpl','html','thtml','stpl'] + settings = {} #used in prepare() + defaults = {} #used in render() + + def __init__(self, source=None, name=None, lookup=[], encoding='utf8', **settings): + """ Create a new template. + If the source parameter (str or buffer) is missing, the name argument + is used to guess a template filename. Subclasses can assume that + self.source and/or self.filename are set. Both are strings. + The lookup, encoding and settings parameters are stored as instance + variables. + The lookup parameter stores a list containing directory paths. + The encoding parameter should be used to decode byte strings or files. + The settings parameter contains a dict for engine-specific settings. + """ + self.name = name + self.source = source.read() if hasattr(source, 'read') else source + self.filename = source.filename if hasattr(source, 'filename') else None + self.lookup = [os.path.abspath(x) for x in lookup] + self.encoding = encoding + self.settings = self.settings.copy() # Copy from class variable + self.settings.update(settings) # Apply + if not self.source and self.name: + self.filename = self.search(self.name, self.lookup) + if not self.filename: + raise TemplateError('Template %s not found.' % repr(name)) + if not self.source and not self.filename: + raise TemplateError('No template specified.') + self.prepare(**self.settings) + + @classmethod + def search(cls, name, lookup=[]): + """ Search name in all directories specified in lookup. + First without, then with common extensions. Return first hit. """ + if not lookup: + depr('The template lookup path list should not be empty.') #0.12 + lookup = ['.'] + + if os.path.isabs(name) and os.path.isfile(name): + depr('Absolute template path names are deprecated.') #0.12 + return os.path.abspath(name) + + for spath in lookup: + spath = os.path.abspath(spath) + os.sep + fname = os.path.abspath(os.path.join(spath, name)) + if not fname.startswith(spath): continue + if os.path.isfile(fname): return fname + for ext in cls.extensions: + if os.path.isfile('%s.%s' % (fname, ext)): + return '%s.%s' % (fname, ext) + + @classmethod + def global_config(cls, key, *args): + ''' This reads or sets the global settings stored in class.settings. ''' + if args: + cls.settings = cls.settings.copy() # Make settings local to class + cls.settings[key] = args[0] + else: + return cls.settings[key] + + def prepare(self, **options): + """ Run preparations (parsing, caching, ...). + It should be possible to call this again to refresh a template or to + update settings. + """ + raise NotImplementedError + + def render(self, *args, **kwargs): + """ Render the template with the specified local variables and return + a single byte or unicode string. If it is a byte string, the encoding + must match self.encoding. This method must be thread-safe! + Local variables may be provided in dictionaries (args) + or directly, as keywords (kwargs). + """ + raise NotImplementedError + + +class MakoTemplate(BaseTemplate): + def prepare(self, **options): + from mako.template import Template + from mako.lookup import TemplateLookup + options.update({'input_encoding':self.encoding}) + options.setdefault('format_exceptions', bool(DEBUG)) + lookup = TemplateLookup(directories=self.lookup, **options) + if self.source: + self.tpl = Template(self.source, lookup=lookup, **options) + else: + self.tpl = Template(uri=self.name, filename=self.filename, lookup=lookup, **options) + + def render(self, *args, **kwargs): + for dictarg in args: kwargs.update(dictarg) + _defaults = self.defaults.copy() + _defaults.update(kwargs) + return self.tpl.render(**_defaults) + + +class CheetahTemplate(BaseTemplate): + def prepare(self, **options): + from Cheetah.Template import Template + self.context = threading.local() + self.context.vars = {} + options['searchList'] = [self.context.vars] + if self.source: + self.tpl = Template(source=self.source, **options) + else: + self.tpl = Template(file=self.filename, **options) + + def render(self, *args, **kwargs): + for dictarg in args: kwargs.update(dictarg) + self.context.vars.update(self.defaults) + self.context.vars.update(kwargs) + out = str(self.tpl) + self.context.vars.clear() + return out + + +class Jinja2Template(BaseTemplate): + def prepare(self, filters=None, tests=None, globals={}, **kwargs): + from jinja2 import Environment, FunctionLoader + if 'prefix' in kwargs: # TODO: to be removed after a while + raise RuntimeError('The keyword argument `prefix` has been removed. ' + 'Use the full jinja2 environment name line_statement_prefix instead.') + self.env = Environment(loader=FunctionLoader(self.loader), **kwargs) + if filters: self.env.filters.update(filters) + if tests: self.env.tests.update(tests) + if globals: self.env.globals.update(globals) + if self.source: + self.tpl = self.env.from_string(self.source) + else: + self.tpl = self.env.get_template(self.filename) + + def render(self, *args, **kwargs): + for dictarg in args: kwargs.update(dictarg) + _defaults = self.defaults.copy() + _defaults.update(kwargs) + return self.tpl.render(**_defaults) + + def loader(self, name): + fname = self.search(name, self.lookup) + if not fname: return + with open(fname, "rb") as f: + return f.read().decode(self.encoding) + + +class SimpleTemplate(BaseTemplate): + + def prepare(self, escape_func=html_escape, noescape=False, syntax=None, **ka): + self.cache = {} + enc = self.encoding + self._str = lambda x: touni(x, enc) + self._escape = lambda x: escape_func(touni(x, enc)) + self.syntax = syntax + if noescape: + self._str, self._escape = self._escape, self._str + + @cached_property + def co(self): + return compile(self.code, self.filename or '', 'exec') + + @cached_property + def code(self): + source = self.source + if not source: + with open(self.filename, 'rb') as f: + source = f.read() + try: + source, encoding = touni(source), 'utf8' + except UnicodeError: + depr('Template encodings other than utf8 are no longer supported.') #0.11 + source, encoding = touni(source, 'latin1'), 'latin1' + parser = StplParser(source, encoding=encoding, syntax=self.syntax) + code = parser.translate() + self.encoding = parser.encoding + return code + + def _rebase(self, _env, _name=None, **kwargs): + if _name is None: + depr('Rebase function called without arguments.' + ' You were probably looking for {{base}}?', True) #0.12 + _env['_rebase'] = (_name, kwargs) + + def _include(self, _env, _name=None, **kwargs): + if _name is None: + depr('Rebase function called without arguments.' + ' You were probably looking for {{base}}?', True) #0.12 + env = _env.copy() + env.update(kwargs) + if _name not in self.cache: + self.cache[_name] = self.__class__(name=_name, lookup=self.lookup) + return self.cache[_name].execute(env['_stdout'], env) + + def execute(self, _stdout, kwargs): + env = self.defaults.copy() + env.update(kwargs) + env.update({'_stdout': _stdout, '_printlist': _stdout.extend, + 'include': functools.partial(self._include, env), + 'rebase': functools.partial(self._rebase, env), '_rebase': None, + '_str': self._str, '_escape': self._escape, 'get': env.get, + 'setdefault': env.setdefault, 'defined': env.__contains__ }) + eval(self.co, env) + if env.get('_rebase'): + subtpl, rargs = env.pop('_rebase') + rargs['base'] = ''.join(_stdout) #copy stdout + del _stdout[:] # clear stdout + return self._include(env, subtpl, **rargs) + return env + + def render(self, *args, **kwargs): + """ Render the template using keyword arguments as local variables. """ + env = {}; stdout = [] + for dictarg in args: env.update(dictarg) + env.update(kwargs) + self.execute(stdout, env) + return ''.join(stdout) + + +class StplSyntaxError(TemplateError): pass + + +class StplParser(object): + ''' Parser for stpl templates. ''' + _re_cache = {} #: Cache for compiled re patterns + # This huge pile of voodoo magic splits python code into 8 different tokens. + # 1: All kinds of python strings (trust me, it works) + _re_tok = '([urbURB]?(?:\'\'(?!\')|""(?!")|\'{6}|"{6}' \ + '|\'(?:[^\\\\\']|\\\\.)+?\'|"(?:[^\\\\"]|\\\\.)+?"' \ + '|\'{3}(?:[^\\\\]|\\\\.|\\n)+?\'{3}' \ + '|"{3}(?:[^\\\\]|\\\\.|\\n)+?"{3}))' + _re_inl = _re_tok.replace('|\\n','') # We re-use this string pattern later + # 2: Comments (until end of line, but not the newline itself) + _re_tok += '|(#.*)' + # 3,4: Open and close grouping tokens + _re_tok += '|([\\[\\{\\(])' + _re_tok += '|([\\]\\}\\)])' + # 5,6: Keywords that start or continue a python block (only start of line) + _re_tok += '|^([ \\t]*(?:if|for|while|with|try|def|class)\\b)' \ + '|^([ \\t]*(?:elif|else|except|finally)\\b)' + # 7: Our special 'end' keyword (but only if it stands alone) + _re_tok += '|((?:^|;)[ \\t]*end[ \\t]*(?=(?:%(block_close)s[ \\t]*)?\\r?$|;|#))' + # 8: A customizable end-of-code-block template token (only end of line) + _re_tok += '|(%(block_close)s[ \\t]*(?=\\r?$))' + # 9: And finally, a single newline. The 10th token is 'everything else' + _re_tok += '|(\\r?\\n)' + + # Match the start tokens of code areas in a template + _re_split = '(?m)^[ \t]*(\\\\?)((%(line_start)s)|(%(block_start)s))(%%?)' + # Match inline statements (may contain python strings) + _re_inl = '(?m)%%(inline_start)s((?:%s|[^\'"\n]*?)+)%%(inline_end)s' % _re_inl + _re_tok = '(?m)' + _re_tok + + default_syntax = '<% %> % {{ }}' + + def __init__(self, source, syntax=None, encoding='utf8'): + self.source, self.encoding = touni(source, encoding), encoding + self.set_syntax(syntax or self.default_syntax) + self.code_buffer, self.text_buffer = [], [] + self.lineno, self.offset = 1, 0 + self.indent, self.indent_mod = 0, 0 + self.paren_depth = 0 + + def get_syntax(self): + ''' Tokens as a space separated string (default: <% %> % {{ }}) ''' + return self._syntax + + def set_syntax(self, syntax): + self._syntax = syntax + self._tokens = syntax.split() + if not syntax in self._re_cache: + names = 'block_start block_close line_start inline_start inline_end' + etokens = map(re.escape, self._tokens) + pattern_vars = dict(zip(names.split(), etokens)) + patterns = (self._re_split, self._re_tok, self._re_inl) + patterns = [re.compile(p%pattern_vars) for p in patterns] + self._re_cache[syntax] = patterns + self.re_split, self.re_tok, self.re_inl = self._re_cache[syntax] + + syntax = property(get_syntax, set_syntax) + + def translate(self): + if self.offset: raise RuntimeError('Parser is a one time instance.') + while True: + m = self.re_split.search(self.source[self.offset:]) + if m: + text = self.source[self.offset:self.offset+m.start()] + self.text_buffer.append(text) + self.offset += m.end() + if m.group(1): # New escape syntax + line, sep, _ = self.source[self.offset:].partition('\n') + self.text_buffer.append(m.group(2)+m.group(5)+line+sep) + self.offset += len(line+sep)+1 + continue + elif m.group(5): # Old escape syntax + depr('Escape code lines with a backslash.') #0.12 + line, sep, _ = self.source[self.offset:].partition('\n') + self.text_buffer.append(m.group(2)+line+sep) + self.offset += len(line+sep)+1 + continue + self.flush_text() + self.read_code(multiline=bool(m.group(4))) + else: break + self.text_buffer.append(self.source[self.offset:]) + self.flush_text() + return ''.join(self.code_buffer) + + def read_code(self, multiline): + code_line, comment = '', '' + while True: + m = self.re_tok.search(self.source[self.offset:]) + if not m: + code_line += self.source[self.offset:] + self.offset = len(self.source) + self.write_code(code_line.strip(), comment) + return + code_line += self.source[self.offset:self.offset+m.start()] + self.offset += m.end() + _str, _com, _po, _pc, _blk1, _blk2, _end, _cend, _nl = m.groups() + if (code_line or self.paren_depth > 0) and (_blk1 or _blk2): # a if b else c + code_line += _blk1 or _blk2 + continue + if _str: # Python string + code_line += _str + elif _com: # Python comment (up to EOL) + comment = _com + if multiline and _com.strip().endswith(self._tokens[1]): + multiline = False # Allow end-of-block in comments + elif _po: # open parenthesis + self.paren_depth += 1 + code_line += _po + elif _pc: # close parenthesis + if self.paren_depth > 0: + # we could check for matching parentheses here, but it's + # easier to leave that to python - just check counts + self.paren_depth -= 1 + code_line += _pc + elif _blk1: # Start-block keyword (if/for/while/def/try/...) + code_line, self.indent_mod = _blk1, -1 + self.indent += 1 + elif _blk2: # Continue-block keyword (else/elif/except/...) + code_line, self.indent_mod = _blk2, -1 + elif _end: # The non-standard 'end'-keyword (ends a block) + self.indent -= 1 + elif _cend: # The end-code-block template token (usually '%>') + if multiline: multiline = False + else: code_line += _cend + else: # \n + self.write_code(code_line.strip(), comment) + self.lineno += 1 + code_line, comment, self.indent_mod = '', '', 0 + if not multiline: + break + + def flush_text(self): + text = ''.join(self.text_buffer) + del self.text_buffer[:] + if not text: return + parts, pos, nl = [], 0, '\\\n'+' '*self.indent + for m in self.re_inl.finditer(text): + prefix, pos = text[pos:m.start()], m.end() + if prefix: + parts.append(nl.join(map(repr, prefix.splitlines(True)))) + if prefix.endswith('\n'): parts[-1] += nl + parts.append(self.process_inline(m.group(1).strip())) + if pos < len(text): + prefix = text[pos:] + lines = prefix.splitlines(True) + if lines[-1].endswith('\\\\\n'): lines[-1] = lines[-1][:-3] + elif lines[-1].endswith('\\\\\r\n'): lines[-1] = lines[-1][:-4] + parts.append(nl.join(map(repr, lines))) + code = '_printlist((%s,))' % ', '.join(parts) + self.lineno += code.count('\n')+1 + self.write_code(code) + + def process_inline(self, chunk): + if chunk[0] == '!': return '_str(%s)' % chunk[1:] + return '_escape(%s)' % chunk + + def write_code(self, line, comment=''): + line, comment = self.fix_backward_compatibility(line, comment) + code = ' ' * (self.indent+self.indent_mod) + code += line.lstrip() + comment + '\n' + self.code_buffer.append(code) + + def fix_backward_compatibility(self, line, comment): + parts = line.strip().split(None, 2) + if parts and parts[0] in ('include', 'rebase'): + depr('The include and rebase keywords are functions now.') #0.12 + if len(parts) == 1: return "_printlist([base])", comment + elif len(parts) == 2: return "_=%s(%r)" % tuple(parts), comment + else: return "_=%s(%r, %s)" % tuple(parts), comment + if self.lineno <= 2 and not line.strip() and 'coding' in comment: + m = re.match(r"#.*coding[:=]\s*([-\w.]+)", comment) + if m: + depr('PEP263 encoding strings in templates are deprecated.') #0.12 + enc = m.group(1) + self.source = self.source.encode(self.encoding).decode(enc) + self.encoding = enc + return line, comment.replace('coding','coding*') + return line, comment + + +def template(*args, **kwargs): + ''' + Get a rendered template as a string iterator. + You can use a name, a filename or a template string as first parameter. + Template rendering arguments can be passed as dictionaries + or directly (as keyword arguments). + ''' + tpl = args[0] if args else None + adapter = kwargs.pop('template_adapter', SimpleTemplate) + lookup = kwargs.pop('template_lookup', TEMPLATE_PATH) + tplid = (id(lookup), tpl) + if tplid not in TEMPLATES or DEBUG: + settings = kwargs.pop('template_settings', {}) + if isinstance(tpl, adapter): + TEMPLATES[tplid] = tpl + if settings: TEMPLATES[tplid].prepare(**settings) + elif "\n" in tpl or "{" in tpl or "%" in tpl or '$' in tpl: + TEMPLATES[tplid] = adapter(source=tpl, lookup=lookup, **settings) + else: + TEMPLATES[tplid] = adapter(name=tpl, lookup=lookup, **settings) + if not TEMPLATES[tplid]: + abort(500, 'Template (%s) not found' % tpl) + for dictarg in args[1:]: kwargs.update(dictarg) + return TEMPLATES[tplid].render(kwargs) + +mako_template = functools.partial(template, template_adapter=MakoTemplate) +cheetah_template = functools.partial(template, template_adapter=CheetahTemplate) +jinja2_template = functools.partial(template, template_adapter=Jinja2Template) + + +def view(tpl_name, **defaults): + ''' Decorator: renders a template for a handler. + The handler can control its behavior like that: + + - return a dict of template vars to fill out the template + - return something other than a dict and the view decorator will not + process the template, but return the handler result as is. + This includes returning a HTTPResponse(dict) to get, + for instance, JSON with autojson or other castfilters. + ''' + def decorator(func): + @functools.wraps(func) + def wrapper(*args, **kwargs): + result = func(*args, **kwargs) + if isinstance(result, (dict, DictMixin)): + tplvars = defaults.copy() + tplvars.update(result) + return template(tpl_name, **tplvars) + elif result is None: + return template(tpl_name, defaults) + return result + return wrapper + return decorator + +mako_view = functools.partial(view, template_adapter=MakoTemplate) +cheetah_view = functools.partial(view, template_adapter=CheetahTemplate) +jinja2_view = functools.partial(view, template_adapter=Jinja2Template) + + + + + + +############################################################################### +# Constants and Globals ######################################################## +############################################################################### + + +TEMPLATE_PATH = ['./', './views/'] +TEMPLATES = {} +DEBUG = False +NORUN = False # If set, run() does nothing. Used by load_app() + +#: A dict to map HTTP status codes (e.g. 404) to phrases (e.g. 'Not Found') +HTTP_CODES = httplib.responses +HTTP_CODES[418] = "I'm a teapot" # RFC 2324 +HTTP_CODES[422] = "Unprocessable Entity" # RFC 4918 +HTTP_CODES[428] = "Precondition Required" +HTTP_CODES[429] = "Too Many Requests" +HTTP_CODES[431] = "Request Header Fields Too Large" +HTTP_CODES[511] = "Network Authentication Required" +_HTTP_STATUS_LINES = dict((k, '%d %s'%(k,v)) for (k,v) in HTTP_CODES.items()) + +#: The default template used for error pages. Override with @error() +ERROR_PAGE_TEMPLATE = """ +%%try: + %%from %s import DEBUG, HTTP_CODES, request, touni + + + + Error: {{e.status}} + + + +

Error: {{e.status}}

+

Sorry, the requested URL {{repr(request.url)}} + caused an error:

+
{{e.body}}
+ %%if DEBUG and e.exception: +

Exception:

+
{{repr(e.exception)}}
+ %%end + %%if DEBUG and e.traceback: +

Traceback:

+
{{e.traceback}}
+ %%end + + +%%except ImportError: + ImportError: Could not generate the error page. Please add bottle to + the import path. +%%end +""" % __name__ + +#: A thread-safe instance of :class:`LocalRequest`. If accessed from within a +#: request callback, this instance always refers to the *current* request +#: (even on a multithreaded server). +request = LocalRequest() + +#: A thread-safe instance of :class:`LocalResponse`. It is used to change the +#: HTTP response for the *current* request. +response = LocalResponse() + +#: A thread-safe namespace. Not used by Bottle. +local = threading.local() + +# Initialize app stack (create first empty Bottle app) +# BC: 0.6.4 and needed for run() +app = default_app = AppStack() +app.push() + +#: A virtual package that redirects import statements. +#: Example: ``import bottle.ext.sqlite`` actually imports `bottle_sqlite`. +ext = _ImportRedirect('bottle.ext' if __name__ == '__main__' else __name__+".ext", 'bottle_%s').module + +if __name__ == '__main__': + opt, args, parser = _cmd_options, _cmd_args, _cmd_parser + if opt.version: + _stdout('Bottle %s\n'%__version__) + sys.exit(0) + if not args: + parser.print_help() + _stderr('\nError: No application specified.\n') + sys.exit(1) + + sys.path.insert(0, '.') + sys.modules.setdefault('bottle', sys.modules['__main__']) + + host, port = (opt.bind or 'localhost'), 8080 + if ':' in host and host.rfind(']') < host.rfind(':'): + host, port = host.rsplit(':', 1) + host = host.strip('[]') + + run(args[0], host=host, port=int(port), server=opt.server, + reloader=opt.reload, plugins=opt.plugin, debug=opt.debug) + + + + +# THE END diff --git a/run_maya_tests.py b/run_maya_tests.py index fea42251e..8adbff342 100644 --- a/run_maya_tests.py +++ b/run_maya_tests.py @@ -42,6 +42,7 @@ "--exclude-dir=avalon/nuke", "--exclude-dir=avalon/houdini", + "--exclude-dir=avalon/photoshop", "--exclude-dir=avalon/harmony", "--exclude-dir=avalon/schema", diff --git a/run_tests.py b/run_tests.py index 7dfa8f247..c66ab794a 100644 --- a/run_tests.py +++ b/run_tests.py @@ -23,6 +23,7 @@ "--exclude-dir=avalon/maya", "--exclude-dir=avalon/nuke", "--exclude-dir=avalon/houdini", + "--exclude-dir=avalon/photoshop", # We can expect any vendors to # be well tested beforehand.