Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Matevz Golob
erp5
Commits
fc016de0
Commit
fc016de0
authored
Oct 24, 2012
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify code a bit.
parent
55364f3d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
product/ERP5OOo/OOoUtils.py
product/ERP5OOo/OOoUtils.py
+7
-15
No files found.
product/ERP5OOo/OOoUtils.py
View file @
fc016de0
...
@@ -269,7 +269,7 @@ class OOoParser(Implicit):
...
@@ -269,7 +269,7 @@ class OOoParser(Implicit):
"""
"""
Return a dictionnary of all pictures in the document
Return a dictionnary of all pictures in the document
"""
"""
if
len
(
self
.
pictures
)
<=
0
:
if
not
self
.
pictures
:
for
file_name
in
self
.
oo_files
:
for
file_name
in
self
.
oo_files
:
raw_data
=
self
.
oo_files
[
file_name
]
raw_data
=
self
.
oo_files
[
file_name
]
pict_type
=
imghdr
.
what
(
None
,
raw_data
)
pict_type
=
imghdr
.
what
(
None
,
raw_data
)
...
@@ -498,13 +498,7 @@ class OOoParser(Implicit):
...
@@ -498,13 +498,7 @@ class OOoParser(Implicit):
"""
"""
Get table dimension as dictionnary contain both height and width
Get table dimension as dictionnary contain both height and width
"""
"""
max_cols
=
0
return
{
'width'
:
max
(
len
(
x
)
for
x
in
table
)
for
line_index
in
range
(
len
(
table
)):
line
=
table
[
line_index
]
if
len
(
line
)
>
max_cols
:
max_cols
=
len
(
line
)
return
{
'width'
:
max_cols
,
'height'
:
len
(
table
)
,
'height'
:
len
(
table
)
}
}
...
@@ -512,11 +506,9 @@ class OOoParser(Implicit):
...
@@ -512,11 +506,9 @@ class OOoParser(Implicit):
"""
"""
Add necessary cells and lines to obtain given bounds
Add necessary cells and lines to obtain given bounds
"""
"""
while
height
>
len
(
table
):
table
+=
[[]]
*
(
len
(
table
)
-
height
)
table
.
append
([])
for
line
in
table
:
for
line
in
range
(
height
):
line
+=
[
None
]
*
(
len
(
line
)
-
width
)
while
width
>
len
(
table
[
line
]):
table
[
line
].
append
(
None
)
return
table
return
table
def
_getTableListUnion
(
self
,
list1
,
list2
):
def
_getTableListUnion
(
self
,
list1
,
list2
):
...
@@ -526,10 +518,10 @@ class OOoParser(Implicit):
...
@@ -526,10 +518,10 @@ class OOoParser(Implicit):
several embedded spreadsheets with the same id. This explain the
several embedded spreadsheets with the same id. This explain the
use of random suffix in such extreme case.
use of random suffix in such extreme case.
"""
"""
for
list2_key
in
list2
.
keys
()
:
for
list2_key
in
list2
:
# Generate a new table ID if needed
# Generate a new table ID if needed
new_key
=
list2_key
new_key
=
list2_key
while
new_key
in
list1
.
keys
()
:
while
new_key
in
list1
:
new_key
=
list2_key
+
'_'
+
str
(
random
.
randint
(
1000
,
9999
))
new_key
=
list2_key
+
'_'
+
str
(
random
.
randint
(
1000
,
9999
))
list1
[
new_key
]
=
list2
[
list2_key
]
list1
[
new_key
]
=
list2
[
list2_key
]
return
list1
return
list1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment