19 # import interfaces |
19 # import interfaces |
20 from pyams_content.component.illustration import IIllustrationTarget |
20 from pyams_content.component.illustration import IIllustrationTarget |
21 from pyams_content.component.paragraph import IParagraphFactory |
21 from pyams_content.component.paragraph import IParagraphFactory |
22 from pyams_content.component.paragraph.interfaces.pictogram import IPictogramItem, IPictogramContainerTarget, \ |
22 from pyams_content.component.paragraph.interfaces.pictogram import IPictogramItem, IPictogramContainerTarget, \ |
23 IPictogramContainer, PICTOGRAM_CONTAINER_KEY, IPictogramParagraph, PICTOGRAM_PARAGRAPH_TYPE, \ |
23 IPictogramContainer, PICTOGRAM_CONTAINER_KEY, IPictogramParagraph, PICTOGRAM_PARAGRAPH_TYPE, \ |
24 PICTOGRAM_PARAGRAPH_RENDERERS |
24 PICTOGRAM_PARAGRAPH_RENDERERS, PICTOGRAM_PARAGRAPH_NAME |
25 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE, ERROR_VALUE |
25 from pyams_content.features.checker.interfaces import IContentChecker, MISSING_VALUE, MISSING_LANG_VALUE, ERROR_VALUE |
26 from pyams_content.reference.pictograms.interfaces import IPictogramTable |
26 from pyams_content.reference.pictograms.interfaces import IPictogramTable |
27 from pyams_form.interfaces.form import IFormContextPermissionChecker |
27 from pyams_form.interfaces.form import IFormContextPermissionChecker |
28 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator |
28 from pyams_i18n.interfaces import II18n, II18nManager, INegotiator |
29 from zope.lifecycleevent import IObjectAddedEvent, ObjectModifiedEvent, ObjectCreatedEvent |
29 from zope.lifecycleevent import IObjectAddedEvent, ObjectModifiedEvent, ObjectCreatedEvent |
184 |
184 |
185 @adapter_config(name='pictograms', context=IPictogramContainerTarget, provides=IContentChecker) |
185 @adapter_config(name='pictograms', context=IPictogramContainerTarget, provides=IContentChecker) |
186 class PictogramContainerContentChecker(BaseContentChecker): |
186 class PictogramContainerContentChecker(BaseContentChecker): |
187 """Pictogram container content checker""" |
187 """Pictogram container content checker""" |
188 |
188 |
189 label = _("Pictograms") |
189 label = PICTOGRAM_PARAGRAPH_NAME |
190 sep = '\n' |
190 sep = '\n' |
191 weight = 210 |
191 weight = 210 |
192 |
192 |
193 def inner_check(self, request): |
193 def inner_check(self, request): |
194 output = [] |
194 output = [] |
207 @factory_config(provided=IPictogramParagraph) |
207 @factory_config(provided=IPictogramParagraph) |
208 class PictogramParagraph(BaseParagraph): |
208 class PictogramParagraph(BaseParagraph): |
209 """Pictograms paragraph""" |
209 """Pictograms paragraph""" |
210 |
210 |
211 icon_class = 'fa-linode' |
211 icon_class = 'fa-linode' |
212 icon_hint = _("Pictograms") |
212 icon_hint = PICTOGRAM_PARAGRAPH_NAME |
213 |
213 |
214 renderer = FieldProperty(IPictogramParagraph['renderer']) |
214 renderer = FieldProperty(IPictogramParagraph['renderer']) |
215 |
215 |
216 |
216 |
217 @utility_config(name=PICTOGRAM_PARAGRAPH_TYPE, provides=IParagraphFactory) |
217 @utility_config(name=PICTOGRAM_PARAGRAPH_TYPE, provides=IParagraphFactory) |
218 class PictogramParagraphFactory(BaseParagraphFactory): |
218 class PictogramParagraphFactory(BaseParagraphFactory): |
219 """Pictograms paragraph factory""" |
219 """Pictograms paragraph factory""" |
220 |
220 |
221 name = _("Pictograms paragraph") |
221 name = PICTOGRAM_PARAGRAPH_NAME |
222 content_type = PictogramParagraph |
222 content_type = PictogramParagraph |
223 |
223 |
224 |
224 |
225 @adapter_config(context=IPictogramParagraph, provides=IContentChecker) |
225 @adapter_config(context=IPictogramParagraph, provides=IContentChecker) |
226 class PictogramParagraphContentChecker(BaseParagraphContentChecker): |
226 class PictogramParagraphContentChecker(BaseParagraphContentChecker): |