--- a/src/pyams_content/component/gallery/interfaces/__init__.py Mon Sep 11 14:53:15 2017 +0200
+++ b/src/pyams_content/component/gallery/interfaces/__init__.py Mon Sep 11 14:54:30 2017 +0200
@@ -16,35 +16,40 @@
# import standard library
# import interfaces
-from pyams_file.interfaces import IMediaFile
-from zope.container.interfaces import IContainer, IOrderedContainer
+from pyams_content.component.paragraph.interfaces import IBaseParagraph
+from zope.container.interfaces import IOrderedContainer
+from zope.contentprovider.interfaces import IContentProvider
# import packages
-from pyams_file.schema import FileField
+from pyams_file.schema import FileField, ImageField
from pyams_i18n.schema import I18nTextLineField, I18nTextField
-from pyams_utils.schema import PersistentList
from zope.annotation.interfaces import IAttributeAnnotatable
-from zope.container.constraints import containers, contains
-from zope.interface import Interface
-from zope.schema import Choice, Bool, TextLine
+from zope.container.constraints import contains, containers
+from zope.interface import Interface, Attribute
+from zope.schema import Bool, TextLine, Choice
from pyams_content import _
GALLERY_CONTAINER_KEY = 'pyams_content.gallery'
-GALLERY_FILE_INFO_KEY = 'pyams_content.gallery.info'
-GALLERY_LINKS_CONTAINER_KEY = 'pyams_content.gallery.links'
class IGalleryFile(Interface):
"""Gallery file marker interface"""
+ containers('.IGallery')
-class IGalleryFileInfo(Interface):
- """Gallery file info"""
+ title = I18nTextLineField(title=_("Legend"),
+ description=_("Image title"),
+ required=False)
- title = I18nTextLineField(title=_("Title"),
- required=False)
+ alt_title = I18nTextLineField(title=_("Accessibility title"),
+ description=_("Alternate title used to describe image content"),
+ required=False)
+
+ data = ImageField(title=_("Image data"),
+ description=_("Image content"),
+ required=True)
description = I18nTextField(title=_("Description"),
required=False)
@@ -81,8 +86,6 @@
class IBaseGallery(IOrderedContainer, IAttributeAnnotatable):
"""Base gallery interface"""
- containers('.IGalleryContainer')
-
title = I18nTextLineField(title=_("Title"),
description=_("Gallery title, as shown in front-office"),
required=True)
@@ -91,10 +94,11 @@
description=_("Gallery description displayed by front-office template"),
required=False)
- visible = Bool(title=_("Visible gallery?"),
- description=_("If 'no', this gallery won't be displayed in front office"),
- required=True,
- default=True)
+ renderer = Choice(title=_("Gallery style"),
+ vocabulary='PyAMS gallery renderers')
+
+ def append(self, value, notify=True):
+ """Append new file to gallery"""
def get_visible_images(self):
"""Get iterator over visible images"""
@@ -103,27 +107,18 @@
class IGallery(IBaseGallery):
"""Gallery interface"""
- contains(IMediaFile)
-
-
-class IGalleryContainer(IContainer):
- """Galleries container"""
-
- contains(IBaseGallery)
+ contains(IGalleryFile)
-class IGalleryContainerTarget(Interface):
- """Galleries container marker interface"""
+class IGalleryRenderer(IContentProvider):
+ """Gallery renderer utility interface"""
+
+ label = Attribute("Renderer label")
-class IGalleryLinksContainer(Interface):
- """Galleries links container interface"""
-
- galleries = PersistentList(title=_("Contained galleries"),
- description=_("List of images galleries linked to this object"),
- value_type=Choice(vocabulary="PyAMS content galleries"),
- required=False)
+class IGalleryTarget(IAttributeAnnotatable):
+ """Gallery container target marker interface"""
-class IGalleryLinksContainerTarget(Interface):
- """Galleries links container marker interface"""
+class IGalleryParagraph(IGallery, IBaseParagraph):
+ """Gallery paragraph"""