#include "LogWindow.h"
-#include <qfile.h>
-#include <qlayout.h>
-#include <qaction.h>
-#include <qpopupmenu.h>
-#include <qtextbrowser.h>
-#include <qapplication.h>
-#include <qdatetime.h>
+#include <QtCore/qfile.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qtextstream.h>
+
+#include <QtGui/qmenu.h>
+#include <QtGui/qlayout.h>
+#include <QtGui/qaction.h>
+#include <QtGui/qtextbrowser.h>
+#include <QtGui/qapplication.h>
#include <SUIT_Tools.h>
#include <SUIT_Session.h>
static QString plainText( const QString& richText )
{
QString aText = richText;
- int startTag = aText.find('<');
- while ( 1 ) {
+ int startTag = aText.indexOf( '<' );
+ while ( true )
+ {
if ( startTag < 0 )
break;
- int finishTag = aText.find('>',startTag);
- if (finishTag < 0)
+
+ int finishTag = aText.indexOf( '>', startTag );
+ if ( finishTag < 0 )
break;
- aText = aText.remove(startTag, finishTag-startTag+1);
- startTag = aText.find('<');
+
+ aText = aText.remove( startTag, finishTag - startTag + 1 );
+ startTag = aText.indexOf( '<' );
}
return aText;
}
*/
LogWindow::LogWindow( QWidget* parent )
: QFrame( parent ),
-SUIT_PopupClient()
+SUIT_PopupClient(),
+myOpFlags( All )
{
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
setFont( SUIT_Tools::stringToFont( fntSet ) );
- myView = new QTextBrowser(this,"myView");
-#if QT_VERSION>0x030007
- myView->setTextFormat( Qt::LogText );
-#endif
+ myView = new QTextEdit( this );
+ myView->setReadOnly( true );
myView->viewport()->installEventFilter( this );
QVBoxLayout* main = new QVBoxLayout( this );
+ main->setMargin( 5 );
main->addWidget( myView );
myBannerSize = 0;
myView->append( mySeparator ); // add separator
myHistory.append( plainText( mySeparator ) );
}
- myView->scrollToBottom();
+ myView->moveCursor( QTextCursor::End );
}
/*!
if ( !myBanner.isEmpty() )
{
myView->append( myBanner );
- myBannerSize = myView->paragraphs();
+ myBannerSize = myView->document()->blockCount();
}
else
myBannerSize = 0;
bool LogWindow::saveLog( const QString& fileName )
{
QFile file( fileName );
- if ( !file.open( IO_WriteOnly ) )
+ if ( !file.open( QFile::WriteOnly ) )
return false;
QTextStream stream( &file );
*/
void LogWindow::createActions()
{
- QAction* a = new QAction( "", tr( "&Copy" ), 0, this );
+ QAction* a = new QAction( tr( "&Copy" ), this );
a->setStatusTip( tr( "&Copy" ) );
- connect( a, SIGNAL( activated() ), SLOT( onCopy()));
+ connect( a, SIGNAL( triggered( bool ) ), SLOT( onCopy() ) );
myActions.insert( CopyId, a );
- a = new QAction( "", tr( "Clea&r" ), 0, this );
+ a = new QAction( tr( "Clea&r" ), this );
a->setStatusTip( tr( "Clea&r" ) );
- connect( a, SIGNAL( activated() ), SLOT( onClear()));
+ connect( a, SIGNAL( triggered( bool ) ), SLOT( onClear() ) );
myActions.insert( ClearId, a );
- a = new QAction( "", tr( "Select &All" ), 0, this );
+ a = new QAction( tr( "Select &All" ), this );
a->setStatusTip( tr( "Select &All" ) );
- connect( a, SIGNAL( activated() ), SLOT( onSelectAll()));
+ connect( a, SIGNAL( triggered( bool ) ), SLOT( onSelectAll() ) );
myActions.insert( SelectAllId, a );
- a = new QAction( "", tr( "&Save log to file..." ), 0, this );
+ a = new QAction( tr( "&Save log to file..." ), this );
a->setStatusTip( tr( "&Save log to file..." ) );
- connect( a, SIGNAL( activated() ), SLOT( onSaveToFile()));
+ connect( a, SIGNAL( triggered( bool ) ), SLOT( onSaveToFile() ) );
myActions.insert( SaveToFileId, a );
}
/*!
Redefined virtual method for popup filling
*/
-void LogWindow::contextMenuPopup( QPopupMenu* popup )
+void LogWindow::contextMenuPopup( QMenu* popup )
{
- myActions[ CopyId ]->addTo( popup );
- myActions[ ClearId ]->addTo( popup );
+ if ( myOpFlags & CopyId )
+ popup->addAction( myActions[ CopyId ] );
+ if ( myOpFlags & ClearId )
+ popup->addAction( myActions[ ClearId ] );
- popup->insertSeparator();
+ popup->addSeparator();
- myActions[ SelectAllId ]->addTo( popup );
+ if ( myOpFlags & SelectAllId )
+ popup->addAction( myActions[ SelectAllId ] );
- popup->insertSeparator();
+ popup->addSeparator();
- myActions[ SaveToFileId ]->addTo( popup );
+ if ( myOpFlags & SaveToFileId )
+ popup->addAction( myActions[ SaveToFileId ] );
+
+ Qtx::simplifySeparators( popup );
updateActions();
}
*/
void LogWindow::updateActions()
{
+/*
int paraFrom, paraTo, indexFrom, indexTo;
myView->getSelection( ¶From, &indexFrom, ¶To, &indexTo );
bool allSelected = myView->hasSelectedText() &&
!paraFrom && paraTo == myView->paragraphs() - 1 &&
!indexFrom && indexTo == myView->paragraphLength( paraTo );
- myActions[ CopyId ]->setEnabled( myView->hasSelectedText() );
- myActions[ ClearId ]->setEnabled( myView->paragraphs() > myBannerSize );
- myActions[ SelectAllId ]->setEnabled( !allSelected );
- myActions[ SaveToFileId ]->setEnabled( myHistory.count() > 0 );
+ myActions[ CopyId ]->setEnabled( ( myOpFlags & CopyId )&& myView->hasSelectedText() );
+ myActions[ ClearId ]->setEnabled( ( myOpFlags & ClearId ) && myView->document()->blockCount() > myBannerSize );
+ myActions[ SelectAllId ]->setEnabled( ( myOpFlags & SelectAllId ) && !allSelected );
+ myActions[ SaveToFileId ]->setEnabled( ( myOpFlags & SaveToFileId ) && myHistory.count() > 0 );
+*/
}
/*!
if ( aName.isNull() )
return;
- QApplication::setOverrideCursor( Qt::waitCursor );
+ QApplication::setOverrideCursor( Qt::WaitCursor );
bool bOk = saveLog( aName );
if ( myView )
myView->copy();
}
+
+void LogWindow::setOperationsFlags( int flags )
+{
+ myOpFlags = flags;
+}
#include <SUIT_PopupClient.h>
-#include <qframe.h>
-#include <qstringlist.h>
+#include <QtCore/qmap.h>
+#include <QtCore/qstringlist.h>
+
+#include <QtGui/qframe.h>
#ifdef WIN32
#pragma warning( disable:4251 )
#endif
class QAction;
-class QTextBrowser;
+class QTextEdit;
/*!
\class LogWindow
{
Q_OBJECT
- enum { CopyId, ClearId, SelectAllId, SaveToFileId };
+public:
+ //! popup operation flags
+ enum
+ {
+ CopyId = 0x01,
+ ClearId = 0x02,
+ SelectAllId = 0x04,
+ SaveToFileId = 0x08,
+ All = CopyId | ClearId | SelectAllId | SaveToFileId,
+ };
public:
- LogWindow( QWidget* theParent );
- virtual ~LogWindow();
+ LogWindow( QWidget* theParent );
+ virtual ~LogWindow();
virtual QString popupClientType() const { return QString( "LogWindow" ); }
- virtual void contextMenuPopup( QPopupMenu* );
+ virtual void contextMenuPopup( QMenu* );
- bool eventFilter( QObject* o, QEvent* e );
+ virtual bool eventFilter( QObject* o, QEvent* e );
void setBanner( const QString& banner );
void setSeparator( const QString& separator );
bool saveLog( const QString& fileName );
+ void setOperationsFlags( int flags );
+
protected slots:
void onSaveToFile();
void onSelectAll();
void updateActions();
private:
- QTextBrowser* myView;
+ QTextEdit* myView;
QString myBanner;
- QString mySeparator;
QStringList myHistory;
+ QString mySeparator;
int myBannerSize;
QMap<int, QAction*> myActions;
+ int myOpFlags;
};
#ifdef WIN32
--- /dev/null
+TEMPLATE = lib
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+INCLUDEPATH = ../../include
+win32:LIBS += ../../lib/suit.lib ../../lib/qtx.lib
+unix:LIBS += -L../../lib -lSUIT -lQtx
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += LOGWINDOW_EXPORTS
+
+HEADERS = *.h
+
+SOURCES = *.cxx
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+INSTALLS += includes
+++ /dev/null
-# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# File : Makefile.in
-# Author : Vladimir Klyachin (OCN)
-# Module : LogWindow
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@
-
-@COMMENCE@
-
-# header files
-EXPORT_HEADERS= LogWindow.h
-
-# Libraries targets
-LIB = libLogWindow.la
-
-LIB_SRC= LogWindow.cxx
-
-LIB_MOC = LogWindow.h
-
-CPPFLAGS+=$(QT_INCLUDES)
-
-LDFLAGS+=$(QT_MT_LIBS)
-
-@CONCLUDE@
-
-
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#if !defined ( _PYTHONCONSOLE_H )
+#define _PYTHONCONSOLE_H
+
+// ========================================================
+// set dllexport type for Win platform
+#ifdef WIN32
+
+#ifdef PYCONSOLE_EXPORTS
+#define PYCONSOLE_EXPORT __declspec(dllexport)
+#else
+#define PYCONSOLE_EXPORT __declspec(dllimport)
+#endif
+
+#else // WIN32
+
+#define PYCONSOLE_EXPORT
+
+#endif // WIN32
+
+// ========================================================
+// little trick - we do not have debug python libraries
+#ifdef _DEBUG
+
+#undef _DEBUG
+//#include <Python.h>
+#define _DEBUG
+
+#else // _DEBUG
+
+//#include <Python.h>
+
+#endif // _DEBUG
+
+// ========================================================
+// avoid warning messages
+#ifdef WIN32
+#pragma warning (disable : 4786)
+#pragma warning (disable : 4251)
+#endif
+
+#endif // _PYTHONCONSOLE_H
--- /dev/null
+TEMPLATE = lib
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+INCLUDEPATH += ../../include $$(PYTHONINC)
+unix:LIBS += -L../../lib -L$$(PYTHONLIB) -lpython2.3 -lSUIT -lPyInterp
+win32:LIBS += /LIBPATH:$$(PYTHONLIB) ../../lib/pyinterp.lib ../../lib/suit.lib
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += PYCONSOLE_EXPORTS
+
+HEADERS = *.h
+
+SOURCES = *.cxx
+
+TRANSLATIONS = resources/PyConsole_msg_en.ts
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+resources.files = resources/*.qm
+resources.path = ../../resources
+
+INSTALLS += includes resources
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : PythonConsole_PyConcole.cxx
+// Author : Vadim SANDLER
+// Module : SALOME
+
+/*!
+ \class PythonConsole
+ \brief Python console widget.
+*/
+
+#include <Python.h>
+
+#include "PyConsole_Console.h"
+#include "PyConsole_Editor.h"
+
+#include <PyInterp_base.h>
+
+#include <QtGui/qmenu.h>
+#include <QtGui/qevent.h>
+#include <QtGui/qaction.h>
+#include <QtGui/qlayout.h>
+#include <QtGui/qclipboard.h>
+#include <QtGui/qapplication.h>
+
+using namespace std;
+
+/*!
+ \brief Constructor.
+
+ Creates new python console widget.
+ \param parent parent widget
+ \param interp python interpreter
+*/
+PythonConsole::PythonConsole( QWidget* parent, PyInterp_base* interp )
+: QFrame( parent ),
+myEditor( 0 )
+{
+ // create python interpreter
+ myInterp = interp;
+ if ( !myInterp )
+ myInterp = new PyConsole_Interp();
+
+ // initialize Python interpretator
+ myInterp->initialize();
+
+ // create editor console
+ QVBoxLayout* lay = new QVBoxLayout( this );
+ lay->setMargin( 5 );
+ myEditor = new PyConsole_Editor( myInterp, this );
+ myEditor->viewport()->installEventFilter( this );
+ lay->addWidget( myEditor );
+
+ createActions();
+}
+
+/*!
+ \brief Destructor.
+
+ Does nothing for the moment.
+*/
+PythonConsole::~PythonConsole()
+{
+}
+
+/*!
+ \brief Execute python command in the interpreter.
+ \param command - string with command and arguments
+*/
+void PythonConsole::exec( const QString& command )
+{
+ if ( myEditor )
+ myEditor->exec( command );
+}
+
+/*!
+ \brief Execute python command in the interpreter
+ and wait until it is finished.
+
+ Block execution of main application until the python command is executed.
+ \param command - string with command and arguments
+*/
+void PythonConsole::execAndWait( const QString& command )
+{
+ if ( myEditor )
+ myEditor->execAndWait( command );
+}
+
+/*!
+ \brief Change the python console's font.
+ \param f - new font
+*/
+void PythonConsole::setFont( const QFont& f )
+{
+ if( myEditor )
+ myEditor->setFont( f );
+}
+
+/*!
+ \brief Get python console font.
+ \return current python console's font
+*/
+QFont PythonConsole::font() const
+{
+ QFont res;
+ if( myEditor )
+ res = myEditor->font();
+ return res;
+}
+
+/*!
+ Custom event handler
+*/
+bool PythonConsole::eventFilter( QObject* o, QEvent* e )
+{
+ if ( o == myEditor->viewport() && e->type() == QEvent::ContextMenu )
+ {
+ contextMenuRequest( (QContextMenuEvent*)e );
+ return true;
+ }
+ return QFrame::eventFilter( o, e );
+}
+
+/*!
+ \brief Process context popup menu event.
+
+ Show popup menu which includes standard copy/paste operations.
+ \param event context menu event
+*/
+void PythonConsole::contextMenuPopup( QMenu* menu )
+{
+ if ( myEditor->isReadOnly() )
+ return;
+
+ updateActions();
+
+ menu->addAction( myActions[CopyId] );
+ menu->addAction( myActions[PasteId] );
+ menu->addAction( myActions[ClearId] );
+
+ menu->addSeparator();
+
+ menu->addAction( myActions[SelectAllId] );
+}
+
+void PythonConsole::createActions()
+{
+ QAction* copyAction = new QAction( tr( "EDIT_COPY_CMD" ), this );
+ connect( copyAction, SIGNAL( triggered( bool ) ), myEditor, SLOT( copy() ) );
+ myActions.insert( CopyId, copyAction );
+
+ QAction* pasteAction = new QAction( tr( "EDIT_PASTE_CMD" ), this );
+ connect( pasteAction, SIGNAL( triggered( bool ) ), myEditor, SLOT( paste() ) );
+ myActions.insert( PasteId, pasteAction );
+
+ QAction* clearAction = new QAction( tr( "EDIT_CLEAR_CMD" ), this );
+ connect( clearAction, SIGNAL( triggered( bool ) ), myEditor, SLOT( clear() ) );
+ myActions.insert( ClearId, clearAction );
+
+ QAction* selAllAction = new QAction( tr( "EDIT_SELECTALL_CMD" ), this );
+ connect( selAllAction, SIGNAL( triggered( bool ) ), myEditor, SLOT( selectAll() ) );
+ myActions.insert( SelectAllId, selAllAction );
+}
+
+void PythonConsole::updateActions()
+{
+ myActions[CopyId]->setEnabled( myEditor->textCursor().hasSelection() );
+ myActions[PasteId]->setEnabled( !myEditor->isReadOnly() && !QApplication::clipboard()->text().isEmpty() );
+ myActions[SelectAllId]->setEnabled( !myEditor->document()->isEmpty() );
+}
--- /dev/null
+// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : PythonConsole_PyConsole.h
+// Author : Vadim SANDLER
+// Module : SALOME
+
+#ifndef PYCONSOLE_CONSOLE_H
+#define PYCONSOLE_CONSOLE_H
+
+#include "PyConsole.h"
+
+#include <QtCore/qmap.h>
+#include <QtGui/qframe.h>
+
+#include <SUIT_PopupClient.h>
+
+class PyInterp_base;
+class PyConsole_Editor;
+
+class PYCONSOLE_EXPORT PythonConsole : public QFrame, public SUIT_PopupClient
+{
+ Q_OBJECT
+
+public:
+ enum
+ {
+ CopyId = 0x01,
+ PasteId = 0x02,
+ ClearId = 0x04,
+ SelectAllId = 0x08,
+ All = CopyId | PasteId | ClearId | SelectAllId
+ };
+
+public:
+ PythonConsole( QWidget* parent, PyInterp_base* interp = 0 );
+ virtual ~PythonConsole();
+
+ //! \brief Get python interperter
+ PyInterp_base* getInterp() { return myInterp; }
+ QFont font() const;
+ virtual void setFont( const QFont& );
+
+ void exec( const QString& command );
+ void execAndWait( const QString& command );
+
+ virtual bool eventFilter( QObject* o, QEvent* e );
+
+ virtual QString popupClientType() const { return QString( "PyConsole" ); }
+ virtual void contextMenuPopup( QMenu* );
+
+private:
+ void createActions();
+ void updateActions();
+
+private:
+ PyInterp_base* myInterp; //!< python interpreter
+ PyConsole_Editor* myEditor; //!< python console editor widget
+ QMap<int, QAction*> myActions;
+};
+
+
+
+#endif
--- /dev/null
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : PyConsole_Editor.cxx
+// Author : Vadim SANDLER
+// Module : SALOME
+
+/*!
+ \class PyConsole_Editor
+ \brief Python command line interpreter front-end GUI widget.
+
+ This class provides simple GUI interface to the Python interpreter, including basic
+ navigation operations, executing commands (both interactively and programmatically),
+ copy-paste operations, history of the commands and so on.
+
+ Here below is the shortcut keyboard boundings used for navigation and other operations:
+ - <Enter> : execute current command
+ - <Ctrl><Break> : clear current command
+ - <Escape> : clear current command
+ - <Up> : previous command in the history
+ - <Shift><Up> : move cursor one row up with selection
+ - <Ctrl><Up> : move cursor one row up without selection
+ - <Ctrl><Shift><Up> : move cursor one row up with selection
+ - <Down> : next command in the history
+ - <Shift><Down> : move cursor one row down with selection
+ - <Ctrl><Down> : move cursor one row down without selection
+ - <Ctrl><Shift><Down> : move cursor one row down with selection
+ - <Left> : move one symbol left without selection
+ - <Shift><Left> : move one symbol left with selection
+ - <Ctrl><Left> : move one word left without selection
+ - <Ctrl><Shift><Left> : move one word left with selection
+ - <Right> : move one symbol right without selection
+ - <Shift><Right> : move one symbol right with selection
+ - <Ctrl><Right> : move one word right without selection
+ - <Ctrl><Shift><Right> : move one word right with selection
+ - <PgUp> : first command in the history
+ - <Shift><PgUp> : move one page up with selection
+ - <Ctrl><PgUp> : move one page up without selection
+ - <Ctrl><Shift><PgUp> : scroll one page up
+ - <PgDn> : last command in the history
+ - <Shift><PgDn> : move one page down with selection
+ - <Ctrl><PgDn> : move one page down without selection
+ - <Ctrl><Shift><PgDn> : scroll one page down
+ - <Home> : move to the beginning of the line without selection
+ - <Shift><Home> : move to the beginning of the line with selection
+ - <Ctrl><Home> : move to the very first symbol without selection
+ - <Ctrl><Shift><Home> : move to the very first symbol with selection
+ - <End> : move to the end of the line without selection
+ - <Shift><End> : move to the end of the line with selection
+ - <Ctrl><End> : move to the very last symbol without selection
+ - <Ctrl><Shift><End> : move to the very last symbol with selection
+ - <Backspace> : delete symbol before the cursor
+ / remove selected text and put it to the clipboard (cut)
+ - <Shift><Backspace> : delete previous word
+ / remove selected text and put it to the clipboard (cut)
+ - <Ctrl><Backspace> : delete text from the cursor to the beginning of the line
+ / remove selected text and put it to the clipboard (cut)
+ - <Delete> : delete symbol after the cursor
+ / remove selected text and put it to the clipboard (cut)
+ - <Shift><Delete> : delete next word
+ / remove selected text and put it to the clipboard (cut)
+ - <Ctrl><Delete> : delete text from the cursor to the end of the line
+ / remove selected text and put it to the clipboard (cut)
+ - <Ctrl><Insert> : copy
+ - <Shift><Insert> : paste
+ - <Ctrl><V> : paste
+ - <Ctrl><C> : copy
+ - <Ctrl><X> : cut
+ - <Ctrl><V> : paste
+
+ TODO:
+ - paste multiline text: process each line as separate command
+ (including mouse middle-button click pasting)
+ - the same for drag-n-drop of multiline text
+*/
+
+#include "PyConsole_Editor.h" // this include must be first (see PyInterp_base.h)!
+
+#include <PyInterp_Dispatcher.h>
+
+#include <SUIT_Tools.h>
+#include <SUIT_Session.h>
+
+#include <QtGui/qmenu.h>
+#include <QtGui/qevent.h>
+#include <QtGui/qclipboard.h>
+#include <QtGui/qscrollbar.h>
+#include <QtGui/qtextobject.h>
+#include <QtGui/qtextcursor.h>
+#include <QtGui/qapplication.h>
+#include <QtGui/qtextdocument.h>
+
+using namespace std;
+
+static QString READY_PROMPT = ">>> ";
+static QString DOTS_PROMPT = "... ";
+#define PROMPT_SIZE myPrompt.length()
+
+/*!
+ \class ExecCommand
+ \brief Python command execution request [internal].
+ */
+class ExecCommand : public PyInterp_LockRequest
+{
+public:
+ /*!
+ \brief Constructor.
+
+ Creates new python command execution request.
+ \param theInterp python interpreter
+ \param theCommand python command
+ \param theListener widget to get the notification messages
+ \param sync if True the request is processed synchronously
+ */
+ ExecCommand( PyInterp_base* theInterp,
+ const char* theCommand,
+ PyConsole_Editor* theListener,
+ bool sync = false )
+ : PyInterp_LockRequest( theInterp, theListener, sync ),
+ myCommand( theCommand ), myState( PyInterp_Event::OK )
+ {}
+
+protected:
+ /*!
+ \brief Execute the python command in the interpreter and
+ get its execution status.
+ */
+ virtual void execute()
+ {
+ if ( myCommand != "" )
+ {
+// SUIT_Session::SetPythonExecuted( true ); // disable GUI user actions
+ int ret = getInterp()->run( myCommand.toLatin1() );
+// SUIT_Session::SetPythonExecuted(false); // enable GUI user actions
+ if ( ret < 0 )
+ myState = PyInterp_Event::ERROR;
+ else if ( ret > 0 )
+ myState = PyInterp_Event::INCOMPLETE;
+ myError = getInterp()->getverr().c_str();
+ myOutput = getInterp()->getvout().c_str();
+ }
+ else
+ {
+ myError = "";
+ myOutput = "";
+ }
+ }
+
+ /*!
+ \brief Create and return a notification event.
+ \return new notification event
+ */
+ virtual QEvent* createEvent() const
+ {
+ return new PyInterp_Event( myState, (PyInterp_Request*)this );
+ }
+
+public:
+ QString myError; //!< Python command error message
+ QString myOutput; //!< Python command output log
+
+private:
+ QString myCommand; //!< Python command
+ int myState; //!< Python command execution status
+};
+
+/*!
+ \brief Constructor.
+
+ Creates python editor window.
+ \param theInterp python interper
+ \param theParent parent widget
+*/
+PyConsole_Editor::PyConsole_Editor( PyInterp_base* theInterp,
+ QWidget* theParent )
+ : QTextEdit( theParent ),
+ myInterp( 0 ),
+ myCmdInHistory( -1 ),
+ myEventLoop( 0 )
+{
+ QString fntSet( "" );
+ QFont aFont = SUIT_Tools::stringToFont( fntSet );
+ setFont( aFont );
+ setUndoRedoEnabled( false );
+
+ myPrompt = READY_PROMPT;
+ setLineWrapMode( QTextEdit::NoWrap );
+ setWordWrapMode( QTextOption::NoWrap );
+ setAcceptRichText( false );
+
+ // san - This is necessary for troubleless initialization
+ onPyInterpChanged( theInterp );
+}
+
+/*!
+ \brief Destructor.
+
+ Does nothing for the moment.
+*/
+PyConsole_Editor::~PyConsole_Editor()
+{
+}
+
+/*!
+ \brief Put the string \a str to the python editor.
+ \param str string to be put in the command line of the editor
+ \param newBlock if True, then the string is printed on a new line
+*/
+void PyConsole_Editor::addText( const QString& str,
+ const bool newBlock )
+{
+ moveCursor( QTextCursor::End );
+ if ( newBlock )
+ textCursor().insertBlock();
+ textCursor().insertText( str );
+ moveCursor( QTextCursor::End );
+ ensureCursorVisible();
+}
+
+/*!
+ \brief Convenient method for executing a Python command,
+ as if the user typed it manually.
+ \param command python command to be executed
+*/
+void PyConsole_Editor::exec( const QString& command )
+{
+ if ( isReadOnly() ) {
+ // some interactive command is being executed in this editor...
+ // shedule the command to the queue
+ myQueue.push_back( command );
+ return;
+ }
+ // remove last line
+ moveCursor( QTextCursor::End );
+ moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ // set "ready" prompt
+ myPrompt = READY_PROMPT;
+ // clear command buffer
+ myCommandBuffer.truncate( 0 );
+ // unset history browsing mode
+ myCmdInHistory = -1;
+ // print command line by line
+ QString cmd = command;
+ if ( !cmd.endsWith( "\n" ) ) cmd += "\n";
+ QStringList lines = command.split( "\n" );
+ for ( int i = 0; i < lines.size(); i++ ) {
+ if ( !lines[i].trimmed().isEmpty() )
+ myHistory.push_back( lines[i] );
+ addText( ( i == 0 ? READY_PROMPT : DOTS_PROMPT ) + lines[i], i != 0 );
+ }
+ // set read-only mode
+ setReadOnly( true );
+ // set busy cursor
+ setCursor( Qt::BusyCursor );
+
+ // post a request to execute Python command;
+ // editor will be informed via a custom event that execution has been completed
+ PyInterp_Dispatcher::Get()->Exec( new ExecCommand( myInterp,
+ cmd.toLatin1(),
+ this ) );
+}
+
+/*!
+ \brief Execute command in the python interpreter
+ and wait until it is finished.
+ \param command python command to be executed
+ */
+void PyConsole_Editor::execAndWait( const QString& command )
+{
+ // already running ?
+ if( myEventLoop )
+ return;
+
+ // create new event loop
+ myEventLoop = new QEventLoop( this );
+ // execute command
+ exec( command );
+ // run event loop
+ myEventLoop->exec();
+ // delete event loop after command is processed
+ delete myEventLoop;
+ myEventLoop = 0;
+}
+
+/*!
+ \brief Process "Enter" key press event.
+
+ Execute the command entered by the user.
+*/
+void PyConsole_Editor::handleReturn()
+{
+ // get last line
+ QTextBlock par = document()->end().previous();
+ if ( !par.isValid() ) return;
+
+ // get command
+ QString cmd = par.text().remove( 0, PROMPT_SIZE );
+ // extend the command buffer with the current command
+ myCommandBuffer.append( cmd );
+ // add command to the history
+ if ( !cmd.trimmed().isEmpty() )
+ myHistory.push_back( cmd );
+
+ // set read-only mode
+ setReadOnly( true );
+ // set busy cursor
+ setCursor( Qt::BusyCursor );
+
+ // post a request to execute Python command;
+ // editor will be informed via a custom event that execution has been completed
+ PyInterp_Dispatcher::Get()->Exec( new ExecCommand( myInterp,
+ myCommandBuffer.toLatin1(),
+ this ) );
+}
+
+/*!
+ \brief Process drop event.
+
+ Paste dragged text.
+ \param event drop event
+*/
+void PyConsole_Editor::dropEvent( QDropEvent* event )
+{
+ // get the initial drop position
+ QPoint pos = event->pos();
+ QTextCursor cur = cursorForPosition( event->pos() );
+ // if the position is not in the last line move it to the end of the command line
+ if ( cur.position() < document()->end().previous().position() + PROMPT_SIZE ) {
+ moveCursor( QTextCursor::End );
+ pos = cursorRect().center();
+ }
+ // create new drop event and use it instead of the original
+ QDropEvent de( pos,
+ event->possibleActions(),
+ event->mimeData(),
+ event->mouseButtons(),
+ event->keyboardModifiers(),
+ event->type() );
+ QTextEdit::dropEvent( &de );
+ // accept the original event
+ event->acceptProposedAction();
+}
+
+/*!
+ \brief Process mouse button release event.
+
+ Left mouse button: copy selection to the clipboard.
+ Middle mouse button: paste clipboard's contents.
+ \param event mouse event
+*/
+void PyConsole_Editor::mouseReleaseEvent( QMouseEvent* event )
+{
+ if ( event->button() == Qt::LeftButton ) {
+ QTextEdit::mouseReleaseEvent( event );
+ copy();
+ }
+ else if ( event->button() == Qt::MidButton ) {
+ QString text;
+ if ( QApplication::clipboard()->supportsSelection() )
+ text = QApplication::clipboard()->text( QClipboard::Selection );
+ if ( text.isEmpty() )
+ text = QApplication::clipboard()->text( QClipboard::Clipboard );
+ QTextCursor cur = cursorForPosition( event->pos() );
+ // if the position is not in the last line move it to the end of the command line
+ if ( cur.position() < document()->end().previous().position() + PROMPT_SIZE ) {
+ moveCursor( QTextCursor::End );
+ }
+ else {
+ setTextCursor( cur );
+ }
+ textCursor().clearSelection();
+ textCursor().insertText( text );
+ }
+ else {
+ QTextEdit::mouseReleaseEvent( event );
+ }
+}
+
+/*!
+ \brief Check if the string is command.
+
+ Return True if the string \a str is likely to be the command
+ (i.e. it is started from the '>>>' or '...').
+ \param str string to be checked
+*/
+bool PyConsole_Editor::isCommand( const QString& str ) const
+{
+ return str.startsWith( READY_PROMPT ) || str.startsWith( DOTS_PROMPT );
+}
+
+/*!
+ \brief Handle keyboard event.
+
+ Implement navigation, history browsing, copy/paste and other common
+ operations.
+ \param event keyboard event
+*/
+void PyConsole_Editor::keyPressEvent( QKeyEvent* event )
+{
+ // get cursor position
+ QTextCursor cur = textCursor();
+ int curLine = cur.blockNumber();
+ int curCol = cur.columnNumber();
+
+ // get last edited line
+ int endLine = document()->blockCount()-1;
+
+ // get pressed key code
+ int aKey = event->key();
+
+ // check if <Ctrl> is pressed
+ bool ctrlPressed = event->modifiers() & Qt::ControlModifier;
+ // check if <Shift> is pressed
+ bool shftPressed = event->modifiers() & Qt::ShiftModifier;
+
+ if ( aKey == Qt::Key_Escape || ctrlPressed && aKey == -1 ) {
+ // process <Ctrl>+<Break> key-binding and <Escape> key: clear current command
+ myCommandBuffer.truncate( 0 );
+ myPrompt = READY_PROMPT;
+ addText( myPrompt, true );
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ return;
+ }
+ else if ( ctrlPressed && aKey == Qt::Key_C ) {
+ // process <Ctrl>+<C> key-binding : copy
+ copy();
+ return;
+ }
+ else if ( ctrlPressed && aKey == Qt::Key_X ) {
+ // process <Ctrl>+<X> key-binding : cut
+ cut();
+ return;
+ }
+ else if ( ctrlPressed && aKey == Qt::Key_V ) {
+ // process <Ctrl>+<V> key-binding : paste
+ paste();
+ return;
+ }
+
+ // check for printed key
+ aKey = ( aKey < Qt::Key_Space || aKey > Qt::Key_ydiaeresis ) ? aKey : 0;
+
+ switch ( aKey ) {
+ case 0 :
+ // any printed key: just print it
+ {
+ if ( curLine < endLine || curCol < PROMPT_SIZE ) {
+ moveCursor( QTextCursor::End );
+ }
+ QTextEdit::keyPressEvent( event );
+ break;
+ }
+ case Qt::Key_Return:
+ case Qt::Key_Enter:
+ // <Enter> key: process the current command
+ {
+ handleReturn();
+ break;
+ }
+ case Qt::Key_Up:
+ // <Up> arrow key: process as follows:
+ // - without <Ctrl>, <Shift> modifiers: previous command in history
+ // - with <Ctrl> modifier key pressed: move cursor one row up without selection
+ // - with <Shift> modifier key pressed: move cursor one row up with selection
+ // - with <Ctrl>+<Shift> modifier keys pressed: scroll one row up
+ {
+ if ( ctrlPressed && shftPressed ) {
+ int value = verticalScrollBar()->value();
+ int spacing = fontMetrics().lineSpacing();
+ verticalScrollBar()->setValue( value > spacing ? value-spacing : 0 );
+ }
+ else if ( shftPressed || ctrlPressed ) {
+ if ( curLine > 0 )
+ moveCursor( QTextCursor::Up,
+ shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
+ }
+ else {
+ if ( myCmdInHistory < 0 && myHistory.count() > 0 ) {
+ // set history browsing mode
+ myCmdInHistory = myHistory.count();
+ // remember current command
+ QTextBlock par = document()->end().previous();
+ myCurrentCommand = par.text().remove( 0, PROMPT_SIZE );
+ }
+ if ( myCmdInHistory > 0 ) {
+ myCmdInHistory--;
+ // get previous command in the history
+ QString previousCommand = myHistory.at( myCmdInHistory );
+ // print previous command
+ moveCursor( QTextCursor::End );
+ moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ addText( myPrompt + previousCommand );
+ // move cursor to the end
+ moveCursor( QTextCursor::End );
+ }
+ }
+ break;
+ }
+ case Qt::Key_Down:
+ // <Down> arrow key: process as follows:
+ // - without <Ctrl>, <Shift> modifiers: next command in history
+ // - with <Ctrl> modifier key pressed: move cursor one row down without selection
+ // - with <Shift> modifier key pressed: move cursor one row down with selection
+ // - with <Ctrl>+<Shift> modifier keys pressed: scroll one row down
+ {
+ if ( ctrlPressed && shftPressed ) {
+ int value = verticalScrollBar()->value();
+ int maxval = verticalScrollBar()->maximum();
+ int spacing = fontMetrics().lineSpacing();
+ verticalScrollBar()->setValue( value+spacing < maxval ? value+spacing : maxval );
+ }
+ else if ( shftPressed || ctrlPressed) {
+ if ( curLine < endLine )
+ moveCursor( QTextCursor::Down,
+ shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
+ }
+ else {
+ if ( myCmdInHistory >= 0 ) {
+ // get next command in the history
+ myCmdInHistory++;
+ QString nextCommand;
+ if ( myCmdInHistory < myHistory.count() ) {
+ // next command in history
+ nextCommand = myHistory.at( myCmdInHistory );
+ }
+ else {
+ // end of history is reached
+ // last printed command
+ nextCommand = myCurrentCommand;
+ // unset history browsing mode
+ myCmdInHistory = -1;
+ }
+ // print next or current command
+ moveCursor( QTextCursor::End );
+ moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ addText( myPrompt + ( nextCommand != TOP_HISTORY_PY ? nextCommand : myCurrentCommand ) );
+ // move cursor to the end
+ moveCursor( QTextCursor::End );
+ }
+ }
+ break;
+ }
+ case Qt::Key_Left:
+ // <Left> arrow key: process as follows:
+ // - without <Ctrl>, <Shift> modifiers: move one symbol left (taking into account prompt)
+ // - with <Ctrl> modifier key pressed: move one word left (taking into account prompt)
+ // - with <Shift> modifier key pressed: move one symbol left with selection
+ // - with <Ctrl>+<Shift> modifier keys pressed: move one word left with selection
+ {
+ QString txt = textCursor().block().text();
+ if ( !shftPressed && isCommand( txt ) && curCol <= PROMPT_SIZE ) {
+ moveCursor( QTextCursor::Up );
+ moveCursor( QTextCursor::EndOfBlock );
+ }
+ else {
+ QTextEdit::keyPressEvent( event );
+ }
+ break;
+ }
+ case Qt::Key_Right:
+ // <Right> arrow key: process as follows:
+ // - without <Ctrl>, <Shift> modifiers: move one symbol right (taking into account prompt)
+ // - with <Ctrl> modifier key pressed: move one word right (taking into account prompt)
+ // - with <Shift> modifier key pressed: move one symbol right with selection
+ // - with <Ctrl>+<Shift> modifier keys pressed: move one word right with selection
+ {
+ QString txt = textCursor().block().text();
+ if ( !shftPressed ) {
+ if ( curCol < txt.length() ) {
+ if ( isCommand( txt ) && curCol < PROMPT_SIZE ) {
+ cur.setPosition( cur.block().position() + PROMPT_SIZE );
+ setTextCursor( cur );
+ break;
+ }
+ }
+ else {
+ if ( curLine < endLine && isCommand( textCursor().block().next().text() ) ) {
+ cur.setPosition( cur.position() + PROMPT_SIZE+1 );
+ setTextCursor( cur );
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ break;
+ }
+ }
+ }
+ QTextEdit::keyPressEvent( event );
+ break;
+ }
+ case Qt::Key_PageUp:
+ // <PageUp> key: process as follows:
+ // - without <Ctrl>, <Shift> modifiers: first command in history
+ // - with <Ctrl> modifier key pressed: move cursor one page up without selection
+ // - with <Shift> modifier key pressed: move cursor one page up with selection
+ // - with <Ctrl>+<Shift> modifier keys pressed: scroll one page up
+ {
+ if ( ctrlPressed && shftPressed ) {
+ verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepSub);
+ }
+ else if ( shftPressed || ctrlPressed ) {
+ bool moved = false;
+ qreal lastY = cursorRect( cur ).top();
+ qreal distance = 0;
+ // move using movePosition to keep the cursor's x
+ do {
+ qreal y = cursorRect( cur ).top();
+ distance += qAbs( y - lastY );
+ lastY = y;
+ moved = cur.movePosition( QTextCursor::Up,
+ shftPressed ? QTextCursor::KeepAnchor :
+ QTextCursor::MoveAnchor );
+ } while ( moved && distance < viewport()->height() );
+ if ( moved ) {
+ cur.movePosition( QTextCursor::Down,
+ shftPressed ? QTextCursor::KeepAnchor :
+ QTextCursor::MoveAnchor );
+ verticalScrollBar()->triggerAction( QAbstractSlider::SliderPageStepSub );
+ }
+ setTextCursor( cur );
+ }
+ else {
+ if ( myCmdInHistory < 0 && myHistory.count() > 0 ) {
+ // set history browsing mode
+ myCmdInHistory = myHistory.count();
+ // remember current command
+ QTextBlock par = document()->end().previous();
+ myCurrentCommand = par.text().remove( 0, PROMPT_SIZE );
+ }
+ if ( myCmdInHistory > 0 ) {
+ myCmdInHistory = 0;
+ // get very first command in the history
+ QString firstCommand = myHistory.at( myCmdInHistory );
+ // print first command
+ moveCursor( QTextCursor::End );
+ moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ addText( myPrompt + firstCommand );
+ // move cursor to the end
+ moveCursor( QTextCursor::End );
+ }
+ }
+ break;
+ }
+ case Qt::Key_PageDown:
+ // <PageDown> key: process as follows:
+ // - without <Ctrl>, <Shift> modifiers: last command in history
+ // - with <Ctrl> modifier key pressed: move cursor one page down without selection
+ // - with <Shift> modifier key pressed: move cursor one page down with selection
+ // - with <Ctrl>+<Shift> modifier keys pressed: scroll one page down
+ {
+ if ( ctrlPressed && shftPressed ) {
+ verticalScrollBar()->triggerAction(QAbstractSlider::SliderPageStepAdd);
+ }
+ else if ( shftPressed || ctrlPressed ) {
+ bool moved = false;
+ qreal lastY = cursorRect( cur ).top();
+ qreal distance = 0;
+ // move using movePosition to keep the cursor's x
+ do {
+ qreal y = cursorRect( cur ).top();
+ distance += qAbs( y - lastY );
+ lastY = y;
+ moved = cur.movePosition( QTextCursor::Down,
+ shftPressed ? QTextCursor::KeepAnchor :
+ QTextCursor::MoveAnchor );
+ } while ( moved && distance < viewport()->height() );
+ if ( moved ) {
+ cur.movePosition( QTextCursor::Up,
+ shftPressed ? QTextCursor::KeepAnchor :
+ QTextCursor::MoveAnchor );
+ verticalScrollBar()->triggerAction( QAbstractSlider::SliderPageStepSub );
+ }
+ setTextCursor( cur );
+ }
+ else {
+ if ( myCmdInHistory >= 0 ) {
+ // unset history browsing mode
+ myCmdInHistory = -1;
+ // print current command
+ moveCursor( QTextCursor::End );
+ moveCursor( QTextCursor::StartOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ addText( myPrompt + myCurrentCommand );
+ // move cursor to the end
+ moveCursor( QTextCursor::End );
+ }
+ }
+ break;
+ }
+ case Qt::Key_Home:
+ // <Home> key: process as follows:
+ // - without <Ctrl>, <Shift> modifiers: move cursor to the beginning of the current line without selection
+ // - with <Ctrl> modifier key pressed: move cursor to the very first symbol without selection
+ // - with <Shift> modifier key pressed: move cursor to the beginning of the current line with selection
+ // - with <Ctrl>+<Shift> modifier keys pressed: move cursor to the very first symbol with selection
+ {
+ if ( ctrlPressed ) {
+ moveCursor( QTextCursor::Start,
+ shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
+ }
+ else {
+ QString txt = textCursor().block().text();
+ if ( isCommand( txt ) ) {
+ if ( shftPressed ) {
+ if ( curCol > PROMPT_SIZE ) {
+ cur.movePosition( QTextCursor::StartOfLine, QTextCursor::KeepAnchor );
+ cur.movePosition( QTextCursor::Right, QTextCursor::KeepAnchor, PROMPT_SIZE );
+ }
+ }
+ else {
+ cur.movePosition( QTextCursor::StartOfLine );
+ cur.movePosition( QTextCursor::Right, QTextCursor::MoveAnchor, PROMPT_SIZE );
+ }
+ setTextCursor( cur );
+ }
+ else {
+ moveCursor( QTextCursor::StartOfBlock,
+ shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
+ }
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ }
+ break;
+ }
+ case Qt::Key_End:
+ // <End> key: process as follows:
+ // - without <Ctrl>, <Shift> modifiers: move cursor to the end of the current line without selection
+ // - with <Ctrl> modifier key pressed: move cursor to the very last symbol without selection
+ // - with <Shift> modifier key pressed: move cursor to the end of the current line with selection
+ // - with <Ctrl>+<Shift> modifier keys pressed: move cursor to the very last symbol with selection
+ {
+ moveCursor( ctrlPressed ? QTextCursor::End : QTextCursor::EndOfBlock,
+ shftPressed ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor );
+ break;
+ }
+ case Qt::Key_Backspace :
+ // <Backspace> key: process as follows
+ // - without any modifiers : delete symbol before the cursor / selection (taking into account prompt)
+ // - with <Shift> modifier key pressed: delete previous word
+ // - with <Ctrl> modifier key pressed: delete text from the cursor to the line beginning
+ // works only for last (command) line
+ {
+ if ( cur.hasSelection() ) {
+ cut();
+ }
+ else if ( cur.position() > document()->end().previous().position() + PROMPT_SIZE ) {
+ if ( shftPressed ) {
+ moveCursor( QTextCursor::PreviousWord, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ }
+ else if ( ctrlPressed ) {
+ cur.setPosition( document()->end().previous().position() + PROMPT_SIZE,
+ QTextCursor::KeepAnchor );
+ setTextCursor( cur );
+ textCursor().removeSelectedText();
+ }
+ else {
+ QTextEdit::keyPressEvent( event );
+ }
+ }
+ else {
+ cur.setPosition( document()->end().previous().position() + PROMPT_SIZE );
+ setTextCursor( cur );
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ }
+ break;
+ }
+ case Qt::Key_Delete :
+ // <Delete> key: process as follows
+ // - without any modifiers : delete symbol after the cursor / selection (taking into account prompt)
+ // - with <Shift> modifier key pressed: delete next word
+ // - with <Ctrl> modifier key pressed: delete text from the cursor to the end of line
+ // works only for last (command) line
+ {
+ if ( cur.hasSelection() ) {
+ cut();
+ }
+ else if ( cur.position() > document()->end().previous().position() + PROMPT_SIZE-1 ) {
+ if ( shftPressed ) {
+ moveCursor( QTextCursor::NextWord, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ }
+ else if ( ctrlPressed ) {
+ moveCursor( QTextCursor::EndOfBlock, QTextCursor::KeepAnchor );
+ textCursor().removeSelectedText();
+ }
+ else {
+ QTextEdit::keyPressEvent( event );
+ }
+ }
+ else {
+ cur.setPosition( document()->end().previous().position() + PROMPT_SIZE );
+ setTextCursor( cur );
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ }
+ break;
+ }
+ case Qt::Key_Insert :
+ // <Insert> key: process as follows
+ // - with <Ctrl> modifier key pressed: copy()
+ // - with <Shift> modifier key pressed: paste() to the command line
+ {
+ if ( ctrlPressed ) {
+ copy();
+ }
+ else if ( shftPressed ) {
+ paste();
+ }
+ else
+ QTextEdit::keyPressEvent( event );
+ break;
+ }
+ }
+}
+
+/*!
+ \brief Handle notification event coming from Python dispatcher.
+ \param event notification event
+*/
+void PyConsole_Editor::customEvent( QEvent* event )
+{
+ switch( event->type() ) {
+ case PyInterp_Event::OK:
+ case PyInterp_Event::ERROR:
+ {
+ PyInterp_Event* pe = dynamic_cast<PyInterp_Event*>( event );
+ if ( pe ){
+ ExecCommand* ec = dynamic_cast<ExecCommand*>( pe->GetRequest() );
+ if ( ec ) {
+ // The next line has appeared dangerous in case if
+ // Python command execution has produced very large output.
+ // A more clever approach is needed...
+ // print python output
+ addText( ec->myOutput, true );
+ addText( ec->myError );
+ }
+ }
+ // clear command buffer
+ myCommandBuffer.truncate( 0 );
+ // set "ready" prompt
+ myPrompt = READY_PROMPT;
+ addText( myPrompt );
+ // unset busy cursor
+ unsetCursor();
+ // stop event loop (if running)
+ if( myEventLoop )
+ myEventLoop->exit();
+ break;
+ }
+ case PyInterp_Event::INCOMPLETE:
+ {
+ // extend command buffer (multi-line command)
+ myCommandBuffer.append( "\n" );
+ // set "dot" prompt
+ myPrompt = DOTS_PROMPT;
+ addText( myPrompt, true );
+ // unset busy cursor
+ unsetCursor();
+ // stop event loop (if running)
+ if( myEventLoop )
+ myEventLoop->exit();
+ break;
+ }
+ default:
+ QTextEdit::customEvent( event );
+ }
+
+ // unset read-only state
+ setReadOnly( false );
+ // unset history browsing mode
+ myCmdInHistory = -1;
+
+ if ( (int)event->type() == (int)PyInterp_Event::OK && myQueue.count() > 0 ) {
+ // process the next sheduled command from the queue (if there is any)
+ QString nextcmd = myQueue[0];
+ myQueue.pop_front();
+ exec( nextcmd );
+ }
+}
+
+/*!
+ \brief Handle Python interpreter change.
+
+ Perform initialization actions if the interpreter is changed.
+ \param interp python interpreter is being set
+*/
+void PyConsole_Editor::onPyInterpChanged( PyInterp_base* interp )
+{
+ if ( myInterp != interp
+ // Force read-only state and wait cursor when myInterp is NULL
+ || !myInterp ) {
+ myInterp = interp;
+ if ( myInterp ) {
+ // print banner
+ myBanner = myInterp->getbanner().c_str();
+ addText( myBanner );
+ // clear command buffer
+ myCommandBuffer.truncate(0);
+ // unset read-only state
+ setReadOnly( false );
+ // unset history browsing mode
+ myCmdInHistory = -1;
+ // add prompt
+ addText( myPrompt );
+ // unset busy cursor
+ viewport()->unsetCursor();
+ // stop event loop (if running)
+ if( myEventLoop)
+ myEventLoop->exit();
+ }
+ else {
+ // clear contents
+ clear();
+ // set read-only state
+ setReadOnly( true );
+ // set busy cursor
+ setCursor( Qt::WaitCursor );
+ }
+ }
+}
+
+/*!
+ \brief "Copy" operation.
+
+ Reimplemented from Qt.
+ Warning! In Qt4 this method is not virtual.
+ */
+void PyConsole_Editor::cut()
+{
+ QTextCursor cur = textCursor();
+ if ( cur.hasSelection() ) {
+ QApplication::clipboard()->setText( cur.selectedText() );
+ int startSelection = cur.selectionStart();
+ if ( startSelection < document()->end().previous().position() + PROMPT_SIZE )
+ startSelection = document()->end().previous().position() + PROMPT_SIZE;
+ int endSelection = cur.selectionEnd();
+ if ( endSelection < document()->end().previous().position() + PROMPT_SIZE )
+ endSelection = document()->end().previous().position() + PROMPT_SIZE;
+ cur.setPosition( startSelection );
+ cur.setPosition( endSelection, QTextCursor::KeepAnchor );
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ setTextCursor( cur );
+ textCursor().removeSelectedText();
+ }
+}
+
+/*!
+ \brief "Paste" operation.
+
+ Reimplemented from Qt.
+ Warning! In Qt4 this method is not virtual.
+ */
+void PyConsole_Editor::paste()
+{
+ QTextCursor cur = textCursor();
+ if ( cur.hasSelection() ) {
+ int startSelection = cur.selectionStart();
+ if ( startSelection < document()->end().previous().position() + PROMPT_SIZE )
+ startSelection = document()->end().previous().position() + PROMPT_SIZE;
+ int endSelection = cur.selectionEnd();
+ if ( endSelection < document()->end().previous().position() + PROMPT_SIZE )
+ endSelection = document()->end().previous().position() + PROMPT_SIZE;
+ cur.setPosition( startSelection );
+ cur.setPosition( endSelection, QTextCursor::KeepAnchor );
+ horizontalScrollBar()->setValue( horizontalScrollBar()->minimum() );
+ setTextCursor( cur );
+ textCursor().removeSelectedText();
+ }
+ if ( textCursor().position() < document()->end().previous().position() + PROMPT_SIZE )
+ moveCursor( QTextCursor::End );
+ QTextEdit::paste();
+}
+
+/*!
+ \brief "Clear" operation.
+
+ Reimplemented from Qt.
+ Warning! In Qt4 this method is not virtual.
+ */
+void PyConsole_Editor::clear()
+{
+ QTextEdit::clear();
+ addText( myBanner );
+ myPrompt = READY_PROMPT;
+ addText( myPrompt );
+}
--- /dev/null
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : PyConsole_Editor.h
+// Author : Vadim SANDLER
+// Module : SALOME
+
+#ifndef PYCONSOLE_EDITOR_H
+#define PYCONSOLE_EDITOR_H
+
+#include "PyConsole_Interp.h" // this include must be first (see PyInterp_base.h)!
+
+#include <QtGui/qtextedit.h>
+
+class QMenu;
+class QEventLoop;
+class PyConsole_Interp;
+
+class PYCONSOLE_EXPORT PyConsole_Editor : public QTextEdit
+{
+ Q_OBJECT;
+
+public:
+ PyConsole_Editor( PyInterp_base* theInterp, QWidget *theParent = 0 );
+ ~PyConsole_Editor();
+
+ virtual void addText( const QString& str, const bool newBlock = false );
+ bool isCommand( const QString& str ) const;
+
+ virtual void exec( const QString& command );
+ void execAndWait( const QString& command );
+
+protected:
+ virtual void dropEvent( QDropEvent* event );
+ virtual void mouseReleaseEvent( QMouseEvent* event );
+ virtual void keyPressEvent ( QKeyEvent* event);
+ virtual void customEvent( QEvent* event);
+
+public slots:
+ void cut();
+ void paste();
+ void clear();
+ void handleReturn();
+ void onPyInterpChanged( PyInterp_base* );
+
+private:
+ PyInterp_base* myInterp; //!< python interpreter
+
+ QString myCommandBuffer; //!< python comman buffer
+ QString myCurrentCommand; //!< currently being printed command
+ QString myPrompt; //!< current command line prompt
+ int myCmdInHistory; //!< current history command index
+ QStringList myHistory; //!< commands history buffer
+ QEventLoop* myEventLoop; //!< internal event loop
+ QString myBanner; //!< current banner
+ QStringList myQueue; //!< python commands queue
+};
+
+#endif
--- /dev/null
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : PyConsole_Interp.cxx
+// Author : Nicolas REJNERI
+// Module : SALOME
+
+#include "PyConsole_Interp.h"
+
+/*!
+ \class PyConsole_Interp
+ \brief Python interpreter to be embedded to the SALOME study's GUI.
+
+ Python interpreter is created one per SALOME study.
+ Calls initialize method defined in the base class, which calls redefined
+ virtual methods initState() & initContext().
+
+ /EDF-CCAR/
+ When SALOME uses multi Python interpreter feature,
+ every study has its own interpreter and thread state (_tstate = Py_NewInterpreter()).
+ This is fine because every study has its own modules (sys.modules) stdout and stderr.<br>
+ <b>But</b> some Python modules must be imported only once. In multi interpreter
+ context Python modules (*.py) are imported several times.
+ For example, the pyqt module must be imported only once because
+ it registers classes in a C module.
+ It's quite the same with omniorb modules (internals and generated with omniidl).
+ This problem is handled with "shared modules" defined in salome_shared_modules.py.
+ These "shared modules" are imported only once and only copied in all
+ the other interpreters.<br>
+ <b>But</b> it's not the only problem. Every interpreter has its own
+ __builtin__ module. That's fine but if we have copied some modules
+ and imported others problems may arise with operations that are not allowed
+ in restricted execution environment. So we must impose that all interpreters
+ have identical __builtin__ module.
+*/
+
+using namespace std;
+
+/*!
+ \brief Constructor.
+
+ Creates new python interpreter.
+*/
+PyConsole_Interp::PyConsole_Interp(): PyInterp_base()
+{
+}
+
+/*!
+ \brief Destructor.
+
+ Does nothing for the moment.
+*/
+PyConsole_Interp::~PyConsole_Interp()
+{
+}
+
+/*!
+ \brief Initialize internal Python interpreter state.
+*/
+bool PyConsole_Interp::initState()
+{
+ // The GIL is acquired and will be held on initState output
+ // It is the caller responsability to release the lock if needed
+ PyEval_AcquireLock();
+ _tstate = Py_NewInterpreter(); // create an interpreter and save current state
+ PySys_SetArgv(PyInterp_base::_argc,PyInterp_base::_argv); // initialize sys.argv
+
+ //If builtinmodule has been initialized all the sub interpreters
+ // will have the same __builtin__ module
+ if(builtinmodule){
+ PyObject *m = PyImport_GetModuleDict();
+ PyDict_SetItemString(m, "__builtin__", builtinmodule);
+ _tstate->interp->builtins = PyModule_GetDict(builtinmodule);
+ Py_INCREF(_tstate->interp->builtins);
+ }
+ PyEval_ReleaseThread(_tstate);
+ return true;
+}
+
+/*!
+ \brief Initialize python interpeter context.
+
+ The GIL is assumed to be held.
+ It is the caller responsability caller to acquire the GIL.
+ It will still be held on initContext() exit.
+*/
+bool PyConsole_Interp::initContext()
+{
+ PyObject *m = PyImport_AddModule("__main__"); // interpreter main module (module context)
+ if(!m){
+ PyErr_Print();
+ return false;
+ }
+ _g = PyModule_GetDict(m); // get interpreter dictionnary context
+
+ if(builtinmodule){
+ PyDict_SetItemString(_g, "__builtins__", builtinmodule); // assign singleton __builtin__ module
+ }
+ return true;
+}
--- /dev/null
+// SALOME SALOMEGUI : implementation of desktop and GUI kernel
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+// File : PyConsole_Interp.h
+// Author : Nicolas REJNERI
+// Module : SALOME
+
+#ifndef PYCONSOLE_INTERP_H
+#define PYCONSOLE_INTERP_H
+
+#include "PyConsole.h"
+
+#include <PyInterp_base.h> // this include must be first (see PyInterp_base.h)!
+
+class PYCONSOLE_EXPORT PyConsole_Interp : public PyInterp_base
+{
+public:
+ PyConsole_Interp();
+ ~PyConsole_Interp();
+
+protected:
+ virtual bool initState();
+ virtual bool initContext();
+};
+
+#endif
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1">
+<context>
+ <name>PythonConsole</name>
+ <message>
+ <location filename="PyConsole_Editor.cxx" line="411"/>
+ <source>EDIT_COPY_CMD</source>
+ <translation>Copy</translation>
+ </message>
+ <message>
+ <location filename="PyConsole_Editor.cxx" line="415"/>
+ <source>EDIT_PASTE_CMD</source>
+ <translation>Paste</translation>
+ </message>
+ <message>
+ <location filename="PyConsole_Editor.cxx" line="419"/>
+ <source>EDIT_CLEAR_CMD</source>
+ <translation>Clear</translation>
+ </message>
+ <message>
+ <location filename="PyConsole_Editor.cxx" line="425"/>
+ <source>EDIT_SELECTALL_CMD</source>
+ <translation>Select All</translation>
+ </message>
+</context>
+</TS>
+++ /dev/null
-# SALOME PyInterp : implementation of base thread-safe Python services
-#
-# Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-#
-#
-# File : Makefile.in
-# Module : SALOME
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@
-
-
-@COMMENCE@
-
-# header files
-EXPORT_HEADERS= PyInterp.h \
- PyInterp_base.h \
- PyInterp_Dispatcher.h
-
-# Libraries targets
-LIB = libPyInterp.la
-
-LIB_SRC= PyInterp_base.cxx \
- PyInterp_Dispatcher.cxx
-
-LIB_MOC = PyInterp_Watcher.h
-
-CPPFLAGS+= $(PYTHON_INCLUDES) $(QT_INCLUDES)
-
-LDFLAGS+= $(PYTHON_LIBS) $(QT_MT_LIBS)
-
-@CONCLUDE@
// ========================================================
// set dllexport type for Win platform
-#ifdef WNT
+#ifdef WIN32
#ifdef PYINTERP_EXPORTS
#define PYINTERP_EXPORT __declspec(dllexport)
#define PYINTERP_EXPORT __declspec(dllimport)
#endif
-#else // WNT
+#else // WIN32
#define PYINTERP_EXPORT
-#endif // WNT
+#endif // WIN32
// ========================================================
-// little trick - if we do not have debug python libraries
+// little trick - we do not have debug python libraries
#ifdef _DEBUG
- #ifndef HAVE_DEBUG_PYTHON
- #undef _DEBUG
- #endif
-#endif
+#undef _DEBUG
#include <Python.h>
+#define _DEBUG
-#ifdef _DEBUG
- #ifndef HAVE_DEBUG_PYTHON
- #define _DEBUG
- #endif
-#endif
+#else // _DEBUG
+
+#include <Python.h>
+
+#endif // _DEBUG
// ========================================================
// avoid warning messages
-#ifdef WNT
+#ifdef WIN32
#pragma warning (disable : 4786)
#pragma warning (disable : 4251)
#endif
--- /dev/null
+TEMPLATE = lib
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+INCLUDEPATH += ../../include $$(PYTHONINC)
+unix:LIBS += -L$$(PYTHONLIB) -lpython2.3
+win32:LIBS += /LIBPATH:$$(PYTHONLIB)
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += PYINTERP_EXPORTS
+
+HEADERS = *.h
+
+SOURCES = *.cxx
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+INSTALLS += includes
// $Header$
-#include <PyInterp_base.h>
-#include <PyInterp_Dispatcher.h>
-#include <PyInterp_Watcher.h>
+#include "PyInterp_base.h"
+#include "PyInterp_Watcher.h"
+#include "PyInterp_Dispatcher.h"
-#include <qapplication.h>
-#include <qobject.h>
+#include <QtCore/qobject.h>
+#include <QtCore/qcoreapplication.h>
-//#include <utilities.h>
using namespace std;
PyInterp_Dispatcher* PyInterp_Dispatcher::myInstance = 0;
void PyInterp_Request::postEvent()
{
-#if QT_VERSION >= 0x030303
// MESSAGE("*** PyInterp_Request::postEvent(): for Qt 3.3.3")
- QApplication::postEvent( getListener(), getEvent() );
-#else
-// MESSAGE("*** PyInterp_Request::postEvent(): for Qt 3.0.5")
- QThread::postEvent( getListener(), getEvent() );
-#endif
+ QCoreApplication::postEvent( getListener(), getEvent() );
}
void PyInterp_Request::setListener( QObject* o )
bool PyInterp_Dispatcher::IsBusy() const
{
- return running();
+ return isRunning();
}
void PyInterp_Dispatcher::Exec( PyInterp_Request* theRequest )
#include "PyInterp.h"
-#include <qthread.h>
-#include <qevent.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qthread.h>
+
+#include <QtGui/qevent.h>
#include <list>
PyInterp_base* myInterp;
};
-class PYINTERP_EXPORT PyInterp_Event : public QCustomEvent
+class PYINTERP_EXPORT PyInterp_Event : public QEvent
{
PyInterp_Event();
PyInterp_Event( const PyInterp_Event& );
enum { NOTIFY = QEvent::User + 5000, OK, ERROR, INCOMPLETE, LAST };
PyInterp_Event( int type, PyInterp_Request* request )
- : QCustomEvent( (QEvent::Type)type ), myRequest( request ) {}
+ : QEvent( (QEvent::Type)type ), myRequest( request ) {}
virtual ~PyInterp_Event();
#ifndef _PYINTERP_WATCHER_H_
#define _PYINTERP_WATCHER_H_
-#include <PyInterp.h>
+#include "PyInterp.h"
-#include <PyInterp_Dispatcher.h>
+#include "PyInterp_Dispatcher.h"
-#include <qobject.h>
+#include <QtCore/qobject.h>
// Private class that keeps track of destructions of request listeners
class PYINTERP_EXPORT PyInterp_Watcher : public QObject
// $Header$
-#include <string>
-#include <vector>
-
#include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)!
+
#include <cStringIO.h>
+#include <string>
+#include <vector>
+
using namespace std;
PyLockWrapper::PyLockWrapper(PyThreadState* theThreadState):
static PyInterpreterState *_interp;
PyInterp_base();
- ~PyInterp_base();
+ virtual ~PyInterp_base();
virtual void initialize();
virtual void init_python();
+++ /dev/null
-# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# File : Makefile.in
-# Author : Vladimir Klyachin (OCN)
-# Module : STD
-# $Header$
-
-top_srcdir=@top_srcdir@
-top_builddir=../..
-srcdir=@srcdir@
-VPATH=.:@srcdir@:@srcdir@/resources
-
-
-@COMMENCE@
-
-# header files
-EXPORT_HEADERS= STD_Application.h \
- STD.h \
- STD_MDIDesktop.h \
- STD_SDIDesktop.h \
- STD_TabDesktop.h \
- STD_CloseDlg.h \
- STD_LoadStudiesDlg.h
-
-# .po files to transform in .qm
-PO_FILES = STD_images.po \
- STD_msg_en.po
-
-# Libraries targets
-LIB = libstd.la
-
-LIB_SRC= STD_Application.cxx \
- STD_MDIDesktop.cxx \
- STD_SDIDesktop.cxx \
- STD_TabDesktop.cxx \
- STD_CloseDlg.cxx \
- STD_LoadStudiesDlg.cxx
-
-LIB_MOC = STD_Application.h \
- STD_MDIDesktop.h \
- STD_SDIDesktop.h \
- STD_TabDesktop.h \
- STD_CloseDlg.h \
- STD_LoadStudiesDlg.h
-
-RESOURCES_FILES = \
-config \
-cut.png \
-copy.png \
-close.png \
-cursor_rotate.png \
-cursor_zoom.png \
-help.png \
-new.png \
-open.png \
-print.png \
-paste.png \
-redo.png \
-reset.png \
-save.png \
-undo_arrow.png \
-undo.png \
-std.ini
-
-CPPFLAGS+=$(QT_INCLUDES)
-
-LDFLAGS+=$(QT_MT_LIBS)
-LIBS+= -lsuit
-
-@CONCLUDE@
--- /dev/null
+TEMPLATE = lib
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+INCLUDEPATH = ../../include
+LIBS += -L../../lib -lSUIT -lQtx
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += STD_EXPORTS
+
+HEADERS = *.h
+
+SOURCES = *.cxx
+
+TRANSLATIONS = resources/STD_images.ts \
+ resources/STD_msg_en.ts
+
+ICONS = resources/*.png
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+resources.files = $$ICONS resources/*.qm resources/*.xml resources/*.ini
+resources.path = ../../resources
+
+INSTALLS += includes resources
+++ /dev/null
-// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#include "STD_LoadStudiesDlg.h"
-
-#include <QtGui/qlabel.h>
-#include <QtGui/qlayout.h>
-#include <QtGui/qlistwidget.h>
-#include <QtGui/qpushbutton.h>
-
-#define SPACING_SIZE 6
-#define MARGIN_SIZE 11
-#define MIN_LISTBOX_WIDTH 150
-#define MIN_LISTBOX_HEIGHT 100
-
-/*!
-* \brief creates a Load study dialog box
-* \param parent a parent widget
-* \param modal bool argument, if true the dialog box is a modal dialog box
-* \param f style flags
-*/
-
-STD_LoadStudiesDlg::STD_LoadStudiesDlg( QWidget* parent, bool modal )
-: QDialog( parent )
-{
- setModal( modal );
- setWindowTitle( tr("DLG_LOAD_STUDY_CAPTION") );
- setSizeGripEnabled( true );
-
- QGridLayout* aTopLayout = new QGridLayout(this);
- aTopLayout->setMargin(MARGIN_SIZE);
- aTopLayout->setSpacing(SPACING_SIZE);
-
- TextLabel1 = new QLabel( this );
- TextLabel1->setGeometry( QRect( 11, 12, 297, 16 ) );
- TextLabel1->setText( tr( "MEN_STUDIES_CHOICE" ) );
-
- QHBoxLayout* aBtnLayout = new QHBoxLayout;
- aBtnLayout->setSpacing( SPACING_SIZE );
- aBtnLayout->setMargin( 0 );
-
- buttonOk = new QPushButton( this );
- buttonOk->setText( tr( "BUT_OK" ) );
- buttonOk->setAutoDefault( true );
- buttonOk->setDefault( true );
-
- buttonCancel = new QPushButton( this );
- buttonCancel->setText( tr( "BUT_CANCEL" ) );
- buttonCancel->setAutoDefault( true );
-
- aBtnLayout->addWidget( buttonOk );
- aBtnLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ) );
- aBtnLayout->addWidget( buttonCancel );
-
- ListComponent = new QListWidget( this );
- ListComponent->setVerticalScrollBarPolicy( Qt::ScrollBarAlwaysOn );
- ListComponent->setMinimumSize( MIN_LISTBOX_WIDTH, MIN_LISTBOX_HEIGHT );
- ListComponent->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
- ListComponent->setSelectionMode( QListWidget::SingleSelection );
-
- aTopLayout->addWidget(TextLabel1, 0, 0);
- aTopLayout->addWidget(ListComponent, 1, 0);
- aTopLayout->addLayout(aBtnLayout, 2, 0);
-
- // signals and slots connections
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) );
-}
-
+++ /dev/null
-// Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License.
-//
-// This library is distributed in the hope that it will be useful
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef STD_LOADSTUDIESDLG_H
-#define STD_LOADSTUDIESDLG_H
-
-#include <STD.h>
-
-#include <QtCore/qvariant.h>
-
-#include <QtGui/qdialog.h>
-
-class QLabel;
-class QListBox;
-class QPushButton;
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QListWidget;
-
-/*!\class STD_LoadStudiesDlg
- * \brief Describes a dialog box that gives a list of opened studies.
- *
- */
-class STD_EXPORT STD_LoadStudiesDlg : public QDialog
-{
- Q_OBJECT
-
-public:
- STD_LoadStudiesDlg( QWidget* parent = 0, bool modal = false );
- ~STD_LoadStudiesDlg() {}
-
- /*!\var TextLabel1
- * \brief stores a dialog text label
- */
- QLabel* TextLabel1;
-
- /*!\var buttonOk
- * \brief stores a dialog button OK
- */
- QPushButton* buttonOk;
-
- /*!\var buttonCancel
- * \brief stores a dialog button Cancel
- */
- QPushButton* buttonCancel;
-
- /*!\var ListComponent
- * \brief stores a dialog list compoent
- */
- QListWidget* ListComponent;
-
-};
-
-#endif // STD_LOADSTUDIESDLG_H
#include <QtxAction.h>
#include <QtxActionMenuMgr.h>
-#include <QtxWorkspaceAction.h>
+//#include <QtxWorkspaceAction.h>
-#include <qvbox.h>
-#include <qmenubar.h>
-#include <qworkspace.h>
-#include <qobjectlist.h>
+#include <QtGui/qframe.h>
+#include <QtGui/qlayout.h>
+#include <QtGui/qmenubar.h>
+#include <QtGui/qworkspace.h>
+#include <QtGui/qapplication.h>
#include <stdarg.h>
/*!Constructor.*/
STD_MDIDesktop::STD_MDIDesktop()
: SUIT_Desktop(),
-myWorkspace( 0 ),
-myWorkspaceAction( 0 )
+myWorkspace( 0 )//,
+//myWorkspaceAction( 0 )
{
- QVBox* base = new QVBox( this );
+ QFrame* base = new QFrame( this );
+ QVBoxLayout* main = new QVBoxLayout( base );
+ main->setMargin( 0 );
base->setFrameStyle( QFrame::Panel | QFrame::Sunken );
setCentralWidget( base );
myWorkspace = new QWorkspace( base );
+ main->addWidget( myWorkspace );
connect( myWorkspace, SIGNAL( windowActivated( QWidget* ) ),
this, SLOT( onWindowActivated( QWidget* ) ) );
}
/*!\retval QPtrList<SUIT_ViewWindow> - return const active window list.*/
-QPtrList<SUIT_ViewWindow> STD_MDIDesktop::windows() const
+QList<SUIT_ViewWindow*> STD_MDIDesktop::windows() const
{
- QPtrList<SUIT_ViewWindow> winList;
+ QList<SUIT_ViewWindow*> winList;
QWidgetList children = myWorkspace->windowList();
- for ( QWidgetListIt it( children ); it.current(); ++it )
+ for ( QWidgetList::iterator it = children.begin(); it != children.end(); ++it )
{
- if ( it.current()->inherits( "SUIT_ViewWindow" ) )
- winList.append( (SUIT_ViewWindow*)it.current() );
+ SUIT_ViewWindow* vw = ::qobject_cast<SUIT_ViewWindow*>( *it );
+ if ( vw )
+ winList.append( vw );
}
return winList;
}
-/*!\retval QWidget - pointer to work space.*/
-QWidget* STD_MDIDesktop::parentArea() const
+/*! add the new widget into desktop.*/
+void STD_MDIDesktop::addWindow( QWidget* w )
{
- return workspace();
+ if ( !w || !workspace() )
+ return;
+
+ workspace()->addWindow( w );
}
/*!Call method perform for operation \a type.*/
void STD_MDIDesktop::windowOperation( const int type )
{
- myWorkspaceAction->perform( operationFlag( type ) );
+ //myWorkspaceAction->perform( operationFlag( type ) );
}
/*!Sets window operations by \a first ... parameters.*/
va_list ints;
va_start( ints, first );
- QValueList<int> typeList;
+ QList<int> typeList;
int cur = first;
while ( cur )
}
/*!Sets window operations by variable \a opList - operation list.*/
-void STD_MDIDesktop::setWindowOperations( const QValueList<int>& opList )
+void STD_MDIDesktop::setWindowOperations( const QList<int>& opList )
{
int flags = 0;
- for ( QValueList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )
+ for ( QList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )
flags = flags | operationFlag( *it );
- myWorkspaceAction->setItems( flags );
+// myWorkspaceAction->setItems( flags );
}
/*!\retval QWorkspace pointer - work space.*/
/*!Create actions: cascade, Tile, Tile Horizontal, Tile Vertical*/
void STD_MDIDesktop::createActions()
{
+/*
if ( myWorkspaceAction )
return;
int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100, MenuWindowId );
mMgr->insert( myWorkspaceAction, winMenuId, -1 );
mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );
+*/
}
/*!Convert STD_MDIDesktop enumerations to QtxWorkspaceAction.*/
int STD_MDIDesktop::operationFlag( const int type ) const
{
int res = 0;
+/*
switch ( type )
{
case Cascade:
res = QtxWorkspaceAction::VTile;
break;
}
+*/
return res;
}
class QtxAction;
class QPopupMenu;
class QWorkspace;
-class QtxWorkspaceAction;
+//class QtxWorkspaceAction;
-#if defined WNT
+#if defined WIN32
#pragma warning( disable: 4251 )
#endif
{
Q_OBJECT
+ class Workspace;
+
public:
enum { MenuWindowId = 6 };
enum { Cascade, Tile, HTile, VTile };
virtual ~STD_MDIDesktop();
virtual SUIT_ViewWindow* activeWindow() const;
- virtual QPtrList<SUIT_ViewWindow> windows() const;
+ virtual QList<SUIT_ViewWindow*> windows() const;
void windowOperation( const int );
void setWindowOperations( const int, ... );
- void setWindowOperations( const QValueList<int>& );
+ void setWindowOperations( const QList<int>& );
QWorkspace* workspace() const;
protected:
void createActions();
- virtual QWidget* parentArea() const;
+ virtual void addWindow( QWidget* );
private:
int operationFlag( const int ) const;
private:
QWorkspace* myWorkspace;
- QtxWorkspaceAction* myWorkspaceAction;
+// QtxWorkspaceAction* myWorkspaceAction;
};
-#if defined WNT
+#if defined WIN32
#pragma warning( default: 4251 )
#endif
#include <SUIT_ViewWindow.h>
-#include <qvbox.h>
-#include <qmenubar.h>
-#include <qobjectlist.h>
+#include <QtGui/qframe.h>
+#include <QtGui/qlayout.h>
+#include <QtGui/qmenubar.h>
+
+#include <QtGui/qlabel.h>
/*!Constructor. Create instance of QVBox*/
STD_SDIDesktop::STD_SDIDesktop()
: SUIT_Desktop()
{
- myMainWidget = new QVBox( this );
+ myMainWidget = new QFrame( this );
myMainWidget->setFrameStyle( QFrame::Panel | QFrame::Sunken );
+
+ QVBoxLayout* main = new QVBoxLayout( myMainWidget );
+ main->setMargin( 0 );
setCentralWidget( myMainWidget );
}
/*!\retval SUIT_ViewWindow - return const active window.*/
SUIT_ViewWindow* STD_SDIDesktop::activeWindow() const
{
- const QObjectList* children = myMainWidget->children();
- if ( !children )
- return 0;
-
- QPtrList<SUIT_ViewWindow> winList;
- for ( QObjectListIt it( *children ); it.current(); ++it )
+ const QObjectList& lst = myMainWidget->children();
+ QList<SUIT_ViewWindow*> winList;
+ for ( QObjectList::const_iterator it = lst.begin(); it != lst.end(); ++it )
{
- if ( it.current()->inherits( "SUIT_ViewWindow" ) )
- winList.append( (SUIT_ViewWindow*)it.current() );
+ SUIT_ViewWindow* vw = ::qobject_cast<SUIT_ViewWindow*>( *it );
+ if ( vw )
+ winList.append( vw );
}
SUIT_ViewWindow* win = 0;
- for ( QPtrListIterator<SUIT_ViewWindow> itr( winList ); itr.current() && !win; ++itr )
+ for ( QList<SUIT_ViewWindow*>::iterator itr = winList.begin(); itr != winList.end() && !win; ++itr )
{
- if ( itr.current()->isActiveWindow() )
- win = itr.current();
+ if ( (*itr)->isActiveWindow() )
+ win = *itr;
}
if ( !win && !winList.isEmpty() )
- win = winList.getFirst();
+ win = winList.first();
return win;
}
/*!\retval QPtrList<SUIT_ViewWindow> - return const active window list.*/
-QPtrList<SUIT_ViewWindow> STD_SDIDesktop::windows() const
+QList<SUIT_ViewWindow*> STD_SDIDesktop::windows() const
{
- QPtrList<SUIT_ViewWindow> winList;
- winList.append( activeWindow() );
+ QList<SUIT_ViewWindow*> winList;
+ winList.append( activeWindow() );
return winList;
}
-/*!\retval QWidget - pointer to main window.*/
-QWidget* STD_SDIDesktop::parentArea() const
+/*! add new widget into desktop.*/
+void STD_SDIDesktop::addWindow( QWidget* w )
{
- return myMainWidget;
+ if ( !w || !centralWidget() || !centralWidget()->layout() )
+ return;
+
+ w->setParent( centralWidget() );
+ centralWidget()->layout()->addWidget( w );
}
#include <SUIT_Desktop.h>
-class QVBox;
+class QFrame;
class STD_EXPORT STD_SDIDesktop: public SUIT_Desktop
{
virtual ~STD_SDIDesktop();
virtual SUIT_ViewWindow* activeWindow() const;
- virtual QPtrList<SUIT_ViewWindow> windows() const;
+ virtual QList<SUIT_ViewWindow*> windows() const;
protected:
- virtual QWidget* parentArea() const;
+ virtual void addWindow( QWidget* );
private:
- QVBox* myMainWidget;
+ QFrame* myMainWidget;
};
#endif
#include <QtxAction.h>
#include <QtxWorkstack.h>
#include <QtxActionMenuMgr.h>
-#include <QtxWorkstackAction.h>
+//#include <QtxWorkstackAction.h>
-#include <qvbox.h>
-#include <qmenubar.h>
-#include <qworkspace.h>
-#include <qobjectlist.h>
+#include <QtGui/qframe.h>
+#include <QtGui/qlayout.h>
#include <stdarg.h>
/*!Constructor.Create new instances of QVBox and QtxWorkstack.*/
STD_TabDesktop::STD_TabDesktop()
: SUIT_Desktop(),
-myWorkstack( 0 ),
-myWorkstackAction( 0 )
+myWorkstack( 0 )//,
+//myWorkstackAction( 0 )
{
- QVBox* base = new QVBox( this );
+ QFrame* base = new QFrame( this );
base->setFrameStyle( QFrame::Panel | QFrame::Sunken );
+ QVBoxLayout* main = new QVBoxLayout( base );
+ main->setMargin( 0 );
+
setCentralWidget( base );
myWorkstack = new QtxWorkstack( base );
+ main->addWidget( myWorkstack );
// setting Expanding size policy for central workstack. If there are several widgets
// in central area of Desktop, other widgets will be added below the workstack (CATHARE, TRIPOLI modules).
// But the workstack must occupy as much space as possible -- set Expanding for it.
myWorkstack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Expanding ) );
- myWorkstack->setAccel(QtxWorkstack::SplitVertical, SHIFT + Key_V);
- myWorkstack->setAccel(QtxWorkstack::SplitHorizontal, SHIFT + Key_H);
- myWorkstack->setAccel(QtxWorkstack::Close, SHIFT + Key_C);
+ myWorkstack->setAccel( QtxWorkstack::SplitVertical, Qt::SHIFT + Qt::Key_V );
+ myWorkstack->setAccel( QtxWorkstack::SplitHorizontal, Qt::SHIFT + Qt::Key_H );
+ myWorkstack->setAccel( QtxWorkstack::Close, Qt::SHIFT + Qt::Key_C );
connect( myWorkstack, SIGNAL( windowActivated( QWidget* ) ),
this, SLOT( onWindowActivated( QWidget* ) ) );
}
/*!\retval QPtrList<SUIT_ViewWindow> - return const active window list.*/
-QPtrList<SUIT_ViewWindow> STD_TabDesktop::windows() const
+QList<SUIT_ViewWindow*> STD_TabDesktop::windows() const
{
- QPtrList<SUIT_ViewWindow> winList;
+ QList<SUIT_ViewWindow*> winList;
QWidgetList children = myWorkstack->windowList();
- for ( QWidgetListIt it( children ); it.current(); ++it )
+ for ( QWidgetList::iterator it = children.begin(); it != children.end(); ++it )
{
- if ( it.current()->inherits( "SUIT_ViewWindow" ) )
- winList.append( (SUIT_ViewWindow*)it.current() );
+ if ( (*it)->inherits( "SUIT_ViewWindow" ) )
+ winList.append( (SUIT_ViewWindow*)*it );
}
return winList;
}
-/*!\retval QWidget pointer - QT work stack.*/
-QWidget* STD_TabDesktop::parentArea() const
+/*! insert new widget into desktop.*/
+void STD_TabDesktop::addWindow( QWidget* w )
{
- return workstack();
+ if ( !w || !workstack() )
+ return;
+
+ workstack()->addWindow( w );
}
/*!Call method perform for operation \a type.*/
void STD_TabDesktop::windowOperation( const int type )
{
- myWorkstackAction->perform( operationFlag( type ) );
+// myWorkstackAction->perform( operationFlag( type ) );
}
/*!Sets window operations by \a first ... parameters.*/
va_list ints;
va_start( ints, first );
- QValueList<int> typeList;
+ QList<int> typeList;
int cur = first;
while ( cur )
}
/*!Sets window operations by variable \a opList - operation list.*/
-void STD_TabDesktop::setWindowOperations( const QValueList<int>& opList )
+void STD_TabDesktop::setWindowOperations( const QList<int>& opList )
{
int flags = 0;
- for ( QValueList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )
+ for ( QList<int>::const_iterator it = opList.begin(); it != opList.end(); ++it )
flags = flags | operationFlag( *it );
- myWorkstackAction->setItems( flags );
+// myWorkstackAction->setItems( flags );
}
/*!\retval QtxWorkstack pointer - QT work stack.*/
/*!Create actions for window.*/
void STD_TabDesktop::createActions()
{
+/*
if ( myWorkstackAction )
return;
int winMenuId = mMgr->insert( tr( "MEN_DESK_WINDOW" ), -1, 100, MenuWindowId );
mMgr->insert( myWorkstackAction, winMenuId, -1 );
mMgr->insert( QtxActionMenuMgr::separator(), winMenuId, -1 );
+*/
}
/*!Convert STD_TabDesktop enumerations to QtxWorkstackAction*/
int STD_TabDesktop::operationFlag( const int type ) const
{
int res = 0;
+/*
switch ( type )
{
case VSplit:
res = QtxWorkstackAction::HSplit;
break;
}
+*/
return res;
}
class QPopupMenu;
class QWorkspace;
class QtxWorkstack;
-class QtxWorkstackAction;
+//class QtxWorkstackAction;
-#if defined WNT
+#if defined WIN32
#pragma warning( disable: 4251 )
#endif
virtual ~STD_TabDesktop();
virtual SUIT_ViewWindow* activeWindow() const;
- virtual QPtrList<SUIT_ViewWindow> windows() const;
+ virtual QList<SUIT_ViewWindow*> windows() const;
void windowOperation( const int );
void setWindowOperations( const int, ... );
- void setWindowOperations( const QValueList<int>& );
+ void setWindowOperations( const QList<int>& );
QtxWorkstack* workstack() const;
protected:
void createActions();
- virtual QWidget* parentArea() const;
+ virtual void addWindow( QWidget* );
private:
int operationFlag( const int ) const;
private:
QtxWorkstack* myWorkstack;
- QtxWorkstackAction* myWorkstackAction;
+// QtxWorkstackAction* myWorkstackAction;
};
-#if defined WNT
+#if defined WIN32
#pragma warning( default: 4251 )
#endif
+++ /dev/null
-# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# This is a Qt message file in .po format. Each msgid starts with
-# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
-# would be translated to "Pub", not "Foo::Pub".
-msgid ""
-msgstr ""
-"Project-Id-Version: example-Qt-message-extraction\n"
-"POT-Creation-Date: 1999-02-23 15:38+0200\n"
-"PO-Revision-Date: 1999-02-23 15:38+0200\n"
-"Last-Translator: \n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-msgid "ICON_DESK_DEFAULTICON"
-msgstr "default.png"
-
-msgid "ICON_APP_DEFAULTICON"
-msgstr "default.png"
-
-msgid "ICON_FILE_NEW"
-msgstr "new.png"
-
-msgid "ICON_FILE_OPEN"
-msgstr "open.png"
-
-msgid "ICON_FILE_SAVE"
-msgstr "save.png"
-
-msgid "ICON_FILE_CLOSE"
-msgstr "close.png"
-
-msgid "ICON_EDIT_CUT"
-msgstr "cut.png"
-
-msgid "ICON_EDIT_COPY"
-msgstr "copy.png"
-
-msgid "ICON_EDIT_PASTE"
-msgstr "paste.png"
-
-msgid "ICON_HELP"
-msgstr "help.png"
-
-msgid "ICON_PRINT"
-msgstr "print.png"
-
-msgid "ICON_RESET"
-msgstr "reset.png"
-
-msgid "ICON_DESK_WINDOW_CASCADE"
-msgstr "cascade.png"
-
-msgid "ICON_DESK_WINDOW_TILE"
-msgstr "tile.png"
-
-msgid "ICON_DESK_WINDOW_VTILE"
-msgstr "vtile.png"
-
-msgid "ICON_DESK_WINDOW_HTILE"
-msgstr "htile.png"
-
-msgid "ICON_DESK_WINDOW_VSPLIT"
-msgstr "vtile.png"
-
-msgid "ICON_DESK_WINDOW_HSPLIT"
-msgstr "htile.png"
-
-msgid "ICON_APP_EDIT_UNDO"
-msgstr "undo.png"
-
-msgid "ICON_APP_EDIT_REDO"
-msgstr "redo.png"
-
-msgid "SUIT_ViewPort::ICON_CURSOR_ROTATE"
-msgstr "cursor_rotate.png"
-
-msgid "SUIT_ViewPort::ICON_CURSOR_ZOOM"
-msgstr "cursor_zoom.png"
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1" language="en_GB">
+<context>
+ <name>@default</name>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_FILE_NEW</source>
+ <translation>new.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_DESK_WINDOW_TILE</source>
+ <translation>tile.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_PRINT</source>
+ <translation>print.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_RESET</source>
+ <translation>reset.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_HELP</source>
+ <translation>help.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_EDIT_CUT</source>
+ <translation>cut.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_DESK_WINDOW_CASCADE</source>
+ <translation>cascade.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_EDIT_COPY</source>
+ <translation>copy.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_APP_DEFAULTICON</source>
+ <translation>default.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_FILE_SAVE</source>
+ <translation>save.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_FILE_OPEN</source>
+ <translation>open.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_DESK_WINDOW_HSPLIT</source>
+ <translation>htile.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_APP_EDIT_REDO</source>
+ <translation>redo.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_APP_EDIT_UNDO</source>
+ <translation>undo.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_DESK_WINDOW_VSPLIT</source>
+ <translation>vtile.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_DESK_DEFAULTICON</source>
+ <translation>default.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_DESK_WINDOW_HTILE</source>
+ <translation>htile.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_DESK_WINDOW_VTILE</source>
+ <translation>vtile.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_EDIT_PASTE</source>
+ <translation>paste.png</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ICON_FILE_CLOSE</source>
+ <translation>close.png</translation>
+ </message>
+</context>
+</TS>
+++ /dev/null
-# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# This is a Qt message file in .po format. Each msgid starts with
-# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
-# would be translated to "Pub", not "Foo::Pub".
-msgid ""
-msgstr ""
-"Project-Id-Version: example-Qt-message-extraction\n"
-"POT-Creation-Date: 1999-02-23 15:38+0200\n"
-"PO-Revision-Date: 1999-02-23 15:38+0200\n"
-"Last-Translator: \n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-msgid "INF_READY"
-msgstr "Ready"
-
-msgid "BUT_OK"
-msgstr "&Ok"
-
-msgid "BUT_CANCEL"
-msgstr "&Cancel"
-
-msgid "BUT_CLOSE"
-msgstr "&Close"
-
-msgid "BUT_HELP"
-msgstr "&Help"
-
-msgid "BUT_YES"
-msgstr "&Yes"
-
-msgid "BUT_NO"
-msgstr "&No"
-
-msgid "BUT_APPLY"
-msgstr "&Apply"
-
-msgid "ERR_ERROR"
-msgstr "Error"
-
-msgid "WRN_WARNING"
-msgstr "Warning"
-
-msgid "INF_INFO"
-msgstr "Information"
-
-msgid "FILTER_FILES"
-msgstr "%1 Files (%2)"
-
-msgid "ALL_FILES"
-msgstr "All Files (*.*)"
-
-msgid "INF_CANCELLED"
-msgstr "Cancelled"
-
-msgid "ERR_UNKNOWN"
-msgstr "Unknown error"
-
-## ----------------------------------------------------
-
-msgid "INF_DESK_DOC_CREATE"
-msgstr "Create a new document"
-
-msgid "ERR_APP_NOAPP"
-msgstr "No application"
-
-msgid "INF_DESK_EXIT"
-msgstr "Exit"
-
-msgid "INF_DESK_TOOLBAR_STANDARD"
-msgstr "Standard"
-
-msgid "MEN_DESK_FILE"
-msgstr "&File"
-
-msgid "MEN_DESK_FILE_CLOSE"
-msgstr "&Close"
-
-msgid "MEN_DESK_FILE_EXIT"
-msgstr "E&xit"
-
-msgid "MEN_DESK_FILE_NEW"
-msgstr "&New"
-
-msgid "MEN_DESK_FILE_OPEN"
-msgstr "&Open..."
-
-msgid "MEN_DESK_FILE_PRINT"
-msgstr "&Print"
-
-msgid "MEN_DESK_FILE_SAVE"
-msgstr "&Save"
-
-msgid "MEN_DESK_FILE_SAVEAS"
-msgstr "Save &As..."
-
-msgid "MEN_DESK_EDIT"
-msgstr "&Edit"
-
-msgid "MEN_DESK_EDIT_CUT"
-msgstr "Cu&t"
-
-msgid "MEN_DESK_EDIT_COPY"
-msgstr "&Copy"
-
-msgid "MEN_DESK_EDIT_PASTE"
-msgstr "&Paste"
-
-msgid "MEN_DESK_HELP"
-msgstr "&Help"
-
-msgid "MEN_DESK_HELP_ABOUT"
-msgstr "&About..."
-
-msgid "MEN_DESK_HELP_CONTENTS"
-msgstr "&Contents"
-
-msgid "MEN_DESK_HELP_SEARCH"
-msgstr "&Search..."
-
-msgid "MEN_DESK_VIEW"
-msgstr "&View"
-
-msgid "MEN_DESK_VIEW_TOOLBARS"
-msgstr "T&oolbars"
-
-msgid "MEN_DESK_VIEW_STATUSBAR"
-msgstr "&Status Bar"
-
-msgid "MEN_DESK_VIEW_STDTOOLBAR"
-msgstr "&Standard"
-
-msgid "PRP_DESK_FILE_CLOSE"
-msgstr "Closes the active document"
-
-msgid "PRP_DESK_FILE_EXIT"
-msgstr "Exits the application"
-
-msgid "PRP_DESK_FILE_NEW"
-msgstr "Creates a new document"
-
-msgid "PRP_DESK_FILE_OPEN"
-msgstr "Opens an existing document"
-
-msgid "PRP_DESK_FILE_PRINT"
-msgstr "Prints the active document"
-
-msgid "PRP_DESK_FILE_SAVE"
-msgstr "Saves the active document"
-
-msgid "PRP_DESK_FILE_SAVEAS"
-msgstr "Saves the active document with a new name"
-
-msgid "PRP_DESK_EDIT_CUT"
-msgstr "Cuts the selection and puts it to the Clipboard"
-
-msgid "PRP_DESK_EDIT_COPY"
-msgstr "Copy the selection to the Clipboard"
-
-msgid "PRP_DESK_EDIT_PASTE"
-msgstr "Inserts the Clipboard content at the insertion point"
-
-msgid "PRP_DESK_HELP_ABOUT"
-msgstr "Shows \'About\' dialog"
-
-msgid "PRP_DESK_HELP_CONTENTS"
-msgstr "Shows the whole help contents"
-
-msgid "PRP_DESK_HELP_SEARCH"
-msgstr "Searches help for a topic"
-
-msgid "PRP_DESK_VIEW_STATUSBAR"
-msgstr "Toggles status bar view on/off"
-
-msgid "PRP_DESK_VIEW_STDTOOLBAR"
-msgstr "Toggles standard toolbar on/off"
-
-msgid "QUE_DESK_EXIT"
-msgstr "Do you really want to quit ?"
-
-msgid "TOT_DESK_FILE_NEW"
-msgstr "New document"
-
-msgid "TOT_DESK_FILE_OPEN"
-msgstr "Open document"
-
-msgid "TOT_DESK_FILE_CLOSE"
-msgstr "Close document"
-
-msgid "TOT_DESK_FILE_PRINT"
-msgstr "Print document"
-
-msgid "TOT_DESK_FILE_SAVE"
-msgstr "Save document"
-
-msgid "TOT_DESK_FILE_SAVEAS"
-msgstr "Save document as..."
-
-msgid "TOT_DESK_FILE_EXIT"
-msgstr "Exit from application"
-
-msgid "TOT_DESK_EDIT_CUT"
-msgstr "Cut"
-
-msgid "TOT_DESK_EDIT_COPY"
-msgstr "Copy"
-
-msgid "TOT_DESK_EDIT_PASTE"
-msgstr "Paste"
-
-msgid "TOT_DESK_HELP_ABOUT"
-msgstr "About..."
-
-msgid "STD_Application::TOT_DOCK_WINDOWS"
-msgstr "Show / hide dockable windows and toolbars"
-
-msgid "STD_Application::MEN_DOCK_WINDOWS"
-msgstr "Windows and Toolbars"
-
-msgid "ERR_DOC_UNKNOWNTYPE_OPEN"
-msgstr "You are trying to open a document of an unknown type\n( %1 )"
-
-msgid "ERR_DOC_UNKNOWNTYPE_SAVE"
-msgstr "You are trying to save this document under an unknown type\n( %1 )"
-
-msgid "ERR_DOC_PERMISSIONDENIED_SAVE"
-msgstr "Can not save file %1. Permission denied"
-
-msgid "ERR_DOC_DIRWITHNAMEEXIST_SAVE"
-msgstr "Can not save file %1.\nDirectory with this name exist on disc. Try to use another name"
-
-msgid "QUE_DOC_FILEEXISTS"
-msgstr "The file %1 already exists.\nDo you want to overwrite it ?"
-
-msgid "ERR_DESK_NOAPP"
-msgstr "No applications registered"
-
-msgid "DESK_DEFAULTTITLE"
-msgstr "Qt Application Desktop"
-
-msgid "QUE_DOC_ALREADYOPEN"
-msgstr "The document %1 is already open.\nDo you want to reload it ?"
-
-msgid "MEN_DESK_WINDOW"
-msgstr "&Window"
-
-msgid "MEN_DESK_NEWWINDOW"
-msgstr "&New Window"
-
-msgid "TOT_DESK_NEWWINDOW"
-msgstr "Create new Window"
-
-msgid "PRP_DESK_NEWWINDOW"
-msgstr "Create new Window"
-
-msgid "MEN_DESK_WINDOW_CASCADE"
-msgstr "&Cascade"
-
-msgid "PRP_DESK_WINDOW_CASCADE"
-msgstr "Arranges the windows as overlapping tiles"
-
-msgid "MEN_DESK_WINDOW_TILE"
-msgstr "&Tile"
-
-msgid "PRP_DESK_WINDOW_TILE"
-msgstr "Arranges the windows as nonoverlapping tiles"
-
-msgid "MEN_DESK_WINDOW_HTILE"
-msgstr "Tile &Horizontally"
-
-msgid "PRP_DESK_WINDOW_HTILE"
-msgstr "Arranges the windows as nonoverlapping horizontal tiles"
-
-msgid "MEN_DESK_WINDOW_VTILE"
-msgstr "Tile &Vertically"
-
-msgid "PRP_DESK_WINDOW_VTILE"
-msgstr "Arranges the windows as nonoverlapping vertical tiles"
-
-msgid "PRP_DESK_WINDOW_ACTIVATE"
-msgstr "Activates this window"
-
-msgid "MEN_DESK_WINDOW_HSPLIT"
-msgstr "Split &Horizontally"
-
-msgid "PRP_DESK_WINDOW_HSPLIT"
-msgstr "Splits the active window on two horizontal parts"
-
-msgid "MEN_DESK_WINDOW_VSPLIT"
-msgstr "Split &Vertically"
-
-msgid "PRP_DESK_WINDOW_VSPLIT"
-msgstr "Splits the active window on two vertical parts"
-
-msgid "INF_DESK_DOCALREADYOPEN"
-msgstr "A document cannot be saved under a name of a document already opened.\nPlease, type another name for the document you want to save.\n( %1 )"
-
-msgid "MEN_DESK_FILE_MRU"
-msgstr "Recent &Files"
-
-msgid "PRP_DESK_FILE_MRU"
-msgstr "Opens a document"
-
-msgid "STD_Application::ABOUT_INFO"
-msgstr "SUIT Std application"
-
-msgid "MSG_FILE_EXISTS"
-msgstr "File \"%1\" already exists.\nDo you want to overwrite it?"
-
-msgid "MSG_CANT_SAVE"
-msgstr "Can't save file \"%1\"."
-
-msgid "TIT_FILE_SAVEAS"
-msgstr "Save As"
-
-msgid "STD_Application::INF_DOC_MODIFIED"
-msgstr "Document has been modified.\nDo you want to save changes?"
-
-msgid "STD_Application::INF_DOCUMENT_MODIFIED"
-msgstr "Document \"%1\" has been modified.\nDo you want to save changes?"
-
-msgid "STD_Application::INF_DOC_SAVED"
-msgstr "Study %1 saved"
-
-msgid "STD_Application::INF_DOC_SAVING"
-msgstr "Saving study "
-
-msgid "STD_Application::INF_DOC_SAVING_FAILS"
-msgstr "Can't save file \"%1\".\nPossible reason is permission denied or disc full.\nTry to use another file name."
-
-msgid "CLOSE_DLG_SAVE_CLOSE"
-msgstr "&Save&&Close"
-
-msgid "CLOSE_DLG_CLOSE"
-msgstr "C&lose w/o saving"
-
-msgid "CLOSE_DLG_UNLOAD"
-msgstr "&Unload"
-
-msgid "TOT_DESK_FILE_LOAD"
-msgstr "Load document"
-
-msgid "PRP_DESK_FILE_LOAD"
-msgstr "Load a document"
-
-msgid "MEN_DESK_FILE_LOAD"
-msgstr "Conn&ect..."
-
-msgid "CLOSE_DLG_CAPTION"
-msgstr "Close active study"
-
-msgid "CLOSE_DLG_DESCRIPTION"
-msgstr "Do you want to close or only unload the study"
-
-msgid "DLG_LOAD_STUDY_CAPTION"
-msgstr "Load Study"
-
-msgid "MEN_STUDIES_CHOICE"
-msgstr "Choose existent study."
-
-
-
-
--- /dev/null
+<!DOCTYPE TS><TS>
+<context>
+ <name>@default</name>
+ <message>
+ <source>TOT_DESK_EDIT_CUT</source>
+ <translation>Cut</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_EDIT_CUT</source>
+ <translation>Cuts the selection and puts it to the Clipboard</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_EDIT_CUT</source>
+ <translation>Cu&t</translation>
+ </message>
+ <message>
+ <source>ERR_APP_NOAPP</source>
+ <translation>No application</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW</source>
+ <translation>&Window</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_EDIT_COPY</source>
+ <translation>Copy</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_CASCADE</source>
+ <translation>&Cascade</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_EDIT_COPY</source>
+ <translation>Copy the selection to the Clipboard</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_CASCADE</source>
+ <translation>Arranges the windows as overlapping tiles</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_SAVEAS</source>
+ <translation>Save document as...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_EDIT_COPY</source>
+ <translation>&Copy</translation>
+ </message>
+ <message>
+ <source>MSG_CANT_SAVE</source>
+ <translation>Can't save file "%1".</translation>
+ </message>
+ <message>
+ <source>INF_DESK_TOOLBAR_STANDARD</source>
+ <translation>Standard</translation>
+ </message>
+ <message>
+ <source>ALL_FILES</source>
+ <translation>All Files (*.*)</translation>
+ </message>
+ <message>
+ <source>DESK_DEFAULTTITLE</source>
+ <translation>Qt Application Desktop</translation>
+ </message>
+ <message>
+ <source>QUE_DESK_EXIT</source>
+ <translation>Do you really want to quit ?</translation>
+ </message>
+ <message>
+ <source>INF_INFO</source>
+ <translation>Information</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_UNKNOWNTYPE_OPEN</source>
+ <translation>You are trying to open a document of an unknown type
+( %1 )</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_UNKNOWNTYPE_SAVE</source>
+ <translation>You are trying to save this document under an unknown type
+( %1 )</translation>
+ </message>
+ <message>
+ <source>CLOSE_DLG_UNLOAD</source>
+ <translation>&Unload</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_NEWWINDOW</source>
+ <translation>Create new Window</translation>
+ </message>
+ <message>
+ <source>BUT_CANCEL</source>
+ <translation>&Cancel</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_HELP_ABOUT</source>
+ <translation>&About...</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_NEWWINDOW</source>
+ <translation>Create new Window</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_VIEW_STATUSBAR</source>
+ <translation>&Status Bar</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_NEWWINDOW</source>
+ <translation>&New Window</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_VIEW_STATUSBAR</source>
+ <translation>Toggles status bar view on/off</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_DIRWITHNAMEEXIST_SAVE</source>
+ <translation>Can not save file %1.
+Directory with this name exist on disc. Try to use another name</translation>
+ </message>
+ <message>
+ <source>BUT_NO</source>
+ <translation>&No</translation>
+ </message>
+ <message>
+ <source>BUT_OK</source>
+ <translation>&Ok</translation>
+ </message>
+ <message>
+ <source>FILTER_FILES</source>
+ <translation>%1 Files (%2)</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_ACTIVATE</source>
+ <translation>Activates this window</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_PRINT</source>
+ <translation>Print document</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_CLOSE</source>
+ <translation>Close document</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_NEW</source>
+ <translation>New document</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_NEW</source>
+ <translation>Creates a new document</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_MRU</source>
+ <translation>Opens a document</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_NEW</source>
+ <translation>&New</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_MRU</source>
+ <translation>Recent &Files</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_EDIT_PASTE</source>
+ <translation>Paste</translation>
+ </message>
+ <message>
+ <source>BUT_YES</source>
+ <translation>&Yes</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_VIEW</source>
+ <translation>&View</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_HELP_ABOUT</source>
+ <translation>Shows 'About' dialog</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE</source>
+ <translation>&File</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_EDIT</source>
+ <translation>&Edit</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_HELP</source>
+ <translation>&Help</translation>
+ </message>
+ <message>
+ <source>ERR_ERROR</source>
+ <translation>Error</translation>
+ </message>
+ <message>
+ <source>ERR_DESK_NOAPP</source>
+ <translation>No applications registered</translation>
+ </message>
+ <message>
+ <source>CLOSE_DLG_CLOSE</source>
+ <translation>C&lose w/o saving</translation>
+ </message>
+ <message>
+ <source>INF_DESK_DOC_CREATE</source>
+ <translation>Create a new document</translation>
+ </message>
+ <message>
+ <source>QUE_DOC_ALREADYOPEN</source>
+ <translation>The document %1 is already open.
+Do you want to reload it ?</translation>
+ </message>
+ <message>
+ <source>BUT_APPLY</source>
+ <translation>&Apply</translation>
+ </message>
+ <message>
+ <source>BUT_CLOSE</source>
+ <translation>&Close</translation>
+ </message>
+ <message>
+ <source>INF_DESK_EXIT</source>
+ <translation>Exit</translation>
+ </message>
+ <message>
+ <source>ERR_UNKNOWN</source>
+ <translation>Unknown error</translation>
+ </message>
+ <message>
+ <source>BUT_HELP</source>
+ <translation>&Help</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_CLOSE</source>
+ <translation>Closes the active document</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_PRINT</source>
+ <translation>Prints the active document</translation>
+ </message>
+ <message>
+ <source>WRN_WARNING</source>
+ <translation>Warning</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_HELP_ABOUT</source>
+ <translation>About...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_VIEW_TOOLBARS</source>
+ <translation>T&oolbars</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_HSPLIT</source>
+ <translation>Splits the active window on two horizontal parts</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_HSPLIT</source>
+ <translation>Split &Horizontally</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_EDIT_PASTE</source>
+ <translation>Inserts the Clipboard content at the insertion point</translation>
+ </message>
+ <message>
+ <source>DLG_LOAD_STUDY_CAPTION</source>
+ <translation>Load Study</translation>
+ </message>
+ <message>
+ <source>CLOSE_DLG_CAPTION</source>
+ <translation>Close active study</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_HELP_SEARCH</source>
+ <translation>Searches help for a topic</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_SAVEAS</source>
+ <translation>Saves the active document with a new name</translation>
+ </message>
+ <message>
+ <source>INF_READY</source>
+ <translation>Ready</translation>
+ </message>
+ <message>
+ <source>INF_CANCELLED</source>
+ <translation>Cancelled</translation>
+ </message>
+ <message>
+ <source>CLOSE_DLG_SAVE_CLOSE</source>
+ <translation>&Save&&Close</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_VSPLIT</source>
+ <translation>Splits the active window on two vertical parts</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_VSPLIT</source>
+ <translation>Split &Vertically</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_TILE</source>
+ <translation>Arranges the windows as nonoverlapping tiles</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_HELP_CONTENTS</source>
+ <translation>&Contents</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_HELP_CONTENTS</source>
+ <translation>Shows the whole help contents</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_HTILE</source>
+ <translation>Tile &Horizontally</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_VTILE</source>
+ <translation>Tile &Vertically</translation>
+ </message>
+ <message>
+ <source>ERR_DOC_PERMISSIONDENIED_SAVE</source>
+ <translation>Can not save file %1. Permission denied</translation>
+ </message>
+ <message>
+ <source>INF_DESK_DOCALREADYOPEN</source>
+ <translation>A document cannot be saved under a name of a document already opened.
+Please, type another name for the document you want to save.
+( %1 )</translation>
+ </message>
+ <message>
+ <source>TIT_FILE_SAVEAS</source>
+ <translation>Save As</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_CLOSE</source>
+ <translation>&Close</translation>
+ </message>
+ <message>
+ <source>MSG_FILE_EXISTS</source>
+ <translation>File "%1" already exists.
+Do you want to overwrite it?</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_PRINT</source>
+ <translation>&Print</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_HELP_SEARCH</source>
+ <translation>&Search...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_VIEW_STDTOOLBAR</source>
+ <translation>&Standard</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_SAVEAS</source>
+ <translation>Save &As...</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_VIEW_STDTOOLBAR</source>
+ <translation>Toggles standard toolbar on/off</translation>
+ </message>
+ <message>
+ <source>QUE_DOC_FILEEXISTS</source>
+ <translation>The file %1 already exists.
+Do you want to overwrite it ?</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_SAVE</source>
+ <translation>Save document</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_EXIT</source>
+ <translation>Exit from application</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_LOAD</source>
+ <translation>Load document</translation>
+ </message>
+ <message>
+ <source>TOT_DESK_FILE_OPEN</source>
+ <translation>Open document</translation>
+ </message>
+ <message>
+ <source>CLOSE_DLG_DESCRIPTION</source>
+ <translation>Do you want to close or only unload the study</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_EXIT</source>
+ <translation>Exits the application</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_OPEN</source>
+ <translation>Opens an existing document</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_SAVE</source>
+ <translation>Saves the active document</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_FILE_LOAD</source>
+ <translation>Load a document</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_HTILE</source>
+ <translation>Arranges the windows as nonoverlapping horizontal tiles</translation>
+ </message>
+ <message>
+ <source>PRP_DESK_WINDOW_VTILE</source>
+ <translation>Arranges the windows as nonoverlapping vertical tiles</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_WINDOW_TILE</source>
+ <translation>&Tile</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_EXIT</source>
+ <translation>E&xit</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_OPEN</source>
+ <translation>&Open...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_LOAD</source>
+ <translation>Conn&ect...</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_FILE_SAVE</source>
+ <translation>&Save</translation>
+ </message>
+ <message>
+ <source>MEN_DESK_EDIT_PASTE</source>
+ <translation>&Paste</translation>
+ </message>
+ <message>
+ <source>MEN_STUDIES_CHOICE</source>
+ <translation>Choose existent study.</translation>
+ </message>
+</context>
+<context>
+ <name>STD_Application</name>
+ <message>
+ <source>INF_DOC_MODIFIED</source>
+ <translation>Document has been modified.
+Do you want to save changes?</translation>
+ </message>
+ <message>
+ <source>INF_DOC_SAVING</source>
+ <translation>Saving study </translation>
+ </message>
+ <message>
+ <source>INF_DOC_SAVED</source>
+ <translation>Study %1 saved</translation>
+ </message>
+ <message>
+ <source>TOT_DOCK_WINDOWS</source>
+ <translation>Show / hide dockable windows and toolbars</translation>
+ </message>
+ <message>
+ <source>MEN_DOCK_WINDOWS</source>
+ <translation>Windows and Toolbars</translation>
+ </message>
+ <message>
+ <source>ABOUT_INFO</source>
+ <translation>SUIT Std application</translation>
+ </message>
+ <message>
+ <source>INF_DOC_SAVING_FAILS</source>
+ <translation>Can't save file "%1".
+Possible reason is permission denied or disc full.
+Try to use another file name.</translation>
+ </message>
+ <message>
+ <source>INF_DOCUMENT_MODIFIED</source>
+ <translation>Document "%1" has been modified.
+Do you want to save changes?</translation>
+ </message>
+</context>
+</TS>
+++ /dev/null
-language=en
--- /dev/null
+TEMPLATE = lib
+DESTDIR = ../../lib
+MOC_DIR = ../../moc
+OBJECTS_DIR = ../../obj/$$TARGET
+
+INCLUDEPATH = ../../include
+LIBS += -L../../lib -lQtx
+
+CONFIG -= debug release debug_and_release
+CONFIG += qt thread debug dll shared
+
+win32:DEFINES += WIN32
+DEFINES += SUIT_EXPORTS
+
+HEADERS = *.h
+
+SOURCES = *.cxx
+
+TRANSLATIONS = resources/SUIT_images.ts \
+ resources/SUIT_msg_en.ts
+
+ICONS = resources/*.png
+
+includes.files = $$HEADERS
+includes.path = ../../include
+
+resources.files = $$ICONS resources/*.qm
+resources.path = ../../resources
+
+INSTALLS += includes resources
+++ /dev/null
-# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# This is a Qt message file in .po format. Each msgid starts with
-# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
-# would be translated to "Pub", not "Foo::Pub".
-msgid ""
-msgstr ""
-"Project-Id-Version: example-Qt-message-extraction\n"
-"POT-Creation-Date: 1999-02-23 15:38+0200\n"
-"PO-Revision-Date: 1999-02-23 15:38+0200\n"
-"Last-Translator: \n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-msgid "ICON_DESK_WINDOW_CASCADE"
-msgstr "cascade.png"
-
-msgid "ICON_DESK_WINDOW_VTILE"
-msgstr "vtile.png"
-
-msgid "ICON_DESK_WINDOW_TILE"
-msgstr "htile.png"
-
--- /dev/null
+<!DOCTYPE TS><TS>
+<context>
+ <name>@default</name>
+ <message>
+ <source>ICON_DESK_WINDOW_TILE</source>
+ <translation>htile.png</translation>
+ </message>
+ <message>
+ <source>ICON_DESK_WINDOW_CASCADE</source>
+ <translation>cascade.png</translation>
+ </message>
+ <message>
+ <source>ICON_DESK_WINDOW_VTILE</source>
+ <translation>vtile.png</translation>
+ </message>
+</context>
+</TS>
+++ /dev/null
-# Copyright (C) 2005 CEA/DEN, EDF R&D, OPEN CASCADE, PRINCIPIA R&D
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2.1 of the License.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-#
-# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# This is a Qt message file in .po format. Each msgid starts with
-# a scope. This scope should *NOT* be translated - eg. "Foo::Bar"
-# would be translated to "Pub", not "Foo::Pub".
-msgid ""
-msgstr ""
-"Project-Id-Version: example-Qt-message-extraction\n"
-"POT-Creation-Date: 1999-02-23 15:38+0200\n"
-"PO-Revision-Date: 1999-02-23 15:38+0200\n"
-"Last-Translator: \n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-
-msgid "MEN_DESK_WINDOW"
-msgstr "&Window"
-
-msgid "MEN_DESK_WINDOW_CASCADE"
-msgstr "&Cascade"
-
-msgid "PRP_DESK_WINDOW_CASCADE"
-msgstr "Arranges the windows as overlapping tiles"
-
-msgid "MEN_DESK_WINDOW_TILE"
-msgstr "&Tile"
-
-msgid "PRP_DESK_WINDOW_TILE"
-msgstr "Arranges the windows as nonoverlapping tiles"
-
-msgid "MEN_DESK_WINDOW_VTILE"
-msgstr "Tile &Vertically"
-
-msgid "PRP_DESK_WINDOW_VTILE"
-msgstr "Arranges the windows as nonoverlapping vertical tiles"
-
-msgid "PRP_DESK_WINDOW_ACTIVATE"
-msgstr "Activates this window"
-
-msgid "LAB_QUICK_PATH"
-msgstr "Quick path:"
-
-msgid "BUT_ADD_PATH"
-msgstr "Add path"
-
-msgid "INF_DESK_DOC_OPEN"
-msgstr "Open File"
-
-msgid "INF_DESK_DOC_SAVE"
-msgstr "Save File"
-
-msgid "ERR_ERROR"
-msgstr "Error"
-
-msgid "WRN_WARNING"
-msgstr "Warning"
-
-msgid "ERR_DIR_NOT_EXIST"
-msgstr "The directory \"%1\" does not exist!"
-
-msgid "ERR_FILE_NOT_EXIST"
-msgstr "The file \"%1\" does not exist!"
-
-msgid "ERR_PERMISSION_DENIED"
-msgstr "Can't save file \"%1\".\nPermission denied."
-
-msgid "INF_DIRECTORIES_FILTER"
-msgstr "Directories"
-
-msgid "QUE_FILE_EXISTS"
-msgstr "The file \"%1\" already exists.\nDo you want to overwrite it?"
-
-msgid "TLT_DUMP_VIEW"
-msgstr "Dump View to File"
-
-msgid "TLT_IMAGE_FILES"
-msgstr "Images Files (*.bmp *.png *.jpg *.jpeg)""
-
-msgid "ERR_CANT_DUMP_VIEW"
-msgstr "Can't dump view contents to the file."
-
-msgid "CONTINUE"
-msgstr "Continue"
-
-msgid "CANCEL"
-msgstr "Cancel"
-
-#======================================================================
-
-msgid "SUIT_Study::OPERATION_LAUNCH"
-msgstr "Operation launch"
-
-msgid "SUIT_Study::PREVIOUS_NOT_FINISHED"
-msgstr "Previous operation is not finished and will be aborted"
-
-#======================================================================
-
-
-
-
-
-
-
-
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE TS><TS version="1.1" language="ms">
+<context>
+ <name>@default</name>
+ <message>
+ <location filename="" line="0"/>
+ <source>MEN_DESK_WINDOW</source>
+ <translation>&Window</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ERR_CANT_DUMP_VIEW</source>
+ <translation>Can't dump view contents to the file.</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>TLT_IMAGE_FILES</source>
+ <translation>Images Files (*.bmp *.png *.jpg *.jpeg)</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>MEN_DESK_WINDOW_CASCADE</source>
+ <translation>&Cascade</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>PRP_DESK_WINDOW_CASCADE</source>
+ <translation>Arranges the windows as overlapping tiles</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ERR_DIR_NOT_EXIST</source>
+ <translation>The directory "%1" does not exist!</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>LAB_QUICK_PATH</source>
+ <translation>Quick path:</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>CONTINUE</source>
+ <translation>Continue</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>CANCEL</source>
+ <translation>Cancel</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ERR_FILE_NOT_EXIST</source>
+ <translation>The file "%1" does not exist!</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>PRP_DESK_WINDOW_ACTIVATE</source>
+ <translation>Activates this window</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ERR_PERMISSION_DENIED</source>
+ <translation>Can't save file "%1".
+Permission denied.</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>ERR_ERROR</source>
+ <translation>Error</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>QUE_FILE_EXISTS</source>
+ <translation>The file "%1" already exists.
+Do you want to overwrite it?</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>WRN_WARNING</source>
+ <translation>Warning</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>TLT_DUMP_VIEW</source>
+ <translation>Dump View to File</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>INF_DESK_DOC_OPEN</source>
+ <translation>Open File</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>INF_DESK_DOC_SAVE</source>
+ <translation>Save File</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>PRP_DESK_WINDOW_TILE</source>
+ <translation>Arranges the windows as nonoverlapping tiles</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>BUT_ADD_PATH</source>
+ <translation>Add path</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>MEN_DESK_WINDOW_VTILE</source>
+ <translation>Tile &Vertically</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>INF_DIRECTORIES_FILTER</source>
+ <translation>Directories</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>PRP_DESK_WINDOW_VTILE</source>
+ <translation>Arranges the windows as nonoverlapping vertical tiles</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>MEN_DESK_WINDOW_TILE</source>
+ <translation>&Tile</translation>
+ </message>
+</context>
+<context>
+ <name>SUIT_Study</name>
+ <message>
+ <location filename="" line="0"/>
+ <source>OPERATION_LAUNCH</source>
+ <translation>Operation launch</translation>
+ </message>
+ <message>
+ <location filename="" line="0"/>
+ <source>PREVIOUS_NOT_FINISHED</source>
+ <translation>Previous operation is not finished and will be aborted</translation>
+ </message>
+</context>
+</TS>