Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
dcba6153
Commit
dcba6153
authored
Jan 15, 2013
by
David C. Lonie
Browse files
Unescape spaces in MPL paths.
Python gets confused otherwise. Change-Id: Iebe588e121f441061b6f9329ca511adc803cfcec
parent
945cf14e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Rendering/Matplotlib/vtkMatplotlibMathTextUtilities.cxx
View file @
dcba6153
...
...
@@ -105,6 +105,22 @@ if (debug) \
} \
}
namespace
{
//----------------------------------------------------------------------------
// Used to replace "\ " with " " in paths.
void
UnEscapeSpaces
(
std
::
string
&
str
)
{
size_t
pos
=
str
.
rfind
(
"
\\
"
);
while
(
pos
!=
std
::
string
::
npos
)
{
str
.
erase
(
pos
,
1
);
pos
=
str
.
rfind
(
"
\\
"
,
pos
);
}
}
}
// end anon namespace
//----------------------------------------------------------------------------
vtkMatplotlibMathTextUtilities
*
vtkMatplotlibMathTextUtilities
::
New
()
{
...
...
@@ -139,6 +155,7 @@ vtkMatplotlibMathTextUtilities* vtkMatplotlibMathTextUtilities::New()
mplPyHome
)
&&
mplPyHome
.
size
()
!=
0
)
{
UnEscapeSpaces
(
mplPyHome
);
vtkMplStartUpDebugMacro
(
"VTK_MATPLOTLIB_PYTHONHOME="
<<
mplPyHome
);
Py_SetPythonHome
(
const_cast
<
char
*>
(
mplPyHome
.
c_str
()));
}
...
...
@@ -153,6 +170,7 @@ vtkMatplotlibMathTextUtilities* vtkMatplotlibMathTextUtilities::New()
mplPyInterp
)
&&
mplPyInterp
.
size
()
!=
0
)
{
UnEscapeSpaces
(
mplPyInterp
);
vtkMplStartUpDebugMacro
(
"VTK_MATPLOTLIB_PYTHONINTERP="
<<
mplPyInterp
);
Py_SetProgramName
(
const_cast
<
char
*>
(
mplPyInterp
.
c_str
()));
}
...
...
@@ -198,6 +216,7 @@ vtkMatplotlibMathTextUtilities* vtkMatplotlibMathTextUtilities::New()
vtkStdString
envPath
(
envPaths
,
pathStart
+
1
,
pathEnd
==
vtkStdString
::
npos
?
vtkStdString
::
npos
:
pathEnd
-
pathStart
);
UnEscapeSpaces
(
envPath
);
PyList_Insert
(
pypath
,
0
,
PyString_FromString
(
envPath
.
c_str
()));
pathEnd
=
pathStart
-
1
;
pathStart
=
envPaths
.
rfind
(
delim
,
pathEnd
);
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment