]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
This modification is necessary in the child classes in order to have an opportunity...
authornds <nds@opencascade.com>
Tue, 10 Nov 2009 05:42:48 +0000 (05:42 +0000)
committernds <nds@opencascade.com>
Tue, 10 Nov 2009 05:42:48 +0000 (05:42 +0000)
src/PyConsole/PyConsole_Console.cxx
src/PyConsole/PyConsole_Console.h
src/PyConsole/PyConsole_Editor.h

index 85df7307abe5c4a0d80e225efeced83bab95c4be..320753af6e0d2b11896a1dc7c55cab7b8f36f69d 100644 (file)
@@ -60,9 +60,7 @@ PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* interp
   // create editor console
   QVBoxLayout* lay = new QVBoxLayout( this );
   lay->setMargin( 0 );
-  myEditor = new PyConsole_Editor( myInterp, this );
-  myEditor->viewport()->installEventFilter( this );
-  lay->addWidget( myEditor );
+  setEditor( new PyConsole_Editor( myInterp, this ) );
 
   createActions();
 }
@@ -76,6 +74,25 @@ PyConsole_Console::~PyConsole_Console()
 {
 }
 
+/*!
+  \brief Set python console editor widget
+  \param editor
+*/
+void PyConsole_Console::setEditor( PyConsole_Editor* theEditor )
+{
+  QVBoxLayout* lay = dynamic_cast<QVBoxLayout*>( layout() );
+  if ( !lay || theEditor == myEditor )
+    return;
+
+  if ( myEditor ) {
+    lay->removeWidget( myEditor );
+    delete myEditor;
+  }
+  myEditor = theEditor;
+  myEditor->viewport()->installEventFilter( this );
+  lay->addWidget( myEditor );
+} 
+
 /*!
   \brief Execute python command in the interpreter.
   \param command string with command and arguments
index ed1203b83e144776ebc350464ac6f356b1c9e5ab..62df6a45b4b8730ded1c39020d8ce527ea55e72d 100644 (file)
@@ -51,6 +51,8 @@ public:
   PyConsole_Console( QWidget* parent, PyConsole_Interp* interp = 0 );
   virtual ~PyConsole_Console();
 
+  void                setEditor( PyConsole_Editor* );
+
   //! \brief Get python interperter
   PyConsole_Interp*   getInterp() { return myInterp; } 
   QFont               font() const;
index 222708c6ecc113b2e455a896c0e01e849b3859b2..a53233a10919f55e36174bce5c8dab0c9b7a42af 100644 (file)
@@ -63,10 +63,10 @@ public slots:
   void           cut();
   void           paste();
   void           clear();
-  void           handleReturn();
+  virtual void   handleReturn();
   void           onPyInterpChanged( PyConsole_Interp* );
   
-private:
+protected:
   PyConsole_Interp* myInterp;           //!< python interpreter
 
   QString           myCommandBuffer;    //!< python comman buffer