From f94b814ab828c2d6d74263f61afaf7de52413893 Mon Sep 17 00:00:00 2001 From: stv Date: Wed, 1 Jun 2005 11:30:24 +0000 Subject: [PATCH] no message --- src/PythonConsole/PythonConsole_PyEditor.cxx | 31 ++++++++++++-------- src/PythonConsole/PythonConsole_PyEditor.h | 2 ++ 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/PythonConsole/PythonConsole_PyEditor.cxx b/src/PythonConsole/PythonConsole_PyEditor.cxx index 7615939c7..3f97fb8e0 100755 --- a/src/PythonConsole/PythonConsole_PyEditor.cxx +++ b/src/PythonConsole/PythonConsole_PyEditor.cxx @@ -24,31 +24,22 @@ // File : PythonConsole_PyEditor.cxx // Author : Nicolas REJNERI // Module : SALOME -// $Header$ #include // this include must be first (see PyInterp_base.h)! + #include + #include -#include #include #include #include +#include -//#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; +} diff --git a/src/PythonConsole/PythonConsole_PyEditor.h b/src/PythonConsole/PythonConsole_PyEditor.h index c847a5acf..5fab9f0a7 100755 --- a/src/PythonConsole/PythonConsole_PyEditor.h +++ b/src/PythonConsole/PythonConsole_PyEditor.h @@ -57,6 +57,8 @@ protected: public slots: void handleReturn(); void onPyInterpChanged( PyInterp_base* ); + + virtual QPopupMenu* createPopupMenu( const QPoint& ); private: QString _buf; -- 2.39.2