1 # |
|
2 # Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net> |
|
3 # All Rights Reserved. |
|
4 # |
|
5 # This software is subject to the provisions of the Zope Public License, |
|
6 # Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. |
|
7 # THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
|
8 # WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
9 # WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
|
10 # FOR A PARTICULAR PURPOSE. |
|
11 # |
|
12 |
|
13 __docformat__ = 'restructuredtext' |
|
14 |
|
15 |
|
16 # import standard library |
|
17 |
|
18 # import interfaces |
|
19 from pyams_content.reference.interfaces import IReferenceInfo, IReferenceTable |
|
20 from zope.annotation.interfaces import IAttributeAnnotatable |
|
21 |
|
22 # import packages |
|
23 from pyams_i18n.schema import I18nImageField, I18nTextLineField |
|
24 from zope.container.constraints import containers, contains |
|
25 from zope.interface import Interface |
|
26 from zope.schema import List, Choice |
|
27 |
|
28 from pyams_content import _ |
|
29 |
|
30 |
|
31 PICTOGRAM_VOCABULARY = 'PyAMS pictograms' |
|
32 SELECTED_PICTOGRAM_VOCABULARY = 'PyAMS selected pictograms' |
|
33 |
|
34 |
|
35 class IPictogram(IReferenceInfo): |
|
36 """Pictogram interface |
|
37 |
|
38 Pictograms are managed in a specific reference table to be easily reused by the application |
|
39 into any shared content. |
|
40 """ |
|
41 |
|
42 containers('.IPictogramTable') |
|
43 |
|
44 image = I18nImageField(title=_("Image"), |
|
45 description=_("Pictogram content"), |
|
46 required=True) |
|
47 |
|
48 alt_title = I18nTextLineField(title=_("Accessibility title"), |
|
49 description=_("Alternate title used to describe image content"), |
|
50 required=False) |
|
51 |
|
52 header = I18nTextLineField(title=_('pictogram-header', default="Header"), |
|
53 description=_("Default header associated with this pictogram"), |
|
54 required=False) |
|
55 |
|
56 |
|
57 class IPictogramTable(IReferenceTable): |
|
58 """Pictograms table interface""" |
|
59 |
|
60 contains(IPictogram) |
|
61 |
|
62 |
|
63 PICTOGRAM_MANAGER_KEY = 'pyams_content.pictogram.manager' |
|
64 |
|
65 |
|
66 class IPictogramManager(Interface): |
|
67 """Pictogram manager interface |
|
68 |
|
69 A pictogram manager (typically, a shared tool) is a component which allows selection of a set of |
|
70 pictogram which will be available for selection into shared content. |
|
71 """ |
|
72 |
|
73 selected_pictograms = List(title=_("Selected pictograms"), |
|
74 description=_("List of selected pictograms which will be available to shared contents"), |
|
75 required=False, |
|
76 value_type=Choice(vocabulary='PyAMS pictograms')) |
|
77 |
|
78 |
|
79 class IPictogramManagerTarget(IAttributeAnnotatable): |
|
80 """Pictogram manager target interface""" |
|