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))
{