Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
EO Time Series Viewer
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Benjamin Jakimow
EO Time Series Viewer
Commits
f6ed67fc
Commit
f6ed67fc
authored
11 years ago
by
Luke Campagnola
Browse files
Options
Downloads
Plain Diff
merged SVG export fixes for python 3
parents
bb3533ab
b48e0e9e
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyqtgraph/exporters/SVGExporter.py
+8
-7
8 additions, 7 deletions
pyqtgraph/exporters/SVGExporter.py
with
8 additions
and
7 deletions
pyqtgraph/exporters/SVGExporter.py
+
8
−
7
View file @
f6ed67fc
from
.Exporter
import
Exporter
from
pyqtgraph.python2_3
import
asUnicode
from
pyqtgraph.parametertree
import
Parameter
from
pyqtgraph.Qt
import
QtGui
,
QtCore
,
QtSvg
import
pyqtgraph
as
pg
...
...
@@ -91,8 +92,8 @@ class SVGExporter(Exporter):
md
.
setData
(
'
image/svg+xml
'
,
QtCore
.
QByteArray
(
xml
.
encode
(
'
UTF-8
'
)))
QtGui
.
QApplication
.
clipboard
().
setMimeData
(
md
)
else
:
with
open
(
fileName
,
'
w
'
)
as
fh
:
fh
.
write
(
xml
.
encode
(
'
UTF
-8
'
))
with
open
(
fileName
,
'
w
b
'
)
as
fh
:
fh
.
write
(
asUnicode
(
xml
)
.
encode
(
'
utf
-8
'
))
xmlHeader
=
"""
\
...
...
@@ -221,8 +222,8 @@ def _generateItemSvg(item, nodes=None, root=None):
## this is taken care of in generateSvg instead.
#if hasattr(item, 'setExportMode'):
#item.setExportMode(False)
xmlStr
=
str
(
arr
)
xmlStr
=
bytes
(
arr
).
decode
(
'
utf-8
'
)
doc
=
xml
.
parseString
(
xmlStr
)
try
:
...
...
@@ -340,7 +341,7 @@ def correctCoordinates(node, item):
if
match
is
None
:
vals
=
[
1
,
0
,
0
,
1
,
0
,
0
]
else
:
vals
=
map
(
float
,
match
.
groups
()[
0
].
split
(
'
,
'
)
)
vals
=
[
float
(
a
)
for
a
in
match
.
groups
()[
0
].
split
(
'
,
'
)
]
tr
=
np
.
array
([[
vals
[
0
],
vals
[
2
],
vals
[
4
]],
[
vals
[
1
],
vals
[
3
],
vals
[
5
]]])
removeTransform
=
False
...
...
@@ -349,9 +350,9 @@ def correctCoordinates(node, item):
continue
if
ch
.
tagName
==
'
polyline
'
:
removeTransform
=
True
coords
=
np
.
array
([
map
(
float
,
c
.
split
(
'
,
'
)
)
for
c
in
ch
.
getAttribute
(
'
points
'
).
strip
().
split
(
'
'
)])
coords
=
np
.
array
([
[
float
(
a
)
for
a
in
c
.
split
(
'
,
'
)
]
for
c
in
ch
.
getAttribute
(
'
points
'
).
strip
().
split
(
'
'
)])
coords
=
pg
.
transformCoordinates
(
tr
,
coords
,
transpose
=
True
)
ch
.
setAttribute
(
'
points
'
,
'
'
.
join
([
'
,
'
.
join
(
map
(
str
,
c
)
)
for
c
in
coords
]))
ch
.
setAttribute
(
'
points
'
,
'
'
.
join
([
'
,
'
.
join
(
[
str
(
a
)
for
a
in
c
]
)
for
c
in
coords
]))
elif
ch
.
tagName
==
'
path
'
:
removeTransform
=
True
newCoords
=
''
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment