Permalink
Browse files

BUG: fix the disable-python command line option

By some oversight this feature wasn't working before.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@21522 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
1 parent 851a1fe commit 93ea4af17fda5463a40cda7ded3686ad1c6c4157 @pieper pieper committed Dec 20, 2012
@@ -760,6 +760,13 @@ void qSlicerCoreApplication::handlePreApplicationCommandLineArguments()
{
this->setAttribute(AA_EnableTesting);
}
+
+#ifdef Slicer_USE_PYTHONQT
+ if (options->isPythonDisabled())
+ {
+ this->setAttribute(AA_DisablePython);
+ }
+#endif
}
//-----------------------------------------------------------------------------
@@ -259,6 +259,15 @@ bool qSlicerCoreCommandOptions::isTestingEnabled() const
return d->ParsedArgs.value("testing").toBool();
}
+#ifdef Slicer_USE_PYTHONQT
+//-----------------------------------------------------------------------------
+bool qSlicerCoreCommandOptions::isPythonDisabled() const
+{
+ Q_D(const qSlicerCoreCommandOptions);
+ return d->ParsedArgs.value("disable-python").toBool();
+}
+#endif
+
//-----------------------------------------------------------------------------
void qSlicerCoreCommandOptions::addArguments()
{
@@ -25,6 +25,7 @@
#include <ctkCommandLineParser.h>
#include "qSlicerBaseQTCoreExport.h"
+#include "vtkSlicerConfigure.h" // For Slicer_USE_PYTHONQT
class QSettings;
class qSlicerCoreCommandOptionsPrivate;
@@ -48,6 +49,9 @@ class Q_SLICER_BASE_QTCORE_EXPORT qSlicerCoreCommandOptions : public ctkCommandL
Q_PROPERTY(bool disableMessageHandlers READ disableMessageHandlers)
Q_PROPERTY(QString tempDirectory READ tempDirectory)
Q_PROPERTY(bool testingEnabled READ isTestingEnabled)
+#ifdef Slicer_USE_PYTHONQT
+ Q_PROPERTY(bool pythonDisabled READ isPythonDisabled)
+#endif
Q_PROPERTY(QStringList additonalModulePaths READ additonalModulePaths)
public:
typedef ctkCommandLineParser Superclass;
@@ -131,6 +135,13 @@ class Q_SLICER_BASE_QTCORE_EXPORT qSlicerCoreCommandOptions : public ctkCommandL
/// \sa settingsEnabled()
bool isTestingEnabled()const;
+#ifdef Slicer_USE_PYTHONQT
+ /// Return True if slicer has no python infrastructure initialized.
+ /// Python is still compiled with the app, but not enabled at run-time.
+ /// \sa settingsEnabled()
+ bool isPythonDisabled()const;
+#endif
+
protected:
/// Add arguments - Called from parse() method

0 comments on commit 93ea4af

Please sign in to comment.