[Erp5-report] r18949 - /erp5/trunk/products/ERP5Form/ScribusUtils.py

nobody at svn.erp5.org nobody at svn.erp5.org
Thu Jan 31 16:32:31 CET 2008


Author: fabien
Date: Thu Jan 31 16:32:30 2008
New Revision: 18949

URL: http://svn.erp5.org?rev=18949&view=rev
Log:
- remove existing group to just keep the custom group 'page_'+numpage.
This fix permit to display many pages and not just the first with all fields on
it like it was before this revision.
The first group is renamed because the first element can't be removed
- remove a code part wich was in the if and else block, and put it just after,
  that permit to not have a duplicate code bloc

Modified:
    erp5/trunk/products/ERP5Form/ScribusUtils.py

Modified: erp5/trunk/products/ERP5Form/ScribusUtils.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5Form/ScribusUtils.py?rev=18949&r1=18948&r2=18949&view=diff
==============================================================================
--- erp5/trunk/products/ERP5Form/ScribusUtils.py (original)
+++ erp5/trunk/products/ERP5Form/ScribusUtils.py Thu Jan 31 16:32:30 2008
@@ -211,15 +211,27 @@
     else:
       # using special page positioning convention for
       # pdf-like rendering
-      del default_groups[0:]
       for page_iterator in range(global_properties['page']):
         page_number = 'page_%s' % str(page_iterator)
         default_groups.append(page_number)
+        
     # default_groups list completed, need to update the form_groups
-    # renaming form default group with list's first item
+    # rename the first group because it can't be removed
+    form.rename_group(form.group_list[0], default_groups[0])
+
+    # add other groups
+    if len(default_groups) > 1:
+      for group in default_groups[1:]:
+        form.add_group(group)
     form_view_id_object.rename_group('Default', default_groups[0])
+
+    # remove all other groups:
+    for existing_group in list(form.get_groups(include_empty=1)):
+      if existing_group not in default_groups:
+        form.remove_group(existing_group)
+
     # adding all other items
-    for group in default_groups[0:]:
+    for group in default_groups:
       form_view_id_object.add_group(group)
     # updating form settings
     # building dict containing (property, value)
@@ -810,25 +822,21 @@
     if page_iterator == 0:
       # margin-top = 0 (first page)
       properties_css_page['margin-top'] = "0px"
-      properties_css_background['height'] = \
-        str(page_height) + 'px'
-      properties_css_background['width']= \
-        str (page_width) + 'px'
-      properties_page['actual_width'] = width_groups[page_iterator]
-      properties_page['actual_height'] = height_groups[page_iterator]
       #properties_css_background['margin-top'] = \
       #   str((y_pos -10))+ 'px'
       #properties_css_background['margin-left']= \
       #   str((x_pos- 5))+   'px' 
     else:
-      # margin-top = page height
-      properties_css_page['margin-top'] = "%spx" %(page_height + 20)
-      properties_page['actual_width'] = width_groups[page_iterator]
-      properties_page['actual_height'] = height_groups[page_iterator] 
-      properties_css_background['height'] = \
-        str(page_height) + 'px'
-      properties_css_background['width']= \
-        str (page_width) + 'px'
+      properties_css_page['margin-top'] = "%spx" %(40)
+
+    # set width and height on page block
+    properties_css_page['width'] = str (page_width) + 'px'
+    properties_css_page['height'] = str (page_height) + 'px'
+
+    properties_page['actual_width'] = width_groups[page_iterator]
+    properties_page['actual_height'] = height_groups[page_iterator] 
+    properties_css_background['height'] = str(page_height) + 'px'
+    properties_css_background['width'] = str (page_width) + 'px'
     # adding properties dict to global dicts
     properties_css_dict['head'][page_id] = properties_css_page
     properties_css_dict['head'][background_id] = properties_css_background




More information about the Erp5-report mailing list