Skip to content

Commit 51cd46d

Browse files
committed
COMP: qSlicerWebPythonProxy: Exclude python eval if python is disabled
git-svn-id: http://svn.slicer.org/Slicer4/trunk@27939 3bd1e089-480b-0410-8dfb-8563597acbee
1 parent be03b25 commit 51cd46d

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

Base/QTGUI/qSlicerWebPythonProxy.cxx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,19 @@ bool qSlicerWebPythonProxy::isPythonEvaluationAllowed()
6969
// --------------------------------------------------------------------------
7070
QString qSlicerWebPythonProxy::evalPython(const QString &python)
7171
{
72+
7273
QString result;
73-
if (this->isPythonEvaluationAllowed())
74+
#ifdef Slicer_USE_PYTHONQT
75+
qSlicerCoreApplication * app = qSlicerCoreApplication::application();
76+
if (app && !qSlicerCoreApplication::testAttribute(qSlicerCoreApplication::AA_DisablePython))
7477
{
75-
qSlicerPythonManager *pythonManager = qSlicerApplication::application()->pythonManager();
76-
result = pythonManager->executeString(python).toString();
78+
if (this->isPythonEvaluationAllowed())
79+
{
80+
qSlicerPythonManager *pythonManager = qSlicerApplication::application()->pythonManager();
81+
result = pythonManager->executeString(python).toString();
82+
}
83+
qDebug() << "Running " << python << " result is " << result;
7784
}
78-
qDebug() << "Running " << python << " result is " << result;
85+
#endif
7986
return result;
8087
}

0 commit comments

Comments
 (0)