Salome HOME
Fix for problem: numbers of isolines functionality work incorrect.
[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 }
40
41 //****************************************************************
42 void PythonConsole::setFont( const QFont& f )
43 {
44   if( myEditor )
45     myEditor->setFont( f );
46 }
47
48 //****************************************************************
49 QFont PythonConsole::font() const
50 {
51   QFont res;
52   if( myEditor )
53     res = myEditor->font();
54   return res;
55 }