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