pyams_file.interfaces
package ⊞¶
-
class
pyams_file.interfaces.
FileModifiedEvent
(object, *descriptions)[source]¶ Bases:
zope.lifecycleevent.ObjectModifiedEvent
Modified file event
Init with a list of modification descriptions.
-
interface
pyams_file.interfaces.
IAudio
[source]¶ Extends:
pyams_file.interfaces.IMediaFile
Audio file interface
-
interface
pyams_file.interfaces.
IAudioField
[source]¶ Extends:
pyams_file.interfaces.IMediaField
Audio file field interface
-
interface
pyams_file.interfaces.
IBaseImage
[source]¶ Extends:
pyams_file.interfaces.IMediaFile
Base image interface
-
interface
pyams_file.interfaces.
IBlobReferenceManager
[source]¶ Blobs references manager
This utility interface is used to manage references to blobs: each file contains a link to a ZODB “Blob” object which is used to store it’s data; when a content is duplicated, all it’s blobs references are updated but the blob itself is not duplicated to reduce space usage. As long as a blob data is not modified, the same content can be shared between several versions of a same content. So it’s only when all references to a given blob have been removed that the blob file is deleted and can be garbaged collected.
-
add_reference
(self, blob, reference)¶ Add a reference to given blob
-
drop_reference
(self, blob, reference)¶ Remove reference from given blob
Blob is deleted if no more referenced.
-
-
interface
pyams_file.interfaces.
IFile
[source]¶ Extends:
zope.annotation.interfaces.IAttributeAnnotatable
File object interface
-
content_type
¶ Content type
The content type identifies the type of content data
Implementation: zope.schema.BytesLine
Read Only: False Required: False Default Value: b’‘ Allowed Type: bytes
-
data
¶ Content data
Actual file content
Implementation: zope.schema.Bytes
Read Only: False Required: False Default Value: b’‘ Allowed Type: bytes
-
get_size
(self)¶ Returns the byte-size of object’s data
-
get_blob
(self, mode='r')¶ Get Blob file associated with this object
-
add_blob_reference
(self, reference)¶ Add a reference to file internal blob
-
free_blob
(self)¶ Free blob associated with this object
-
-
interface
pyams_file.interfaces.
IFileField
[source]¶ Extends:
zope.schema.interfaces.IBytes
File object field interface
-
schema
¶ Required value schema
-
-
interface
pyams_file.interfaces.
IFileFieldContainer
[source]¶ Extends:
zope.annotation.interfaces.IAttributeAnnotatable
Marker interface for contents holding file properties
-
interface
pyams_file.interfaces.
IFileInfo
[source]¶ File extended information
-
title
¶ Title
Implementation: zope.schema.TextLine
Read Only: False Required: False Default Value: None Allowed Type: str
-
description
¶ Description
Implementation: zope.schema.Text
Read Only: False Required: False Default Value: None Allowed Type: str
-
filename
¶ Save file as…
Name under which the file will be saved
Implementation: zope.schema.TextLine
Read Only: False Required: False Default Value: None Allowed Type: str
-
language
¶ Language
File’s content language
Implementation: zope.schema.Choice
Read Only: False Required: False Default Value: None
-
-
interface
pyams_file.interfaces.
IFileModifiedEvent
[source]¶ Extends:
zope.lifecycleevent.interfaces.IObjectModifiedEvent
Modified file event interface
-
interface
pyams_file.interfaces.
IFileModifierForm
[source]¶ File modifier form marker interface
These forms have a custom context permission checker.
-
interface
pyams_file.interfaces.
IFileWidget
[source]¶ Extends:
z3c.form.interfaces.IFileWidget
File field widget
-
interface
pyams_file.interfaces.
IImage
[source]¶ Extends:
pyams_file.interfaces.IBaseImage
Image object interface
-
get_image_size
(self)¶ Returns an (x, y) tuple describing image dimensions
-
resize
(self, width, height)¶ Resize image to given dimensions
-
crop
(self, x1, y1, x2, y2)¶ Crop image to given coordinates
-
rotate
(self, angle=-90)¶ Rotate image, default to right
-
-
interface
pyams_file.interfaces.
IImageField
[source]¶ Extends:
pyams_file.interfaces.IMediaField
Image file object field interface
-
interface
pyams_file.interfaces.
IImageWidget
[source]¶ Extends:
pyams_file.interfaces.IMediaWidget
Image field widget
-
interface
pyams_file.interfaces.
IMediaField
[source]¶ Extends:
pyams_file.interfaces.IFileField
Media file object field interface
-
interface
pyams_file.interfaces.
IMediaFile
[source]¶ Extends:
pyams_file.interfaces.IFile
Multimedia file
-
interface
pyams_file.interfaces.
IMediaWidget
[source]¶ Extends:
pyams_file.interfaces.IFileWidget
Media file widget
-
interface
pyams_file.interfaces.
ISVGImage
[source]¶ Extends:
pyams_file.interfaces.IBaseImage
SVG file interface
-
interface
pyams_file.interfaces.
IThumbnailForm
[source]¶ Extends:
pyams_file.interfaces.IFileModifierForm
Image thumbnail selection form marker interface
-
interface
pyams_file.interfaces.
IThumbnailGeometry
[source]¶ Image thumbnail geometry interface
-
x1
¶ Thumbnail position X1
Implementation: zope.schema.Int
Read Only: False Required: True Default Value: None Allowed Type: int
-
y1
¶ Thumbnail position Y1
Implementation: zope.schema.Int
Read Only: False Required: True Default Value: None Allowed Type: int
-
x2
¶ Thumbnail position X2
Implementation: zope.schema.Int
Read Only: False Required: True Default Value: None Allowed Type: int
-
y2
¶ Thumbnail position Y2
Implementation: zope.schema.Int
Read Only: False Required: True Default Value: None Allowed Type: int
-
is_empty
(self)¶ Check if geometry is not empty
-
-
interface
pyams_file.interfaces.
IThumbnailImageField
[source]¶ Extends:
pyams_file.interfaces.IImageField
,pyams_file.interfaces.IThumbnailField
Image object field with thumbnail interface
-
interface
pyams_file.interfaces.
IThumbnailImageWidget
[source]¶ Extends:
pyams_file.interfaces.IImageWidget
Image field widget with thumbnail selection
-
interface
pyams_file.interfaces.
IThumbnailMediaField
[source]¶ Extends:
pyams_file.interfaces.IMediaField
,pyams_file.interfaces.IThumbnailField
Media object field with thumbnail interface
-
interface
pyams_file.interfaces.
IThumbnailMediaWidget
[source]¶ Extends:
pyams_file.interfaces.IMediaWidget
Media file widget with thumbnail selection
-
interface
pyams_file.interfaces.
IThumbnailVideoField
[source]¶ Extends:
pyams_file.interfaces.IVideoField
,pyams_file.interfaces.IThumbnailField
Video object field with thumbnail interface
-
interface
pyams_file.interfaces.
IThumbnailer
[source]¶ Interface of adapter used to generate image thumbnails
-
label
¶ Thumbnail label
-
section
¶ Thumbnail section
-
weight
¶ Thumbnail weight
-
get_default_geometry
(self)¶ Get default thumbnail geometry
-
create_thumbnail
(self, target, format=None)¶ Create thumbnail of the given source object
Source can be any file which can provide thumbnails (image, video, PDF file…). Target, which defines thumbnail size, can be defined as a selection name (‘pano’, ‘square’, ‘xs’…), as a geometry or as a (width, height) tuple.
If the requested image is of a resolution higher than that of the original file, the resulting image resolution will be that of the original file.
If format (JPEG, PNG…) is given, this will be the format of the generated thumbnail; otherwise the format will be those of the source image.
-
-
interface
pyams_file.interfaces.
IThumbnails
[source]¶ Image thumbnail interface
Displays are images thumbnails generated ‘on the fly’ and stored into image annotations for future use
-
get_image_size
(self)¶ Get original image size
-
get_thumbnail_size
(self, thumbnail_name, forced=False)¶ Get real size of the genrated thumbnail
If forced is True, the generated thumbnail can be larger than the original source
-
get_geometry
(self, selection_name)¶ Get geometry of a given thumbnail
-
set_geometry
(self, selection_name, geometry)¶ Set geometry for given thumbnail
-
clear_geometries
(self)¶ Remove all stored geometries from object annotations
-
get_thumbnail_name
(self, thumbnail_name, with_size=None)¶ Get matching name for the given thumbnail name or size
-
get_selection
(self, selection_name, format=None)¶ Get image for given user selection
-
get_thumbnail
(self, thumbnail_name, format=None, watermark=None)¶ Get requested thumbnail
Display can be specified as: - a name matching a custom thumbnailer utility - a width, as wXXX where XXX is the requested image width - a height, as hYYY, where YYY is the requested image height - a size, as XXXxYYY
-
delete_thumbnail
(self, thumbnail_name)¶ Remove selected thumbnail from object annotations
-
clear_thumbnails
(self)¶ Remove all thumbnails from object annotations
-
-
interface
pyams_file.interfaces.
IVideo
[source]¶ Extends:
pyams_file.interfaces.IMediaFile
Video file interface
-
interface
pyams_file.interfaces.
IVideoField
[source]¶ Extends:
pyams_file.interfaces.IMediaField
Video file field interface
-
interface
pyams_file.interfaces.
IWatermarker
[source]¶ Interface of utility used to add image watermark
-
add_watermark
(self, image, watermark, position='scale', opacity=1, format=None)¶ Add watermark to given image
-