Salome HOME
Merge remote branch 'origin/Doc_update_ver741' into V7_5_BR
authorvsr <vsr@opencascade.com>
Mon, 10 Nov 2014 08:20:45 +0000 (11:20 +0300)
committervsr <vsr@opencascade.com>
Mon, 10 Nov 2014 08:20:45 +0000 (11:20 +0300)
50 files changed:
CMakeLists.txt
src/CAF/CAF_Study.cxx
src/DDS/DDS_Dictionary.cxx
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/LightApp/LightApp_PyInterp.h
src/OBJECT/SALOME_InteractiveObject.hxx
src/OCCViewer/OCCViewer_ClippingDlg.cxx
src/OCCViewer/OCCViewer_CubeAxesDlg.cxx
src/OCCViewer/OCCViewer_ViewModel.cxx
src/OCCViewer/OCCViewer_ViewModel.h
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/OCCViewer/resources/OCCViewer_msg_en.ts
src/OCCViewer/resources/OCCViewer_msg_fr.ts
src/OCCViewer/resources/OCCViewer_msg_ja.ts
src/PVViewer/PVViewer_GUIElements.cxx
src/PVViewer/PVViewer_GUIElements.h
src/PVViewer/PVViewer_ViewManager.cxx
src/PVViewer/PVViewer_ViewManager.h
src/PVViewer/PVViewer_ViewWindow.cxx
src/PyConsole/PyConsole_Console.cxx
src/PyConsole/PyConsole_Console.h
src/PyConsole/PyConsole_Editor.cxx
src/PyConsole/PyConsole_Editor.h
src/PyConsole/PyConsole_EnhEditor.cxx
src/PyConsole/PyConsole_EnhEditor.h
src/PyConsole/PyConsole_EnhInterp.cxx
src/PyConsole/PyConsole_EnhInterp.h
src/PyConsole/PyConsole_Interp.cxx
src/PyConsole/PyConsole_Interp.h
src/PyConsole/PyConsole_Request.cxx
src/PyConsole/PyConsole_Request.h
src/Qtx/QtxRubberBand.cxx
src/SOCC/SOCC_ViewModel.cxx
src/SVTK/resources/SVTK_msg_en.ts
src/SVTK/resources/SVTK_msg_fr.ts
src/SVTK/resources/SVTK_msg_ja.ts
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Application.h
src/SalomeApp/SalomeApp_DoubleSpinBox.cxx
src/SalomeApp/SalomeApp_ExceptionHandler.cxx
src/SalomeApp/SalomeApp_IntSpinBox.cxx
src/SalomeApp/SalomeApp_NoteBook.cxx
src/SalomeApp/SalomeApp_PyInterp.h
src/SalomeApp/SalomeApp_Study.cxx
src/Session/SALOME_Session_Server.cxx
src/TreeData/TreeItem.cxx
src/TreeData/TreeItem.hxx
src/TreeData/TreeModel.cxx
src/TreeData/TreeModel.hxx

index 274140c448887ad528b8a98283fb324cf6e13c5b..2ce226a174b9d7d1959f9ebba93ec62d8bb68850 100755 (executable)
@@ -30,11 +30,11 @@ CMAKE_POLICY(SET CMP0003 NEW)
 STRING(TOUPPER ${PROJECT_NAME} PROJECT_NAME_UC)
 
 SET(${PROJECT_NAME_UC}_MAJOR_VERSION 7)
-SET(${PROJECT_NAME_UC}_MINOR_VERSION 4)
-SET(${PROJECT_NAME_UC}_PATCH_VERSION 1)
+SET(${PROJECT_NAME_UC}_MINOR_VERSION 5)
+SET(${PROJECT_NAME_UC}_PATCH_VERSION 0)
 SET(${PROJECT_NAME_UC}_VERSION
   ${${PROJECT_NAME_UC}_MAJOR_VERSION}.${${PROJECT_NAME_UC}_MINOR_VERSION}.${${PROJECT_NAME_UC}_PATCH_VERSION})
-SET(${PROJECT_NAME_UC}_VERSION_DEV 1)
+SET(${PROJECT_NAME_UC}_VERSION_DEV 0)
 
 # Find KERNEL
 # ===========
index 0b60a95fda03f699e000f94fcb53f529a18e3ee5..3b69c88ebd06bac6a02cdb64aa4c1eb052736c75 100755 (executable)
@@ -25,8 +25,6 @@
 #include "CAF_Tools.h"
 #include "CAF_Application.h"
 
-#include <Basics_OCCTVersion.hxx>
-
 #include <SUIT_Desktop.h>
 #include <SUIT_MessageBox.h>
 #include <SUIT_Application.h>
index 823bfe1a881ae57b062102351ef331c55334a622..d22fdb0ba2279d39da44c0e8960efcbd371507ce 100644 (file)
@@ -24,8 +24,6 @@
 
 #include "DDS_KeyWords.h"
 
-#include <Basics_OCCTVersion.hxx>
-
 #include <LDOMString.hxx>
 #include <LDOMParser.hxx>
 
index 3017896cfafb27abbaaf4cc235cd83743b3dd3db..56b3f88527f7a8b1aca507791d8b4e9eef0e14c3 100644 (file)
@@ -58,9 +58,7 @@
 #include "LightApp_WgViewModel.h"
 #include "LightApp_FullScreenHelper.h"
 
-
 #include <GUI_version.h>
-#include <Basics_OCCTVersion.hxx>
 
 #include <SALOME_Event.h>
 
@@ -223,7 +221,6 @@ static const char* imageEmptyIcon[] = {
 
 int LightApp_Application::lastStudyId = 0;
 
-
 // Markers used to parse array with dockable windows and toolbars state.
 // For more details please see the qdockarealayout.cpp && qtoolbararealayout.cpp
 // in the Qt source code.
@@ -1618,7 +1615,7 @@ void LightApp_Application::onStudyCreated( SUIT_Study* theStudy )
 
 #ifndef DISABLE_PYCONSOLE
   if( pythonConsole() )
-    pythonConsole()->getInterp()->initStudy();
+    getPyInterp()->initStudy();
 #endif
 }
 
@@ -1649,7 +1646,7 @@ void LightApp_Application::onStudyOpened( SUIT_Study* theStudy )
 
 #ifndef DISABLE_PYCONSOLE
   if( pythonConsole() )
-    pythonConsole()->getInterp()->initStudy();
+    getPyInterp()->initStudy();
 #endif
 
   emit studyOpened();
@@ -1918,7 +1915,7 @@ QWidget* LightApp_Application::createWindow( const int flag )
 #ifndef DISABLE_PYCONSOLE
   else  if ( flag == WT_PyConsole )
   {
-    PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(),new LightApp_PyInterp());
+    PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(), getPyInterp() );
     pyCons->setObjectName( "pythonConsole" );
     pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) );
     pyCons->setFont(resourceMgr()->fontValue( "PyConsole", "font" ));
@@ -4156,6 +4153,11 @@ void LightApp_Application::onDesktopMessage( const QString& message )
     // update object browser
     updateObjectBrowser();
   }
+  else if ( message.toLower().startsWith( "activate_viewer" ) ) {
+    QString vtype = message.split( sectionSeparator ).last();
+    if ( !vtype.isEmpty() )
+      getViewManager( vtype, true );
+  }
   else {
     QStringList data = message.split( sectionSeparator );
     if ( data.count() > 1 ) {
@@ -4453,3 +4455,19 @@ bool LightApp_Application::checkExistingDoc()
   return result;
 }
 
+#ifndef DISABLE_PYCONSOLE
+
+PyConsole_Interp* LightApp_Application::getPyInterp()
+{
+  static PyConsole_Interp* myInterp = 0;
+  if ( !myInterp )
+    myInterp = createPyInterp();
+  return myInterp;
+}
+
+PyConsole_Interp* LightApp_Application::createPyInterp()
+{
+  return new LightApp_PyInterp();
+}
+
+#endif // DISABLE_PYCONSOLE
index 3ea6cb1ddfa5535887b921069f39c8459ab65feb..54be0df781f7e9e4622c2fd155a5b4a1300b2fa7 100644 (file)
@@ -42,6 +42,7 @@
 class LogWindow;
 #ifndef DISABLE_PYCONSOLE
 class PyConsole_Console;
+class PyConsole_Interp;
 #endif
 class LightApp_WidgetContainer;
 class LightApp_Preferences;
@@ -182,6 +183,10 @@ public:
 
   virtual bool                        checkExistingDoc();
 
+#ifndef DISABLE_PYCONSOLE
+  PyConsole_Interp*                   getPyInterp();
+#endif
+
 signals:
   void                                studyOpened();
   void                                studySaved();
@@ -231,6 +236,10 @@ protected:
   virtual QMap<int, QString>          activateModuleActions() const;
   virtual void                        moduleActionSelected( const int );
 
+#ifndef DISABLE_PYCONSOLE
+  virtual PyConsole_Interp*           createPyInterp();
+#endif
+
 protected slots:
   virtual void                        onDesktopActivated();
   virtual void                        onViewManagerRemoved( SUIT_ViewManager* );
index de8c2663666c9b9559c980d5b5558e42850ba591..7f35fbb25d19fdf8201407e45dd643d9d838d455 100644 (file)
 
 class LightApp_PyInterp : public PyConsole_EnhInterp
 {
+  friend class LightApp_Application;
+
 public:
-  LightApp_PyInterp();
   virtual ~LightApp_PyInterp();
   
 protected:
+  LightApp_PyInterp();
   virtual void initPython();
 };
 
index 17c29310a8407122a88aa6945ad15f59f0ef87b8..df63cd8cc16dc525609629bde7834c82dd36f64f 100755 (executable)
@@ -59,7 +59,7 @@ public:
   Standard_EXPORT   Standard_Boolean isComponentType(const char* ComponentDataType); 
 
   // Must be defined for using by NCollection for ceratin of data map
-  friend Standard_Boolean IsEqual(const Handle(SALOME_InteractiveObject)& anIO1,
+  Standard_EXPORT friend Standard_Boolean IsEqual(const Handle(SALOME_InteractiveObject)& anIO1,
                                  const Handle(SALOME_InteractiveObject)& anIO2);
 
 protected:
index ec75a10529ccbf4c4e93c1cfaddddf4078b41f33..2c993287b88d4b1f749a61981607c80e007d97ea 100644 (file)
@@ -37,6 +37,8 @@
 #include "OCCViewer_ViewManager.h"
 #include "OCCViewer_ClipPlaneInteractor.h"
 
+#include <Basics_OCCTVersion.hxx>
+
 #include <V3d_View.hxx>
 #include <Visual3d_View.hxx>
 #include <Geom_Plane.hxx>
@@ -92,7 +94,17 @@ void getMinMaxFromContext( Handle(AIS_InteractiveContext) ic,
       if ( !aPrs->IsEmpty() && !aPrs->IsInfinite() ) {
         isFound = true;
         double xmin, ymin, zmin, xmax, ymax, zmax;
+#if OCC_VERSION_LARGE > 0x06070100
+       Bnd_Box aBox = aPrs->MinMaxValues();
+       xmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X();
+       ymin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y();
+       zmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Z();
+       xmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().X();
+       ymax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().Y();
+       zmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().Z();
+#else
         aPrs->MinMaxValues( xmin, ymin, zmin, xmax, ymax, zmax );
+#endif
         aXMin = qMin( aXMin, xmin );  aXMax = qMax( aXMax, xmax );
         aYMin = qMin( aYMin, ymin );  aYMax = qMax( aYMax, ymax );
         aZMin = qMin( aZMin, zmin );  aZMax = qMax( aZMax, zmax );
index 31561c3a5893a5c5396acecf28e1adf77777f373..c62789d55bc8612dd626d52683a5e55c3802870d 100644 (file)
@@ -29,8 +29,6 @@
 #include "QtxAction.h"
 #include "QtxIntSpinBox.h"
 
-#include <Basics_OCCTVersion.hxx>
-
 #include <QCheckBox>
 #include <QGroupBox>
 #include <QLineEdit>
index 64e558564f96c8a5acfbaad70984d93c67b91ce4..ae9e8639f91e23d97a48391bcf5ddd38a1fdce86 100755 (executable)
@@ -36,6 +36,8 @@
 
 #include "ViewerData_AISShape.hxx"
 
+#include <Basics_OCCTVersion.hxx>
+
 #include "QtxActionToolMgr.h"
 #include "QtxBackgroundTool.h"
 
@@ -956,7 +958,17 @@ double OCCViewer_Viewer::computeSceneSize(const Handle(V3d_View)& view3d) const
   double aMaxSide = 0;
   double Xmin = 0, Ymin = 0, Zmin = 0, Xmax = 0, Ymax = 0, Zmax = 0;
 
+#if OCC_VERSION_LARGE > 0x06070100
+  Bnd_Box aBox = view3d->View()->MinMaxValues();
+  Xmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X();
+  Ymin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y();
+  Zmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Z();
+  Xmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().X();
+  Ymax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().Y();
+  Zmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().Z();
+#else
   view3d->View()->MinMaxValues( Xmin, Ymin, Zmin, Xmax, Ymax, Zmax );
+#endif
 
   if ( Xmin != RealFirst() && Ymin != RealFirst() && Zmin != RealFirst() &&
        Xmax != RealLast()  && Ymax != RealLast()  && Zmax != RealLast() )
index 5ca95ef263c4f5a70746d9c00cef6ddd9983b605..685e362b029a80e8950426bd7e7f0fa16589115f 100755 (executable)
@@ -36,7 +36,6 @@
 #include <V3d_View.hxx>
 #include <AIS_Trihedron.hxx>
 #include <AIS_InteractiveContext.hxx>
-#include <Basics_OCCTVersion.hxx>
 #include <Graphic3d_SequenceOfHClipPlane.hxx>
 
 class QKeyEvent;
index 4f38b4110457ec4c72197a4a339772a760272b08..2fa68a577e0317016ab4664bc643cc620fffe8b3 100755 (executable)
@@ -651,7 +651,17 @@ bool OCCViewer_ViewWindow::computeGravityCenter( double& theX, double& theY, dou
       continue;
     }
 
+#if OCC_VERSION_LARGE > 0x06070100
+    Bnd_Box aBox = aStructure->MinMaxValues();
+    aXmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().X();
+    aYmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Y();
+    aZmin = aBox.IsVoid() ? RealFirst() : aBox.CornerMin().Z();
+    aXmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().X();
+    aYmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().Y();
+    aZmax = aBox.IsVoid() ? RealLast()  : aBox.CornerMax().Z();
+#else
     aStructure->MinMaxValues( aXmin, aYmin, aZmin, aXmax, aYmax, aZmax );
+#endif
 
     // Infinite structures are skipped
     Standard_Real aLIM = ShortRealLast() - 1.0;
index 09bd1217e41edecffe60a1b181930960b8f1df09..710c6907db8697d55a38ebdf57c5c6eab667b48d 100644 (file)
     <name>OCCViewer_AxialScaleDlg</name>
     <message>
         <source>DLG_SCALING</source>
-        <translation>Axes scaling</translation>
+        <translation>Scaling</translation>
     </message>
     <message>
         <source>LBL_X</source>
index 1ffde87ee234c063758e0662a2496ee7ee3744e4..547a90d8b09de6d0c51833198b144e0d1dc36814 100755 (executable)
     </message>
     <message>
         <source>MNU_SCALING</source>
-        <translation>Changer l&apos;échelle</translation>
+        <translation>Mise à l&apos;échelle</translation>
     </message>
     <message>
         <source>DSC_SCALING</source>
     <name>OCCViewer_AxialScaleDlg</name>
     <message>
         <source>DLG_SCALING</source>
-        <translation>Changer l&apos;échelle des axes</translation>
+        <translation>Mise à l&apos;échelle</translation>
     </message>
     <message>
         <source>LBL_X</source>
index dc12be6ddca1c371d2ce4c26779e5d6f853608ee..c9a97890a870a7471da9a6b5b174b9b50ae4927c 100644 (file)
     </message>
     <message>
       <source>MNU_SCALING</source>
-      <translation>軸のスケーリング</translation>
+      <translation>スケーリング</translation>
     </message>
     <message>
       <source>DSC_SCALING</source>
     <name>OCCViewer_AxialScaleDlg</name>
     <message>
       <source>DLG_SCALING</source>
-      <translation>ã\82¹ã\82±ã\83¼ã\83«ã\81®å¤\89æ\9b´</translation>
+      <translation>ã\82¹ã\82±ã\83¼ã\83ªã\83³ã\82°</translation>
     </message>
     <message>
       <source>LBL_X</source>
index ff139e682c2cff50d2983a86526ccdd9238db051..b68bc1eada5146f0908516c8f70a30116177d288 100644 (file)
@@ -40,14 +40,12 @@ PVViewer_GUIElements::PVViewer_GUIElements(SUIT_Desktop* desk) :
   pipelineBrowserWidget  = new pqPipelineBrowserWidget(desk);
   pipelineBrowserWidget->hide();
 
-  sourcesMenu = new QMenu(desk);
-  pqParaViewMenuBuilders::buildSourcesMenu(*sourcesMenu, desk);
-
-  filtersMenu = new QMenu(desk);
-  pqParaViewMenuBuilders::buildFiltersMenu(*filtersMenu, desk);
-
-  macrosMenu = new QMenu(desk);
-  pqParaViewMenuBuilders::buildMacrosMenu(*macrosMenu);
+//  sourcesMenu = new QMenu(desk);
+//  pqParaViewMenuBuilders::buildSourcesMenu(*sourcesMenu, desk);
+//  filtersMenu = new QPVMenu(desk);
+//  pqParaViewMenuBuilders::buildFiltersMenu(*filtersMenu, desk);
+//  macrosMenu = new QMenu(desk);
+//  pqParaViewMenuBuilders::buildMacrosMenu(*macrosMenu);
 }
 
 PVViewer_GUIElements * PVViewer_GUIElements::GetInstance(SUIT_Desktop* desk)
@@ -57,44 +55,45 @@ PVViewer_GUIElements * PVViewer_GUIElements::GetInstance(SUIT_Desktop* desk)
   return theInstance;
 }
 
-void PVViewer_GUIElements::updateSourcesMenu(QMenu *menu)
-{
-  if (menu)
-    {
-      menu->clear();
-      QList<QAction *> act_list = sourcesMenu->actions();
-      foreach(QAction * a, act_list)
-      {
-        menu->addAction(a);
-      }
-    }
-}
-
-void PVViewer_GUIElements::updateFiltersMenu(QMenu *menu)
-{
-  if (menu)
-    {
-      menu->clear();
-      QList<QAction *> act_list = filtersMenu->actions();
-      foreach(QAction * a, act_list)
-      {
-        menu->addAction(a);
-      }
-    }
-}
-
-void PVViewer_GUIElements::updateMacrosMenu(QMenu *menu)
-{
-  if (menu)
-    {
-      menu->clear();
-      QList<QAction *> act_list = macrosMenu->actions();
-      foreach(QAction * a, act_list)
-      {
-        menu->addAction(a);
-      }
-    }
-}
+//void PVViewer_GUIElements::updateSourcesMenu(QMenu *menu)
+//{
+//  if (menu)
+//    {
+//      menu->clear();
+//      QList<QAction *> act_list = sourcesMenu->actions();
+//      foreach(QAction * a, act_list)
+//      {
+//        menu->addAction(a);
+//      }
+//    }
+//}
+//
+//void PVViewer_GUIElements::updateFiltersMenu(QMenu *menu)
+//{
+//  if (menu)
+//    {
+//      filtersMenu->linkToMenu(menu);
+//      menu->clear();
+//      QList<QAction *> act_list = filtersMenu->actions();
+//      foreach(QAction * a, act_list)
+//      {
+//        menu->addAction(a);
+//      }
+//    }
+//}
+//
+//void PVViewer_GUIElements::updateMacrosMenu(QMenu *menu)
+//{
+//  if (menu)
+//    {
+//      menu->clear();
+//      QList<QAction *> act_list = macrosMenu->actions();
+//      foreach(QAction * a, act_list)
+//      {
+//        menu->addAction(a);
+//      }
+//    }
+//}
 
 
 void PVViewer_GUIElements::onEmulateApply()
index aa22f4b2d9b8d7f18db5af84cb2e326cadbd4fe2..1615efc48ef77cf0dca70a501d747c64665ec657 100644 (file)
@@ -33,8 +33,6 @@ class QMenu;
 /*!
  * Some GUI elements of ParaView need to be instanciated in a proper order. This class
  * holds all of them for the sake of clarity.
- * For example sources menu should be built *before* loading ParaView's configuration, so that the
- * list of sources gets properly populated.
  */
 class PVVIEWER_EXPORT PVViewer_GUIElements: public QObject
 {
@@ -47,9 +45,9 @@ public:
   pqPipelineBrowserWidget * getPipelineBrowserWidget() { return pipelineBrowserWidget; }
 
   // Update the sources menu from what was built in private member 'sourcesMenu'
-  void updateSourcesMenu(QMenu *);
-  void updateFiltersMenu(QMenu *);
-  void updateMacrosMenu(QMenu *);
+//  void updateSourcesMenu(QMenu *);
+//  void updateFiltersMenu(QMenu *);
+//  void updateMacrosMenu(QMenu *);
 
 public slots:
   void onEmulateApply();  // better use the slot from PVViewer_ViewManager if you want to trigger "Apply"
index 74baf63fab3dc3f1617a0c7dc52672b721073006..0d4b2ec4f3f0e5a7f6b75265a408952475a58054 100644 (file)
@@ -135,9 +135,9 @@ void PVViewer_ViewManager::ParaviewInitBehaviors(bool fullSetup, SUIT_Desktop* a
     ParaviewBehaviors->instanciateMinimalBehaviors(aDesktop);
 }
 
-void PVViewer_ViewManager::ParaviewLoadConfigurations()
+void PVViewer_ViewManager::ParaviewLoadConfigurations(bool force)
 {
-  if (!ConfigLoaded)
+  if (!ConfigLoaded || force)
     {
       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
       QString aPath = resMgr->stringValue("resources", "PVViewer", QString());
index fad78159f3f39f90a9e64fd18ea17eefdb29ecb0..9061eb65a7cb7a503509aaa5615cfefdcb577d3b 100644 (file)
@@ -48,7 +48,7 @@ public:
   //! Initialize ParaView if not yet done (once per session)
   static bool   ParaviewInitApp(SUIT_Desktop* aDesktop, LogWindow * w);
   static void   ParaviewInitBehaviors(bool fullSetup=false, SUIT_Desktop* aDesktop=0);
-  static void   ParaviewLoadConfigurations();
+  static void   ParaviewLoadConfigurations(bool force=false);
   static void   ParaviewCleanup();
 
   //! Connect to the external PVServer, using the PARAVIS engine to launch it if it is not
index c7fff08a2c288aeb1f4a78f73de25de840b4c2ad..bdb1edfa08ad740e511704621ab6f1b53de0b148 100644 (file)
@@ -22,6 +22,7 @@
 
 #include "PVViewer_ViewWindow.h"
 #include "PVViewer_ViewManager.h"
+#include "PVViewer_ViewModel.h"
 #include "PVViewer_GUIElements.h"
 
 #include <SUIT_ViewManager.h>
@@ -46,6 +47,7 @@ PVViewer_ViewWindow::PVViewer_ViewWindow( SUIT_Desktop* theDesktop, PVViewer_Vie
   : SUIT_ViewWindow( theDesktop ), myPVMgr( 0 )
 {
   myModel = theModel;
+  setViewManager(myModel->getViewManager());
   myPVMgr = qobject_cast<pqTabbedMultiViewWidget*>(pqApplicationCore::instance()->manager("MULTIVIEW_WIDGET"));
   if (myPVMgr) {
     myPVMgr->setParent( this );
index a3991bf88a8885103e52a684776b8716e737f344..5ec6eb57e07d45cf0890d7f06580052c7516b1ae 100644 (file)
 PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* interp )
 : QWidget( parent )
 {
-  // create python interpreter
-  myInterp = interp;
-  if ( !myInterp )
-    myInterp = new PyConsole_Interp();
+  PyConsole_Interp* anInterp = interp ? interp : new PyConsole_Interp();
   
   // initialize Python interpretator
-  myInterp->initialize();
+  anInterp->initialize();
   
   // create editor console
   QVBoxLayout* lay = new QVBoxLayout( this );
   lay->setMargin( 0 );
-  myEditor = new PyConsole_Editor( myInterp, this );
+  myEditor = new PyConsole_Editor( anInterp, this );
   char* synchronous = getenv("PYTHON_CONSOLE_SYNC");
   if (synchronous && atoi(synchronous))
   {
@@ -78,8 +75,8 @@ PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* interp
 /**
  * Protected constructor.
  */
-PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* i,  PyConsole_Editor* e)
-  : QWidget (parent), myEditor(e), myInterp(i)
+PyConsole_Console::PyConsole_Console( QWidget* parent, PyConsole_Interp* /*i*/,  PyConsole_Editor* e )
+  : QWidget (parent), myEditor(e)
 {}
 
 /*!
@@ -91,6 +88,11 @@ PyConsole_Console::~PyConsole_Console()
 {
 }
 
+PyConsole_Interp* PyConsole_Console::getInterp() const
+{
+  return myEditor ? myEditor->getInterp() : 0;
+} 
+
 /*!
   \brief Execute python command in the interpreter.
   \param command string with command and arguments
@@ -373,21 +375,18 @@ void PyConsole_Console::stopLog()
  * @param parent
  * @param interp
  */
-PyConsole_EnhConsole::PyConsole_EnhConsole( QWidget* parent, PyConsole_EnhInterp* interp)
-  : PyConsole_Console(parent, interp, 0)
+PyConsole_EnhConsole::PyConsole_EnhConsole( QWidget* parent, PyConsole_Interp* interp )
+  : PyConsole_Console( parent, interp, 0 )
 {
-  // create python interpreter
-  myInterp = interp;
-  if ( !myInterp )
-    myInterp = new PyConsole_EnhInterp();
+  PyConsole_Interp* anInterp = interp ? interp : new PyConsole_EnhInterp();
 
   // initialize Python interpretator
-  myInterp->initialize();
+  anInterp->initialize();
 
   // create editor console
   QVBoxLayout* lay = new QVBoxLayout( this );
   lay->setMargin( 0 );
-  myEditor = new PyConsole_EnhEditor( static_cast<PyConsole_EnhInterp*>(myInterp), this );
+  myEditor = new PyConsole_EnhEditor( anInterp, this );
   char* synchronous = getenv("PYTHON_CONSOLE_SYNC");
   if (synchronous && atoi(synchronous))
   {
index 54442c2cd9c162cf2ed847410406789064866075..b32b078e40f0eeb789ceda5da7cc3e975e20093b 100644 (file)
@@ -34,7 +34,6 @@
 
 class PyConsole_Interp;
 class PyConsole_Editor;
-class PyConsole_EnhInterp;
 
 class PYCONSOLE_EXPORT PyConsole_Console : public QWidget, public SUIT_PopupClient
 {
@@ -59,7 +58,7 @@ public:
   virtual ~PyConsole_Console();
 
   //! \brief Get python interperter
-  PyConsole_Interp*   getInterp() { return myInterp; } 
+  PyConsole_Interp*   getInterp() const;
   QFont               font() const;
   virtual void        setFont( const QFont& );
 
@@ -93,8 +92,6 @@ protected:
 
   PyConsole_Console( QWidget* parent, PyConsole_Interp*,  PyConsole_Editor*);
 
-
-  PyConsole_Interp*   myInterp;    //!< python interpreter
   PyConsole_Editor*   myEditor;    //!< python console editor widget
   QMap<int, QAction*> myActions;   //!< menu actions list
 };
@@ -109,7 +106,7 @@ class PYCONSOLE_EXPORT PyConsole_EnhConsole: public PyConsole_Console
   Q_OBJECT
 
 public:
-  PyConsole_EnhConsole( QWidget* parent, PyConsole_EnhInterp* interp = 0);
+  PyConsole_EnhConsole( QWidget* parent, PyConsole_Interp* interp = 0 );
   virtual ~PyConsole_EnhConsole() {}
 };
 
index 42ea63e4f6c5f6b07fe9c986f011fc07d6347c89..aeb61f965e0cc5dd56d67116a539bd09eb3d5050 100644 (file)
@@ -191,16 +191,20 @@ PyConsole_Editor::PyConsole_Editor( PyConsole_Interp* theInterp,
 
 /*!
   \brief Destructor.
-
-  Does nothing for the moment.
 */
 PyConsole_Editor::~PyConsole_Editor()
 {
-  myInterp->destroy();
-  delete myInterp;
   myInterp = 0;
 }
 
+/*!
+  \brief Get Python interpreter
+*/
+PyConsole_Interp* PyConsole_Editor::getInterp() const
+{
+  return myInterp;
+}
+
 /*!
   \brief Get synchronous mode flag value.
   
index c939ef1b7da3e9fd78f947738427b11222426a42..5094f8687861c8451e83ff5594300961f884a6e3 100644 (file)
@@ -42,6 +42,8 @@ class PYCONSOLE_EXPORT PyConsole_Editor : public QTextEdit
 public:
   PyConsole_Editor( PyConsole_Interp* theInterp, QWidget *theParent = 0 );
   ~PyConsole_Editor();
+
+  PyConsole_Interp* getInterp() const;
   
   virtual void   addText( const QString& str, const bool newBlock = false, const bool isError = false );
   bool           isCommand( const QString& str ) const;
index 20a5ef1c5e7003f0d168e6dd5c0ad0d47daf69d6..aa73ac04b33bb752a9bad6dff386c93c6b729631 100644 (file)
@@ -43,7 +43,7 @@ const std::vector<QString> PyConsole_EnhEditor::SEPARATORS = \
  * @param interp the interpreter linked to the editor
  * @param parent parent widget
  */
-PyConsole_EnhEditor::PyConsole_EnhEditor(PyConsole_EnhInterp * interp, QWidget * parent) :
+PyConsole_EnhEditor::PyConsole_EnhEditor(PyConsole_Interp* interp, QWidget* parent) :
      PyConsole_Editor(interp, parent),
      _tab_mode(false),
      _cursor_pos(-1),
@@ -117,7 +117,8 @@ void PyConsole_EnhEditor::clearCompletion()
       setTextCursor(tc);
       textCursor().deletePreviousChar();
       // TODO: before wait for any TAB event to be completed
-      static_cast<PyConsole_EnhInterp *>(myInterp)->clearCompletion();
+      if ( myInterp ) 
+       myInterp->clearCompletion();
     }
   _tab_mode = false;
 }
@@ -222,8 +223,8 @@ PyInterp_Request* PyConsole_EnhEditor::createTabRequest( const QString& input )
       _compl_before_point = QString("");
     }
 
-  return new CompletionCommand( static_cast<PyConsole_EnhInterp *>(myInterp), _compl_before_point,
-                               _compl_after_point, this, isSync() );
+  return new CompletionCommand( myInterp, _compl_before_point,
+                               _compl_after_point, this, isSync() );
 }
 
 /**
@@ -231,7 +232,7 @@ PyInterp_Request* PyConsole_EnhEditor::createTabRequest( const QString& input )
  * @param matches list of possible completions
  * @param result return value
  */
-void PyConsole_EnhEditor::formatCompletion(const std::vector<QString> & matches, QString & result) const
+void PyConsole_EnhEditor::formatCompletion(const QStringList& matches, QString& result) const
 {
   int sz = matches.size();
 
@@ -255,90 +256,97 @@ void PyConsole_EnhEditor::formatCompletion(const std::vector<QString> & matches,
  */
 void PyConsole_EnhEditor::customEvent( QEvent* event )
 {
-  std::vector<QString> matches;
+  QStringList matches;
   QString first_match, comple_text, doc, base;
   QTextCursor cursor(textCursor());
   QTextBlockFormat bf;
   QTextCharFormat cf;
-  PyConsole_EnhInterp * interp = static_cast<PyConsole_EnhInterp *>(myInterp);
   int cursorPos;
 
   switch( event->type() )
   {
     case PyInterp_Event::ES_TAB_COMPLETE_OK:
+    {
       // Extract corresponding matches from the interpreter
-      matches = interp->getLastMatches();
+      matches = getInterp()->getLastMatches();
+      doc = getInterp()->getDocStr();
 
       if (matches.size() == 0)
-        {
-          // Completion successful but nothing returned.
-          _tab_mode = false;
-          _cursor_pos = -1;
-          return;
-        }
-
+      {
+       // Completion successful but nothing returned.
+       _tab_mode = false;
+       _cursor_pos = -1;
+       return;
+      }
+      
       // Only one match - complete directly and update doc string window
-      doc = interp->getDocStr();
       if (matches.size() == 1)
-        {
-          first_match = matches[0].mid(_compl_after_point.size());
-          cursor.insertText(first_match);
-          _tab_mode = false;
-          if (doc == QString(""))
-            emit updateDoc(formatDocHTML("(no documentation available)\n"));
-          else
-            emit updateDoc(formatDocHTML(doc));
-        }
+      {
+       first_match = matches[0].mid(_compl_after_point.size());
+       cursor.insertText(first_match);
+       _tab_mode = false;
+       if (doc.isEmpty())
+         emit updateDoc(formatDocHTML("(no documentation available)\n"));
+       else
+         emit updateDoc(formatDocHTML(doc));
+      }
       else
-        {
-          // Detect if there is a common base to all available completion
-          // In this case append this base to the text already
-          extractCommon(matches, base);
-          first_match = base.mid(_compl_after_point.size());
-          cursor.insertText(first_match);
-
-          // If this happens to match exaclty the first completion
-          // also provide doc
-          if (base == matches[0])
-            {
-              doc = formatDocHTML(doc);
-              emit updateDoc(doc);
-            }
-
-          // Print all matching completion in a "undo-able" block
-          cursorPos = cursor.position();
-          cursor.insertBlock();
-          cursor.beginEditBlock();
-
-          // Insert all matches
-          QTextCharFormat cf;
-          cf.setForeground(QBrush(Qt::darkGreen));
-          cursor.setCharFormat(cf);
-          formatCompletion(matches, comple_text);
-          cursor.insertText(comple_text);
-          cursor.endEditBlock();
-
-          // Position cursor where it was before inserting the completion list:
-          cursor.setPosition(cursorPos);
-          setTextCursor(cursor);
-        }
+      {
+       // Detect if there is a common base to all available completion
+       // In this case append this base to the text already
+       extractCommon(matches, base);
+       first_match = base.mid(_compl_after_point.size());
+       cursor.insertText(first_match);
+       
+       // If this happens to match exaclty the first completion
+       // also provide doc
+       if (base == matches[0])
+       {
+         doc = formatDocHTML(doc);
+         emit updateDoc(doc);
+       }
+       
+       // Print all matching completion in a "undo-able" block
+       cursorPos = cursor.position();
+       cursor.insertBlock();
+       cursor.beginEditBlock();
+       
+       // Insert all matches
+       QTextCharFormat cf;
+       cf.setForeground(QBrush(Qt::darkGreen));
+       cursor.setCharFormat(cf);
+       formatCompletion(matches, comple_text);
+       cursor.insertText(comple_text);
+       cursor.endEditBlock();
+       
+       // Position cursor where it was before inserting the completion list:
+       cursor.setPosition(cursorPos);
+       setTextCursor(cursor);
+      }
       break;
+    }
     case PyInterp_Event::ES_TAB_COMPLETE_ERR:
+    {
       // Tab completion was unsuccessful, switch off mode:
       _tab_mode = false;
       _cursor_pos = -1;
       break;
+    }
     case PyInterp_Event::ES_OK:
     case PyInterp_Event::ES_ERROR:
     case PyInterp_Event::ES_INCOMPLETE:
+    {
       // Before everything else, call super()
       PyConsole_Editor::customEvent(event);
       // If we are in multi_paste_mode, process the next item:
       multiLineProcessNextLine();
       break;
+    }
     default:
+    {
       PyConsole_Editor::customEvent( event );
       break;
+    }
   }
 }
 
@@ -347,7 +355,7 @@ void PyConsole_EnhEditor::customEvent( QEvent* event )
  * @param matches
  * @param result
  */
-void PyConsole_EnhEditor::extractCommon(const std::vector<QString> & matches, QString & result) const
+void PyConsole_EnhEditor::extractCommon(const QStringList& matches, QString& result) const
 {
   result = "";
   int charIdx = 0;
index c18738f29d2e59eb6bf7c1bdbdb6be4936541127..546ea98fc11099641b5ed83698fb07987653e56a 100644 (file)
 #define PYCONSOLE_ENHEDITOR_H_
 
 #include "PyConsole.h"
-
 #include "PyConsole_Editor.h"
+
 #include <QObject>
 #include <queue>
 
-class PyConsole_EnhInterp;
-
 /**
  * Enhanced Python editor handling tab completion.
  */
@@ -38,7 +36,7 @@ class PYCONSOLE_EXPORT PyConsole_EnhEditor: public PyConsole_Editor
   Q_OBJECT;
 
 public:
-  PyConsole_EnhEditor(PyConsole_EnhInterp * interp, QWidget * parent=0);
+  PyConsole_EnhEditor(PyConsole_Interp* interp, QWidget* parent = 0);
   virtual ~PyConsole_EnhEditor() {}
 
 signals:
@@ -83,14 +81,14 @@ protected:
   virtual void handleTab();
   virtual void handleBackTab();
   virtual void clearCompletion();
-  virtual void formatCompletion(const std::vector<QString> & matches, QString & result) const;
+  virtual void formatCompletion(const QStringList& matches, QString& result) const;
   virtual QString formatDocHTML(const QString & doc) const;
 
   virtual void multilinePaste(const QString & s);
   virtual void multiLineProcessNextLine();
 
 private:
-  void extractCommon(const std::vector<QString> & matches, QString & result) const;
+  void extractCommon(const QStringList& matches, QString& result) const;
 
 };
 
index 1f5defe0714bde0bcf29d7593ffcae097c4fcab9..eb5cb2705d1c18724ba74a5c590c10edc9556e5b 100644 (file)
@@ -37,6 +37,31 @@ static const char * tmp_k[] = {"and",  "as", "assert", "break",  "class",
 const std::vector<QString> PyConsole_EnhInterp::PYTHON_KEYWORDS = \
       std::vector<QString>(tmp_k, tmp_k+sizeof(tmp_k)/sizeof(tmp_k[0]));
 
+/*!
+  \brief Constructor
+*/
+PyConsole_EnhInterp::PyConsole_EnhInterp()
+  : PyConsole_Interp()
+{
+}
+
+/*!
+  \brief Destructor
+*/
+PyConsole_EnhInterp::~PyConsole_EnhInterp()
+{
+}
+
+QStringList PyConsole_EnhInterp::getLastMatches() const
+{
+  return _last_matches;
+}
+
+QString PyConsole_EnhInterp::getDocStr() const
+{
+  return _doc_str;
+}
+
 /*!
   \brief Run Python dir() command and saves the result internally in _lastPy
   \param dirArgument Python expression to pass to the dir command. The parsing of what the
@@ -45,7 +70,7 @@ const std::vector<QString> PyConsole_EnhInterp::PYTHON_KEYWORDS = \
   the user types "a_string_variable.rsp <TAB>", this is "rsp".
   \return command exit status - 0 = success
 */
-int PyConsole_EnhInterp::runDirCommand(const QString & dirArgument, const QString & startMatch)
+int PyConsole_EnhInterp::runDirCommand(const QString& dirArgument, const QString& startMatch)
 {
   int ret;
   std::vector<QString> v;
@@ -99,8 +124,9 @@ int PyConsole_EnhInterp::runDirCommand(const QString & dirArgument, const QStrin
  * @return -1 if the call to dir() or the parsing of the result failed, 0 otherwise.
  */
 int PyConsole_EnhInterp::runDirAndExtract(const QString& dirArgument,
-       const QString & startMatch, std::vector<QString> & result,
-       bool discardSwig) const
+                                         const QString& startMatch,
+                                         QStringList& result,
+                                         bool discardSwig) const
 {
   QRegExp re("^[A-Z].+_[A-Z]+[a-z]+.+$");  // discard SWIG static method, e.g. MEDCouplingUMesh_Blabla
   QString command("dir(" + dirArgument + ")");
@@ -146,9 +172,6 @@ int PyConsole_EnhInterp::runDirAndExtract(const QString& dirArgument,
  */
 void PyConsole_EnhInterp::clearCompletion()
 {
-  _last_matches.resize(0);
-  _doc_str = QString("");
+  _last_matches.clear();
+  _doc_str = "";
 }
-
-
-
index 4b16aa369c6330d8592c37e6bb08f70c4c040a4f..42c0ab35d9d4e576c1734c462ec5e0fd3537b0d9 100644 (file)
 class PYCONSOLE_EXPORT PyConsole_EnhInterp: public PyConsole_Interp
 {
 public:
-  PyConsole_EnhInterp()
-    : PyConsole_Interp(), _last_matches(0), _doc_str("")
-    {}
+  PyConsole_EnhInterp();
+  virtual ~PyConsole_EnhInterp();
 
-  virtual ~PyConsole_EnhInterp() {}
-
-  const std::vector<QString>& getLastMatches() const { return _last_matches; }
-  const QString & getDocStr() const                  { return _doc_str; }
+  virtual QStringList getLastMatches() const;
+  virtual QString getDocStr() const;
 
   virtual int runDirCommand(const QString& dirArgument, const QString& startMatch);
   virtual void clearCompletion();
@@ -55,13 +52,12 @@ protected:
   static const std::vector<QString> PYTHON_KEYWORDS;
 
   /** Last computed matches */
-  std::vector<QString> _last_matches;
+  QStringList _last_matches;
   /** Doc string of the first match - when only one match it will be displayed by the Editor*/
   QString _doc_str;
 
-  virtual int runDirAndExtract(const QString& dirArgument, const QString & startMatch,
-      std::vector<QString> & result, bool discardSwig=true) const;
-
+  virtual int runDirAndExtract(const QString& dirArgument, const QString& startMatch,
+                              QStringList& result, bool discardSwig=true) const;
 };
 
 #endif /* PYCONSOLE_ENHINTERP_H_ */
index 01c94fe20953b5c1012027d729682f9fb922fefd..e1365760a011ccc71636904297b458daf7a65ccd 100644 (file)
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-
-//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
 //  File   : PyConsole_Interp.cxx
 //  Author : Nicolas REJNERI, Adrien BRUNETON
-//  Module : SALOME
-//
+
 #include "PyConsole_Interp.h"
 
 /*!
   Creates new python interpreter.
 */
 PyConsole_Interp::PyConsole_Interp(): PyInterp_Interp()
-{}
+{
+}
 
 /*!
   \brief Destructor.
 
   Does nothing for the moment.
 */
-PyConsole_Interp::~PyConsole_Interp() { }
+PyConsole_Interp::~PyConsole_Interp()
+{
+}
 
 /*! Sets the variable "__IN_SALOME_GUI_CONSOLE" to True.
 * This is not attached to a module (like salome_iapp.IN_SALOME_GUI_CONSOLE)
@@ -72,3 +72,22 @@ int PyConsole_Interp::afterRun()
 {
   return PyRun_SimpleString("__builtins__.__IN_SALOME_GUI_CONSOLE=False");
 }
+
+QStringList PyConsole_Interp::getLastMatches() const
+{
+  return QStringList();
+}
+
+QString PyConsole_Interp::getDocStr() const
+{
+  return QString();
+}
+
+int PyConsole_Interp::runDirCommand(const QString&, const QString& )
+{
+  return 0;
+}
+
+void PyConsole_Interp::clearCompletion()
+{
+}
index 5434e481347a9f00ef40b54d4e85c42362caf924..31e8f7e97a66c6167e5a203c9e66381e5f0d40a8 100644 (file)
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-
-//  SALOME SALOMEGUI : implementation of desktop and GUI kernel
 //  File   : PyConsole_Interp.h
 //  Author : Nicolas REJNERI, Adrien BRUNETON
-//  Module : SALOME
-//
+
 #ifndef PYCONSOLE_INTERP_H
 #define PYCONSOLE_INTERP_H
 
 #include "PyConsole.h"
+#include "PyInterp_Interp.h"   /// !!! WARNING !!! THIS INCLUDE MUST BE VERY FIRST !!!
 
-#include <PyInterp_Interp.h>   /// !!! WARNING !!! THIS INCLUDE MUST BE VERY FIRST !!!
+#include <QStringList>
 
 class PYCONSOLE_EXPORT PyConsole_Interp : public PyInterp_Interp
 {
@@ -40,6 +38,12 @@ public:
 
   virtual int afterRun();
   virtual int beforeRun();
+
+  virtual QStringList getLastMatches() const;
+  virtual QString getDocStr() const;
+
+  virtual int runDirCommand(const QString&, const QString&);
+  virtual void clearCompletion();
 };
 
 #endif // PYCONSOLE_INTERP_H
index 97bf7f2df41d5ade45bc41a4899d665e3ef5ee3a..12a5e612db80fed42db3991d891f3dfdcdcbfd18 100644 (file)
 // Created on: 3 avr. 2013
 
 #include "PyConsole_Request.h"
-
-#include "PyInterp_Event.h"
+#include "PyConsole_Interp.h"
 #include "PyConsole_Event.h"
-#include "PyConsole_EnhInterp.h"
-#include "PyConsole_EnhEditor.h"
+#include "PyInterp_Event.h"
 
 #include <QCoreApplication>
 
  * @param sync
  */
 ExecCommand::ExecCommand( PyInterp_Interp*        theInterp,
-               const QString&          theCommand,
-               PyConsole_Editor*       theListener,
-               bool                    sync )
-    : PyInterp_LockRequest( theInterp, theListener, sync ),
-      myCommand( theCommand ), myState( PyInterp_Event::ES_OK )
-  {}
+                         const QString&          theCommand,
+                         QObject*                theListener,
+                         bool                    theSync )
+  : PyInterp_LockRequest( theInterp, theListener, theSync ),
+    myCommand( theCommand ), myState( PyInterp_Event::ES_OK )
+{}
 
 /**
  * Execute the command by calling the run() method of the embedded interpreter.
@@ -50,13 +48,13 @@ ExecCommand::ExecCommand( PyInterp_Interp*        theInterp,
 void ExecCommand::execute()
 {
   if ( myCommand != "" )
-    {
-      int ret = getInterp()->run( myCommand.toUtf8().data() );
-      if ( ret < 0 )
-        myState = PyInterp_Event::ES_ERROR;
-      else if ( ret > 0 )
-        myState = PyInterp_Event::ES_INCOMPLETE;
-    }
+  {
+    int ret = getInterp()->run( myCommand.toUtf8().data() );
+    if ( ret < 0 )
+      myState = PyInterp_Event::ES_ERROR;
+    else if ( ret > 0 )
+      myState = PyInterp_Event::ES_INCOMPLETE;
+  }
 }
 
 /**
@@ -80,13 +78,13 @@ QEvent* ExecCommand::createEvent()
   \param theListener widget to get the notification messages
   \param sync        if True the request is processed synchronously
 */
-CompletionCommand::CompletionCommand( PyConsole_EnhInterp*  theInterp,
-               const QString&          input,
-               const QString&         startMatch,
-               PyConsole_EnhEditor*           theListener,
-               bool                    sync)
-     : PyInterp_LockRequest( theInterp, theListener, sync ),
-       _tabSuccess(false), _dirArg(input), _startMatch(startMatch)
+CompletionCommand::CompletionCommand( PyInterp_Interp*   theInterp,
+                                     const QString&     theInput,
+                                     const QString&     theStartMatch,
+                                     QObject*           theListener,
+                                     bool               theSync )
+  : PyInterp_LockRequest( theInterp, theListener, theSync ),
+    _tabSuccess(false), _dirArg(theInput), _startMatch(theStartMatch)
 {}
 
 /**
@@ -95,12 +93,8 @@ CompletionCommand::CompletionCommand( PyConsole_EnhInterp*  theInterp,
  */
 void CompletionCommand::execute()
 {
-  PyConsole_EnhInterp * interp = static_cast<PyConsole_EnhInterp *>(getInterp());
-    int ret = interp->runDirCommand( _dirArg,  _startMatch);
-    if (ret == 0)
-      _tabSuccess = true;
-    else
-      _tabSuccess = false;
+  int ret = static_cast<PyConsole_Interp*>(getInterp())->runDirCommand( _dirArg,  _startMatch );
+  _tabSuccess = ret == 0;
 }
 
 /**
@@ -110,9 +104,5 @@ void CompletionCommand::execute()
 QEvent* CompletionCommand::createEvent()
 {
   int typ = _tabSuccess ? PyInterp_Event::ES_TAB_COMPLETE_OK : PyInterp_Event::ES_TAB_COMPLETE_ERR;
-
   return new PyInterp_Event( typ, this);
 }
-
-
-
index c2f22ff432bad9f9efc245bb20e2e32f344fe141..5605cc7fa5fc45690eab7990c66a15d8f8d3c400 100644 (file)
@@ -23,7 +23,6 @@
 #ifndef PYCONSOLE_REQUEST_H_
 #define PYCONSOLE_REQUEST_H_
 
-#include "PyConsole.h"
 #include "PyInterp_Request.h"
 
 #include <vector>
@@ -31,7 +30,6 @@
 #include <QEvent>
 
 class PyInterp_Interp;
-class PyConsole_Editor;
 
 /*!
   \class ExecCommand
@@ -52,8 +50,8 @@ public:
   */
   ExecCommand( PyInterp_Interp*        theInterp,
                const QString&          theCommand,
-               PyConsole_Editor*       theListener,
-               bool                    sync = false );
+               QObject*                theListener,
+               bool                    theSync = false );
 
 protected:
   /*!
@@ -73,17 +71,14 @@ private:
   int     myState;     //!< Python command execution status
 };
 
-class PyConsole_EnhInterp;
-class PyConsole_EnhEditor;
-
 class CompletionCommand : public PyInterp_LockRequest
 {
 public:
-  CompletionCommand( PyConsole_EnhInterp*      theInterp,
-               const QString&          input,
-               const QString&          startMatch,
-               PyConsole_EnhEditor*    theListener,
-               bool                    sync = false );
+  CompletionCommand( PyInterp_Interp*     theInterp,
+                    const QString&       theInput,
+                    const QString&       theStartMatch,
+                    QObject*             theListener,
+                    bool                 theSync = false );
 
 
 protected:
@@ -99,7 +94,6 @@ protected:
 
   virtual void execute();
   virtual QEvent* createEvent();
-
 };
 
 #endif /* PYCONSOLE_REQUEST_H_ */
index 16dca8b96c549c4883f48f8e8e74663a77ce2c6d..9a72c5846e9a3fdc32f11d876946ac41577a0d1f 100755 (executable)
@@ -205,8 +205,8 @@ void QtxAbstractRubberBand::updateMask()
   if ( isClosed() )
     r += createRegion( myPoints.last(), myPoints.first() );
 
-  setMask( r );
-
+  if ( !r.isEmpty() )
+    setMask( r );
 }
 
 
index 3def58d2ccb1650f0d76874836487b5eed22fa94..69f17119d1c3d06aad73f9a8c54152b49e9e01ed 100755 (executable)
@@ -57,7 +57,6 @@
 
 //#include "SALOMEDSClient.hxx"
 //#include "SALOMEDS_StudyManager.hxx"
-#include <Basics_OCCTVersion.hxx>
 
 #include <AIS_TypeOfIso.hxx>
 #include <Precision.hxx>
index a21b2d92d745c588b197d114533bebb2472f4295..e7f237aaef6e8c2905d73a3e9776f3e06c86dac8 100644 (file)
     </message>
     <message>
         <source>DSC_SVTK_SCALING</source>
-        <translation>Scaling</translation>
+        <translation>Change scale of axes</translation>
     </message>
     <message>
         <source>MNU_SVTK_SCALING</source>
@@ -341,10 +341,6 @@ Please, refer to the documentation.</translation>
         <source>LBL_Z</source>
         <translation>Z:</translation>
     </message>
-    <message>
-        <source>MEN_SCALING</source>
-        <translation>Scaling</translation>
-    </message>
     <message>
         <source>DLG_TITLE</source>
         <translation>Scaling</translation>
index 15f55eca950f2f738473969d09b8926ffb2eb144..01ae93dac17a44e87cedb9bb69e319ade6ee0af2 100755 (executable)
     </message>
     <message>
         <source>DSC_SVTK_SCALING</source>
-        <translation>Mise à l&apos;échelle</translation>
+        <translation>Changer l&apos;échelle des axes de coordonnées</translation>
     </message>
     <message>
         <source>MNU_SVTK_SCALING</source>
@@ -341,10 +341,6 @@ Veuillez consulter la documentation.</translation>
         <source>LBL_Z</source>
         <translation>Z:</translation>
     </message>
-    <message>
-        <source>MEN_SCALING</source>
-        <translation>Echelle</translation>
-    </message>
     <message>
         <source>DLG_TITLE</source>
         <translation>Mise à l&apos;échelle</translation>
index 11d36a3ef14f61e8b6ca7c2a3244172b41938dd8..983fa07a1e456b57993fd160c246f07960ddd5e0 100644 (file)
     </message>
     <message>
       <source>DSC_SVTK_SCALING</source>
-      <translation>スケーリング</translation>
+      <translation>座標のスケールの軸を変更します。</translation>
     </message>
     <message>
       <source>MNU_SVTK_SCALING</source>
       <source>LBL_Z</source>
       <translation>Z:</translation>
     </message>
-    <message>
-      <source>MEN_SCALING</source>
-      <translation>スケール</translation>
-    </message>
     <message>
       <source>DLG_TITLE</source>
       <translation>スケーリング</translation>
index 12ff6b9a3f70b4f324833268e7b396d8bcec2bf5..c142eca0b827dad9e86f3eb665e470f2ef8293e0 100644 (file)
@@ -588,6 +588,9 @@ void SalomeApp_Application::onDesktopMessage( const QString& message )
     if ( a )
       a->setEnabled( false );
   }
+  else if ( message.toLower() == "connect_to_study" ) {
+    onLoadDoc();
+  }
   LightApp_Application::onDesktopMessage( message );
 }
 
@@ -1109,7 +1112,7 @@ QWidget* SalomeApp_Application::createWindow( const int flag )
 #ifndef DISABLE_PYCONSOLE
   else if ( flag == WT_PyConsole )
   {
-    PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(), new SalomeApp_PyInterp() );
+    PyConsole_Console* pyCons = new PyConsole_EnhConsole( desktop(), getPyInterp() );
     pyCons->setObjectName( "pythonConsole" );
     pyCons->setWindowTitle( tr( "PYTHON_CONSOLE" ) );
     pyCons->setFont(resourceMgr()->fontValue( "PyConsole", "font" ));
@@ -2121,3 +2124,13 @@ bool SalomeApp_Application::checkExistingDoc()
   }
   return result;
 }
+
+
+#ifndef DISABLE_PYCONSOLE
+
+PyConsole_Interp* SalomeApp_Application::createPyInterp()
+{
+  return new SalomeApp_PyInterp();
+}
+
+#endif // DISABLE_PYCONSOLE
index b9833a1dcdb797d96bd2f549adbfcf19db157cb6..aeee6dcb2be248afca72485c37eba98dc00aefad 100644 (file)
@@ -168,6 +168,7 @@ protected:
 
 #ifndef DISABLE_PYCONSOLE
   bool                                updateStudy();
+  virtual PyConsole_Interp*           createPyInterp();
 #endif
 
   virtual void                        afterCloseDoc();
index 5274494994295f72def591034ff1e459f65d9fd3..9611f2ff4be00e1214ca8f0623d40a91fb83539c 100644 (file)
@@ -23,7 +23,6 @@
 
 #ifndef DISABLE_PYCONSOLE
   #include <PyConsole_Interp.h> // this include must be first (see PyInterp_base.h)!
-  #include <PyConsole_Console.h>
 #endif
 
 #include "SalomeApp_DoubleSpinBox.h"
@@ -438,8 +437,7 @@ SalomeApp_DoubleSpinBox::SearchState SalomeApp_DoubleSpinBox::findVariable( cons
           if( studyDS->IsString( aName ) )
             {
 #ifndef DISABLE_PYCONSOLE
-              PyConsole_Console* pyConsole = app->pythonConsole();
-              PyConsole_Interp* pyInterp = pyConsole->getInterp();
+              PyConsole_Interp* pyInterp = app->getPyInterp();
               PyLockWrapper aLock; // Acquire GIL
               std::string command;
               command  = "import salome_notebook ; ";
index 6c2184022d1ac1955fdd7b484844725d9595fff4..a4360c60e8b156a1f02fd2749f39b48c536d6b1f 100644 (file)
@@ -24,7 +24,6 @@
 #include "Utils_CorbaException.hxx"
 
 #include "CASCatch.hxx"
-#include "Basics_OCCTVersion.hxx"
 
 #include <OSD.hxx>
 
index 2e8bcc78d90f607da37a2668af3fec4d428a157f..b5cc01765d6e117a9197071ce65a46f1c5d7a525 100644 (file)
@@ -23,7 +23,6 @@
 
 #ifndef DISABLE_PYCONSOLE
   #include <PyConsole_Interp.h> //this include must be first (see PyInterp_base.h)!
-  #include <PyConsole_Console.h>
 #endif
 
 #include "SalomeApp_IntSpinBox.h"
@@ -386,8 +385,7 @@ SalomeApp_IntSpinBox::SearchState SalomeApp_IntSpinBox::findVariable( const QStr
           if( studyDS->IsString( aName ) )
             {
 #ifndef DISABLE_PYCONSOLE
-              PyConsole_Console* pyConsole = app->pythonConsole();
-              PyConsole_Interp* pyInterp = pyConsole->getInterp();
+              PyConsole_Interp* pyInterp = app->getPyInterp();
               PyLockWrapper aLock; // Acquire GIL
               std::string command;
               command  = "import salome_notebook ; ";
index b5ecb767ad43ae4563cf3331481cb11da9def5fb..242aae2ca3d2b39c1df8b3fd09868ea00e93b873 100644 (file)
@@ -285,7 +285,7 @@ bool NoteBook_TableRow::IsValidStringValue(const QString theValue)
 
   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
   PyConsole_Console* pyConsole = app->pythonConsole();
-  PyConsole_Interp* pyInterp = pyConsole->getInterp();
+  PyConsole_Interp* pyInterp = app->getPyInterp();
   PyLockWrapper aLock; // Acquire GIL
   std::string command = "import salome_notebook ; ";
   command += "salome_notebook.checkThisNoteBook(";
@@ -459,7 +459,7 @@ bool NoteBook_Table::IsValid() const
 
   SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
   PyConsole_Console* pyConsole = app->pythonConsole();
-  PyConsole_Interp* pyInterp = pyConsole->getInterp();
+  PyConsole_Interp* pyInterp = app->getPyInterp();
   PyLockWrapper aLock; // Acquire GIL
   std::string command = "import salome_notebook ; ";
   command += "salome_notebook.checkThisNoteBook(";
index bf7bd8d500083006dbfdc8dc30d882969143f511..a0b6a3ec2b8dce607e4ad71390e159dfcbdf9f77 100755 (executable)
@@ -31,8 +31,9 @@
 
 class SalomeApp_PyInterp : public PyConsole_EnhInterp
 {
+  friend class SalomeApp_Application;
+
 public:
-  SalomeApp_PyInterp();
   virtual ~SalomeApp_PyInterp();
 
   virtual void initPython();
@@ -40,6 +41,7 @@ public:
   virtual void closeContext();
 
 protected:
+  SalomeApp_PyInterp();
   virtual int  beforeRun();
 
 private:
index 2934889368ae8446a0f7c327f85641c628322024..ab6166997d6d3e58ccdbaa1433310d69d15368c4 100644 (file)
@@ -49,7 +49,6 @@
 
 #ifndef DISABLE_PYCONSOLE
   #include "SalomeApp_PyInterp.h" // WARNING! This include must be the first!
-  #include <PyConsole_Console.h>
 #endif
 
 #include "utilities.h"
@@ -741,8 +740,7 @@ void SalomeApp_Study::closeDocument(bool permanently)
       desk->blockSignals( isBlocked );
 #ifndef DISABLE_PYCONSOLE
       SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( application() );
-      if( app->pythonConsole() )
-        app->pythonConsole()->getInterp()->destroy();
+      app->getPyInterp()->destroy();
 #endif
     }
     SALOMEDSClient_Study* aStudy = 0;
index ee57a9cd18e08cdc9838c903b86c8e776fb2afbc..30d208e83284d286c81f5fa8762900a67db8a466 100755 (executable)
@@ -30,8 +30,6 @@
 #include <SALOME_LifeCycleCORBA.hxx>
 #include <SALOME_Event.h>
 
-#include <Basics_OCCTVersion.hxx>
-
 #include <Container_init_python.hxx>
 #include <ConnectionManager_i.hxx>
 #include <RegistryService.hxx>
index 8e6dbce63803c350503c98f56600038f2c757aaa..9a0e66b477f78676ace0b6ca5f6ce8f3f5cba753 100644 (file)
@@ -47,7 +47,7 @@ void TreeItem::initialize(const QString &nameId,
   //when creating the root item).
   if ( parent != NULL ) {
     this->associateToModel(parent->associatedModel());
-  }  
+  }
 }
 
 TreeItem::~TreeItem()
@@ -128,13 +128,13 @@ void TreeItem::appendChild(const QString &nameId,
     folder = new TreeItem(folderNameId, folderColumnValues, this);
     this->appendChild(folder);
   }
-    
+
   // We create the relative path of the next iteration (delete the
   // first folder path).
   QStringList nextRelativePath;
   for (int i = 1; i < relativePath.size(); ++i)
     nextRelativePath << relativePath[i];
-    
+
   folder->appendChild(nameId, columnValues, nextRelativePath);
 }
 
@@ -154,6 +154,49 @@ void TreeItem::appendChild(TreeItem *item)
   model->endInsertRows();
 }
 
+/*!
+ * This removes the specified child to this item. This item is the
+ * direct parent of the specified child.
+ */
+void TreeItem::removeChild(TreeItem *item)
+{
+  TreeModel * model = this->associatedModel();
+
+  int position = this->childCount();
+  model->beginRemoveRows(this->modelIndex(), position, position);
+  _childItems.removeOne(item);
+  _childItemsMapById.remove(item->nameId());
+  _childItemsMapByLabel.remove(item->data(0).toString());
+  model->endRemoveRows();
+}
+
+void TreeItem::removeChild(DataObject * dataObject, const QStringList &relativePath) {
+  if ( relativePath.isEmpty() ) {
+    // It is a direct child => just remove it.
+    QString nameId = QString(dataObject->getNameId().c_str());
+    TreeItem * child = this->childById(nameId);
+    if (child != NULL)
+      this->removeChild(child);
+    return;
+  }
+
+  // The child is embedded in a sub-folder.
+  // We first check if the sub-folder already exist:
+  TreeItem * folder = this->childByLabel(relativePath[0]);
+  if ( folder == NULL )
+    return;
+
+  // Go down into subfolder, if any.
+  QStringList nextRelativePath;
+  for (int i = 1; i < relativePath.size(); ++i)
+    nextRelativePath << relativePath[i];
+
+  folder->removeChild(dataObject, nextRelativePath);
+
+  if (folder->childCount() == 0)
+    this->removeChild(folder);
+}
+
 /*!
  * The child() function returns the child that corresponds to the
  * specified row number in the item's list of child items.
index d60e560fe3dc7cd369425b4dae2392a6dc8fcedc..c0a7d40772adbf786c5c3de9059d9e96d89daadd 100644 (file)
@@ -51,8 +51,10 @@ class TREEDATA_EXPORT TreeItem
                    const QVector<QVariant> &columnValues,
                    const QStringList &relativePath=QStringList());
 
-  
-  
+  void removeChild(TreeItem * child);
+  void removeChild(DataObject * dataObject,
+                   const QStringList &relativePath=QStringList());
+
   TreeItem *child(int row);
   TreeItem *childById(const QString &nameId);
   TreeItem *childByLabel(const QString &label);
@@ -62,7 +64,6 @@ class TREEDATA_EXPORT TreeItem
   QVariant data(int column) const;
   bool setData(int column, const QVariant &value);
 
-
  private:
   void initialize(const QString &nameId,
                   const QVector<QVariant> &columnValues,
index 12510fd40806f7e3c6ffd8f1bc68afccecb12bc6..0c5e6422b1b043e42797602c4d13840709a9749c 100644 (file)
@@ -186,7 +186,7 @@ bool TreeModel::setHeaderData(int section, Qt::Orientation orientation,
 // This part is a specific behavior to get a TreeModel that can
 // organize itself the tree hierarchy using data provided in a
 // filesystem-like format:
-// 
+//
 // data="a/b/c" ==> creation/filling of the hierarchy a->b->c
 // The "folder" categories are unique whereas the leaves may exists
 // in multiple instances.
@@ -208,3 +208,10 @@ bool TreeModel::addData(DataObject * dataObject, const QStringList &path) {
   rootItem->appendChild(dataObject, path);
   return true;
 }
+
+bool TreeModel::removeData(DataObject * dataObject) {
+  QStringList path = QString(dataObject->getPath().c_str()).split(DataObject::pathsep.c_str());
+  TreeItem * rootItem = this->getItem();
+  rootItem->removeChild(dataObject, path);
+  return true;
+}
index 9cb262e086f47f8205589d290b7e67c36bba9e23..65bafb687a2a2e080c4fb443a09cd07952b74c3d 100644 (file)
@@ -83,7 +83,7 @@ public:
   // This part is a specific behavior to get a TreeModel that can
   // organize itself the tree hierarchy using data provided in a
   // filesystem-like format:
-  // 
+  //
   // data="a/b/c" ==> creation/filling of the hierarchy a->b->c
   // The "folder" categories are unique whereas the leaves may exists
   // in multiple instances.
@@ -93,6 +93,7 @@ public:
   bool addData(DataObject * dataObject, const QStringList &path);
 
   // TODO: We should implement the delete and the update fucntions
+  bool removeData(DataObject * dataObject);
 
   // This part contains helper functions for general purposes
   TreeItem * getRootItem();