]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
no message
authorstv <stv@opencascade.com>
Wed, 1 Jun 2005 11:30:24 +0000 (11:30 +0000)
committerstv <stv@opencascade.com>
Wed, 1 Jun 2005 11:30:24 +0000 (11:30 +0000)
src/PythonConsole/PythonConsole_PyEditor.cxx
src/PythonConsole/PythonConsole_PyEditor.h

index 7615939c7be2bbdf083e223ab635d4239612f37a..3f97fb8e0d8303548abbd7ef9627bfb161d513b2 100755 (executable)
 //  File   : PythonConsole_PyEditor.cxx
 //  Author : Nicolas REJNERI
 //  Module : SALOME
-//  $Header$
 
 #include <PythonConsole_PyEditor.h> // this include must be first (see PyInterp_base.h)!
+
 #include <PyInterp_Dispatcher.h>
+
 #include <SUIT_Tools.h>
 
-#include <qapplication.h>
 #include <qmap.h>
 #include <qclipboard.h>
 #include <qdragobject.h>
+#include <qapplication.h>
 
-//#include "utilities.h"
 using namespace std;
 
-
-//#ifdef _DEBUG_
-//static int MYDEBUG = 1;
-//#else
-//static int MYDEBUG = 0;
-//#endif
-
-
 enum { IdCopy, IdPaste, IdClear, IdSelectAll };
 
-
 static QString READY_PROMPT = ">>> ";
 static QString DOTS_PROMPT  = "... ";
 #define PROMPT_SIZE _currentPrompt.length()
@@ -105,6 +96,7 @@ PythonConsole_PyEditor::PythonConsole_PyEditor(PyInterp_base* theInterp, QWidget
   QFont aFont = SUIT_Tools::stringToFont( fntSet );
   setFont(aFont);
   setTextFormat(QTextEdit::PlainText);
+  setUndoRedoEnabled( false );
 
   _currentPrompt = READY_PROMPT;
   setWordWrap(NoWrap);
@@ -682,3 +674,18 @@ void PythonConsole_PyEditor::onPyInterpChanged( PyInterp_base* interp )
     }
   }
 }
+
+QPopupMenu* PythonConsole_PyEditor::createPopupMenu( const QPoint& pos )
+{
+  QPopupMenu* popup = QTextEdit::createPopupMenu( pos );
+
+  for ( int i = 0; popup && i < popup->count(); i++ )
+  {
+    if ( !popup->isItemEnabled( popup->idAt( i ) ) )
+      popup->removeItemAt( i );
+  }
+
+  SUIT_Tools::simplifySeparators( popup );
+
+  return popup;
+}
index c847a5acff9ac440b7e81f4c1cc602aef3243b11..5fab9f0a7f88a67ae45f7fc553c78f173efc40f3 100755 (executable)
@@ -57,6 +57,8 @@ protected:
 public slots:
   void handleReturn();
   void onPyInterpChanged( PyInterp_base* );
+
+  virtual QPopupMenu* createPopupMenu( const QPoint& );
   
 private:
   QString        _buf;