Added property to check for pictograms
authorThierry Florac <tflorac@ulthar.net>
Wed, 25 Sep 2019 15:23:50 +0200
changeset 465 e4397e6a6890
parent 464 6a70ef009b65
child 466 49f831e73fc8
Added property to check for pictograms
src/pyams_default_theme/component/paragraph/milestone.py
--- a/src/pyams_default_theme/component/paragraph/milestone.py	Wed Sep 25 10:27:19 2019 +0200
+++ b/src/pyams_default_theme/component/paragraph/milestone.py	Wed Sep 25 15:23:50 2019 +0200
@@ -10,17 +10,19 @@
 # FOR A PARTICULAR PURPOSE.
 #
 
-__docformat__ = 'restructuredtext'
-
 from pyramid.decorator import reify
 
-from pyams_content.component.paragraph.interfaces.milestone import IMilestoneParagraph, IMilestoneContainer
+from pyams_content.component.paragraph.interfaces.milestone import IMilestoneContainer, \
+    IMilestoneParagraph
 from pyams_content.features.renderer.interfaces import IContentRenderer
 from pyams_default_theme.features.renderer import BaseContentRenderer
 from pyams_skin.layer import IPyAMSLayer
 from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config
 
+
+__docformat__ = 'restructuredtext'
+
 from pyams_default_theme import _
 
 
@@ -28,7 +30,8 @@
 # Milestone paragraph default renderer
 #
 
-@adapter_config(name='default', context=(IMilestoneParagraph, IPyAMSLayer), provides=IContentRenderer)
+@adapter_config(name='default', context=(IMilestoneParagraph, IPyAMSLayer),
+                provides=IContentRenderer)
 @template_config(template='templates/milestone-default.pt', layer=IPyAMSLayer)
 class DefaultMilestoneParagraphRenderer(BaseContentRenderer):
     """Default Pictogram renderer"""
@@ -43,6 +46,13 @@
         return IMilestoneContainer(self.context)
 
     @property
+    def has_pictograms(self):
+        for milestone in self.milestones.values():
+            if milestone.pictogram is not None:
+                return True
+        return False
+
+    @property
     def has_anchors(self):
         for milestone in self.milestones.values():
             if milestone.anchor is not None: