Commit 839e94b1 authored by Jean-Paul Smets's avatar Jean-Paul Smets

Presentation cleanup (white spaces, tabs, method parameters).

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@15220 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 8a0ad4a3
......@@ -211,6 +211,8 @@ class ManageModule:
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
......@@ -563,7 +565,6 @@ class ManageFiles:
def getPDFFile(self, file_descriptor):
""" Get file content """
return file_descriptor.open()
security.declarePublic('setBackgroundPictures')
......@@ -609,6 +610,7 @@ class ManageFiles:
# going to the begining of the input file
pdf_file.seek(0)
# saving content
# saving content
temp_pdf.write(pdf_file.read())
temp_pdf.close()
......@@ -787,14 +789,14 @@ class ManageCSS:
security.declarePublic('setPageProperties')
def setPageProperties(self
,properties_css_dict,
page_iterator
,properties_css_dict
,page_iterator
,page_id
,page_height,
page_width,
original_page_width,
original_page_height,
width_groups,height_groups):
,page_height
,page_width,
,original_page_width
,original_page_height
,width_groups,height_groups):
"""
recover all CSS data relative to the current page and save these
information in the output dict
......@@ -852,12 +854,13 @@ class ManageCSS:
,properties_css_dict
,field
,page_width
,page_height,
page_iterator
,page_height
,page_iterator
,page_gap
,keep_page,
original_page_width,
original_page_height,properties_page,actual_width,actual_height):
,original_page_width
,original_page_height
,properties_page,actual_width,actual_height):
"""
recover all CSS data relative to the current page_object (field)
and save these informations in the output dict
......@@ -879,8 +882,6 @@ class ManageCSS:
str(float(properties_field['position_y']) - \
(actual_height + page_gap)* page_iterator)
# Processing object for CSS data
# declaring dict containing all css data
# _stand for general display
......@@ -939,9 +940,9 @@ class ManageCSS:
properties_css_object_error['background'] = 'rgb(128,128,255)'
elif properties_field['type'] != 'TextAreaField':
properties_css_object_stand['background'] = '#F5F5DC'
properties_css_object_error['background'] = 'rgb(255,64,64)'
properties_css_object_error['background'] = 'rgb(255,64,64)' # Previously #B9D9D4 - should become a parameter
else:
properties_css_object_stand['background'] = '#F5F5DC'
properties_css_object_stand['background'] = '#F5F5DC' # Previously #B9D9D4 - should become a parameter
properties_css_object_error['background'] = 'rgb(255,64,64)'
# add completed properties (in our case only the class rendering the text
......@@ -1128,9 +1129,6 @@ class ManageCSS:
return properties_css_dict
security.declarePublic('setFinalProperties')
def setFinalProperties(self
,properties_css_dict
......@@ -1147,10 +1145,6 @@ class ManageCSS:
properties_css_dict['head']['page_end'] = properties_css_page
return properties_css_dict
security.declarePublic('generateOutputContent')
def generateOutputContent(self
,properties_css_dict
......@@ -1200,9 +1194,6 @@ class ManageCSS:
# return final String
return form_css_content
security.declarePublic('createOutputFile')
def createOutputFile(self
,form_css_content
......@@ -1215,17 +1206,13 @@ class ManageCSS:
factory.addDTMLDocument(form_css_id,"css",form_css_content)
class ScribusParser:
"""
Parses a Scribus file (pda) with PDF-elements inside
"""
#declare security
security = ClassSecurityInfo()
security.declarePublic('getObjectTooltipProperty')
def getObjectTooltipProperty(self, check_key, default_value, object_name, object_dict):
"""
......@@ -1253,8 +1240,6 @@ class ScribusParser:
+ ": using " + str(default_value))
return default_value
security.declarePublic('getXmlObjectPropertiesDict')
def getXmlObjectsPropertiesDict(self, xml_string):
"""
......@@ -1301,7 +1286,6 @@ class ScribusParser:
#for each PAGE object, searching for PAGEOBJECT
for page in page_list:
# getting page number
# parsing method from the previous ScribusUtils
page_number = -1
......@@ -1413,7 +1397,6 @@ class ScribusParser:
return (returned_page_dict,keep_page,page_gap)
security.declarePublic('getPropertiesConversionDict')
def getPropertiesConversionDict(self, text_page_dict):
"""
......@@ -1442,7 +1425,6 @@ class ScribusParser:
# declaring ScribusParser object to run other functions
sp = ScribusParser()
for page_number in text_page_dict.keys():
# iterating through 'PAGE' object of the document
# id = page_number
......@@ -1518,8 +1500,6 @@ class ScribusParser:
tooltipfield_value
# end of 'ANTOOLTIP' parsing
# getting usefull attributes from scribus 'PAGEOBJECT
#and 'ANTOOLTIP'
#
......@@ -1536,7 +1516,6 @@ class ScribusParser:
'0',
object_name,
object_content)
object_properties['size_x'] = \
sp.getObjectTooltipProperty('WIDTH',
'100',
......@@ -1548,8 +1527,6 @@ class ScribusParser:
object_name,
object_content)
# converting values to integer-compliant to prevent errors
# when using them for that converting from 'str' -> 'float'
# -> 'int' -> 'str'
......@@ -1564,7 +1541,6 @@ class ScribusParser:
object_properties['size_y'] = \
str(int(float(object_properties['size_y'])))
# getting object title
# object title can only be user-specified in the 'tooltip' dict
object_properties['title'] = \
......@@ -1573,7 +1549,6 @@ class ScribusParser:
object_name,
tooltipfield_properties_dict)
# getting object order position for erp5 form
temp_order = \
sp.getObjectTooltipProperty('order',
......@@ -1581,7 +1556,6 @@ class ScribusParser:
object_name,
tooltipfield_properties_dict)
if temp_order not in ['left','right']:
# temp_order invalid
# trying to get it from its position in original Scribus file
......@@ -1591,9 +1565,6 @@ class ScribusParser:
temp_order = 'left'
object_properties['order'] = temp_order
# getting special ANFLAG sub-properties
temp_ANFLAG = long(sp.getObjectTooltipProperty('ANFLAG',
0,
......@@ -1647,7 +1618,6 @@ class ScribusParser:
# 'read only" field
anflag_properties['readOnly'] = 1
# getting maximum number of caracters the field can hold
# note : only used for textfields ('StringField', 'IntegerField',
# 'FloatField', etc.)
......@@ -1666,7 +1636,6 @@ class ScribusParser:
object_content)
print " => MaxInput = %s" % object_properties['maximum_input']
# getting object type :
# first checking for user-specified type in 'tooltip' properties
if tooltipfield_properties_dict.has_key('type'):
......@@ -1741,8 +1710,6 @@ class ScribusParser:
object_properties['data_type'] = 'date'
object_properties['default_data'] = '1970/01/01'
# getting 'required' property
# checking for user data in tooltipfield. if nothing found then
# taking hard-written value in anflag properties
......@@ -1752,7 +1719,6 @@ class ScribusParser:
object_name,
tooltipfield_properties_dict)
# getting type properties for special types
object_properties['rendering'] = 'single'
# Stringfields handle properties
......@@ -1835,8 +1801,6 @@ class ScribusParser:
object_name,
tooltipfield_properties_dict)
# getting creation order from 'tooltip' properties
# used to create ERP5 objects in a special order
if tooltipfield_properties_dict.has_key('nb') and \
......@@ -1881,7 +1845,6 @@ class ScribusParser:
# before going to the next page_object
returned_object_dict[object_name] = object_properties
# final processing before returning full page with modified
# page_object_properties : setting 'nb' property to all objects
# without user-specified 'nb' property
......@@ -1906,21 +1869,14 @@ class ScribusParser:
# add the object at the end of the new list
returned_object_list.append((nb_value,returned_object_dict[nb_value]))
# adding returned list of object to the page dict
# before going to the next page
returned_page_dict[page_number] = returned_object_list
# returning final dict containing all the modified data
print " => end ScribusParser.getPropertiesConversion"
return (returned_page_dict)
security.declarePublic('initFieldDict')
def initFieldDict(self):
"""
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment