Author: jmorliaguet
Date: Mon Jun  5 20:41:03 2006
New Revision: 3327

Modified:
   cpsskins/branches/paris-sprint-2006/setup/README.txt
   cpsskins/branches/paris-sprint-2006/setup/io/README.txt
   cpsskins/branches/paris-sprint-2006/setup/io/utils.py
   cpsskins/branches/paris-sprint-2006/setup/manager.py
   cpsskins/branches/paris-sprint-2006/setup/preset.py
   cpsskins/branches/paris-sprint-2006/setup/test/presets.tgz
   cpsskins/branches/paris-sprint-2006/standard/filters/style/README.txt
   cpsskins/branches/paris-sprint-2006/standard/io/preset.py
   
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt
   cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/views.py

Log:

- simplifications: no need to have both a preset name and a title. The name
  functions as a title.



Modified: cpsskins/branches/paris-sprint-2006/setup/README.txt
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/README.txt        (original)
+++ cpsskins/branches/paris-sprint-2006/setup/README.txt        Mon Jun  5 
20:41:03 2006
@@ -92,8 +92,7 @@
 resource directly (e.g. 'cpsskins://dummy:resource1') we access it by
 referring to the corresponding preset (e.g. 'cpsskins://[EMAIL PROTECTED]').
 
-    >>> preset1 = resources.register(name=u'preset1', title=u'Preset 1',
-    ...                               resource=resource1)
+    >>> preset1 = resources.register(name=u'preset1', resource=resource1)
 
 we can look up the preset:
 
@@ -113,8 +112,7 @@
 
 Now we register the second resource:
 
-    >>> preset2 = resources.register(name=u'preset2', title=u'Preset 2',
-    ...                               resource=resource2)
+    >>> preset2 = resources.register(name=u'preset2', resource=resource2)
 
 and look it up in the registry:
 
@@ -134,8 +132,8 @@
 
 so we register a local resource, we do this by passing a context to register():
 
-    >>> preset3 = resources.register(name=u'preset3', title=u'Preset 3',
-    ...                               resource=resource3, context=root)
+    >>> preset3 = resources.register(name=u'preset3', resource=resource3,
+    ...                              context=root)
 
 We now have a local resource in the context of the root folder:
 
@@ -192,7 +190,7 @@
     >>> print archive[u'presets.xml']
     <?xml version="1.0" encoding="utf-8"?>
     <presets>
-      <preset name="red" title="Red title" type="format-style">
+      <preset name="red" type="format-style">
         <rule selector="div.standardPlainHtml h1">
           <property name="color" value="red"/>
         </rule>
@@ -427,7 +425,7 @@
     >>> print color
     #ff0000
 
-    >>> resources.register(name=u'red', title=u'Color red', resource=color)
+    >>> resources.register(name=u'red', resource=color)
     <Preset: cpsskins://[EMAIL PROTECTED]>
 
     >>> IType(color).getTypeName()

Modified: cpsskins/branches/paris-sprint-2006/setup/io/README.txt
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/io/README.txt     (original)
+++ cpsskins/branches/paris-sprint-2006/setup/io/README.txt     Mon Jun  5 
20:41:03 2006
@@ -62,7 +62,7 @@
     >>> style = Style()
     >>> style[u'h1'] = {'color': 'red'}
     >>> root[u'style-1'] = style
-    >>> resources.register(name=u'style1', title=u'Style 1', resource=style)
+    >>> resources.register(name=u'style1', resource=style)
     <Preset: cpsskins://[EMAIL PROTECTED]>
 
 When exporting presets, the resource's own type is skipped, we write:
@@ -87,7 +87,7 @@
     >>> print toXML(preset, u'presets')
     <?xml version="1.0" encoding="utf-8"?>
     <presets>
-      <preset name="style1" title="Style 1" type="format-style">
+      <preset name="style1" type="format-style">
         <rule selector="h1">
           <property name="color" value="red"/>
         </rule>

Modified: cpsskins/branches/paris-sprint-2006/setup/io/utils.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/io/utils.py       (original)
+++ cpsskins/branches/paris-sprint-2006/setup/io/utils.py       Mon Jun  5 
20:41:03 2006
@@ -238,13 +238,12 @@
 
         typename = el.getAttribute(u'type')
         name = el.getAttribute(u'name')
-        title = el.getAttribute(u'title')
 
         factory_name = u'cpsskins.%s' % typename.replace('-', '.')
         resource = createObject(factory_name)
 
-        preset = resources.register(name=name, title=title, resource=resource,
-                                     context=context)
+        preset = resources.register(name=name, resource=resource,
+                                    context=context)
         mgr.registerElement(resource)
 
         importer = getMultiAdapter((preset, el), IDOMAdapter)

Modified: cpsskins/branches/paris-sprint-2006/setup/manager.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/manager.py        (original)
+++ cpsskins/branches/paris-sprint-2006/setup/manager.py        Mon Jun  5 
20:41:03 2006
@@ -42,18 +42,17 @@
 
     ### Registration of presets  ######################################
 
-    def register(self, name=u'', title=u'', resource=None, filename=None,
-                 context=None):
+    def register(self, name=u'', resource=None, filename=None, context=None):
         """Register the preset as a utility.
         """
         presets = getThemeManager(context).getPresets()
         chooser = INameChooser(presets)
         preset_name = chooser.chooseName(name, context)
         if context is None:
-            preset = GlobalPreset(name=name, title=title, resource=resource,
+            preset = GlobalPreset(name=name, resource=resource,
                                   filename=filename)
         else:
-            preset = LocalPreset(name=name, title=title, resource=resource)
+            preset = LocalPreset(name=name, resource=resource)
 
         uri = IIdentifiable(preset).getURI()
         if uri in presets:

Modified: cpsskins/branches/paris-sprint-2006/setup/preset.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/setup/preset.py (original)
+++ cpsskins/branches/paris-sprint-2006/setup/preset.py Mon Jun  5 20:41:03 2006
@@ -29,9 +29,8 @@
     """
     implements(IPreset)
 
-    def __init__(self, name=u'', title=u'', resource=None):
+    def __init__(self, name=u'', resource=None):
         self.name = name
-        self.title = title
         self.resource = resource
         # add a reference from the resource to the preset
         self.resource.__parent__ = self

Modified: cpsskins/branches/paris-sprint-2006/setup/test/presets.tgz
==============================================================================
Binary files. No diff available.

Modified: cpsskins/branches/paris-sprint-2006/standard/filters/style/README.txt
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/filters/style/README.txt       
(original)
+++ cpsskins/branches/paris-sprint-2006/standard/filters/style/README.txt       
Mon Jun  5 20:41:03 2006
@@ -77,8 +77,7 @@
     >>> from cpsskins.standard.fields.color import WebColor
 
     >>> color = WebColor(255, 0, 0)
-    >>> preset = resources.register(name=u'red', title=u'Red color',
-    ...                              resource=color)
+    >>> preset = resources.register(name=u'red', resource=color)
 
     >>> print CSSRenderer(s)()
     p.style12345  {color:#ff0000}
@@ -99,8 +98,7 @@
     ... "\x18\x05\xa3`\x14\x8c\x82Q0\nF\x01\xbd\x01\x00\x07\x80\x00\x01:" \
     ... "\xe7\xca\xd4\x00\x00\x00\x00IEND\xaeB`\x82"
 
-    >>> preset1 = resources.register(name=u'image1', title=u'Image 1',
-    ...                               resource=image1)
+    >>> preset1 = resources.register(name=u'image1', resource=image1)
 
     >>> s[u'p'] = {'background-image': 'cpsskins://[EMAIL PROTECTED]'}
 

Modified: cpsskins/branches/paris-sprint-2006/standard/io/preset.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/standard/io/preset.py   (original)
+++ cpsskins/branches/paris-sprint-2006/standard/io/preset.py   Mon Jun  5 
20:41:03 2006
@@ -47,7 +47,6 @@
 
         preset_el = document.createElement(u'preset')
         preset_el.setAttribute(u'name', context.name)
-        preset_el.setAttribute(u'title', context.title)
         preset_el.setAttribute(u'type', IType(resource).name)
         node.appendChild(preset_el)
 

Modified: 
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt
==============================================================================
--- 
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt  
    (original)
+++ 
cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/element_editor.pt  
    Mon Jun  5 20:41:03 2006
@@ -75,8 +75,9 @@
       <p><em>You can save these settings as a preset.</em></p>
       <form enctype="multipart/form-data" method="post"
             tal:attributes="action 
string:${display/@@absolute_url}/@@createPreset">
-        <label for="title">Choose a title</label>
-        <input id="title" style="padding: 1px" type="text" name="title" />
+        <label for="name">Choose a name
+          <input id="name" style="padding: 1px" type="text" name="name" />
+        </label>
         <input type="hidden" name="uri" tal:attributes="value info/uri" />
         <input type="hidden" name="use" value="1" />
         <input type="submit" style="padding: 1px" name="UPDATE_SUBMIT"

Modified: cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/views.py
==============================================================================
--- cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/views.py       
(original)
+++ cpsskins/branches/paris-sprint-2006/ui/screens/elementeditor/views.py       
Mon Jun  5 20:41:03 2006
@@ -143,7 +143,7 @@
         self.context = context
         self.request = request
 
-    def createPreset(self, title=u'', uri=u'', use=False):
+    def createPreset(self, name=u'', uri=u'', use=False):
         """Create a preset from an element referred to by its URI.
         if 'use' is True the preset will be used; in that case the context
         must be the display.
@@ -159,8 +159,7 @@
 
         resource = locationCopy(removeSecurityProxy(element))
         getThemeManager(context).registerElement(resource)
-
-        preset = resources.register(title=title, resource=resource,
+        preset = resources.register(name=name, resource=resource,
                                     context=context)
         if use:
             self.usePreset(uri=IIdentifiable(preset).getURI())
@@ -168,7 +167,7 @@
     def usePreset(self, uri=u'', current_uri=u''):
         """Use a preset referred to by its URI
 
-        The context is the display
+        The context is the display.
 
         """
         context = self.context
-- 
http://lists.nuxeo.com/mailman/listinfo/z3lab-checkins

Reply via email to