Author: jmorliaguet
Date: Fri Oct 21 23:28:18 2005
New Revision: 28523

Modified:
   z3lab/cpsskins/branches/jmo-perspectives/configuration/elements/__init__.py
   
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/configure.zcml
   z3lab/cpsskins/branches/jmo-perspectives/elements/displays/__init__.py
   z3lab/cpsskins/branches/jmo-perspectives/elements/presentation.py
   z3lab/cpsskins/branches/jmo-perspectives/portlets/breadcrumbs/configure.zcml
Log:


- element presentation settings are registered in zcml



Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/elements/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/configuration/elements/__init__.py 
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/configuration/elements/__init__.py 
Fri Oct 21 23:28:18 2005
@@ -30,102 +30,6 @@
 from cpsskins.portlets.custom import ICustomPortlet
 from cpsskins.interfaces import IPortlet
 
-factories = {
-
-    IThemePage: {
-        'display': 'area',
-        'formats': {
-            'widget': 'page_body',
-            'layout': 'page',
-            'style': '',
-            }
-        },
-
-    IPageBlock: {
-        'display': 'area',
-        'formats': {
-            'widget': 'table_frame',
-            'layout': 'container',
-            'style': '',
-            }
-        },
-
-    ICell: {
-        'display': 'area',
-        'formats': {
-            'widget': 'table_cell',
-            'layout': 'container',
-            'style': '',
-            }
-        },
-
-    ISlot: {
-        'display': 'boxgroup',
-        'formats': {
-            'effect': 'scale',
-            'widget': 'frame_box',
-            'style': '',
-            }
-        },
-
-    IPortlet: {
-        'display': 'box',
-        'formats': {
-            'widget': 'plain_html',
-            'style': '',
-            }
-        },
-
-    IMacroSlotPortlet: {
-        'display': 'box',
-        'formats': {
-            'widget': 'plain_html',
-            'style': '',
-            }
-        },
-
-    IDummyPortlet: {
-        'display': 'box',
-        'formats': {
-            'widget': 'plain_html',
-            'style': '',
-            }
-        },
-
-    IActionsPortlet: {
-        'display': 'box',
-        'formats': {
-            'widget': 'vertical_menu',
-            'style': '',
-            }
-        },
-
-    IImagePortlet: {
-        'display': 'box',
-        'formats': {
-            'effect': 'scale',
-            'widget': 'image',
-            'style': '',
-            }
-        },
-
-    IBreadcrumbsPortlet: {
-        'display': 'box',
-        'formats': {
-            'widget': 'horizontal_trail',
-            'style': '',
-            }
-        },
-
-    ICustomPortlet: {
-        'display': 'box',
-        'formats': {
-            'widget': 'plain_html',
-            'style': '',
-            }
-        },
-}
-
 from cpsskins.elements.displays.area import Area
 from cpsskins.elements.displays.box import Box
 from cpsskins.elements.displays.boxgroup import BoxGroup

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py
       (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/configuration/presentations/metaconfigure.py
       Fri Oct 21 23:28:18 2005
@@ -45,7 +45,7 @@
     def format(self, _context, name, id=''):
         self._formats[name] = id
 
-    def __call__(self, iface):
-        presentation_registry.register((iface,),
+    def __call__(self):
+        presentation_registry.register(self.for_,
             {'display': self._display, 'formats': self._formats})
 

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/configure.zcml
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/configure.zcml    
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/configure.zcml    Fri Oct 
21 23:28:18 2005
@@ -1,5 +1,6 @@
 <configure
     xmlns="http://namespaces.zope.org/zope";
+    xmlns:cpsskins="http://namespaces.zope.org/cpsskins";
     xmlns:i18n="http://namespaces.zope.org/i18n";
     i18n_domain="cpsskins"
     >
@@ -103,6 +104,28 @@
 
   </content>
 
+  <cpsskins:presentation
+      for=".interfaces.IThemePage">
+
+    <cpsskins:display
+        type="area"
+    />
+
+    <cpsskins:format
+        name="layout"
+        id="page"
+    />
+
+    <cpsskins:format
+        name="widget"
+        id="page_body"
+    />
+
+    <cpsskins:format
+        name="style"
+    />
+
+  </cpsskins:presentation>
 
   <!-- Page block -->
 
@@ -143,6 +166,28 @@
 
   </content>
 
+  <cpsskins:presentation
+      for=".interfaces.IPageBlock">
+
+    <cpsskins:display
+        type="area"
+    />
+
+    <cpsskins:format
+        name="layout"
+        id="container"
+    />
+
+    <cpsskins:format
+        name="widget"
+        id="table_frame"
+    />
+
+    <cpsskins:format
+        name="style"
+    />
+
+  </cpsskins:presentation>
 
 
   <!-- Cell -->
@@ -184,6 +229,29 @@
 
   </content>
 
+  <cpsskins:presentation
+      for=".interfaces.ICell">
+
+    <cpsskins:display
+        type="area"
+    />
+
+    <cpsskins:format
+        name="layout"
+        id="container"
+    />
+
+    <cpsskins:format
+        name="widget"
+        id="table_cell"
+    />
+
+    <cpsskins:format
+        name="style"
+    />
+
+  </cpsskins:presentation>
+
 
   <!-- Slot -->
 
@@ -230,6 +298,30 @@
 
   </content>
 
+  <cpsskins:presentation
+      for=".interfaces.ISlot">
+
+    <cpsskins:display
+        type="boxgroup"
+    />
+
+    <cpsskins:format
+        name="effect"
+        id="scale"
+    />
+
+    <cpsskins:format
+        name="widget"
+        id="frame_box"
+    />
+
+    <cpsskins:format
+        name="style"
+    />
+
+  </cpsskins:presentation>
+
+
 
   <!-- Portlet -->
 
@@ -262,6 +354,24 @@
 
   </content>
 
+  <cpsskins:presentation
+      for=".interfaces.IPortlet">
+
+    <cpsskins:display
+        type="box"
+    />
+
+    <cpsskins:format
+        name="widget"
+        id="plain_html"
+    />
+
+    <cpsskins:format
+        name="style"
+    />
+
+  </cpsskins:presentation>
+
 
   <!-- package includes -->
 

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/displays/__init__.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/displays/__init__.py      
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/displays/__init__.py      
Fri Oct 21 23:28:18 2005
@@ -20,9 +20,11 @@
 from zope.app.interface import queryType
 from zope.app.location.pickling import locationCopy
 from zope.app.traversing.interfaces import IPathAdapter
+from zope.component import getUtility
 from zope.interface import implements
 from zope.security.proxy import removeSecurityProxy
 
+from cpsskins.configuration.interfaces import IRegistry
 from cpsskins.elements import Element
 from cpsskins.elements.interfaces import IDisplayable, IDisplay, IDisplayType
 from cpsskins.elements.interfaces import IFormattable
@@ -33,6 +35,8 @@
 from cpsskins.thememanager import getThemeManager
 from cpsskins.storage.interfaces import IDisplayStorage
 
+presentation_registry = getUtility(IRegistry, 'presentations')
+
 class Display(Element):
 
     implements(IDisplay)
@@ -210,11 +214,11 @@
     def factory(self):
         """Display factory. Return a display element.
         """
-        from cpsskins.configuration.elements import factories, 
display_factories
+        from cpsskins.configuration.elements import display_factories
         context = self.context
-        factory_info = factories.get(context.getContentType())
+        factory_info = presentation_registry.get(context.getContentType())
         if factory_info is None:
-            factory_info = factories.get(context.getElementType())
+            factory_info = presentation_registry.get(context.getElementType())
         display_name = factory_info['display']
         factory = display_factories[display_name]
         return apply(factory, ())

Modified: z3lab/cpsskins/branches/jmo-perspectives/elements/presentation.py
==============================================================================
--- z3lab/cpsskins/branches/jmo-perspectives/elements/presentation.py   
(original)
+++ z3lab/cpsskins/branches/jmo-perspectives/elements/presentation.py   Fri Oct 
21 23:28:18 2005
@@ -21,7 +21,6 @@
 from zope.interface import implements
 from zope.component import getUtility
 
-from cpsskins.configuration.elements import factories
 from cpsskins.configuration.interfaces import IRegistry
 from cpsskins.elements.interfaces import IDisplayable, IFormattable
 from cpsskins.ontology import hasFormat, hasDisplay, hasDisplayFromPerspective
@@ -30,6 +29,7 @@
 from interfaces import IPresentable
 
 format_registry = getUtility(IRegistry, 'formats')
+presentation_registry = getUtility(IRegistry, 'presentations')
 
 class Presentable(object):
     """This adapter makes elements presentable, i.e. displayable and 
formattable
@@ -59,9 +59,9 @@
         display = displayable.addDisplay(perspective)
 
         formattable = IFormattable(display)
-        factory_info = factories.get(context.getContentType())
+        factory_info = presentation_registry.get(context.getContentType())
         if factory_info is None:
-            factory_info = factories.get(context.getElementType())
+            factory_info = presentation_registry.get(context.getElementType())
         for type, id in factory_info['formats'].items():
             formattable.addFormat(type, id)
 

Modified: 
z3lab/cpsskins/branches/jmo-perspectives/portlets/breadcrumbs/configure.zcml
==============================================================================
--- 
z3lab/cpsskins/branches/jmo-perspectives/portlets/breadcrumbs/configure.zcml    
    (original)
+++ 
z3lab/cpsskins/branches/jmo-perspectives/portlets/breadcrumbs/configure.zcml    
    Fri Oct 21 23:28:18 2005
@@ -33,7 +33,7 @@
 
     <format
         name="widget"
-        id="vertical_menu"
+        id="horizontal_trail"
     />
 
     <format
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to