int LightApp_Application::lastStudyId = 0;
-
// Markers used to parse array with dockable windows and toolbars state.
// For more details please see the qdockarealayout.cpp && qtoolbararealayout.cpp
// in the Qt source code.
#ifndef DISABLE_PYCONSOLE
if( pythonConsole() )
- pythonConsole()->getInterp()->initStudy();
+ getPyInterp()->initStudy();
#endif
}
#ifndef DISABLE_PYCONSOLE
if( pythonConsole() )
- pythonConsole()->getInterp()->initStudy();
+ getPyInterp()->initStudy();
#endif
emit studyOpened();
#ifndef DISABLE_PYCONSOLE
else if ( flag == WT_PyConsole )
{
- PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(),new LightApp_PyInterp());
+ PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(), getPyInterp() );
pyCons->setObjectName( "pythonConsole" );
pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) );
pyCons->setFont(resourceMgr()->fontValue( "PyConsole", "font" ));
return result;
}
+#ifndef DISABLE_PYCONSOLE
+
+PyConsole_Interp* LightApp_Application::getPyInterp()
+{
+ static PyConsole_Interp* myInterp = 0;
+ if ( !myInterp )
+ myInterp = createPyInterp();
+ return myInterp;
+}
+
+PyConsole_Interp* LightApp_Application::createPyInterp()
+{
+ return new LightApp_PyInterp();
+}
+
+#endif // DISABLE_PYCONSOLE
class LogWindow;
#ifndef DISABLE_PYCONSOLE
class PyConsole_Console;
+class PyConsole_Interp;
#endif
class LightApp_WidgetContainer;
class LightApp_Preferences;
virtual bool checkExistingDoc();
+#ifndef DISABLE_PYCONSOLE
+ PyConsole_Interp* getPyInterp();
+#endif
+
signals:
void studyOpened();
void studySaved();
virtual QMap<int, QString> activateModuleActions() const;
virtual void moduleActionSelected( const int );
+#ifndef DISABLE_PYCONSOLE
+ virtual PyConsole_Interp* createPyInterp();
+#endif
+
protected slots:
virtual void onDesktopActivated();
virtual void onViewManagerRemoved( SUIT_ViewManager* );
class LightApp_PyInterp : public PyConsole_EnhInterp
{
+ friend class LightApp_Application;
+
public:
- LightApp_PyInterp();
virtual ~LightApp_PyInterp();
protected:
+ LightApp_PyInterp();
virtual void initPython();
};
PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* interp )
: QWidget( parent )
{
- // create python interpreter
- myInterp = interp;
- if ( !myInterp )
- myInterp = new PyConsole_Interp();
+ PyConsole_Interp* anInterp = interp ? interp : new PyConsole_Interp();
// initialize Python interpretator
- myInterp->initialize();
+ anInterp->initialize();
// create editor console
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setMargin( 0 );
- myEditor = new PyConsole_Editor( myInterp, this );
+ myEditor = new PyConsole_Editor( anInterp, this );
char* synchronous = getenv("PYTHON_CONSOLE_SYNC");
if (synchronous && atoi(synchronous))
{
/**
* Protected constructor.
*/
-PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* i, PyConsole_Editor* e)
- : QWidget (parent), myEditor(e), myInterp(i)
+PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* /*i*/, PyConsole_Editor* e )
+ : QWidget (parent), myEditor(e)
{}
/*!
{
}
+PyConsole_Interp* PyConsole_Console::getInterp() const
+{
+ return myEditor ? myEditor->getInterp() : 0;
+}
+
/*!
\brief Execute python command in the interpreter.
\param command string with command and arguments
* @param parent
* @param interp
*/
-PyConsole_EnhConsole::PyConsole_EnhConsole( QWidget* parent, PyConsole_EnhInterp* interp)
- : PyConsole_Console(parent, interp, 0)
+PyConsole_EnhConsole::PyConsole_EnhConsole( QWidget* parent, PyConsole_Interp* interp )
+ : PyConsole_Console( parent, interp, 0 )
{
- // create python interpreter
- myInterp = interp;
- if ( !myInterp )
- myInterp = new PyConsole_EnhInterp();
+ PyConsole_Interp* anInterp = interp ? interp : new PyConsole_EnhInterp();
// initialize Python interpretator
- myInterp->initialize();
+ anInterp->initialize();
// create editor console
QVBoxLayout* lay = new QVBoxLayout( this );
lay->setMargin( 0 );
- myEditor = new PyConsole_EnhEditor( static_cast<PyConsole_EnhInterp*>(myInterp), this );
+ myEditor = new PyConsole_EnhEditor( anInterp, this );
char* synchronous = getenv("PYTHON_CONSOLE_SYNC");
if (synchronous && atoi(synchronous))
{
class PyConsole_Interp;
class PyConsole_Editor;
-class PyConsole_EnhInterp;
class PYCONSOLE_EXPORT PyConsole_Console : public QWidget, public SUIT_PopupClient
{
virtual ~PyConsole_Console();
//! \brief Get python interperter
- PyConsole_Interp* getInterp() { return myInterp; }
+ PyConsole_Interp* getInterp() const;
QFont font() const;
virtual void setFont( const QFont& );
PyConsole_Console( QWidget* parent, PyConsole_Interp*, PyConsole_Editor*);
-
- PyConsole_Interp* myInterp; //!< python interpreter
PyConsole_Editor* myEditor; //!< python console editor widget
QMap<int, QAction*> myActions; //!< menu actions list
};
Q_OBJECT
public:
- PyConsole_EnhConsole( QWidget* parent, PyConsole_EnhInterp* interp = 0);
+ PyConsole_EnhConsole( QWidget* parent, PyConsole_Interp* interp = 0 );
virtual ~PyConsole_EnhConsole() {}
};
/*!
\brief Destructor.
-
- Does nothing for the moment.
*/
PyConsole_Editor::~PyConsole_Editor()
{
- myInterp->destroy();
- delete myInterp;
myInterp = 0;
}
+/*!
+ \brief Get Python interpreter
+*/
+PyConsole_Interp* PyConsole_Editor::getInterp() const
+{
+ return myInterp;
+}
+
/*!
\brief Get synchronous mode flag value.
public:
PyConsole_Editor( PyConsole_Interp* theInterp, QWidget *theParent = 0 );
~PyConsole_Editor();
+
+ PyConsole_Interp* getInterp() const;
virtual void addText( const QString& str, const bool newBlock = false, const bool isError = false );
bool isCommand( const QString& str ) const;
* @param interp the interpreter linked to the editor
* @param parent parent widget
*/
-PyConsole_EnhEditor::PyConsole_EnhEditor(PyConsole_EnhInterp * interp, QWidget * parent) :
+PyConsole_EnhEditor::PyConsole_EnhEditor(PyConsole_Interp* interp, QWidget* parent) :
PyConsole_Editor(interp, parent),
_tab_mode(false),
_cursor_pos(-1),
setTextCursor(tc);
textCursor().deletePreviousChar();
// TODO: before wait for any TAB event to be completed
- static_cast<PyConsole_EnhInterp *>(myInterp)->clearCompletion();
+ if ( myInterp )
+ myInterp->clearCompletion();
}
_tab_mode = false;
}
_compl_before_point = QString("");
}
- return new CompletionCommand( static_cast<PyConsole_EnhInterp *>(myInterp), _compl_before_point,
- _compl_after_point, this, isSync() );
+ return new CompletionCommand( myInterp, _compl_before_point,
+ _compl_after_point, this, isSync() );
}
/**
* @param matches list of possible completions
* @param result return value
*/
-void PyConsole_EnhEditor::formatCompletion(const std::vector<QString> & matches, QString & result) const
+void PyConsole_EnhEditor::formatCompletion(const QStringList& matches, QString& result) const
{
int sz = matches.size();
*/
void PyConsole_EnhEditor::customEvent( QEvent* event )
{
- std::vector<QString> matches;
+ QStringList matches;
QString first_match, comple_text, doc, base;
QTextCursor cursor(textCursor());
QTextBlockFormat bf;
QTextCharFormat cf;
- PyConsole_EnhInterp * interp = static_cast<PyConsole_EnhInterp *>(myInterp);
int cursorPos;
switch( event->type() )
{
case PyInterp_Event::ES_TAB_COMPLETE_OK:
+ {
// Extract corresponding matches from the interpreter
- matches = interp->getLastMatches();
+ matches = getInterp()->getLastMatches();
+ doc = getInterp()->getDocStr();
if (matches.size() == 0)
- {
- // Completion successful but nothing returned.
- _tab_mode = false;
- _cursor_pos = -1;
- return;
- }
-
+ {
+ // Completion successful but nothing returned.
+ _tab_mode = false;
+ _cursor_pos = -1;
+ return;
+ }
+
// Only one match - complete directly and update doc string window
- doc = interp->getDocStr();
if (matches.size() == 1)
- {
- first_match = matches[0].mid(_compl_after_point.size());
- cursor.insertText(first_match);
- _tab_mode = false;
- if (doc == QString(""))
- emit updateDoc(formatDocHTML("(no documentation available)\n"));
- else
- emit updateDoc(formatDocHTML(doc));
- }
+ {
+ first_match = matches[0].mid(_compl_after_point.size());
+ cursor.insertText(first_match);
+ _tab_mode = false;
+ if (doc.isEmpty())
+ emit updateDoc(formatDocHTML("(no documentation available)\n"));
+ else
+ emit updateDoc(formatDocHTML(doc));
+ }
else
- {
- // Detect if there is a common base to all available completion
- // In this case append this base to the text already
- extractCommon(matches, base);
- first_match = base.mid(_compl_after_point.size());
- cursor.insertText(first_match);
-
- // If this happens to match exaclty the first completion
- // also provide doc
- if (base == matches[0])
- {
- doc = formatDocHTML(doc);
- emit updateDoc(doc);
- }
-
- // Print all matching completion in a "undo-able" block
- cursorPos = cursor.position();
- cursor.insertBlock();
- cursor.beginEditBlock();
-
- // Insert all matches
- QTextCharFormat cf;
- cf.setForeground(QBrush(Qt::darkGreen));
- cursor.setCharFormat(cf);
- formatCompletion(matches, comple_text);
- cursor.insertText(comple_text);
- cursor.endEditBlock();
-
- // Position cursor where it was before inserting the completion list:
- cursor.setPosition(cursorPos);
- setTextCursor(cursor);
- }
+ {
+ // Detect if there is a common base to all available completion
+ // In this case append this base to the text already
+ extractCommon(matches, base);
+ first_match = base.mid(_compl_after_point.size());
+ cursor.insertText(first_match);
+
+ // If this happens to match exaclty the first completion
+ // also provide doc
+ if (base == matches[0])
+ {
+ doc = formatDocHTML(doc);
+ emit updateDoc(doc);
+ }
+
+ // Print all matching completion in a "undo-able" block
+ cursorPos = cursor.position();
+ cursor.insertBlock();
+ cursor.beginEditBlock();
+
+ // Insert all matches
+ QTextCharFormat cf;
+ cf.setForeground(QBrush(Qt::darkGreen));
+ cursor.setCharFormat(cf);
+ formatCompletion(matches, comple_text);
+ cursor.insertText(comple_text);
+ cursor.endEditBlock();
+
+ // Position cursor where it was before inserting the completion list:
+ cursor.setPosition(cursorPos);
+ setTextCursor(cursor);
+ }
break;
+ }
case PyInterp_Event::ES_TAB_COMPLETE_ERR:
+ {
// Tab completion was unsuccessful, switch off mode:
_tab_mode = false;
_cursor_pos = -1;
break;
+ }
case PyInterp_Event::ES_OK:
case PyInterp_Event::ES_ERROR:
case PyInterp_Event::ES_INCOMPLETE:
+ {
// Before everything else, call super()
PyConsole_Editor::customEvent(event);
// If we are in multi_paste_mode, process the next item:
multiLineProcessNextLine();
break;
+ }
default:
+ {
PyConsole_Editor::customEvent( event );
break;
+ }
}
}
* @param matches
* @param result
*/
-void PyConsole_EnhEditor::extractCommon(const std::vector<QString> & matches, QString & result) const
+void PyConsole_EnhEditor::extractCommon(const QStringList& matches, QString& result) const
{
result = "";
int charIdx = 0;
#define PYCONSOLE_ENHEDITOR_H_
#include "PyConsole.h"
-
#include "PyConsole_Editor.h"
+
#include <QObject>
#include <queue>
-class PyConsole_EnhInterp;
-
/**
* Enhanced Python editor handling tab completion.
*/
Q_OBJECT;
public:
- PyConsole_EnhEditor(PyConsole_EnhInterp * interp, QWidget * parent=0);
+ PyConsole_EnhEditor(PyConsole_Interp* interp, QWidget* parent = 0);
virtual ~PyConsole_EnhEditor() {}
signals:
virtual void handleTab();
virtual void handleBackTab();
virtual void clearCompletion();
- virtual void formatCompletion(const std::vector<QString> & matches, QString & result) const;
+ virtual void formatCompletion(const QStringList& matches, QString& result) const;
virtual QString formatDocHTML(const QString & doc) const;
virtual void multilinePaste(const QString & s);
virtual void multiLineProcessNextLine();
private:
- void extractCommon(const std::vector<QString> & matches, QString & result) const;
+ void extractCommon(const QStringList& matches, QString& result) const;
};
const std::vector<QString> PyConsole_EnhInterp::PYTHON_KEYWORDS = \
std::vector<QString>(tmp_k, tmp_k+sizeof(tmp_k)/sizeof(tmp_k[0]));
+/*!
+ \brief Constructor
+*/
+PyConsole_EnhInterp::PyConsole_EnhInterp()
+ : PyConsole_Interp()
+{
+}
+
+/*!
+ \brief Destructor
+*/
+PyConsole_EnhInterp::~PyConsole_EnhInterp()
+{
+}
+
+QStringList PyConsole_EnhInterp::getLastMatches() const
+{
+ return _last_matches;
+}
+
+QString PyConsole_EnhInterp::getDocStr() const
+{
+ return _doc_str;
+}
+
/*!
\brief Run Python dir() command and saves the result internally in _lastPy
\param dirArgument Python expression to pass to the dir command. The parsing of what the
the user types "a_string_variable.rsp <TAB>", this is "rsp".
\return command exit status - 0 = success
*/
-int PyConsole_EnhInterp::runDirCommand(const QString & dirArgument, const QString & startMatch)
+int PyConsole_EnhInterp::runDirCommand(const QString& dirArgument, const QString& startMatch)
{
int ret;
std::vector<QString> v;
* @return -1 if the call to dir() or the parsing of the result failed, 0 otherwise.
*/
int PyConsole_EnhInterp::runDirAndExtract(const QString& dirArgument,
- const QString & startMatch, std::vector<QString> & result,
- bool discardSwig) const
+ const QString& startMatch,
+ QStringList& result,
+ bool discardSwig) const
{
QRegExp re("^[A-Z].+_[A-Z]+[a-z]+.+$"); // discard SWIG static method, e.g. MEDCouplingUMesh_Blabla
QString command("dir(" + dirArgument + ")");
*/
void PyConsole_EnhInterp::clearCompletion()
{
- _last_matches.resize(0);
- _doc_str = QString("");
+ _last_matches.clear();
+ _doc_str = "";
}
-
-
-
class PYCONSOLE_EXPORT PyConsole_EnhInterp: public PyConsole_Interp
{
public:
- PyConsole_EnhInterp()
- : PyConsole_Interp(), _last_matches(0), _doc_str("")
- {}
+ PyConsole_EnhInterp();
+ virtual ~PyConsole_EnhInterp();
- virtual ~PyConsole_EnhInterp() {}
-
- const std::vector<QString>& getLastMatches() const { return _last_matches; }
- const QString & getDocStr() const { return _doc_str; }
+ virtual QStringList getLastMatches() const;
+ virtual QString getDocStr() const;
virtual int runDirCommand(const QString& dirArgument, const QString& startMatch);
virtual void clearCompletion();
static const std::vector<QString> PYTHON_KEYWORDS;
/** Last computed matches */
- std::vector<QString> _last_matches;
+ QStringList _last_matches;
/** Doc string of the first match - when only one match it will be displayed by the Editor*/
QString _doc_str;
- virtual int runDirAndExtract(const QString& dirArgument, const QString & startMatch,
- std::vector<QString> & result, bool discardSwig=true) const;
-
+ virtual int runDirAndExtract(const QString& dirArgument, const QString& startMatch,
+ QStringList& result, bool discardSwig=true) const;
};
#endif /* PYCONSOLE_ENHINTERP_H_ */
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
// File : PyConsole_Interp.cxx
// Author : Nicolas REJNERI, Adrien BRUNETON
-// Module : SALOME
-//
+
#include "PyConsole_Interp.h"
/*!
Creates new python interpreter.
*/
PyConsole_Interp::PyConsole_Interp(): PyInterp_Interp()
-{}
+{
+}
/*!
\brief Destructor.
Does nothing for the moment.
*/
-PyConsole_Interp::~PyConsole_Interp() { }
+PyConsole_Interp::~PyConsole_Interp()
+{
+}
/*! Sets the variable "__IN_SALOME_GUI_CONSOLE" to True.
* This is not attached to a module (like salome_iapp.IN_SALOME_GUI_CONSOLE)
{
return PyRun_SimpleString("__builtins__.__IN_SALOME_GUI_CONSOLE=False");
}
+
+QStringList PyConsole_Interp::getLastMatches() const
+{
+ return QStringList();
+}
+
+QString PyConsole_Interp::getDocStr() const
+{
+ return QString();
+}
+
+int PyConsole_Interp::runDirCommand(const QString&, const QString& )
+{
+ return 0;
+}
+
+void PyConsole_Interp::clearCompletion()
+{
+}
//
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
-
-// SALOME SALOMEGUI : implementation of desktop and GUI kernel
// File : PyConsole_Interp.h
// Author : Nicolas REJNERI, Adrien BRUNETON
-// Module : SALOME
-//
+
#ifndef PYCONSOLE_INTERP_H
#define PYCONSOLE_INTERP_H
#include "PyConsole.h"
+#include "PyInterp_Interp.h" /// !!! WARNING !!! THIS INCLUDE MUST BE VERY FIRST !!!
-#include <PyInterp_Interp.h> /// !!! WARNING !!! THIS INCLUDE MUST BE VERY FIRST !!!
+#include <QStringList>
class PYCONSOLE_EXPORT PyConsole_Interp : public PyInterp_Interp
{
virtual int afterRun();
virtual int beforeRun();
+
+ virtual QStringList getLastMatches() const;
+ virtual QString getDocStr() const;
+
+ virtual int runDirCommand(const QString&, const QString&);
+ virtual void clearCompletion();
};
#endif // PYCONSOLE_INTERP_H
// Created on: 3 avr. 2013
#include "PyConsole_Request.h"
-
-#include "PyInterp_Event.h"
+#include "PyConsole_Interp.h"
#include "PyConsole_Event.h"
-#include "PyConsole_EnhInterp.h"
-#include "PyConsole_EnhEditor.h"
+#include "PyInterp_Event.h"
#include <QCoreApplication>
* @param sync
*/
ExecCommand::ExecCommand( PyInterp_Interp* theInterp,
- const QString& theCommand,
- PyConsole_Editor* theListener,
- bool sync )
- : PyInterp_LockRequest( theInterp, theListener, sync ),
- myCommand( theCommand ), myState( PyInterp_Event::ES_OK )
- {}
+ const QString& theCommand,
+ QObject* theListener,
+ bool theSync )
+ : PyInterp_LockRequest( theInterp, theListener, theSync ),
+ myCommand( theCommand ), myState( PyInterp_Event::ES_OK )
+{}
/**
* Execute the command by calling the run() method of the embedded interpreter.
void ExecCommand::execute()
{
if ( myCommand != "" )
- {
- int ret = getInterp()->run( myCommand.toUtf8().data() );
- if ( ret < 0 )
- myState = PyInterp_Event::ES_ERROR;
- else if ( ret > 0 )
- myState = PyInterp_Event::ES_INCOMPLETE;
- }
+ {
+ int ret = getInterp()->run( myCommand.toUtf8().data() );
+ if ( ret < 0 )
+ myState = PyInterp_Event::ES_ERROR;
+ else if ( ret > 0 )
+ myState = PyInterp_Event::ES_INCOMPLETE;
+ }
}
/**
\param theListener widget to get the notification messages
\param sync if True the request is processed synchronously
*/
-CompletionCommand::CompletionCommand( PyConsole_EnhInterp* theInterp,
- const QString& input,
- const QString& startMatch,
- PyConsole_EnhEditor* theListener,
- bool sync)
- : PyInterp_LockRequest( theInterp, theListener, sync ),
- _tabSuccess(false), _dirArg(input), _startMatch(startMatch)
+CompletionCommand::CompletionCommand( PyInterp_Interp* theInterp,
+ const QString& theInput,
+ const QString& theStartMatch,
+ QObject* theListener,
+ bool theSync )
+ : PyInterp_LockRequest( theInterp, theListener, theSync ),
+ _tabSuccess(false), _dirArg(theInput), _startMatch(theStartMatch)
{}
/**
*/
void CompletionCommand::execute()
{
- PyConsole_EnhInterp * interp = static_cast<PyConsole_EnhInterp *>(getInterp());
- int ret = interp->runDirCommand( _dirArg, _startMatch);
- if (ret == 0)
- _tabSuccess = true;
- else
- _tabSuccess = false;
+ int ret = static_cast<PyConsole_Interp*>(getInterp())->runDirCommand( _dirArg, _startMatch );
+ _tabSuccess = ret == 0;
}
/**
QEvent* CompletionCommand::createEvent()
{
int typ = _tabSuccess ? PyInterp_Event::ES_TAB_COMPLETE_OK : PyInterp_Event::ES_TAB_COMPLETE_ERR;
-
return new PyInterp_Event( typ, this);
}
-
-
-
#ifndef PYCONSOLE_REQUEST_H_
#define PYCONSOLE_REQUEST_H_
-#include "PyConsole.h"
#include "PyInterp_Request.h"
#include <vector>
#include <QEvent>
class PyInterp_Interp;
-class PyConsole_Editor;
/*!
\class ExecCommand
*/
ExecCommand( PyInterp_Interp* theInterp,
const QString& theCommand,
- PyConsole_Editor* theListener,
- bool sync = false );
+ QObject* theListener,
+ bool theSync = false );
protected:
/*!
int myState; //!< Python command execution status
};
-class PyConsole_EnhInterp;
-class PyConsole_EnhEditor;
-
class CompletionCommand : public PyInterp_LockRequest
{
public:
- CompletionCommand( PyConsole_EnhInterp* theInterp,
- const QString& input,
- const QString& startMatch,
- PyConsole_EnhEditor* theListener,
- bool sync = false );
+ CompletionCommand( PyInterp_Interp* theInterp,
+ const QString& theInput,
+ const QString& theStartMatch,
+ QObject* theListener,
+ bool theSync = false );
protected:
virtual void execute();
virtual QEvent* createEvent();
-
};
#endif /* PYCONSOLE_REQUEST_H_ */
#ifndef DISABLE_PYCONSOLE
else if ( flag == WT_PyConsole )
{
- PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(), new SalomeApp_PyInterp() );
+ PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(), getPyInterp() );
pyCons->setObjectName( "pythonConsole" );
pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) );
pyCons->setFont(resourceMgr()->fontValue( "PyConsole", "font" ));
}
return result;
}
+
+
+#ifndef DISABLE_PYCONSOLE
+
+PyConsole_Interp* SalomeApp_Application::createPyInterp()
+{
+ return new SalomeApp_PyInterp();
+}
+
+#endif // DISABLE_PYCONSOLE
#ifndef DISABLE_PYCONSOLE
bool updateStudy();
+ virtual PyConsole_Interp* createPyInterp();
#endif
virtual void afterCloseDoc();
#ifndef DISABLE_PYCONSOLE
#include <PyConsole_Interp.h> // this include must be first (see PyInterp_base.h)!
- #include <PyConsole_Console.h>
#endif
#include "SalomeApp_DoubleSpinBox.h"
if( studyDS->IsString( aName ) )
{
#ifndef DISABLE_PYCONSOLE
- PyConsole_Console* pyConsole = app->pythonConsole();
- PyConsole_Interp* pyInterp = pyConsole->getInterp();
+ PyConsole_Interp* pyInterp = app->getPyInterp();
PyLockWrapper aLock; // Acquire GIL
std::string command;
command = "import salome_notebook ; ";
#ifndef DISABLE_PYCONSOLE
#include <PyConsole_Interp.h> //this include must be first (see PyInterp_base.h)!
- #include <PyConsole_Console.h>
#endif
#include "SalomeApp_IntSpinBox.h"
if( studyDS->IsString( aName ) )
{
#ifndef DISABLE_PYCONSOLE
- PyConsole_Console* pyConsole = app->pythonConsole();
- PyConsole_Interp* pyInterp = pyConsole->getInterp();
+ PyConsole_Interp* pyInterp = app->getPyInterp();
PyLockWrapper aLock; // Acquire GIL
std::string command;
command = "import salome_notebook ; ";
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
PyConsole_Console* pyConsole = app->pythonConsole();
- PyConsole_Interp* pyInterp = pyConsole->getInterp();
+ PyConsole_Interp* pyInterp = app->getPyInterp();
PyLockWrapper aLock; // Acquire GIL
std::string command = "import salome_notebook ; ";
command += "salome_notebook.checkThisNoteBook(";
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
PyConsole_Console* pyConsole = app->pythonConsole();
- PyConsole_Interp* pyInterp = pyConsole->getInterp();
+ PyConsole_Interp* pyInterp = app->getPyInterp();
PyLockWrapper aLock; // Acquire GIL
std::string command = "import salome_notebook ; ";
command += "salome_notebook.checkThisNoteBook(";
class SalomeApp_PyInterp : public PyConsole_EnhInterp
{
+ friend class SalomeApp_Application;
+
public:
- SalomeApp_PyInterp();
virtual ~SalomeApp_PyInterp();
virtual void initPython();
virtual void closeContext();
protected:
+ SalomeApp_PyInterp();
virtual int beforeRun();
private:
#ifndef DISABLE_PYCONSOLE
#include "SalomeApp_PyInterp.h" // WARNING! This include must be the first!
- #include <PyConsole_Console.h>
#endif
#include "utilities.h"
desk->blockSignals( isBlocked );
#ifndef DISABLE_PYCONSOLE
SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( application() );
- if( app->pythonConsole() )
- app->pythonConsole()->getInterp()->destroy();
+ app->getPyInterp()->destroy();
#endif
}
SALOMEDSClient_Study* aStudy = 0;