Salome HOME
New item (FontItem), allowing to show information about font setting and to select...
[modules/gui.git] / src / PythonConsole / PythonConsole_PyConsole.cxx
1 #include "PythonConsole_PyConsole.h"
2 #include "PythonConsole_PyEditor.h"
3 #include "PyInterp_base.h"
4
5 #include "SUIT_Desktop.h"
6
7 #include <qlayout.h>
8
9 using namespace std;
10
11 //****************************************************************
12 PythonConsole::PythonConsole(QWidget* parent, PyInterp_base* interp)
13 : QWidget(parent), myEditor( 0 )
14 {
15   // create python interpreter
16   myInterp = interp;
17   if ( !myInterp )
18     myInterp = new PythonConsole_PyInterp();
19   
20   // initialize Python interpretator
21   myInterp->initialize();
22
23   // create editor console
24   QVBoxLayout* lay = new QVBoxLayout( this );
25   myEditor = new PythonConsole_PyEditor(myInterp, this,"Python Interpreter");
26   lay->addWidget( myEditor );
27 }
28
29 //****************************************************************
30 PythonConsole::~PythonConsole()
31 {
32 }
33
34 //****************************************************************
35 void PythonConsole::exec( const QString& command )
36 {
37   if ( myEditor )
38     myEditor->exec( command );
39 }