Moved skin-related features into ".skin" modules
authorThierry Florac <thierry.florac@onf.fr>
Fri, 18 May 2018 15:51:14 +0200
changeset 546 213db0cb6b4c
parent 545 ae803782cc37
child 547 5eb6713c8e7d
Moved skin-related features into ".skin" modules
src/pyams_content/shared/blog/manager.py
src/pyams_content/shared/form/zmi/render.py
src/pyams_content/shared/imagemap/zmi/paragraph.py
src/pyams_content/shared/imagemap/zmi/render.py
src/pyams_content/shared/logo/zmi/paragraph.py
src/pyams_content/shared/site/manager.py
src/pyams_content/shared/view/portlet/__init__.py
src/pyams_content/shared/view/zmi/render.py
--- a/src/pyams_content/shared/blog/manager.py	Fri May 18 15:50:16 2018 +0200
+++ b/src/pyams_content/shared/blog/manager.py	Fri May 18 15:51:14 2018 +0200
@@ -19,6 +19,8 @@
 from pyams_content.component.illustration import IIllustrationTarget
 from pyams_content.component.paragraph.interfaces import IParagraphFactorySettings
 from pyams_content.component.theme.interfaces import IThemesManagerTarget
+from pyams_content.features.footer.interfaces import IFooterTarget
+from pyams_content.features.header.interfaces import IHeaderTarget
 from pyams_content.features.preview.interfaces import IPreviewTarget
 from pyams_content.reference.pictograms.interfaces import IPictogramManagerTarget
 from pyams_content.root.interfaces import ISiteRoot
@@ -53,7 +55,7 @@
 
 
 @implementer(IBlogManager, IParagraphFactorySettings, IThemesManagerTarget, IPictogramManagerTarget,
-             IIllustrationTarget, IPortalContext, IPreviewTarget, IAttributeAnnotatable)
+             IIllustrationTarget, IPortalContext, IHeaderTarget, IFooterTarget, IPreviewTarget, IAttributeAnnotatable)
 class BlogManager(Folder, BaseSharedTool, UserSkinnableContent):
     """Nlog manager class"""
 
--- a/src/pyams_content/shared/form/zmi/render.py	Fri May 18 15:50:16 2018 +0200
+++ b/src/pyams_content/shared/form/zmi/render.py	Fri May 18 15:51:14 2018 +0200
@@ -23,7 +23,7 @@
 from pyams_skin.layer import IPyAMSLayer
 
 # import packages
-from pyams_content.features.renderer.zmi import BaseContentRenderer
+from pyams_content.features.renderer.skin import BaseContentRenderer
 from pyams_form.form import InnerAddForm
 from pyams_form.help import FormHelp
 from pyams_utils.adapter import adapter_config
--- a/src/pyams_content/shared/imagemap/zmi/paragraph.py	Fri May 18 15:50:16 2018 +0200
+++ b/src/pyams_content/shared/imagemap/zmi/paragraph.py	Fri May 18 15:51:14 2018 +0200
@@ -16,9 +16,7 @@
 # import standard library
 
 # import interfaces
-from pyams_content.component.association.interfaces import IAssociationInfo
-from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer, \
-    IParagraphRenderer
+from pyams_content.component.paragraph.interfaces import IParagraphContainerTarget, IParagraphContainer
 from pyams_content.component.paragraph.zmi.interfaces import IParagraphInnerEditor, IParagraphContainerView
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_content.shared.common.interfaces import IWfSharedContent
@@ -38,7 +36,7 @@
 from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config
 from pyams_utils.traversing import get_parent
-from pyams_viewlet.viewlet import viewlet_config, BaseContentProvider, Viewlet
+from pyams_viewlet.viewlet import viewlet_config, Viewlet
 from pyams_zmi.form import AdminDialogAddForm
 from pyramid.view import view_config
 from z3c.form import field, button
@@ -143,25 +141,3 @@
 @template_config(template='templates/imagemap-preview.pt', layer=IPyAMSLayer)
 class ImagemapParagraphPreviewWidgetsSuffix(Viewlet):
     """Image map paragraph preview widgets suffix"""
-
-
-#
-# Image map paragraph renderer
-#
-
-@adapter_config(context=(IImageMapParagraph, IPyAMSLayer), provides=IParagraphRenderer)
-@template_config(template='templates/paragraph-render.pt', layer=IPyAMSLayer)
-class ImagemapParagraphRenderer(BaseContentProvider):
-    """Image map paragraph renderer"""
-
-    language = None
-
-    def update(self):
-        i18n = II18n(self.context)
-        if self.language:
-            setattr(self, 'title', i18n.get_attribute('title', self.language, request=self.request))
-        else:
-            setattr(self, 'title', i18n.query_attribute('title', request=self.request))
-
-    def get_item_info(self, item):
-        return IAssociationInfo(item, None)
--- a/src/pyams_content/shared/imagemap/zmi/render.py	Fri May 18 15:50:16 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#
-# Copyright (c) 2008-2015 Thierry Florac <tflorac AT ulthar.net>
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.1 (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.
-#
-
-__docformat__ = 'restructuredtext'
-
-
-# import standard library
-
-# import interfaces
-from pyams_content.component.association.interfaces import IAssociationInfo
-from pyams_content.features.renderer.interfaces import IContentRenderer
-from pyams_content.shared.imagemap.interfaces import IWfImageMap
-from pyams_skin.layer import IPyAMSLayer
-
-# import packages
-from pyams_content.features.renderer.zmi import BaseContentRenderer
-from pyams_template.template import template_config
-from pyams_utils.adapter import adapter_config
-
-
-@adapter_config(name='imagemap-render', context=(IWfImageMap, IPyAMSLayer), provides=IContentRenderer)
-@template_config(template='templates/render.pt', layer=IPyAMSLayer)
-class ImagemapRenderer(BaseContentRenderer):
-    """Image map renderer"""
-
-    weight = 20
-
-    def get_item_info(self, item):
-        return IAssociationInfo(item, None)
--- a/src/pyams_content/shared/logo/zmi/paragraph.py	Fri May 18 15:50:16 2018 +0200
+++ b/src/pyams_content/shared/logo/zmi/paragraph.py	Fri May 18 15:51:14 2018 +0200
@@ -22,7 +22,7 @@
 from pyams_content.interfaces import MANAGE_CONTENT_PERMISSION
 from pyams_content.shared.common import IWfSharedContent
 from pyams_content.shared.logo.interfaces import ILogosParagraph, LOGOS_PARAGRAPH_TYPE
-from pyams_form.interfaces.form import IInnerForm, IEditFormButtons
+from pyams_form.interfaces.form import IInnerForm
 from pyams_i18n.interfaces import II18n
 from pyams_skin.interfaces.viewlet import IToolbarAddingMenu
 from pyams_skin.layer import IPyAMSLayer
@@ -30,7 +30,7 @@
 
 # import packages
 from pyams_content.component.paragraph.zmi import IParagraphContainerView, BaseParagraphAddMenu, \
-    BaseParagraphAJAXAddForm, BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm
+    BaseParagraphAJAXAddForm, BaseParagraphPropertiesEditForm, BaseParagraphAJAXEditForm, IParagraphEditFormButtons
 from pyams_content.features.renderer.zmi import BaseRenderedContentRenderer
 from pyams_content.features.renderer.zmi.widget import RendererFieldWidget
 from pyams_content.shared.logo.paragraph import LogosParagraph
@@ -122,7 +122,7 @@
     @property
     def buttons(self):
         if self.mode == INPUT_MODE:
-            return button.Buttons(IEditFormButtons)
+            return button.Buttons(IParagraphEditFormButtons)
         else:
             return button.Buttons()
 
--- a/src/pyams_content/shared/site/manager.py	Fri May 18 15:50:16 2018 +0200
+++ b/src/pyams_content/shared/site/manager.py	Fri May 18 15:51:14 2018 +0200
@@ -19,6 +19,8 @@
 from pyams_content.component.illustration import IIllustrationTarget
 from pyams_content.component.paragraph.interfaces import IParagraphFactorySettings
 from pyams_content.component.theme.interfaces import IThemesManagerTarget
+from pyams_content.features.footer.interfaces import IFooterTarget
+from pyams_content.features.header.interfaces import IHeaderTarget
 from pyams_content.features.preview.interfaces import IPreviewTarget
 from pyams_content.interfaces import MANAGE_SITE_PERMISSION
 from pyams_content.reference.pictograms.interfaces import IPictogramManagerTarget
@@ -51,7 +53,7 @@
 
 
 @implementer(ISiteManager, IParagraphFactorySettings, IThemesManagerTarget, IPictogramManagerTarget,
-             IIllustrationTarget, IPortalContext, IPreviewTarget, IAttributeAnnotatable)
+             IIllustrationTarget, IPortalContext, IHeaderTarget, IFooterTarget, IPreviewTarget, IAttributeAnnotatable)
 class SiteManager(SiteContainerMixin, OrderedContainer, BaseSharedTool, UserSkinnableContent):
     """Site manager persistent class"""
 
--- a/src/pyams_content/shared/view/portlet/__init__.py	Fri May 18 15:50:16 2018 +0200
+++ b/src/pyams_content/shared/view/portlet/__init__.py	Fri May 18 15:51:14 2018 +0200
@@ -17,17 +17,13 @@
 
 # import interfaces
 from pyams_content.shared.view.portlet.interfaces import IViewItemsPortletSettings
-from pyams_portal.interfaces import IPortalContext, IPortletRenderer
-from pyams_skin.layer import IPyAMSLayer
 from pyams_utils.interfaces import VIEW_PERMISSION
 
 # import packages
 from pyams_content.workflow import PUBLISHED_STATES
-from pyams_portal.portlet import PortletSettings, portlet_config, Portlet, PortletRenderer
+from pyams_portal.portlet import PortletSettings, portlet_config, Portlet
 from pyams_sequence.utility import get_sequence_target
-from pyams_template.template import template_config
-from pyams_utils.adapter import adapter_config
-from zope.interface import implementer, Interface
+from zope.interface import implementer
 from zope.schema.fieldproperty import FieldProperty
 
 from pyams_content import _
@@ -63,11 +59,3 @@
     toolbar_css_class = 'fa fa-fw fa-2x fa-th-list'
 
     settings_class = ViewItemsPortletSettings
-
-
-@adapter_config(context=(IPortalContext, IPyAMSLayer, Interface, IViewItemsPortletSettings), provides=IPortletRenderer)
-@template_config(template='templates/view-items-list.pt', layer=IPyAMSLayer)
-class ViewItemsPortletRenderer(PortletRenderer):
-    """View items portlet renderer"""
-
-    label = _("Simple list view")
--- a/src/pyams_content/shared/view/zmi/render.py	Fri May 18 15:50:16 2018 +0200
+++ b/src/pyams_content/shared/view/zmi/render.py	Fri May 18 15:51:14 2018 +0200
@@ -21,7 +21,7 @@
 from pyams_skin.layer import IPyAMSLayer
 
 # import packages
-from pyams_content.features.renderer.zmi import BaseContentRenderer
+from pyams_content.features.renderer.skin import BaseContentRenderer
 from pyams_template.template import template_config
 from pyams_utils.adapter import adapter_config