[Zope3-checkins] CVS: zopeproducts/photoslide - LICENSE:1.1 README:1.1 __init__.py:1.1 configure.zcml:1.1 interfaces.py:1.1

Bjorn Tillenius bjorn at codeworks.lt
Fri Aug 15 09:15:21 EDT 2003


Update of /cvs-repository/zopeproducts/photoslide
In directory cvs.zope.org:/tmp/cvs-serv26803

Added Files:
	LICENSE README __init__.py configure.zcml interfaces.py 
Log Message:
First checkin of the photoslide product.

This product produces a slide show of photos. It works, although the
views aren't that nice yet. 


=== Added File zopeproducts/photoslide/LICENSE ===
Zope Public License (ZPL) Version 2.0
-----------------------------------------------

This software is Copyright (c) Zope Corporation (tm) and
Contributors. All rights reserved.

This license has been certified as open source. It has also
been designated as GPL compatible by the Free Software
Foundation (FSF).

Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:

1. Redistributions in source code must retain the above
   copyright notice, this list of conditions, and the following
   disclaimer.

2. Redistributions in binary form must reproduce the above
   copyright notice, this list of conditions, and the following
   disclaimer in the documentation and/or other materials
   provided with the distribution.

3. The name Zope Corporation (tm) must not be used to
   endorse or promote products derived from this software
   without prior written permission from Zope Corporation.

4. The right to distribute this software or to use it for
   any purpose does not give you the right to use Servicemarks
   (sm) or Trademarks (tm) of Zope Corporation. Use of them is
   covered in a separate agreement (see
   http://www.zope.com/Marks).

5. If any files are modified, you must cause the modified
   files to carry prominent notices stating that you changed
   the files and the date of any change.

Disclaimer

  THIS SOFTWARE IS PROVIDED BY ZOPE CORPORATION ``AS IS''
  AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
  NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
  NO EVENT SHALL ZOPE CORPORATION OR ITS CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
  DAMAGE.


This software consists of contributions made by Zope
Corporation and many individuals on behalf of Zope
Corporation.  Specific attributions are listed in the
accompanying credits file.


=== Added File zopeproducts/photoslide/README ===
PhotoSlide Product

  Overview

    This product is a container which can contain photos. It will keep
    you from configure every single photo since the photos can use the 
    this product's options. It also provides some views of the all the
    photos. Currently the views aren't that nice and could really need
    a better look.

    It also contains a PhotoSlide Folder. The only advantage of using
    this right now is if you create a folder inside it via FTP, it will
    create a PhotoSlide. Later on it should also provide a view of the
    slide shows which it contain.

  Dependencies

    It requires that zopeproducts.photo is installed.
    
  Current Status

    At the moment this product is usable, the most important thing to
    fix is to make the views look nicer.

  Other Notes

    This product was created by Bjorn Tillenius, if you have any
    questions you can reach me at <bjorn(at)codeworks.lt>.


=== Added File zopeproducts/photoslide/__init__.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""The Photo Slide package

$Id: __init__.py,v 1.1 2003/08/15 12:15:14 BjornT Exp $
"""

from zope.app import zapi
from zope.app.container.btree import BTreeContainer
from zope.app.content.folder import Folder
from zope.app.context import ContextWrapper
from zope.app.interfaces.file import IDirectoryFactory
from zope.interface import implements

from persistence.list import PersistentList

from zopeproducts.photo import defaultImageResizer
from zopeproducts.photoslide.interfaces import IPhotoSlide, IPhotoSlideFolder

class PhotoSlide(BTreeContainer):
    """An implementation of IPhotoSlide."""

    implements(IPhotoSlide)

    title = ''
    description = ''
    currentDisplayId = 'medium'
    resizeUtility = defaultImageResizer
    useParentOptions = True
    
    def __init__(self, title=''):
        super(PhotoSlide, self).__init__()
        self._title = title
        self._positions = PersistentList()

    def setObject(self, key, object):
        """Needed in order to keep track of the positions of the photos."""
        name = super(PhotoSlide, self).setObject(key, object)
        if name not in self._positions:
            self._positions.append(name)
        return name

    def __delitem__(self, key):
        """Needed in order to keep track of the positions of the photos."""
        if key in self._positions:
            self._positions.remove(key)
        super(PhotoSlide, self).__delitem__(key)

    def getPosition(self, photoName):
        """See IPhotoSlide."""
        return self._positions.index(photoName)+1

    def setPosition(self, photoName, index):
        """See IPhotoSlide."""
        self._positions.remove(photoName)
        self._positions.insert(int(index)-1, photoName)

    def getPhotos(self):
        """See IPhotoSlide."""
        photos = []
        for name in self._positions:
            photos.append(ContextWrapper(self[name], self))
            
        return photos

    def getPhotoNames(self):
        """See IPhotoSlide."""
        return self._positions

class PhotoSlideFactory(object):
    """Creates photo slides in the file system representation. """

    implements(IDirectoryFactory)

    def __call__(self, name):
        photoslide = PhotoSlide()
        photoslide.title = name
        return photoslide

class PhotoSlideFolder(BTreeContainer):
    """An implementation of IPhotoSlideFolder

    It does nothing special for now.
    """

    implements(IPhotoSlideFolder)


=== Added File zopeproducts/photoslide/configure.zcml ===
<configure
    xmlns="http://namespaces.zope.org/zope"
    i18n_domain="photo"
    >

<content class=".PhotoSlide">
  <implements
      interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
      />
  <implements
      interface="zope.app.interfaces.container.IContentContainer"
      />
  <factory
      id="Photo Slide"
      permission="zope.ManageContent"
      description="Photo Slide"
      />
  <require
      permission="zope.View"
      interface=".interfaces.IPhotoSlide"
      />
  <require
      permission="zope.ManageContent"
      set_schema=".interfaces.IPhotoSlide"
      />
</content>

<content class=".PhotoSlideFolder">
  <implements
      interface="zope.app.interfaces.annotation.IAttributeAnnotatable"
      />
  <implements
      interface="zope.app.interfaces.container.IContentContainer"
      />
  <factory
      id="PhotoSlideFolder"
      permission="zope.ManageContent"
      title="Photo Slide Folder"
      description="A Folder which contains PhotoSlide objects"
      />
  <require
      permission="zope.View"
      interface=".interfaces.IPhotoSlideFolder"
      />
  <require
      permission="zope.ManageContent"
      set_schema=".interfaces.IPhotoSlideFolder"
      />
</content>

<!-- Adapters -->

<!-- Upload Photo permission -->
<adapter
    factory="zopeproducts.photo.PhotoFactory"
    provides="zope.app.interfaces.file.IDirectoryFactory"
    for=".interfaces.IPhotoSlide"
    permission="zope.ManageContent"
    />

<!-- Create Photo permission -->
<adapter
    factory="zopeproducts.photo.PhotoFactory"
    provides="zope.app.interfaces.file.IFileFactory"
    for=".interfaces.IPhotoSlide"
    permission="zope.ManageContent"
    />

<!-- Create Photo Slide permission -->
<adapter
    factory=".PhotoSlideFactory"
    provides="zope.app.interfaces.file.IDirectoryFactory"
    for=".interfaces.IPhotoSlideFolder"
    permission="zope.ManageContent"
    />

<!-- Delete Photo Slide permission -->
<adapter
    factory="zope.app.container.directory.noop"
    provides="zope.app.interfaces.file.IWriteDirectory"
    for=".interfaces.IPhotoSlideFolder"
    permission="zope.ManageContent"
    />

<!-- List Photo Slide permission -->
<adapter
    factory="zope.app.container.directory.noop"
    provides="zope.app.interfaces.file.IReadDirectory"
    for=".interfaces.IPhotoSlide"
    permission="zope.ManageContent"
    />

<!-- Delete Photo permission -->
<adapter
    factory="zope.app.container.directory.noop"
    provides="zope.app.interfaces.file.IWriteDirectory"
    for=".interfaces.IPhotoSlide"
    permission="zope.ManageContent"
    />

<include package=".browser" />

</configure>


=== Added File zopeproducts/photoslide/interfaces.py ===
##############################################################################
#
# Copyright (c) 2003 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""Interface descriptions for the PhotoSlide package

$Id: interfaces.py,v 1.1 2003/08/15 12:15:14 BjornT Exp $
"""
from zope.schema import TextLine, Text
from zope.app.interfaces.container import IContainer
from zope.i18n import MessageIDFactory

from zopeproducts.photo.interfaces import IPhotoContainer

_ = MessageIDFactory("photo")


class IPhotoSlide(IContainer, IPhotoContainer):
    """Contains Photo objects and can show a slide show of them"""

    title = TextLine(title=_('Title'),
                     description=_('The title of the photo slide'),
                     default=u'',
                     required=True)

    description = Text(title=_('Description'),
                       description=_('The description of the photo slide'),
                       default=u'',
                       required=False)


    def getPosition(photo):
        """Returns the position of the photo in the slide show.

        The first photo has position 1.
        """
    
    def setPosition(photo, index):
        """Sets the position of the photo in the slide show."""

    def getPhotos():
        """Returns an ordered list of the photos."""

    def getPhotoNames():
        """Returns an ordered list of the names of the photos."""

class IPhotoSlideFolder(IContainer):
    """A container which contains PhotoSlide objects.

    For now it's only used in order to make it easier to create new
    slide shows. In future it will probably have to keep track of the
    order of the slide shows and it's implementation should provide
    a nice view of the available shows.
    """
    




More information about the Zope3-Checkins mailing list