Salome HOME
Join modifications from branch BR_3_1_0deb T_OCC_development_generic_2006_start
authorjfa <jfa@opencascade.com>
Wed, 28 Dec 2005 08:38:00 +0000 (08:38 +0000)
committerjfa <jfa@opencascade.com>
Wed, 28 Dec 2005 08:38:00 +0000 (08:38 +0000)
46 files changed:
INSTALL
Makefile.in
bin/VERSION
bin/runLightSalome.sh [new file with mode: 0755]
build_configure
doc/salome/GUI_index.html [new file with mode: 0755]
doc/salome/tui/SUIT/doxyfile
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Module.cxx
src/LightApp/LightApp_PreferencesDlg.cxx
src/LightApp/LightApp_PreferencesDlg.h
src/LightApp/LightApp_ShowHideOp.cxx
src/LightApp/resources/LightApp.xml
src/LightApp/resources/LightApp_msg_en.po
src/OCCViewer/OCCViewer_ViewWindow.cxx
src/ObjBrowser/OB_Browser.cxx
src/ObjBrowser/OB_Browser.h
src/ObjBrowser/OB_ListItem.cxx
src/ObjBrowser/OB_ListItem.h
src/ObjBrowser/OB_ListView.cxx
src/ObjBrowser/OB_ListView.h
src/Plot2d/Plot2d_ViewFrame.cxx
src/Plot2d/Plot2d_ViewWindow.cxx
src/PyInterp/PyInterp_Dispatcher.cxx
src/PyInterp/PyInterp_base.cxx
src/PyInterp/PyInterp_base.h
src/PythonConsole/PythonConsole_PyEditor.cxx
src/PythonConsole/PythonConsole_PyInterp.cxx
src/Qtx/QtxListResourceEdit.cxx
src/Qtx/QtxListResourceEdit.h
src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_Module.cxx
src/SALOME_PYQT/SALOME_PYQT_GUI/SALOME_PYQT_PyInterp.cxx
src/SALOME_PYQT/SalomePyQt/SalomePyQt_v4.sip
src/STD/STD_Application.cxx
src/STD/STD_TabDesktop.cxx
src/STD/resources/STD_msg_en.po
src/SUIT/SUIT_MessageBox.cxx
src/SUIT/SUIT_MessageBox.h
src/SVTK/SVTK_ViewModel.cxx
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Application.h
src/SalomeApp/SalomeApp_PyInterp.cxx
src/SalomeApp/resources/SalomeApp.xml
src/SalomeApp/resources/SalomeApp_msg_en.po
src/Session/SALOME_Session_Server.cxx
src/Session/Session_ServerThread.cxx

diff --git a/INSTALL b/INSTALL
index dab02b3a0467a8e8cc907739bbc2faecdb8d7ddb..dcef3b788d93a12eeb4a649f0b751dc9e9b68be3 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,3 +1,3 @@
-This is the version 3.1.0b1 of SALOMEGUI
+This is the version 3.1.0 of SALOMEGUI
 Compatible with :
-        - KERNEL 3.1.0b1
+        - KERNEL 3.1.0
index 41e9d3c718392117cd930e9a93ef1de6cc35b19b..989c6a47611a2795477f0eb8f8d78b0b32d3f4ef 100644 (file)
@@ -75,7 +75,8 @@ uc_clear.png \
 channel.cfg \
 
 BIN_SCRIPT= VERSION \
-runLightSalome.csh
+runLightSalome.csh \
+runLightSalome.sh
 
 # copy header files in common directory
 OWN_CONFIG_H=@OWN_CONFIG_H@
index adc8613cc77af8197bbe956a9d03e8c80ee5349b..fe6986e154cc845dbfe8275f01159331240524e0 100755 (executable)
@@ -1 +1 @@
-THIS IS SALOME - SALOMEGUI VERSION: 3.1.0b1
+THIS IS SALOME - SALOMEGUI VERSION: 3.1.0
diff --git a/bin/runLightSalome.sh b/bin/runLightSalome.sh
new file mode 100755 (executable)
index 0000000..f99a812
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/bash -f
+
+if [ -z "$SUITRoot" ] ; then          
+  export SUITRoot=${GUI_ROOT_DIR}/share/salome
+fi
+# this variable necessary for loading .ini or .xml file
+if [ -z "$LightAppConfig" ] ; then
+  export LightAppConfig=${GUI_ROOT_DIR}/share/salome/resources
+fi
+if [ -z "$LightAppResources" ] ; then
+  export LightAppResources=${GUI_ROOT_DIR}/share/salome/resources
+fi
+
+SUITApp LightApp -style salome $* &
index 873825f0b9144e924be90db292419180d8e87bb6..ec5cce644a17373bb3c97efee81d30d60538dcce 100755 (executable)
@@ -109,7 +109,7 @@ fi
 
 # make a link allowing AC_OUTPUT to find the salome_adm/.../*.in  files
 echo "" >> configure.in_tmp1
-echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/salome_adm' >> configure.in_tmp1
+echo 'ln -fs ${KERNEL_ROOT_DIR}/salome_adm ${ROOT_SRCDIR}/.' >> configure.in_tmp1
 
 echo  "" >> configure.in_tmp1
 echo "AC_OUTPUT([ \\" >> configure.in_tmp1
diff --git a/doc/salome/GUI_index.html b/doc/salome/GUI_index.html
new file mode 100755 (executable)
index 0000000..465e3ea
--- /dev/null
@@ -0,0 +1,95 @@
+<!DOCTYPE doctype PUBLIC "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+                                            
+  <meta http-equiv="Content-Type"
+ content="text/html; charset=iso-8859-1">
+                                            
+  <meta name="GENERATOR"
+ content="Mozilla/4.73 [en] (WinNT; I) [Netscape]">
+  <title>Gui Module Documentation</title>
+</head>
+  <body bgcolor="#cccccc" text="#000000" link="#0000ee" alink="#0000ee"
+ vlink="#551a8b">
+       
+<div align="center">    &nbsp;           
+<center>          
+<center>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
+ &nbsp;&nbsp;</center>
+       
+<table width="96%" align="center">
+           <tbody>
+              <tr>
+           <td><a href="http://www.opencascade.com"><img
+ src="tui/SUIT/sources/logocorp.gif" border="0" height="46" width="122">
+                </a></td>
+             <td>                                                       
+               
+      <div align="right"><a href="http://www.opencascade.org/SALOME/"><img
+ src="tui/SUIT/sources/application.gif" border="0" height="46" width="108">
+                </a></div>
+           </td>
+           </tr>
+                                                      
+  </tbody>    
+</table>
+       
+<div align="center">    
+<center>    
+<hr width="100%" size="2">   
+<h1>GUI MODULE Documentation</h1>
+                                     </center>
+    </div>
+       
+<table width="96%">
+      <tbody>
+               
+  </tbody>    
+</table>
+    </center>
+       
+<div align="center">       
+<p> <img src="tui/SUIT/sources/Application-About.png"
+ alt="Application-About.png" width="30%" height="20%">
+    &nbsp; &nbsp;&nbsp;          </p>
+             </div>
+       
+<center>    
+<table width="96%">
+      <tbody>
+                 
+  </tbody>    
+</table>
+   <br>
+   <br>
+   <br>
+   </center>
+     
+<address> </address>
+   
+<center><big><a href="gui/KERNEL/kernel.htm">GUI Documentation</a></big></center>
+      
+<address> </address>
+   
+<center></center>
+      
+<center><br>
+   </center>
+     
+<address> </address>
+   
+<center><big><a href="tui/SUIT/index.html">TUI Documentation</a></big></center>
+      
+<address> </address>
+   
+<center></center>
+      
+<center><br>
+   <br>
+    </center>
+    </div>
+     <br>
+  <br>
+ <br>
+</body>
+</html>
index 02d73d5e59412d0d12e7e683d7927f3f0066ebc8..7d82b803d859dc1e67135cd0bd7536a9bc1e1309 100755 (executable)
@@ -3,7 +3,7 @@
 #---------------------------------------------------------------------------
 # Project related configuration options
 #---------------------------------------------------------------------------
-PROJECT_NAME           = "SALOME v.3.1.0a"
+PROJECT_NAME           = "SALOME v.3.1.0"
 PROJECT_NUMBER         = id#1.1
 OUTPUT_DIRECTORY       = ../
 CREATE_SUBDIRS         = NO
index 3aa523b1c07dfac37b31a1336a9548a5710bfeb6..50f5fe543f6f91a0d9804af29bb141b079a7fbf7 100644 (file)
@@ -41,6 +41,7 @@
 
 #include <LogWindow.h>
 #include <OB_Browser.h>
+#include <OB_ListView.h>
 #include <PythonConsole_PyConsole.h>
 
 #include <GLViewer_Viewer.h>
 #include <qobjectlist.h>
 #include <qcombobox.h>
 #include <qinputdialog.h>
-
-#define OBJECT_BROWSER_WIDTH 300
-#define OBJECT_COLUMN_WIDTH 150
-
-#ifdef WIN32
-#define DEFAULT_BROWSER "start iexplore.exe"
-#else
-#define DEFAULT_BROWSER "mozilla"
-#endif
+#include <qmessagebox.h>
 
 #define FIRST_HELP_ID 1000000
 
@@ -338,7 +331,7 @@ void LightApp_Application::createActions()
   //! Preferences
   createAction( PreferencesId, tr( "TOT_DESK_PREFERENCES" ), QIconSet(),
                tr( "MEN_DESK_PREFERENCES" ), tr( "PRP_DESK_PREFERENCES" ),
-               CTRL+Key_P, desk, false, this, SLOT( onPreferences() ) );
+               CTRL+Key_F, desk, false, this, SLOT( onPreferences() ) );
 
   //! Help for modules
   int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 );
@@ -485,8 +478,8 @@ void LightApp_Application::createActions()
     createMenu( a, newWinMenu, -1 );
   }
 
-  createAction( RenameId, tr( "TOT_RENAME" ), QIconSet(), tr( "MEN_RENAME" ), tr( "PRP_RENAME" ),
-               0, desk, false, this, SLOT( onRenameWindow() ) );
+  createAction( RenameId, tr( "TOT_RENAME" ), QIconSet(), tr( "MEN_DESK_RENAME" ), tr( "PRP_RENAME" ),
+               SHIFT+Key_R, desk, false, this, SLOT( onRenameWindow() ) );
   createMenu( RenameId, windowMenu, -1 );
 
   connect( modGroup, SIGNAL( selected( QAction* ) ), this, SLOT( onModuleActivation( QAction* ) ) );
@@ -780,17 +773,13 @@ public:
            postEvent (qApp, ce2000);
          }
       }
-
-    if( myStatus != 0 || myApp.isEmpty())
+      if( myStatus != 0)
       {
-       myParams = "";
-       aCommand.sprintf("%s %s %s", QString(DEFAULT_BROWSER).latin1(),myParams.latin1(), myHelpFile.latin1());
-       myStatus = system(aCommand);
-       if(myStatus != 0)
-         {
-           QCustomEvent* ce2001 = new QCustomEvent (2001);
-           postEvent (qApp, ce2001);
-         }
+        qApp->lock();
+        SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+                               QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").arg(myApp).arg(myHelpFile),
+                               QObject::tr("BUT_OK"));
+        qApp->unlock();
       }
   }
 
@@ -821,8 +810,15 @@ void LightApp_Application::onHelpContentsModule()
   QString anApp = resMgr->stringValue("ExternalBrowser", "application");
   QString aParams = resMgr->stringValue("ExternalBrowser", "parameters");
 
-  RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
-  rs->start();
+  if (!anApp.isEmpty()) {
+    RunBrowser* rs = new RunBrowser(anApp, aParams, helpFile);
+    rs->start();
+  }
+  else {
+    SUIT_MessageBox::warn1(desktop(), tr("WRN_WARNING"),
+                           tr("DEFINE_EXTERNAL_BROWSER"),
+                           tr("BUT_OK"));
+  }
 }
 
 /*!Sets enable or disable some actions on selection changed.*/
@@ -888,11 +884,21 @@ void LightApp_Application::addWindow( QWidget* wid, const int flag, const int st
     myWindows[flag]->setResizeEnabled( true );
     myWindows[flag]->setCloseMode( QDockWindow::Always );
     myWindows[flag]->setName( QString( "dock_window_%1" ).arg( flag ) );
+    myWindows[flag]->setFixedExtentWidth( wid->width() );
+    myWindows[flag]->setFixedExtentHeight( wid->height() );
   }
 
   QFont f;
   if( wid->inherits( "PythonConsole" ) )
-    f = ( ( PythonConsole* )wid )->font();
+  {
+    if( resourceMgr()->hasValue( "PyConsole", "font" ) )
+      f = resourceMgr()->fontValue( "PyConsole", "font" );
+    else
+    {
+      f = ( ( PythonConsole* )wid )->font();
+      resourceMgr()->setValue( "PyConsole", "font", f );
+    }
+  }
   else
     f = wid->font();
 
@@ -1018,7 +1024,7 @@ void LightApp_Application::updateObjectBrowser( const bool updateModels )
   if ( objectBrowser() )
   {
     objectBrowser()->updateGeometry();
-    objectBrowser()->updateTree();
+    objectBrowser()->updateTree( 0, false );
   }
 }
 
@@ -1252,7 +1258,11 @@ void LightApp_Application::onPreferences()
   if ( !prefDlg )
     return;
 
-  prefDlg->exec();
+  if ( ( prefDlg->exec() == QDialog::Accepted || prefDlg->isSaved() ) &&  resourceMgr() ) {
+    if ( desktop() )
+      desktop()->saveGeometry( resourceMgr(), "desktop" );
+    resourceMgr()->save();
+  }
 
   delete prefDlg;
 }
@@ -1319,10 +1329,12 @@ QWidget* LightApp_Application::createWindow( const int flag )
     ob->setAutoUpdate( true );
     ob->setAutoOpenLevel( 1 );
     ob->setCaption( tr( "OBJECT_BROWSER" ) );
-    ob->listView()->setColumnWidth( 0, OBJECT_COLUMN_WIDTH );
-    ob->resize( OBJECT_BROWSER_WIDTH, ob->height() );
-    ob->setFilter( new LightApp_OBFilter( selectionMgr() ) );
 
+    OB_ListView* ob_list = dynamic_cast<OB_ListView*>( const_cast<QListView*>( ob->listView() ) );
+    if( ob_list )
+      ob_list->setColumnMaxWidth( 0, desktop()->width()/4 );
+
+    ob->setFilter( new LightApp_OBFilter( selectionMgr() ) );
     ob->setNameTitle( tr( "OBJ_BROWSER_NAME" ) );
 
     // Create OBSelector
@@ -1375,7 +1387,8 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const
 
   LightApp_Application* that = (LightApp_Application*)this;
 
-  if ( !_prefs_ && crt )
+  bool toCreate = !_prefs_ && crt;
+  if( toCreate )
   {
     _prefs_ = new LightApp_Preferences( resourceMgr() );
     that->createPreferences( _prefs_ );
@@ -1411,7 +1424,8 @@ LightApp_Preferences* LightApp_Application::preferences( const bool crt ) const
       {
        int modCat = _prefs_->addPreference( mod->moduleName() );
        _prefs_->setItemProperty( modCat, "info", QString::null );
-       mod->createPreferences();
+       if( toCreate )
+         mod->createPreferences();
       }
     }
   }
@@ -1456,12 +1470,14 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
   int undoPref = pref->addPreference( tr( "PREF_UNDO_LEVEL" ), studyGroup, LightApp_Preferences::IntSpin, "Study", "undo_level" );
   pref->setItemProperty( undoPref, "min", 1 );
   pref->setItemProperty( undoPref, "max", 100 );
+  pref->addPreference( tr( "PREF_STORE_POS" ), studyGroup, LightApp_Preferences::Bool, "Study", "store_positions" );
 
   int extgroup = pref->addPreference( tr( "PREF_GROUP_EXT_BROWSER" ), genTab );
   pref->setItemProperty( extgroup, "columns", 1 );
   int apppref = pref->addPreference( tr( "PREF_APP" ), extgroup, LightApp_Preferences::File, "ExternalBrowser", "application" );
   pref->setItemProperty( apppref, "existing", true );
   pref->setItemProperty( apppref, "flags", QFileInfo::ExeUser );
+  pref->setItemProperty( apppref, "readOnly", false );
 
   pref->addPreference( tr( "PREF_PARAM" ), extgroup, LightApp_Preferences::String, "ExternalBrowser", "parameters" );
 
@@ -1587,6 +1603,13 @@ void LightApp_Application::createPreferences( LightApp_Preferences* pref )
                       LightApp_Preferences::Color, "SUPERVGraph", "Title" );
 //  pref->addPreference( tr( "PREF_SUPERV_CTRL_COLOR" ), supervGroup,
 //                    LightApp_Preferences::Color, "SUPERVGraph", "Ctrl" );
+
+  int obTab = pref->addPreference( tr( "PREF_TAB_OBJBROWSER" ), salomeCat );
+  int objSetGroup = pref->addPreference( tr( "PREF_OBJ_BROWSER_SETTINGS" ), obTab );
+  pref->addPreference( tr( "PREF_AUTO_SIZE_FIRST" ), objSetGroup, LightApp_Preferences::Bool,
+                      "ObjectBrowser", "auto_size_first" );
+  pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, LightApp_Preferences::Bool,
+                      "ObjectBrowser", "auto_size" );
 }
 
 /*!Changed preferences */
@@ -1649,19 +1672,26 @@ void LightApp_Application::preferencesChanged( const QString& sec, const QString
 
   if( sec=="ObjectBrowser" )
   {
-    if( param=="auto_size" )
+    if( param=="auto_size" || param=="auto_size_first" )
     {
       OB_Browser* ob = objectBrowser();
       if( !ob )
        return;
 
-      bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false );
+      bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false ),
+           autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
       ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
-
+      ob->listView()->setColumnWidthMode( 0, autoSizeFirst ? QListView::Maximum : QListView::Manual );
       updateObjectBrowser( false );
     }
   }
 
+  if( sec=="Study" )
+  { 
+    if( param=="store_positions" )
+      updateWindows();
+  }
+
   if( sec=="PyConsole" )
   {
     if( param=="font" )
@@ -1757,6 +1787,10 @@ void LightApp_Application::updateViewManagers()
 /*!Load windows geometry.*/
 void LightApp_Application::loadWindowsGeometry()
 {
+  bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
+  if( !store )
+    return;
+
   QtxDockAction* dockMgr = 0;
 
   QAction* a = action( ViewWindowsId );
@@ -1781,6 +1815,10 @@ void LightApp_Application::loadWindowsGeometry()
 /*!Save windows geometry.*/
 void LightApp_Application::saveWindowsGeometry()
 {
+  bool store = resourceMgr()->booleanValue( "Study", "store_positions", true );
+  if( !store )
+    return;
+
   QtxDockAction* dockMgr = 0;
 
   QAction* a = action( ViewWindowsId );
index 46d3f82afbba36a87b47afa7317d9a1e08445b21..283c49c89f7ebcf26dde76f788fef76ecbf1ec0f 100644 (file)
@@ -121,12 +121,18 @@ bool LightApp_Module::activateModule( SUIT_Study* study )
 }
 
 /*!Deactivate module.*/
-bool LightApp_Module::deactivateModule( SUIT_Study* )
+bool LightApp_Module::deactivateModule( SUIT_Study* study )
 {
   delete mySwitchOp;
   mySwitchOp = 0;
 
-  return true;
+  // abort all operations
+  MapOfOperation::const_iterator anIt;
+  for( anIt = myOperations.begin(); anIt != myOperations.end(); anIt++ ) {
+    anIt.data()->abort();
+  }
+
+  return CAM_Module::activateModule( study );
 }
 
 /*!NOT IMPLEMENTED*/
index d44586445d60031549401f7f5f6d3328c389d343..5d0f1ead4a3a01f353fae732ef205fdb4dccdd0e 100644 (file)
@@ -31,7 +31,7 @@
 */
 LightApp_PreferencesDlg::LightApp_PreferencesDlg( LightApp_Preferences* prefs, QWidget* parent )
 : QtxDialog( parent, 0, true, false, OK | Close | Apply ),
-myPrefs( prefs )
+myPrefs( prefs ), mySaved ( false )
 {
   setCaption( tr( "CAPTION" ) );
 
@@ -79,6 +79,7 @@ void LightApp_PreferencesDlg::accept()
   QtxDialog::accept();
 
   myPrefs->store();
+  mySaved = true;
 }
 
 /*!Reject. Restore preferences from backup.*/
@@ -99,4 +100,5 @@ void LightApp_PreferencesDlg::onApply()
 {
   myPrefs->store();
   myPrefs->toBackup();
+  mySaved = true;
 }
index 95ffb79b6d42be2f993673a7c7854c48ec456aea..ea7bf55fe22697014b9b709ff843950ed2e29d58 100644 (file)
@@ -40,12 +40,16 @@ public:
   virtual void          accept();
   virtual void          reject();
 
+  bool                  isSaved() { return mySaved; }
+  void                  setSaved( bool saved ) { mySaved = saved; } 
+
 private slots:
   void                  onHelp();
   void                  onApply();
 
 private:
   LightApp_Preferences* myPrefs;
+  bool                  mySaved;
 };
 
 #endif
index 4cf18982dd5d82d638cc020863ba236d5dd02d80..52f16266f424acb5d53427b47487bb864353bd69 100644 (file)
@@ -58,8 +58,16 @@ void LightApp_ShowHideOp::startOperation()
     abort();
     return;
   }
-  QString aStr =  sel.param( 0, "component" ).toString();
-  QString mod_name = app->moduleTitle( aStr );//sel.param( 0, "component" ).toString() );
+
+  QString mod_name;
+  if( sel.count()>0 )
+  {
+    QString aStr =  sel.param( 0, "component" ).toString();
+    mod_name = app->moduleTitle( aStr );
+  }
+  else if( app->activeModule() )
+    mod_name = app->moduleTitle( app->activeModule()->name() );
+
   LightApp_Displayer* d = LightApp_Displayer::FindDisplayer( mod_name, true );
   if( !d )
   {
index beb65b8aacc9f77ab9ecb9908dd4b7f8363012c1..2a4932e04b54e720124bb78a26f0863cc9f7ee10 100644 (file)
@@ -44,6 +44,9 @@
     <parameter name="QuickDirList" value=""/>
     <!-- Here go other common user preferences -->
   </section>
+  <section name="Study">
+    <parameter value="true" name="store_positions" />
+  </section>
   <section name="OCCViewer" >
     <parameter value="35, 136, 145" name="background" />
     <parameter value="1" name="iso_number_u" />
index b59f4a2fda349bcf3e1cdd40a97e4f50ddf21689..5c321533545eadb1847a4cceef318cc35b20855b 100644 (file)
@@ -35,8 +35,8 @@ msgstr "Trying to activate module \"%1\""
 msgid "LightApp_Application::TOT_RENAME"
 msgstr "Rename"
 
-msgid "LightApp_Application::MEN_RENAME"
-msgstr "Rename"
+msgid "LightApp_Application::MEN_DESK_RENAME"
+msgstr "&Rename"
 
 msgid "LightApp_Application::PRP_RENAME"
 msgstr "Rename active window"
@@ -45,7 +45,7 @@ msgid "LightApp_Application::TOT_DESK_PREFERENCES"
 msgstr "Preferences"
 
 msgid "LightApp_Application::MEN_DESK_PREFERENCES"
-msgstr "Preferences..."
+msgstr "Pre&ferences..."
 
 msgid "LightApp_Application::TOT_DESK_MRU"
 msgstr "Most recently used"
@@ -66,20 +66,26 @@ msgid "LightApp_Application::PRP_MODULE"
 msgstr "Switch to the module \"%1\""
 
 msgid "LightApp_Application::NEW_WINDOW_0"
-msgstr "GL view"
+msgstr "&GL view"
 
 msgid "LightApp_Application::NEW_WINDOW_1"
-msgstr "Plot2d view"
+msgstr "&Plot2d view"
 
 msgid "LightApp_Application::NEW_WINDOW_2"
-msgstr "OCC view"
+msgstr "&OCC view"
 
 msgid "LightApp_Application::NEW_WINDOW_3"
-msgstr "VTK view"
+msgstr "VT&K view"
 
 msgid "LightApp_Application::INF_CANCELLED"
 msgstr "Module activation cancelled"
 
+msgid "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"
+msgstr "External browser \"%1\" can not show help page \"%2\""
+
+msgid "LightApp_Application::DEFINE_EXTERNAL_BROWSER"
+msgstr "Define external browser in preferences"
+
 msgid "LightApp_Application::DATA_MODELS"
 msgstr "Data models"
 
@@ -120,6 +126,9 @@ msgstr "ASCII save"
 msgid "LightApp_Application::PREF_UNDO_LEVEL"
 msgstr "Undo level"
 
+msgid "LightApp_Application::PREF_STORE_POS"
+msgstr "Store positions of windows"
+
 msgid "LightApp_Application::PREF_GROUP_EXT_BROWSER"
 msgstr "External browser"
 
@@ -138,6 +147,9 @@ msgstr "Font"
 msgid "LightApp_Application::PREF_TAB_OBJBROWSER"
 msgstr "Object browser"
 
+msgid "LightApp_Application::PREF_OBJ_BROWSER_SETTINGS"
+msgstr "Object browser settings"
+
 msgid "LightApp_Application::PREF_GROUP_DEF_COLUMNS"
 msgstr "Default columns"
 
@@ -233,6 +245,12 @@ msgstr "Title color"
 msgid "LightApp_Application::PREF_SUPERV_CTRL_COLOR"
 msgstr "Ctrl color"
 
+msgid "LightApp_Application::PREF_AUTO_SIZE"
+msgstr "Auto size for other columns"
+
+msgid "LightApp_Application::PREF_AUTO_SIZE_FIRST"
+msgstr "Auto size for first column"
+
 //=======================================================================================
 
 msgid "LightApp_PreferencesDlg::CAPTION"
index 1a020f497722028047ca584b5ec249d34366bd67..4900fd9de51ef680d34f8bdfaf908b7383989030 100755 (executable)
@@ -160,19 +160,6 @@ const char* imageCrossCursor[] = {
   "................................",
   "................................",
   "................................"};
-  
-
-QPixmap zoomPixmap(imageZoomCursor);
-QPixmap rotatePixmap(imageRotateCursor);
-QPixmap globalPanPixmap(imageCrossCursor);
-
-QCursor        defCursor(Qt::ArrowCursor);
-QCursor        handCursor(Qt::PointingHandCursor);
-QCursor        panCursor(Qt::SizeAllCursor);
-QCursor        zoomCursor(zoomPixmap);
-QCursor        rotCursor(rotatePixmap);
-QCursor        glPanCursor(globalPanPixmap);
-
 
 
 //////////////////////////////////////////////////////////////////////
@@ -344,6 +331,8 @@ void OCCViewer_ViewWindow::activateZoom()
     myCursor = cursor();               /* save old cursor */
   
   if ( myOperation != ZOOMVIEW ) {
+    QPixmap zoomPixmap (imageZoomCursor);
+    QCursor zoomCursor (zoomPixmap);
     setTransformRequested ( ZOOMVIEW );                
     setCursor( zoomCursor );
   }
@@ -360,6 +349,7 @@ void OCCViewer_ViewWindow::activatePanning()
     myCursor = cursor();               // save old cursor 
   
   if ( myOperation != PANVIEW ) {
+    QCursor panCursor (Qt::SizeAllCursor);
     setTransformRequested ( PANVIEW );
     setCursor( panCursor );
   }
@@ -375,6 +365,8 @@ void OCCViewer_ViewWindow::activateRotation()
     myCursor = cursor();               // save old cursor 
   
   if ( myOperation != ROTATE ) {
+    QPixmap rotatePixmap (imageRotateCursor);
+    QCursor rotCursor (rotatePixmap);
     setTransformRequested ( ROTATE );
     setCursor( rotCursor );    
   }
@@ -385,6 +377,8 @@ void OCCViewer_ViewWindow::activateGlobalPanning()
 {
   Handle(V3d_View) aView3d = myViewPort->getView();
   if ( !aView3d.IsNull() ) {
+    QPixmap globalPanPixmap (imageCrossCursor);
+    QCursor glPanCursor (globalPanPixmap);
     myCurScale = aView3d->Scale();
     aView3d->FitAll(0.01, false);
     myCursor = cursor();               // save old cursor 
@@ -404,6 +398,7 @@ void OCCViewer_ViewWindow::activateWindowFit()
     myCursor = cursor();               /* save old cursor */
 
   if ( myOperation != WINDOWFIT ) {
+    QCursor handCursor (Qt::PointingHandCursor);
     setTransformRequested ( WINDOWFIT );               
     setCursor ( handCursor );
     myCursorIsHand = true;
@@ -460,6 +455,7 @@ void OCCViewer_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent)
       if ( myDrawRect ) {
         drawRect();
        if ( !myCursorIsHand )  {   // we are going to sketch a rectangle
+          QCursor handCursor (Qt::PointingHandCursor);
          myCursorIsHand = true;                
          myCursor = cursor();
          setCursor( handCursor );
index 81ee7a6bf311c788bf4bdf017aa2756c5e4a48b0..fff6ab535446c5b7537334a662cdb3cc6cd06cfa 100755 (executable)
@@ -134,7 +134,7 @@ void OB_Browser::setRootIsDecorated( const bool decor )
     return;
 
   myRootDecorated = decor;
-  updateTree();
+  updateTree( 0, false );
 }
 
 int OB_Browser::autoOpenLevel() const
@@ -506,7 +506,7 @@ void OB_Browser::setAppropriateColumn( const int id, const bool on )
   myView->setAppropriate( myColumnIds[id], on );
 }
 
-void OB_Browser::updateTree( SUIT_DataObject* obj )
+void OB_Browser::updateTree( SUIT_DataObject* obj, const bool autoOpen )
 {
   if ( !obj && !(obj = getRootObject()) )
     return;
@@ -523,7 +523,8 @@ void OB_Browser::updateTree( SUIT_DataObject* obj )
 
   restoreState( selObjs, openObjs, curObj, selKeys, openKeys, curKey );
 
-  autoOpenBranches();
+  if( autoOpen )
+    autoOpenBranches();
 
   if ( selNum != numberOfSelected() )
     emit selectionChanged();
@@ -860,11 +861,22 @@ void OB_Browser::restoreState( const DataObjectMap& selObjs, const DataObjectMap
 
     if ( openObjs.contains( obj ) )
     {
-      if ( openObjs[obj] )
+      bool parentOpen = true;
+      if( item && item->parent() )
+       parentOpen = item->parent()->isOpen();
+       
+      if ( openObjs[obj] && parentOpen )
         lv->setOpen( item, true );
     }
     else if ( !key.isNull() && openKeys.contains( key ) )
-      lv->setOpen( item, true );
+    {
+      bool parentOpen = true;
+      if( item && item->parent() )
+       parentOpen = item->parent()->isOpen();
+
+      if( parentOpen )
+       lv->setOpen( item, true );
+    }
 
     if ( !curItem && ( curObj == obj || ( !curKey.isNull() && curKey == key )) )
       curItem = item;
@@ -892,7 +904,7 @@ OB_Browser::DataObjectKey OB_Browser::objectKey( SUIT_DataObject* obj ) const
 void OB_Browser::keyPressEvent( QKeyEvent* e )
 {
   if ( e->key() == Qt::Key_F5 )
-    updateTree();
+    updateTree( 0, false );
 
   QFrame::keyPressEvent( e );
 }
@@ -1083,7 +1095,7 @@ void OB_Browser::removeObject( SUIT_DataObject* obj, const bool autoUpd )
   if ( isAutoUpdate() )
   {
     SUIT_DataObject* pObj = item && item->parent() ? dataObject( item->parent() ) : 0;
-    updateTree( pObj );
+    updateTree( pObj, false );
   }
   else
     delete item;
index 5d7575b47c0bca195e9df97877f1c88ac32d7739..cd0b48889308805105e0c70f4e83dfda20895b1d 100755 (executable)
@@ -70,7 +70,7 @@ public:
   bool              isAutoDeleteObjects() const;
   virtual void      setAutoDeleteObjects( const bool );
 
-  virtual void      updateTree( SUIT_DataObject* = 0 );
+  virtual void      updateTree( SUIT_DataObject* = 0, const bool autoOpen = true );
   virtual void      replaceTree( SUIT_DataObject*, SUIT_DataObject* );
 
   bool              isShowToolTips();
index fb821308f2d2d6c8bcf8c9f87f5b3f19d3356762..b2ced5c7bc77fbd83574f3ecc87ae88633a6ec3b 100755 (executable)
@@ -192,6 +192,17 @@ int OB_ListItem::rtti() const
   return RTTI();
 }
 
+void OB_ListItem::setText( int column, const QString& text )
+{
+  QListViewItem::setText( column, text );
+  QFontMetrics fm = listView()->fontMetrics();
+  int necessary = width( fm, listView(), column ),
+      current = listView()->columnWidth( column );
+
+  if( listView()->columnWidthMode( column )==QListView::Maximum && necessary>current )
+    listView()->setColumnWidth( column, necessary );
+}
+
 /*!
     Class: OB_CheckListItem
     Descr: Check list view item for OB_Browser.
index 071ec308a68883b82258df78c1a2d24353ea0146..6b06cd8424fdbfd81e77f8561ceb473a669ffabb 100755 (executable)
@@ -75,6 +75,7 @@ public:
   virtual void            paintFocus( QPainter* p, const QColorGroup& cg, const QRect& r );
   virtual void            paintCell( QPainter* p, const QColorGroup& cg, int c, int w, int align );
 
+  virtual void setText ( int column, const QString & text );
 
   virtual int      rtti() const;
 
index 70a9ca63534006199aae9865dae82e3db3da2f12..53d62602f15de6c4a942c31afe9fb39d5af1672c 100755 (executable)
@@ -162,3 +162,39 @@ bool OB_ListView::isDropAccepted( QListViewItem* drag, QListViewItem* drop ) con
 
   return dropObj->isDropAccepted( dragObj );
 }
+
+void OB_ListView::setColumnWidth( int col, int width )
+{
+  int max = columnMaxWidth( col );
+  if( max>0 && width>max )
+    width = max;
+  QListView::setColumnWidth( col, width );
+}
+
+int OB_ListView::columnMaxWidth( const int col ) const
+{
+  int res = -1;
+  if( myMaxColWidth.contains( col ) )
+    res = myMaxColWidth[col];
+  else if( myMaxColRatio.contains( col ) )
+    res = int( myMaxColRatio[col]*height() );
+  return res;
+}
+
+void OB_ListView::setColumnMaxWidth( const int col, const int w )
+{
+  myMaxColWidth.insert( col, w );
+}
+
+double OB_ListView::columnMaxRatio( const int col ) const
+{
+  double res = 0.0;
+  if( myMaxColRatio.contains( col ) )
+    res = myMaxColRatio[col];
+  return res;
+}
+
+void OB_ListView::setColumnMaxRatio( const int col, const double r )
+{
+  myMaxColRatio.insert( col, r );
+}
index 5c9feb5d117174fd9a26c71a8f406a447a532668..03a394c213bd1c23a2e7a986ed4f39942f86744c 100755 (executable)
@@ -47,6 +47,11 @@ public:
   void                    setFilter( OB_Filter* );
 
   bool                    isOk( QListViewItem* ) const;
+  virtual void            setColumnWidth( int, int );
+  int                     columnMaxWidth( const int ) const;
+  void                    setColumnMaxWidth( const int, const int );
+  double                  columnMaxRatio( const int ) const;
+  void                    setColumnMaxRatio( const int, const double );
 
 signals:
   void                    dropped( QPtrList<QListViewItem>, QListViewItem*, int );
@@ -69,6 +74,8 @@ private:
 protected:
   QPtrList<QListViewItem> myItems;
   OB_Filter*              myFilter;
+  QMap<int,int>           myMaxColWidth;
+  QMap<int,double>        myMaxColRatio;
 };
 
 #ifdef WIN32
index e43e40cee3eacfdcd04f47028baf37d98b11b13c..67933dbae4a4065de8771c1e6eda7afd7c40b863 100755 (executable)
@@ -130,13 +130,6 @@ const char* imageCrossCursor[] = {
   "................................"};
   
 
-QPixmap zoomPixmap(imageZoomCursor);
-QPixmap globalPanPixmap(imageCrossCursor);
-
-QCursor        panCursor(Qt::SizeAllCursor);
-QCursor        zoomCursor(zoomPixmap);
-QCursor        glPanCursor(globalPanPixmap);
-
 //=================================================================================
 // Plot2d_ViewFrame implementation
 //=================================================================================
@@ -306,8 +299,8 @@ void Plot2d_ViewFrame::readPreferences()
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
 
   myCurveType = resMgr->integerValue( "Plot2d", "CurveType", myCurveType );
-  if ( myCurveType < 1 || myCurveType > 2 )
-    myCurveType = 1;
+  setCurveType( resMgr->integerValue( "Plot2d", "CurveType", myCurveType ) );
+
   myShowLegend = resMgr->booleanValue( "Plot2d", "ShowLegend", myShowLegend );
   myLegendPos = resMgr->integerValue( "Plot2d", "LegendPos", myLegendPos );
   myMarkerSize = resMgr->integerValue( "Plot2d", "MarkerSize", myMarkerSize );
@@ -683,6 +676,7 @@ void Plot2d_ViewFrame::eraseCurve( Plot2d_Curve* curve, bool update )
   if ( curveKey ) {
     myPlot->removeCurve( curveKey );
     myCurves.remove( curveKey );
+    updateTitles();
     if ( update )
       myPlot->replot();
   }
@@ -905,8 +899,12 @@ int Plot2d_ViewFrame::testOperation( const QMouseEvent& me )
   switch (btn)
   {
   case zoomBtn:
-    myPlot->canvas()->setCursor( zoomCursor );
-    return ZoomId;
+    {
+      QPixmap zoomPixmap (imageZoomCursor);
+      QCursor zoomCursor (zoomPixmap);
+      myPlot->canvas()->setCursor( zoomCursor );
+      return ZoomId;
+    }
   case panBtn:
     myPlot->canvas()->setCursor( QCursor( Qt::SizeAllCursor ) );
     return PanId;
@@ -1533,6 +1531,7 @@ void Plot2d_ViewFrame::wheelEvent(QWheelEvent* event)
 */
 void Plot2d_ViewFrame::onViewPan()
 { 
+  QCursor panCursor (Qt::SizeAllCursor);
   myPlot->canvas()->setCursor( panCursor );
   myOperation = PanId;
   qApp->installEventFilter( this );
@@ -1542,6 +1541,8 @@ void Plot2d_ViewFrame::onViewPan()
 */
 void Plot2d_ViewFrame::onViewZoom() 
 {
+  QPixmap zoomPixmap (imageZoomCursor);
+  QCursor zoomCursor (zoomPixmap);
   myPlot->canvas()->setCursor( zoomCursor );
   myOperation = ZoomId;
   qApp->installEventFilter( this );
@@ -1567,6 +1568,8 @@ void Plot2d_ViewFrame::onViewFitArea()
 */
 void Plot2d_ViewFrame::onViewGlobalPan() 
 {
+  QPixmap globalPanPixmap (imageCrossCursor);
+  QCursor glPanCursor (globalPanPixmap);
   myPlot->canvas()->setCursor( glPanCursor );
   myPlot->changeAxisOptions( QwtPlot::xBottom, QwtAutoScale::Logarithmic, false );
   myPlot->changeAxisOptions( QwtPlot::yLeft, QwtAutoScale::Logarithmic, false );
index 447ec7dad192cae4d4bbdad14152c60718ca6d35..5c558ea0fb21e689596ce80f454a791bc2dec426 100755 (executable)
@@ -357,7 +357,12 @@ void Plot2d_ViewWindow::onChangeVerMode()
 //****************************************************************
 void Plot2d_ViewWindow::onChangeCurveMode()
 {
-  myCurveBtn->SetItem(myViewFrame->getCurveType());
+  int aCurveType = myViewFrame->getCurveType();
+  myCurveBtn->SetItem(aCurveType);
+
+  myActionsMap[CurvPointsId]->setOn(aCurveType == 0);
+  myActionsMap[CurvLinesId]->setOn(aCurveType == 1);
+  myActionsMap[CurvSplinesId]->setOn(aCurveType == 2);
 }
 
 //****************************************************************
@@ -425,26 +430,14 @@ void Plot2d_ViewWindow::onLegend()
 void Plot2d_ViewWindow::onCurves()
 {
   QtxAction* aSender = (QtxAction*) sender();
-  if(aSender == myActionsMap[CurvPointsId]) {
-    myActionsMap[CurvPointsId]->setOn(true);
-    myActionsMap[CurvLinesId]->setOn(false);
-    myActionsMap[CurvSplinesId]->setOn(false);
+  if(aSender == myActionsMap[CurvPointsId])
     myViewFrame->setCurveType(0);
-  }
-  else if(aSender == myActionsMap[CurvLinesId]) {
-    myActionsMap[CurvLinesId]->setOn(true);
-    myActionsMap[CurvPointsId]->setOn(false);
-    myActionsMap[CurvSplinesId]->setOn(false);
+  else if(aSender == myActionsMap[CurvLinesId])
     myViewFrame->setCurveType(1);
-  }
-  else if(aSender == myActionsMap[CurvSplinesId]) {
-    myActionsMap[CurvSplinesId]->setOn( true );
-    myActionsMap[CurvPointsId]->setOn( false );
-    myActionsMap[CurvLinesId]->setOn( false );
+  else if(aSender == myActionsMap[CurvSplinesId])
     myViewFrame->setCurveType(2);
-  }
 }
-
 //****************************************************************
 void Plot2d_ViewWindow::onDumpView()
 {
index 3312e527c75ae32f45108bb1fdc80fe6b704d89c..3d5067dba7ee01a31cd1993b4d10715c9a4317d0 100755 (executable)
@@ -31,7 +31,8 @@ void PyInterp_Request::process()
   safeExecute();
 
   myMutex.lock();
-  if ( !IsSync() && getListener() && getEvent() )
+  //if ( !IsSync() && getListener() && getEvent() )
+  if ( getListener() && getEvent() )
     postEvent();
   myMutex.unlock();
 }
@@ -56,7 +57,8 @@ QEvent* PyInterp_Request::createEvent() const
 
 QEvent* PyInterp_Request::getEvent()
 {
-  if ( !myEvent && !IsSync() )
+  //if ( !myEvent && !IsSync() )
+  if ( !myEvent )
     myEvent = createEvent();
   return myEvent;
 }
@@ -142,7 +144,8 @@ void PyInterp_Dispatcher::Exec( PyInterp_Request* theRequest )
   if ( !theRequest )
     return;
 
-  if ( theRequest->IsSync() && !IsBusy() ) // synchronous processing - nothing is done if dispatcher is busy!
+  //if ( theRequest->IsSync() && !IsBusy() ) // synchronous processing - nothing is done if dispatcher is busy!
+  if ( theRequest->IsSync() ) // synchronous processing - nothing is done if dispatcher is busy!
     processRequest( theRequest );
   else { // asynchronous processing
     myQueueMutex.lock();
index a75c39bdd8ff54c794a5ce9044e8d7a366fd4bc0..69ccefc9d671a8cc6f36f3a2fdf7281157810acc 100644 (file)
@@ -22,18 +22,30 @@ PyLockWrapper::PyLockWrapper(PyThreadState* theThreadState):
   myThreadState(theThreadState),
   mySaveThreadState(0)
 {
-  PyEval_AcquireLock();
-  mySaveThreadState = PyThreadState_Swap(myThreadState); // store previous current in save,
-                                                         // set local in current
+#if defined(USE_GILSTATE)
+  if (myThreadState->interp == PyInterp_base::_interp) {
+    _savestate = PyGILState_Ensure();
+  } else {
+    PyEval_AcquireThread(myThreadState);
+  }
+#else 
+  PyEval_AcquireThread(myThreadState);
+#endif
 }
 
-
-PyLockWrapper::~PyLockWrapper(){
-  PyThreadState_Swap(mySaveThreadState); // restore previous current (no need to get local,
-  PyEval_ReleaseLock();                  // local thread state* already in _tstate
+PyLockWrapper::~PyLockWrapper()
+{
+#if defined(USE_GILSTATE)
+  if (myThreadState->interp == PyInterp_base::_interp) {
+    PyGILState_Release(_savestate);
+  } else {
+    PyEval_ReleaseThread(myThreadState);
+  }
+#else 
+  PyEval_ReleaseThread(myThreadState);
+#endif
 }
 
-
 class PyReleaseLock{
 public:
   ~PyReleaseLock(){
@@ -47,14 +59,16 @@ PyLockWrapper PyInterp_base::GetLockWrapper(){
 }
 
 
-// main python interpreter
+// main python interpreter (static attributes)
 
-//PyThreadState *PyInterp_base::_gtstate = 0; // force 0 before execution
 int PyInterp_base::_argc = 1;
 char* PyInterp_base::_argv[] = {""};
 
 PyObject *PyInterp_base::builtinmodule = NULL;
 
+PyThreadState *PyInterp_base::_gtstate = NULL;
+PyInterpreterState *PyInterp_base::_interp = NULL;
+
 
 /*!
  * basic constructor here : herited classes constructors must call initalize() method
@@ -66,8 +80,6 @@ PyInterp_base::PyInterp_base(): _tstate(0), _vout(0), _verr(0), _g(0), _atFirst(
 
 PyInterp_base::~PyInterp_base()
 {
-  PyLockWrapper aLock(_tstate);
-  //Py_EndInterpreter(_tstate);
 }
 
 
@@ -85,10 +97,10 @@ void PyInterp_base::initialize()
   init_python();
   // Here the global lock is released
 
-  // The lock will be acquired in initState. Make provision to release it on exit
-  PyReleaseLock aReleaseLock;
-
   initState();
+
+  PyLockWrapper aLock= GetLockWrapper();
+
   initContext();
 
   // used to interpret & compile commands
@@ -96,45 +108,40 @@ void PyInterp_base::initialize()
   if(!m){
     PyErr_Print();
     return;
-  }   
-  
+  }
+
   // Create cStringIO to capture stdout and stderr
   PycString_IMPORT;
-  //PycStringIO = (PycStringIO_CAPI *)xxxPyCObject_Import("cStringIO", "cStringIO_CAPI");
   _vout = PycStringIO->NewOutput(128);
   _verr = PycStringIO->NewOutput(128);
-  
+
   // All the initRun outputs are redirected to the standard output (console)
   initRun();
 }
 
 void PyInterp_base::init_python()
 {
-  static PyThreadState *_gtstate = 0;
-
   _atFirst = false;
   if (Py_IsInitialized())
     return;
 
+  // Python is not initialized
   Py_SetProgramName(_argv[0]);
   Py_Initialize(); // Initialize the interpreter
   PySys_SetArgv(_argc, _argv);
   PyEval_InitThreads(); // Create (and acquire) the interpreter lock
+  _interp = PyThreadState_Get()->interp;
   _gtstate = PyEval_SaveThread(); // Release global thread state
-//  if(!_gtstate){
-//    PyReleaseLock aReleaseLock;
-//    Py_Initialize(); // Initialize the interpreter
-//    PyEval_InitThreads(); // Initialize and acquire the global interpreter lock
-//    PySys_SetArgv(_argc,_argv); // initialize sys.argv
-//    _gtstate = PyThreadState_Get();
-//  }
 }
 
 string PyInterp_base::getbanner()
 {
+ // Should we take the lock ?
+ // PyEval_RestoreThread(_tstate);
   string aBanner("Python ");
   aBanner = aBanner + Py_GetVersion() + " on " + Py_GetPlatform() ;
   aBanner = aBanner + "\ntype help to get general information on environment\n";
+  //PyEval_SaveThread();
   return aBanner;
 }
 
@@ -185,11 +192,11 @@ int compile_command(const char *command,PyObject *context)
     return 1;
   }else{
     // Complete and correct text. We evaluate it.
-#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0
-    PyObjWrapper r(PyEval_EvalCode(v,context,context));
-#else
+    //#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0
+    //    PyObjWrapper r(PyEval_EvalCode(v,context,context));
+    //#else
     PyObjWrapper r(PyEval_EvalCode((PyCodeObject *)(void *)v,context,context));
-#endif
+    //#endif
     if(!r){
       // Execution error. We return -1
       PyErr_Print();
@@ -240,15 +247,16 @@ int PyInterp_base::simpleRun(const char *command)
   // Reset redirected outputs before treatment
   PySys_SetObject("stderr",_verr);
   PySys_SetObject("stdout",_vout);
-    
+
   PyObjWrapper verr(PyObject_CallMethod(_verr,"reset",""));
   PyObjWrapper vout(PyObject_CallMethod(_vout,"reset",""));
-  
+
   int ier = compile_command(command,_g);
 
   // Outputs are redirected on standards outputs (console)
   PySys_SetObject("stdout",PySys_GetObject("__stdout__"));
   PySys_SetObject("stderr",PySys_GetObject("__stderr__"));
+
   return ier;
 }
 
@@ -290,4 +298,3 @@ string PyInterp_base::getvout(){
   string aRet(PyString_AsString(v));
   return aRet;
 }
index b2e0a0b261cdbf0ff8cfb6a2e8e036e09ccb06d3..66847770d1eb66234747a29bb542c5d34aa15ab3 100644 (file)
 //#include <pthread.h>  // must be before Python.h !
 
 #include <Python.h>   // must be before qt includes ...
+#include <compile.h>   // Python include needed for versions before 2.4. Included in Python.h now.
+#include <eval.h>   // Python include needed for versions before 2.4. Included in Python.h now.
 
-#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0
-extern "C" PyObject * PyEval_EvalCode(PyObject *co, PyObject *g, PyObject *l);
+//#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0
+//extern "C" PyObject * PyEval_EvalCode(PyObject *co, PyObject *g, PyObject *l);
+//#endif
+
+/* For 2.3, use the PyGILState_ calls */
+#if (PY_VERSION_HEX >= 0x02030000)
+#define USE_GILSTATE
 #endif
 
 #define TOP_HISTORY_PY "--- top of history ---"
@@ -35,17 +42,21 @@ class PYINTERP_EXPORT PyLockWrapper
 {
   PyThreadState* myThreadState;
   PyThreadState* mySaveThreadState;
+#if defined(USE_GILSTATE)
+  PyGILState_STATE _savestate ;
+#endif
  public:
   PyLockWrapper(PyThreadState* theThreadState);
   ~PyLockWrapper();
 };
 
-
 class PYINTERP_EXPORT PyInterp_base{
  public:
   static int _argc;
   static char* _argv[];
   static PyObject *builtinmodule;
+  static PyThreadState *_gtstate;
+  static PyInterpreterState *_interp;
   
   PyInterp_base();
   ~PyInterp_base();
index 0a5a4f0dac99db1bb536b00a489e688c11613e0d..5bb4aed68f933ca15844601a6bc04e82ec320065 100755 (executable)
@@ -56,8 +56,10 @@ static QString DOTS_PROMPT  = "... ";
 class ExecCommand : public PyInterp_LockRequest
 {
 public:
-  ExecCommand(PyInterp_base* theInterp, const char* theCommand, PythonConsole_PyEditor* theListener)
-: PyInterp_LockRequest( theInterp, theListener ), myCommand(theCommand), myState( PyInterp_Event::OK )
+  ExecCommand(PyInterp_base* theInterp, const char* theCommand,
+              PythonConsole_PyEditor* theListener, bool sync = false)
+    : PyInterp_LockRequest( theInterp, theListener, sync ),
+      myCommand( theCommand ), myState( PyInterp_Event::OK )
   {}
 
 protected:
index 62b48390580612e5433f205ca634d191295f0638..5b7d3e579b602e39940c7cd77eb2d4c0efbd6cff 100755 (executable)
@@ -92,6 +92,7 @@ bool PythonConsole_PyInterp::initState()
     _tstate->interp->builtins = PyModule_GetDict(builtinmodule);
     Py_INCREF(_tstate->interp->builtins);
   }
+  PyEval_ReleaseThread(_tstate);
   return true;
 }
 
index 93acf840962dd94724d85057562877730f57560e..75e74e9980f9b779a0a68c631f065f451ff1a3de 100644 (file)
@@ -1303,12 +1303,13 @@ QtxListResourceEdit::FileItem::FileItem( const QString& title, QtxResourceEdit*
 : PrefItem( Font, edit, pItem, parent ),
   myFlags( QFileInfo::ReadUser ),
   myIsExisting( true ),
+  myIsReadOnly ( true ),
   myFileDlg( 0 )
 {
   new QLabel( title, this );
   myFile = new QLineEdit( this );
   myFile->setValidator( new FileValidator( this, myFile ) );
-  myFile->setReadOnly( true );
+  myFile->setReadOnly( myIsReadOnly );
   myOpenFile = new QToolButton( this );
   myOpenFile->setText( "..." );
   connect( myOpenFile, SIGNAL( clicked() ), this, SLOT( onOpenFile() ) );
@@ -1338,6 +1339,8 @@ QVariant QtxListResourceEdit::FileItem::property( const QString& name ) const
     return myIsExisting;
   else if( name=="flags" )
     return myFlags;
+  else if( name=="readOnly")
+    return myIsReadOnly;
 
   return QVariant();
 }
@@ -1359,6 +1362,11 @@ void QtxListResourceEdit::FileItem::setProperty( const QString& name, const QVar
 
   else if( name=="flags" && value.canCast( QVariant::UInt ) )
     myFlags = value.toUInt();
+
+  else if( name=="readOnly" && value.canCast( QVariant::Bool) ) {
+    myIsReadOnly = value.toBool();
+    myFile->setReadOnly( myIsReadOnly );
+  }
 }
 
 void QtxListResourceEdit::FileItem::onOpenFile()
index 86bc32f1b9e19a40f5292de3a4425993faa7590d..19713ca08f66bad43047e78ca4f28dfd9bc25930 100644 (file)
@@ -518,6 +518,7 @@ private slots:
 
 private:
   uint          myFlags;
+  bool          myIsReadOnly;
   QStringList   myFilter;
   bool          myIsExisting;
   QLineEdit*    myFile;
index 055df7904463e2bb2f45af731eb85de020b39522..3cb6cbbda3368dd429cd3b68f4c8f2d241bbe961 100644 (file)
@@ -503,11 +503,11 @@ void SALOME_PYQT_Module::init( CAM_Application* app )
   PyLockWrapper aLock = myInterp->GetLockWrapper();
   // ... (the Python module is already imported)
   // ... finally call Python module's initialize() method
-  PyObjWrapper res( PyObject_CallMethod( myModule, "initialize", "" ) );
-  if( !res ) {
-    // VSR: this method may not be implemented in Python module
-    // PyErr_Print();
-    PyErr_Clear();
+  if(PyObject_HasAttrString(myModule , "initialize")){
+    PyObjWrapper res( PyObject_CallMethod( myModule, "initialize", "" ) );
+    if( !res ) {
+      PyErr_Print();
+    }
   }
   
   // get the windows list from the Python module by calling windows() method
@@ -517,51 +517,51 @@ void SALOME_PYQT_Module::init( CAM_Application* app )
   // VSR: LogWindow is not yet implemented
   // myWindowsMap.insert( SalomeApp_Application::WT_LogWindow,     Qt::DockBottom );
 
-  PyObjWrapper res1( PyObject_CallMethod( myModule, "windows", "" ) );
-  if( !res1 ) {
-    // VSR: this method may not be implemented in Python module
-    // PyErr_Print();
-    PyErr_Clear();
-  }
-  else {
-    myWindowsMap.clear();
-    if ( PyDict_Check( res1 ) ) {
-      PyObject* key;
-      PyObject* value;
-      int pos = 0;
-      while ( PyDict_Next( res1, &pos, &key, &value ) ) {
-       // parse the return value
-       // it should be a map: {integer:integer}
-       int aKey, aValue;
-       if( key && PyInt_Check( key ) && value && PyInt_Check( value ) ) {
-         aKey   = PyInt_AsLong( key );
-         aValue = PyInt_AsLong( value );
-         myWindowsMap[ aKey ] = aValue;
-       }
+  if(PyObject_HasAttrString(myModule , "windows")){
+    PyObjWrapper res1( PyObject_CallMethod( myModule, "windows", "" ) );
+    if( !res1 ) {
+      PyErr_Print();
+    }
+    else {
+      myWindowsMap.clear();
+      if ( PyDict_Check( res1 ) ) {
+        PyObject* key;
+        PyObject* value;
+        int pos = 0;
+        while ( PyDict_Next( res1, &pos, &key, &value ) ) {
+         // parse the return value
+         // it should be a map: {integer:integer}
+         int aKey, aValue;
+         if( key && PyInt_Check( key ) && value && PyInt_Check( value ) ) {
+           aKey   = PyInt_AsLong( key );
+           aValue = PyInt_AsLong( value );
+           myWindowsMap[ aKey ] = aValue;
+         }
+        }
       }
     }
   }
   // get the windows list from the Python module by calling views() method
-  PyObjWrapper res2( PyObject_CallMethod( myModule, "views", "" ) );
-  if( !res2 ) {
-    // VSR: this method may not be implemented in Python module
-    // PyErr_Print();
-    PyErr_Clear();
-  }
-  else {
-    // parse the return value
-    // result can be one string...
-    if ( PyString_Check( res2 ) ) {
-      myViewMgrList.append( PyString_AsString( res2 ) );
+  if(PyObject_HasAttrString(myModule , "views")){
+    PyObjWrapper res2( PyObject_CallMethod( myModule, "views", "" ) );
+    if( !res2 ) {
+      PyErr_Print();
     }
-    // ... or list of strings
-    else if ( PyList_Check( res2 ) ) {
-      int size = PyList_Size( res2 );
-      for ( int i = 0; i < size; i++ ) {
-       PyObject* value = PyList_GetItem( res2, i );
-       if( value && PyString_Check( value ) ) {
-         myViewMgrList.append( PyString_AsString( value ) );
-       }
+    else {
+      // parse the return value
+      // result can be one string...
+      if ( PyString_Check( res2 ) ) {
+        myViewMgrList.append( PyString_AsString( res2 ) );
+      }
+      // ... or list of strings
+      else if ( PyList_Check( res2 ) ) {
+        int size = PyList_Size( res2 );
+        for ( int i = 0; i < size; i++ ) {
+         PyObject* value = PyList_GetItem( res2, i );
+         if( value && PyString_Check( value ) ) {
+           myViewMgrList.append( PyString_AsString( value ) );
+         }
+        }
       }
     }
   }
@@ -596,20 +596,20 @@ void SALOME_PYQT_Module::activate( SUIT_Study* theStudy )
 
   if ( IsCallOldMethods ) { //__CALL_OLD_METHODS__
     // call Python module's setSettings() method (obsolete)
-    PyObjWrapper res( PyObject_CallMethod( myModule, "setSettings", "" ) );
-    if( !res ) {
-      // VSR: this method may not be implemented in Python module
-      // PyErr_Print();
-      PyErr_Clear();
+    if(PyObject_HasAttrString(myModule , "setSettings")){
+      PyObjWrapper res( PyObject_CallMethod( myModule, "setSettings", "" ) );
+      if( !res ) {
+        PyErr_Print();
+      }
     }
   }                         //__CALL_OLD_METHODS__
 
   // call Python module's activate() method (for the new modules)
-  PyObjWrapper res1( PyObject_CallMethod( myModule, "activate", "" ) );
-  if( !res1 ) {
-    // VSR: this method may not be implemented in Python module
-    // PyErr_Print();
-    PyErr_Clear();
+  if(PyObject_HasAttrString(myModule , "activate")){
+    PyObjWrapper res1( PyObject_CallMethod( myModule, "activate", "" ) );
+    if( !res1 ) {
+      PyErr_Print();
+    }
   }
 }
 
@@ -625,11 +625,11 @@ void SALOME_PYQT_Module::deactivate( SUIT_Study* theStudy )
     return;
   }
   // then call Python module's deactivate() method
-  PyObjWrapper res( PyObject_CallMethod( myModule, "deactivate", "" ) );
-  if( !res ) {
-    // VSR: this method may not be implemented in Python module
-    // PyErr_Print();
-    PyErr_Clear();
+  if(PyObject_HasAttrString(myModule , "deactivate")){
+    PyObjWrapper res( PyObject_CallMethod( myModule, "deactivate", "" ) );
+    if( !res ) {
+      PyErr_Print();
+    }
   }
 }
 
@@ -659,11 +659,11 @@ void SALOME_PYQT_Module::studyChanged( SUIT_Study* theStudy )
   PyLockWrapper aLock = myInterp->GetLockWrapper();
 
   // call Python module's activeStudyChanged() method
-  PyObjWrapper res( PyObject_CallMethod( myModule, "activeStudyChanged", "i", aStudyId ) );
-  if( !res ) {
-    // VSR: this method may not be implemented in Python module
-    // PyErr_Print();
-    PyErr_Clear();
+  if(PyObject_HasAttrString(myModule , "activeStudyChanged")){
+    PyObjWrapper res( PyObject_CallMethod( myModule, "activeStudyChanged", "i", aStudyId ) );
+    if( !res ) {
+      PyErr_Print();
+    }
   }
 }
 
@@ -741,8 +741,8 @@ void SALOME_PYQT_Module::contextMenu( const QString& theContext, QPopupMenu* the
     return;
   
   QString aContext( theContext ), aObject( "" ), aParent( "" );
-
-  if ( IsCallOldMethods ) { //__CALL_OLD_METHODS__
+  if ( IsCallOldMethods && PyObject_HasAttrString(myModule , "definePopup") ) { //__CALL_OLD_METHODS__
     // call definePopup() Python module's function
     // this is obsolete function, used only for compatibility reasons
     PyObjWrapper res(PyObject_CallMethod( myModule, 
@@ -752,9 +752,7 @@ void SALOME_PYQT_Module::contextMenu( const QString& theContext, QPopupMenu* the
                                          aObject.latin1(), 
                                          aParent.latin1() ) );
     if( !res ) {
-      // VSR: this method may not be implemented in Python module
-      // PyErr_Print();
-      PyErr_Clear();
+      PyErr_Print();
     }
     else {
       // parse return value
@@ -775,18 +773,18 @@ void SALOME_PYQT_Module::contextMenu( const QString& theContext, QPopupMenu* the
   PyObjWrapper sipPopup( sipBuildResult( 0, "M", thePopupMenu, sipClass_QPopupMenu ) );
 
   // then call Python module's createPopupMenu() method (for new modules)
-  PyObjWrapper res1( PyObject_CallMethod( myModule,
+  if ( PyObject_HasAttrString(myModule , "createPopupMenu") ) { 
+    PyObjWrapper res1( PyObject_CallMethod( myModule,
                                          "createPopupMenu",
                                          "Os",
                                          sipPopup.get(),
                                          aContext.latin1() ) );
-  if( !res1 ) {
-    // VSR: this method may not be implemented in Python module
-    // PyErr_Print();
-    PyErr_Clear();
+    if( !res1 ) {
+      PyErr_Print();
+    }
   }
 
-  if ( IsCallOldMethods ) { //__CALL_OLD_METHODS__
+  if ( IsCallOldMethods && PyObject_HasAttrString(myModule , "customPopup") ) { //__CALL_OLD_METHODS__
     // call customPopup() Python module's function
     // this is obsolete function, used only for compatibility reasons
     PyObjWrapper res2( PyObject_CallMethod( myModule,
@@ -797,9 +795,7 @@ void SALOME_PYQT_Module::contextMenu( const QString& theContext, QPopupMenu* the
                                            aObject.latin1(), 
                                            aParent.latin1() ) );
     if( !res2 ) {
-      // VSR: this method may not be implemented in Python module
-      // PyErr_Print();
-      PyErr_Clear();
+      PyErr_Print();
     }
   }                        //__CALL_OLD_METHODS__
 }
@@ -815,11 +811,11 @@ void SALOME_PYQT_Module::guiEvent( const int theId )
   if ( !myInterp || !myModule )
     return;
   
-  PyObjWrapper res( PyObject_CallMethod( myModule, "OnGUIEvent", "i", theId ) );
-  if( !res ) {
-    // VSR: this method may not be implemented in Python module
-    // PyErr_Print();
-    PyErr_Clear();
+  if ( PyObject_HasAttrString(myModule , "OnGUIEvent") ) { 
+    PyObjWrapper res( PyObject_CallMethod( myModule, "OnGUIEvent", "i", theId ) );
+    if( !res ) {
+      PyErr_Print();
+    }
   }
 }
 
@@ -934,11 +930,11 @@ void SALOME_PYQT_Module::setWorkSpace()
     }
     PyObjWrapper pyws( sipBuildResult( 0, "M", aWorkspace, sipClass_QWidget ) );
     // ... and finally call Python module's setWorkspace() method (obsolete)
-    PyObjWrapper res( PyObject_CallMethod( myModule, "setWorkSpace", "O", pyws.get() ) );
-    if( !res ) {
-      // VSR: this method may not be implemented in Python module
-      // PyErr_Print();
-      PyErr_Clear();
+    if ( PyObject_HasAttrString(myModule , "setWorkSpace") ) { 
+      PyObjWrapper res( PyObject_CallMethod( myModule, "setWorkSpace", "O", pyws.get() ) );
+      if( !res ) {
+        PyErr_Print();
+      }
     }
   }                         //__CALL_OLD_METHODS__
 }
index dbde7b1d314909f7eb4f9b07f5ae5ba5c5c94116..1956ec3afcf688486df9e3cb2b221ecfa97b5ff7 100644 (file)
@@ -38,9 +38,9 @@ bool SALOME_PYQT_PyInterp::initState()
   */
   SCRUTE(KERNEL_PYTHON::_gtstate);
   _tstate = KERNEL_PYTHON::_gtstate;
-  PyEval_AcquireLock();
-  PyThreadState_Swap(_tstate);
+  PyEval_AcquireThread(_tstate);
   SCRUTE(_tstate);
+  PyEval_ReleaseThread(_tstate);
   return true;
 }
 
@@ -67,11 +67,11 @@ int SALOME_PYQT_PyInterp::run(const char *command)
     PyErr_Print();
     return -1;
   }
-#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0
-  PyObject *r = PyEval_EvalCode(code,_g,_g);
-#else
-  PyObject *r = PyEval_EvalCode((PyCodeObject*)code,_g,_g);
-#endif
+  //#if PY_VERSION_HEX < 0x02040000 // python version earlier than 2.4.0
+  //  PyObject *r = PyEval_EvalCode(code,_g,_g);
+  //#else
+  PyObject *r = PyEval_EvalCode((PyCodeObject *)code,_g,_g);
+  //#endif
   Py_DECREF(code);
   if(!r){
     // Une erreur s est produite a l execution
@@ -81,4 +81,3 @@ int SALOME_PYQT_PyInterp::run(const char *command)
   Py_DECREF(r);
   return 0;
 }
-
index eee54b26ca1d0e3ba1caabfa6c751744071ba448..f306399b184aabe9a0bd09a81417f4bcc59fc4db 100644 (file)
@@ -73,7 +73,7 @@ public:
   static const QString     getActiveComponent();
   static void              updateObjBrowser( const int = 0, bool = true );
 
-  static QString           getFileName         ( QWidget*, const QString&, const QStringList&, const QString&, bool );
+  static QString           getFileName         ( QWidget*, const QString&, const QStringList&, const QString&, bool ) /ReleaseGIL/ ;
   static QStringList       getOpenFileNames    ( QWidget*, const QString&, const QStringList&, const QString& );
   static QString           getExistingDirectory( QWidget*, const QString&, const QString& );
 
index 49d5cfcfcc8b43622d353b3511afd1bfec9960e1..3e955e6c9239c316d346e9773050b771edaee21f 100755 (executable)
@@ -163,7 +163,7 @@ void STD_Application::createActions()
 
   createAction( FileSaveAsId, tr( "TOT_DESK_FILE_SAVEAS" ), QIconSet(),
                 tr( "MEN_DESK_FILE_SAVEAS" ), tr( "PRP_DESK_FILE_SAVEAS" ),
-                0, desk, false, this, SLOT( onSaveAsDoc() ) );
+                CTRL+Key_A, desk, false, this, SLOT( onSaveAsDoc() ) );
 
   createAction( EditCopyId, tr( "TOT_DESK_EDIT_COPY" ),
                 resMgr->loadPixmap( "STD", tr( "ICON_EDIT_COPY" ) ),
@@ -177,7 +177,7 @@ void STD_Application::createActions()
 
   QAction* a = createAction( ViewStatusBarId, tr( "TOT_DESK_VIEW_STATUSBAR" ),
                              QIconSet(), tr( "MEN_DESK_VIEW_STATUSBAR" ),
-                             tr( "PRP_DESK_VIEW_STATUSBAR" ), 0, desk, true );
+                             tr( "PRP_DESK_VIEW_STATUSBAR" ), SHIFT+Key_S, desk, true );
   a->setOn( desk->statusBar()->isVisibleTo( desk ) );
   connect( a, SIGNAL( toggled( bool ) ), this, SLOT( onViewStatusBar( bool ) ) );
 
@@ -186,7 +186,7 @@ void STD_Application::createActions()
 
   createAction( HelpAboutId, tr( "TOT_DESK_HELP_ABOUT" ), QIconSet(),
                 tr( "MEN_DESK_HELP_ABOUT" ), tr( "PRP_DESK_HELP_ABOUT" ),
-                0, desk, false, this, SLOT( onHelpAbout() ) );
+                SHIFT+Key_A, desk, false, this, SLOT( onHelpAbout() ) );
 
   //SRN: BugID IPAL9021, add an action "Load"
   createAction( FileLoadId, tr( "TOT_DESK_FILE_LOAD" ),
index 935b36dcb8d695dbedd54050afbc5921c015c4ae..24dfd5ccf27a321ceb42002a9c6ecac05c578fde 100644 (file)
@@ -47,7 +47,7 @@ myWorkstackAction( 0 )
 
   myWorkstack = new QtxWorkstack( base );
   // 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, TIRPOLI modules).  
+  // 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 ) );
 
index a88cd6ecebc1a95ff31d3e77b8eb9927ddd748fa..2c5d9fd37858b8f4f920e5bfea134f9b65762f2e 100755 (executable)
@@ -123,7 +123,7 @@ msgid "MEN_DESK_VIEW_TOOLBARS"
 msgstr "T&oolbars"
 
 msgid "MEN_DESK_VIEW_STATUSBAR"
-msgstr "Stat&us Bar"
+msgstr "&Status Bar"
 
 msgid "MEN_DESK_VIEW_STDTOOLBAR"
 msgstr "&Standard"
index 9d38c0519e7af46f29b903ca1a410141622fc4cb..1d4d03cada3d6d54a1577c9204b36b312349c0b6 100755 (executable)
 /*!
     Shows info message box with one button [ static ]
 */
-int SUIT_MessageBox::info1( QWidget* parent, const QString& caption, const QString& text,
-                                                  const QString& textButton0 )
+int SUIT_MessageBox::info1( QWidget* parent, 
+                           const QString& caption, 
+                           const QString& text,
+                           const QString& textButton0 )
 {
-       SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
-    int ret = QMessageBox::information( parent, caption, text, textButton0,
-                                        QString::null, QString::null, 0, 0 );
-    qApp->processEvents();
-    return ret;
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  int ret = QMessageBox::information( parent, caption, text, textButton0,
+                                     QString::null, QString::null, 0, 0 );
+  qApp->processEvents();
+  return ret;
 }
 
 /*!
     Shows warning message box with one button [ static ]
 */
-int SUIT_MessageBox::warn1( QWidget* parent, const QString& caption, const QString& text,
-                                                  const QString& textButton0 )
+int SUIT_MessageBox::warn1( QWidget* parent, 
+                           const QString& caption, 
+                           const QString& text,
+                           const QString& textButton0 )
 {
-       SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
-    int ret = QMessageBox::warning( parent, caption, text, textButton0,
-                                    QString::null, QString::null, 0, 0 );
-    qApp->processEvents();
-    return ret;
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  int ret = QMessageBox::warning( parent, caption, text, textButton0,
+                                 QString::null, QString::null, 0, 0 );
+  qApp->processEvents();
+  return ret;
 }
 
 /*!
     Shows error message box with one button [ static ]
 */
-int SUIT_MessageBox::error1( QWidget* parent, const QString& caption,
-                                                       const QString& text, const QString& textButton0 )
+int SUIT_MessageBox::error1( QWidget* parent, 
+                            const QString& caption,
+                            const QString& text,
+                            const QString& textButton0 )
 {
-       SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
-    int ret = QMessageBox::critical( parent, caption, text, textButton0,
-                                     QString::null, QString::null, 0, 0 );
-    qApp->processEvents();
-    return ret;
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  int ret = QMessageBox::critical( parent, caption, text, textButton0,
+                                  QString::null, QString::null, 0, 0 );
+  qApp->processEvents();
+  return ret;
+}
+
+/*!
+    Shows question message box with one button [ static ]
+*/
+int SUIT_MessageBox::question1( QWidget* parent, 
+                               const QString& caption,
+                               const QString& text, 
+                               const QString& textButton0 )
+{
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  int ret = QMessageBox::question( parent, caption, text, textButton0,
+                                  QString::null, QString::null, 0, 0 );
+  qApp->processEvents();
+  return ret;
 }
 
 /*!
     Shows info message box with two buttons.
     Returns id of the pressed button or -1 if escaped [ static ]
 */
-int SUIT_MessageBox::info2( QWidget* parent, const QString& caption,
-                                                  const QString& text, const QString& textButton0,
-                                                  const QString& textButton1, int idButton0, int idButton1, int idDefault )
+int SUIT_MessageBox::info2( QWidget* parent, 
+                           const QString& caption,
+                           const QString& text, 
+                           const QString& textButton0,
+                           const QString& textButton1, 
+                           int idButton0, int idButton1, int idDefault )
 {
-       SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
-    if ( idDefault == idButton0 )
-        idDefault = 0;
-    else if ( idDefault == idButton1 )
-        idDefault = 1;
-    else
-        idDefault = 0;
-
-    int ret = QMessageBox::information( parent, caption, text, textButton0,
-                                        textButton1, QString::null, idDefault );
-    qApp->processEvents();
-    return ( ret == 0 ? idButton0 : idButton1 );
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  if ( idDefault == idButton0 )
+    idDefault = 0;
+  else if ( idDefault == idButton1 )
+    idDefault = 1;
+  else
+    idDefault = 0;
+  
+  int ret = QMessageBox::information( parent, caption, text, textButton0,
+                                     textButton1, QString::null, idDefault );
+  qApp->processEvents();
+  return ( ret == 0 ? idButton0 : idButton1 );
 }
 
 /*!
-    Shows warning message box with two buttons.
+  Shows warning message box with two buttons.
     Returns id of the pressed button or -1 if escaped [ static ]
 */
-int SUIT_MessageBox::warn2( QWidget* parent, const QString& caption, const QString& text,
-                           const QString& textButton0, const QString& textButton1,
-                           int idButton0, int idButton1, int idDefault )
+int SUIT_MessageBox::warn2( QWidget* parent, 
+                           const QString& caption,
+                           const QString& text,
+                           const QString& textButton0, 
+                           const QString& textButton1,
+                           int idButton0, int idButton1, int idDefault )
 {
-       SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
-
-    if ( idDefault == idButton0 )
-        idDefault = 0;
-    else if ( idDefault == idButton1 )
-        idDefault = 1;
-    else
-        idDefault = 0;
-
-    int ret = QMessageBox::warning( parent, caption, text, textButton0,
-                                    textButton1, QString::null, idDefault );
-    qApp->processEvents();
-    return ( ret == 0 ? idButton0 : idButton1 );
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  
+  if ( idDefault == idButton0 )
+    idDefault = 0;
+  else if ( idDefault == idButton1 )
+    idDefault = 1;
+  else
+    idDefault = 0;
+  
+  int ret = QMessageBox::warning( parent, caption, text, textButton0,
+                                 textButton1, QString::null, idDefault );
+  qApp->processEvents();
+  return ( ret == 0 ? idButton0 : idButton1 );
 }
 
 /*!
     Shows error message box with two buttons
     Returns id of the pressed button or -1 if escaped [ static ]
 */
-int SUIT_MessageBox::error2( QWidget* parent, const QString& caption, const QString& text,
-                            const QString& textButton0, const QString& textButton1,
-                            int idButton0, int idButton1, int idDefault )
+int SUIT_MessageBox::error2( QWidget* parent, 
+                            const QString& caption, 
+                            const QString& text,
+                            const QString& textButton0, 
+                            const QString& textButton1,
+                            int idButton0, int idButton1, int idDefault )
 {
-       SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
-
-    if ( idDefault == idButton0 )
-        idDefault = 0;
-    else if ( idDefault == idButton1 )
-        idDefault = 1;
-    else
-        idDefault = 0;
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  
+  if ( idDefault == idButton0 )
+    idDefault = 0;
+  else if ( idDefault == idButton1 )
+    idDefault = 1;
+  else
+    idDefault = 0;
+  
+  int ret = QMessageBox::critical( parent, caption, text, textButton0,
+                                  textButton1, QString::null, idDefault );
+  qApp->processEvents();
+  return ( ret == 0 ? idButton0 : idButton1 );
+}
 
-    int ret = QMessageBox::critical( parent, caption, text, textButton0,
-                                     textButton1, QString::null, idDefault );
-    qApp->processEvents();
-    return ( ret == 0 ? idButton0 : idButton1 );
+/*!
+    Shows question message box with two buttons
+    Returns id of the pressed button or -1 if escaped [ static ]
+*/
+int SUIT_MessageBox::question2( QWidget* parent, 
+                               const QString& caption, 
+                               const QString& text,
+                               const QString& textButton0, 
+                               const QString& textButton1,
+                               int idButton0, int idButton1, int idDefault )
+{
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  
+  if ( idDefault == idButton0 )
+    idDefault = 0;
+  else if ( idDefault == idButton1 )
+    idDefault = 1;
+  else
+    idDefault = 0;
+  
+  int ret = QMessageBox::question( parent, caption, text, textButton0,
+                                  textButton1, QString::null, idDefault );
+  qApp->processEvents();
+  return ( ret == 0 ? idButton0 : idButton1 );
 }
 
 /*!
     Shows info message box with three buttons.
     Returns id of the pressed button or -1 if escaped [ static ]
 */
-int SUIT_MessageBox::info3( QWidget* parent, const QString& caption, const QString& text,
-                           const QString& textButton0, const QString& textButton1,
-                           const QString& textButton2, int idButton0, int idButton1,
-                           int idButton2, int idDefault )
+int SUIT_MessageBox::info3( QWidget* parent, 
+                           const QString& caption,
+                           const QString& text,
+                           const QString& textButton0, 
+                           const QString& textButton1,
+                           const QString& textButton2, 
+                           int idButton0, int idButton1,
+                           int idButton2, int idDefault )
 {
-       SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
-
-    if ( idDefault == idButton0 )
-        idDefault = 0;
-    else if ( idDefault == idButton1 )
-        idDefault = 1;
-    else if ( idDefault == idButton2 )
-        idDefault = 2;
-    else
-        idDefault = 0;
-
-    int ret = QMessageBox::information( parent, caption, text, textButton0,
-                                        textButton1, textButton2, idDefault );
-    qApp->processEvents();
-    switch ( ret )
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  
+  if ( idDefault == idButton0 )
+    idDefault = 0;
+  else if ( idDefault == idButton1 )
+    idDefault = 1;
+  else if ( idDefault == idButton2 )
+    idDefault = 2;
+  else
+    idDefault = 0;
+  
+  int ret = QMessageBox::information( parent, caption, text, textButton0,
+                                     textButton1, textButton2, idDefault );
+  qApp->processEvents();
+  switch ( ret )
     {
-        case 0:
-            return idButton0;
-        case 1:
-            return idButton1;
-        case 2:
-            return idButton2;
+    case 0:
+      return idButton0;
+    case 1:
+      return idButton1;
+    case 2:
+      return idButton2;
     }
-    return -1;
+  return -1;
 }
 
 /*!
     Shows warning message box with three buttons.
     Returns id of the pressed button or -1 if escaped [ static ]
 */
-int SUIT_MessageBox::warn3( QWidget* parent, const QString& caption, const QString& text,
-                           const QString& textButton0, const QString& textButton1,
-                           const QString& textButton2, int idButton0, int idButton1,
-                           int idButton2, int idDefault )
+int SUIT_MessageBox::warn3( QWidget* parent, 
+                           const QString& caption, 
+                           const QString& text,
+                           const QString& textButton0, 
+                           const QString& textButton1,
+                           const QString& textButton2, 
+                           int idButton0, int idButton1,
+                           int idButton2, int idDefault )
 {
-       SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
-
-    if ( idDefault == idButton0 )
-        idDefault = 0;
-    else if ( idDefault == idButton1 )
-        idDefault = 1;
-    else if ( idDefault == idButton2 )
-        idDefault = 2;
-    else
-        idDefault = 0;
-
-    int ret = QMessageBox::warning( parent, caption, text, textButton0,
-                                    textButton1, textButton2, idDefault );
-    qApp->processEvents();
-    switch ( ret )
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  
+  if ( idDefault == idButton0 )
+    idDefault = 0;
+  else if ( idDefault == idButton1 )
+    idDefault = 1;
+  else if ( idDefault == idButton2 )
+    idDefault = 2;
+  else
+    idDefault = 0;
+  
+  int ret = QMessageBox::warning( parent, caption, text, textButton0,
+                                 textButton1, textButton2, idDefault );
+  qApp->processEvents();
+  switch ( ret )
     {
-        case 0:
-            return idButton0;
-        case 1:
-            return idButton1;
-        case 2:
-            return idButton2;
+    case 0:
+      return idButton0;
+    case 1:
+      return idButton1;
+    case 2:
+      return idButton2;
     }
-    return -1;
+  return -1;
 }
 
 /*!
     Shows error message box with three buttons.
     Returns id of the pressed button or -1 if escaped [ static ]
 */
-int SUIT_MessageBox::error3( QWidget* parent, const QString& caption, const QString& text,
-                            const QString& textButton0, const QString& textButton1,
-                            const QString& textButton2, int idButton0, int idButton1,
-                            int idButton2, int idDefault )
+int SUIT_MessageBox::error3( QWidget* parent, 
+                            const QString& caption, 
+                            const QString& text,
+                            const QString& textButton0, 
+                            const QString& textButton1,
+                            const QString& textButton2, 
+                            int idButton0, int idButton1,
+                            int idButton2, int idDefault )
 {
-       SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
-
-    if ( idDefault == idButton0 )
-        idDefault = 0;
-    else if ( idDefault == idButton1 )
-        idDefault = 1;
-    else if ( idDefault == idButton2 )
-        idDefault = 2;
-    else
-        idDefault = 0;
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  
+  if ( idDefault == idButton0 )
+    idDefault = 0;
+  else if ( idDefault == idButton1 )
+    idDefault = 1;
+  else if ( idDefault == idButton2 )
+    idDefault = 2;
+  else
+    idDefault = 0;
+  
+  int ret = QMessageBox::critical( parent, caption, text, textButton0,
+                                  textButton1, textButton2, idDefault );
+  qApp->processEvents();
+  switch ( ret )
+    {
+    case 0:
+      return idButton0;
+    case 1:
+      return idButton1;
+    case 2:
+      return idButton2;
+    }
+  return -1;
+}
 
-    int ret = QMessageBox::critical( parent, caption, text, textButton0,
-                                     textButton1, textButton2, idDefault );
-    qApp->processEvents();
-    switch ( ret )
+/*!
+    Shows question message box with three buttons.
+    Returns id of the pressed button or -1 if escaped [ static ]
+*/
+int SUIT_MessageBox::question3( QWidget* parent, 
+                               const QString& caption, 
+                               const QString& text,
+                               const QString& textButton0, 
+                               const QString& textButton1,
+                               const QString& textButton2, 
+                               int idButton0, int idButton1,
+                               int idButton2, int idDefault )
+{
+  SUIT_OverrideCursor cw( parent ? parent->cursor() : Qt::arrowCursor );
+  
+  if ( idDefault == idButton0 )
+    idDefault = 0;
+  else if ( idDefault == idButton1 )
+    idDefault = 1;
+  else if ( idDefault == idButton2 )
+    idDefault = 2;
+  else
+    idDefault = 0;
+  
+  int ret = QMessageBox::question( parent, caption, text, textButton0,
+                                  textButton1, textButton2, idDefault );
+  qApp->processEvents();
+  switch ( ret )
     {
-        case 0:
-            return idButton0;
-        case 1:
-            return idButton1;
-        case 2:
-            return idButton2;
+    case 0:
+      return idButton0;
+    case 1:
+      return idButton1;
+    case 2:
+      return idButton2;
     }
-    return -1;
+  return -1;
 }
index dd8dccd533e3289371fc98f9700b2fbe3b7f6cee..f8cf626be96d4dadd4a5ea879c5b8674c3aeb6b0 100755 (executable)
@@ -48,6 +48,8 @@ public:
                        const QString& textButton0 );
     static int error1 ( QWidget* parent, const QString& caption, const QString& text,
                        const QString& textButton0 );
+    static int question1 ( QWidget* parent, const QString& caption, const QString& text,
+                          const QString& textButton0 );
     //@}
 
     /** @name Two buttons message boxes.*/
@@ -61,6 +63,9 @@ public:
     static int error2 ( QWidget* parent, const QString& caption, const QString& text,
                        const QString& textButton0, const QString& textButton1,
                        int idButton0, int idButton1, int idDefault );
+    static int question2 ( QWidget* parent, const QString& caption, const QString& text,
+                          const QString& textButton0, const QString& textButton1,
+                          int idButton0, int idButton1, int idDefault );
     //@}
 
     /** @name Three buttons message boxes.*/
@@ -77,6 +82,10 @@ public:
                        const QString& textButton0, const QString& textButton1,
                        const QString& textButton2, int idButton0, int idButton1,
                        int idButton2, int idDefault );
+    static int question3 ( QWidget* parent, const QString& caption, const QString& text,
+                          const QString& textButton0, const QString& textButton1,
+                          const QString& textButton2, int idButton0, int idButton1,
+                          int idButton2, int idDefault );
     //@}
 };
 
index 60942b8447fad78848741abf477bf8cda2b15076..a8a11fbd2e8115a911c6832651112b6733018169 100644 (file)
 //
 // See http://www.salome-platform.org/
 //
-#include <qpopupmenu.h>\r
-#include <qcolordialog.h>\r
-\r
-#include <vtkCamera.h>\r
-#include <vtkRenderer.h>\r
-#include <vtkActorCollection.h>\r
-\r
-#include "SUIT_Session.h"\r
-\r
-#include "SVTK_Selection.h"\r
-#include "SVTK_ViewModel.h"\r
-#include "SVTK_ViewWindow.h"\r
-#include "SVTK_Prs.h"\r
-\r
-#include "VTKViewer_ViewModel.h"\r
-\r
-#include "SVTK_RenderWindowInteractor.h"\r
-#include "SVTK_RenderWindow.h"\r
-\r
-//#include <ToolsGUI.h>\r
-\r
-#include <SALOME_Actor.h>\r
-#include <SALOME_InteractiveObject.hxx>\r
-\r
-// Temporarily commented to avoid awful dependecy on SALOMEDS\r
-// TODO: better mechanism of storing display/erse status in a study\r
-// should be provided...\r
-//#include "Utils_ORB_INIT.hxx"\r
-//#include "Utils_SINGLETON.hxx"\r
-//#include "SALOME_ModuleCatalog_impl.hxx"\r
-//#include "SALOME_NamingService.hxx"\r
-\r
-//#include "SALOMEDSClient.hxx"\r
-//#include "SALOMEDS_StudyManager.hxx"\r
-\r
-// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study.\r
-// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from \r
-// SALOMEDS::StudyManager - no linkage with SalomeApp. \r
-\r
-// Temporarily commented to avoid awful dependecy on SALOMEDS\r
-// TODO: better mechanism of storing display/erse status in a study\r
-// should be provided...\r
-//static _PTR(Study) getStudyDS() \r
-//{\r
-//  SALOMEDSClient_Study* aStudy = NULL;\r
-//  _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );\r
-  // get id of SUIT_Study, if it's a SalomeApp_Study, it will return\r
-  //    id of its underlying SALOMEDS::Study\r
-//  SUIT_Application* app = SUIT_Session::session()->activeApplication();\r
-//  if ( !app )  return _PTR(Study)(aStudy); \r
-//  SUIT_Study* stud = app->activeStudy();\r
-//  if ( !stud ) return _PTR(Study)(aStudy);  \r
-//  const int id = stud->id(); // virtual method, must return SALOMEDS_Study id\r
-  // get SALOMEDS_Study with this id from StudyMgr\r
-//  return aMgr->GetStudyByID( id );\r
-//}\r
-\r
-//==========================================================\r
-SVTK_Viewer::SVTK_Viewer()\r
-{\r
-  myTrihedronSize = 100;\r
-}\r
-\r
-//==========================================================\r
-SVTK_Viewer::~SVTK_Viewer() \r
-{\r
-}\r
-\r
-QColor SVTK_Viewer::backgroundColor() const\r
-{\r
-  return myBgColor;\r
-}\r
-\r
-void SVTK_Viewer::setBackgroundColor( const QColor& c )\r
-{\r
-  if ( c.isValid() )\r
-    myBgColor = c;\r
-}\r
-\r
-//==========================================================\r
-SUIT_ViewWindow* SVTK_Viewer::createView( SUIT_Desktop* theDesktop )\r
-{\r
-  SVTK_ViewWindow* vw = new SVTK_ViewWindow( theDesktop, this );\r
-  vw->setBackgroundColor( backgroundColor() );\r
-  vw->SetTrihedronSize( trihedronSize() );\r
-  return vw;\r
-}\r
-\r
-int SVTK_Viewer::trihedronSize() const\r
-{\r
-  return myTrihedronSize;\r
-}\r
-\r
-void SVTK_Viewer::setTrihedronSize( const int sz )\r
-{\r
-  myTrihedronSize = sz;\r
-\r
-  SUIT_ViewManager* vm = getViewManager();\r
-  if ( !vm )\r
-    return;\r
-\r
-  QPtrVector<SUIT_ViewWindow> vec = vm->getViews();\r
-  for ( int i = 0; i < vec.count(); i++ )\r
-  {\r
-    SUIT_ViewWindow* win = vec.at( i );\r
-    if ( !win || !win->inherits( "SVTK_ViewWindow" ) )\r
-      continue;\r
-\r
-    SVTK_ViewWindow* vw = (SVTK_ViewWindow*)win;\r
-    vw->SetTrihedronSize( sz );\r
-  }\r
-}\r
-\r
-//==========================================================\r
-void SVTK_Viewer::setViewManager(SUIT_ViewManager* theViewManager)\r
-{\r
-  SUIT_ViewModel::setViewManager(theViewManager);\r
-\r
-  if ( !theViewManager )\r
-    return;\r
-\r
-  connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), \r
-          this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));\r
-  \r
-  connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), \r
-          this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));\r
-  \r
-  connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), \r
-          this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));\r
-}\r
-\r
-//==========================================================\r
-void SVTK_Viewer::contextMenuPopup( QPopupMenu* thePopup )\r
-{\r
-  thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );\r
-  thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );\r
-\r
-  thePopup->insertSeparator();\r
-\r
-  SVTK_ViewWindow* aView = (SVTK_ViewWindow*)(myViewManager->getActiveView());\r
-  if ( aView && !aView->getToolBar()->isVisible() )\r
-    thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );\r
-}\r
-\r
-//==========================================================\r
-void SVTK_Viewer::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)\r
-{\r
-  if(SVTK_ViewWindow* aVW = dynamic_cast<SVTK_ViewWindow*>(vw)){\r
-    if(SVTK_RenderWindowInteractor* aRWI = aVW->getRWInteractor()){\r
-      switch(event->button()) {\r
-      case LeftButton:\r
-       aRWI->LeftButtonPressed(event) ;\r
-       break ;\r
-      case MidButton:\r
-       aRWI->MiddleButtonPressed(event) ;\r
-       break ;\r
-      case RightButton:\r
-       aRWI->RightButtonPressed(event) ;\r
-       break;\r
-      default:\r
-       break ;\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
-//==========================================================\r
-void \r
-SVTK_Viewer\r
-::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)\r
-{\r
-  if(SVTK_ViewWindow* aVW = dynamic_cast<SVTK_ViewWindow*>(vw)){\r
-    if(SVTK_RenderWindowInteractor* aRWI = aVW->getRWInteractor()){\r
-      aRWI->MouseMove( event );\r
-    }\r
-  }\r
-}\r
-\r
-//==========================================================\r
-void \r
-SVTK_Viewer\r
-::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)\r
-{\r
-  if(SVTK_ViewWindow* aVW = dynamic_cast<SVTK_ViewWindow*>(vw)){\r
-    if(SVTK_RenderWindowInteractor* aRWI = aVW->getRWInteractor()){\r
-      switch(event->button()) {\r
-      case LeftButton:\r
-       aRWI->LeftButtonReleased(event) ;\r
-       break ;\r
-      case MidButton:\r
-       aRWI->MiddleButtonReleased(event) ;\r
-       break ;\r
-      case RightButton:\r
-       aRWI->RightButtonReleased(event) ;\r
-       break;\r
-      default:\r
-       break ;\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
-//==========================================================\r
-void \r
-SVTK_Viewer\r
-::enableSelection(bool isEnabled)\r
-{\r
-  mySelectionEnabled = isEnabled;\r
-  //!! To be done for view windows\r
-}\r
-\r
-//==========================================================\r
-void\r
-SVTK_Viewer\r
-::enableMultiselection(bool isEnable)\r
-{\r
-  myMultiSelectionEnabled = isEnable;\r
-  //!! To be done for view windows\r
-}\r
-\r
-void SVTK_Viewer::onDumpView()\r
-{\r
-  SVTK_ViewWindow* aView = (SVTK_ViewWindow*)(myViewManager->getActiveView());\r
-  if ( aView )\r
-    aView->onDumpView();\r
-}\r
-\r
-//==========================================================\r
-void SVTK_Viewer::onChangeBgColor()\r
-{\r
-  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();\r
-  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)\r
-    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))\r
-      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)){\r
-       QColor aColor = QColorDialog::getColor( aView->backgroundColor(), aView);\r
-       if ( aColor.isValid() )\r
-         aView->setBackgroundColor(aColor);\r
-      }\r
-}\r
-\r
-//==========================================================\r
-void\r
-SVTK_Viewer\r
-::onShowToolbar() \r
-{\r
-  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();\r
-  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)\r
-    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))\r
-      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))\r
-       aView->getToolBar()->show();    \r
-}\r
-\r
-//==========================================================\r
-void\r
-SVTK_Viewer\r
-::Display( const SALOME_VTKPrs* prs )\r
-{\r
-  // try do downcast object\r
-  if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>( prs )){\r
-    if(aPrs->IsNull())\r
-      return;\r
-    if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){\r
-      // get SALOMEDS Study\r
-      // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-      // TODO: better mechanism of storing display/erse status in a study\r
-      // should be provided...\r
-      // _PTR(Study) aStudy(getStudyDS());\r
-      anActorCollection->InitTraversal();\r
-      while(vtkActor* anActor = anActorCollection->GetNextActor()){\r
-       if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){\r
-         // Set visibility flag\r
-          // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-          // TODO: better mechanism of storing display/erse status in a study\r
-          // should be provided...\r
-         //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();\r
-         //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){\r
-         //  ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this);\r
-         //}\r
-         // just display the object\r
-         QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();\r
-         for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){\r
-           if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){\r
-             if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)){\r
-               if(SVTK_RenderWindowInteractor* aRWI = aView->getRWInteractor()){\r
-                 aRWI->Display(anAct,false);\r
-                 if(anAct->IsSetCamera()){\r
-                   vtkRenderer* aRenderer =  aView->getRenderer();\r
-                   anAct->SetCamera( aRenderer->GetActiveCamera() );\r
-                 }\r
-               }\r
-             }\r
-           }\r
-         }\r
-       }\r
-      }\r
-    }\r
-  }\r
-}\r
-\r
-//==========================================================\r
-void\r
-SVTK_Viewer\r
-::Erase( const SALOME_VTKPrs* prs, const bool forced )\r
-{\r
-  // try do downcast object\r
-  if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>( prs )){\r
-    if(aPrs->IsNull())\r
-      return;\r
-    if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){\r
-      // get SALOMEDS Study\r
-      // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-      // TODO: better mechanism of storing display/erse status in a study\r
-      // should be provided...\r
-      //_PTR(Study) aStudy(getStudyDS());\r
-      anActorCollection->InitTraversal();\r
-      while(vtkActor* anActor = anActorCollection->GetNextActor())\r
-       if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){\r
-         // Set visibility flag\r
-          // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-          // TODO: better mechanism of storing display/erse status in a study\r
-          // should be provided...\r
-         //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();\r
-         //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){\r
-         //  ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);\r
-         //}\r
-         // just display the object\r
-         QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();\r
-         for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){\r
-           if(SUIT_ViewWindow* aViewWindow = aViews.at(i))\r
-             if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))\r
-               if(SVTK_RenderWindowInteractor* aRWI = aView->getRWInteractor())\r
-                 if ( forced )\r
-                   aRWI->Remove(anAct,false);\r
-                 else\r
-                   aRWI->Erase(anAct,forced);\r
-         }\r
-       }\r
-    }\r
-  }\r
-}\r
-  \r
-//==========================================================\r
-void\r
-SVTK_Viewer\r
-::EraseAll( const bool forced )\r
-{\r
-  // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-  // TODO: better mechanism of storing display/erse status in a study\r
-  // should be provided...\r
-  //_PTR(Study) aStudy(getStudyDS());\r
-  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();\r
-  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){\r
-    if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){\r
-      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)){\r
-       vtkRenderer* aRenderer =  aView->getRenderer();\r
-       vtkActorCollection* anActorCollection = aRenderer->GetActors();\r
-       anActorCollection->InitTraversal();\r
-       while(vtkActor* anActor = anActorCollection->GetNextActor()){\r
-         if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){\r
-           // Set visibility flag\r
-            // Temporarily commented to avoid awful dependecy on SALOMEDS\r
-            // TODO: better mechanism of storing display/erse status in a study\r
-            // should be provided...\r
-           //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();\r
-           //if(!anObj.IsNull() && anObj->hasEntry() && aStudy)\r
-           //  ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);\r
-           if(forced)\r
-             aRenderer->RemoveActor(anAct);\r
-           else{\r
-             // just erase actor\r
-             anAct->SetVisibility( false );\r
-             // erase dependent actors\r
-             vtkActorCollection* aCollection = vtkActorCollection::New();\r
-             anAct->GetChildActors( aCollection );\r
-             aCollection->InitTraversal();\r
-             while(vtkActor* aSubAct = aCollection->GetNextActor())\r
-               aSubAct->SetVisibility( false );\r
-             aCollection->Delete();\r
-           }\r
-         }\r
-       }\r
-      }\r
-    }\r
-  }\r
-  Repaint();\r
-}\r
-\r
-//==========================================================\r
-SALOME_Prs* \r
-SVTK_Viewer\r
-::CreatePrs( const char* entry )\r
-{\r
-  SVTK_Prs* prs = new SVTK_Prs();\r
-  if ( entry ) {\r
-    vtkRenderer* rnr =  ( (SVTK_ViewWindow*) getViewManager()->getActiveView() )->getRenderer();\r
-    vtkActorCollection* theActors = rnr->GetActors();\r
-    theActors->InitTraversal();\r
-    vtkActor* ac;\r
-    while( ( ac = theActors->GetNextActor() ) ) {\r
-      SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );\r
-      if ( anActor && anActor->hasIO() && !strcmp( anActor->getIO()->getEntry(), entry ) ) {\r
-       prs->AddObject( ac );\r
-      }\r
-    }\r
-  }\r
-  return prs;\r
-}\r
-\r
-//==========================================================\r
-void\r
-SVTK_Viewer\r
-::BeforeDisplay( SALOME_Displayer* d )\r
-{\r
-  d->BeforeDisplay( this, SALOME_VTKViewType() );\r
-}\r
-\r
-//==========================================================\r
-void\r
-SVTK_Viewer::AfterDisplay( SALOME_Displayer* d )\r
-{\r
-  d->AfterDisplay( this, SALOME_VTKViewType() );\r
-}\r
-\r
-//==========================================================\r
-bool\r
-SVTK_Viewer\r
-::isVisible( const Handle(SALOME_InteractiveObject)& io )\r
-{\r
-  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();\r
-  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)\r
-    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))\r
-      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))\r
-       if(SVTK_RenderWindowInteractor* aRWI = aView->getRWInteractor())\r
-         if(!aRWI->isVisible( io ))\r
-           return false;\r
-  return true;\r
-}\r
-\r
-//==========================================================\r
-void \r
-SVTK_Viewer\r
-::Repaint()\r
-{\r
-//  if (theUpdateTrihedron) onAdjustTrihedron();\r
-  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();\r
-  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)\r
-    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))\r
-      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))\r
-       if(SVTK_RenderWindow* aRW = aView->getRenderWindow())\r
-         aRW->update();\r
-}\r
-\r
-void \r
-SVTK_Viewer\r
-::onSelectionChanged()\r
-{\r
-  emit selectionChanged();\r
-}\r
-\r
+#include <qpopupmenu.h>
+#include <qcolordialog.h>
+
+#include <vtkCamera.h>
+#include <vtkRenderer.h>
+#include <vtkActorCollection.h>
+
+#include "SUIT_Session.h"
+
+#include "SVTK_Selection.h"
+#include "SVTK_ViewModel.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Prs.h"
+
+#include "VTKViewer_ViewModel.h"
+
+#include "SVTK_RenderWindowInteractor.h"
+#include "SVTK_RenderWindow.h"
+
+//#include <ToolsGUI.h>
+
+#include <SALOME_Actor.h>
+#include <SALOME_InteractiveObject.hxx>
+
+// Temporarily commented to avoid awful dependecy on SALOMEDS
+// TODO: better mechanism of storing display/erse status in a study
+// should be provided...
+//#include "Utils_ORB_INIT.hxx"
+//#include "Utils_SINGLETON.hxx"
+//#include "SALOME_ModuleCatalog_impl.hxx"
+//#include "SALOME_NamingService.hxx"
+
+//#include "SALOMEDSClient.hxx"
+//#include "SALOMEDS_StudyManager.hxx"
+
+// in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study.
+// SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from 
+// SALOMEDS::StudyManager - no linkage with SalomeApp. 
+
+// Temporarily commented to avoid awful dependecy on SALOMEDS
+// TODO: better mechanism of storing display/erse status in a study
+// should be provided...
+//static _PTR(Study) getStudyDS() 
+//{
+//  SALOMEDSClient_Study* aStudy = NULL;
+//  _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );
+  // get id of SUIT_Study, if it's a SalomeApp_Study, it will return
+  //    id of its underlying SALOMEDS::Study
+//  SUIT_Application* app = SUIT_Session::session()->activeApplication();
+//  if ( !app )  return _PTR(Study)(aStudy); 
+//  SUIT_Study* stud = app->activeStudy();
+//  if ( !stud ) return _PTR(Study)(aStudy);  
+//  const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
+  // get SALOMEDS_Study with this id from StudyMgr
+//  return aMgr->GetStudyByID( id );
+//}
+
+//==========================================================
+SVTK_Viewer::SVTK_Viewer()
+{
+  myTrihedronSize = 100;
+}
+
+//==========================================================
+SVTK_Viewer::~SVTK_Viewer() 
+{
+}
+
+QColor SVTK_Viewer::backgroundColor() const
+{
+  return myBgColor;
+}
+
+void SVTK_Viewer::setBackgroundColor( const QColor& c )
+{
+  if ( c.isValid() )
+    myBgColor = c;
+}
+
+//==========================================================
+SUIT_ViewWindow* SVTK_Viewer::createView( SUIT_Desktop* theDesktop )
+{
+  SVTK_ViewWindow* vw = new SVTK_ViewWindow( theDesktop, this );
+  vw->setBackgroundColor( backgroundColor() );
+  vw->SetTrihedronSize( trihedronSize() );
+  return vw;
+}
+
+int SVTK_Viewer::trihedronSize() const
+{
+  return myTrihedronSize;
+}
+
+void SVTK_Viewer::setTrihedronSize( const int sz )
+{
+  myTrihedronSize = sz;
+
+  SUIT_ViewManager* vm = getViewManager();
+  if ( !vm )
+    return;
+
+  QPtrVector<SUIT_ViewWindow> vec = vm->getViews();
+  for ( int i = 0; i < vec.count(); i++ )
+  {
+    SUIT_ViewWindow* win = vec.at( i );
+    if ( !win || !win->inherits( "SVTK_ViewWindow" ) )
+      continue;
+
+    SVTK_ViewWindow* vw = (SVTK_ViewWindow*)win;
+    vw->SetTrihedronSize( sz );
+  }
+}
+
+//==========================================================
+void SVTK_Viewer::setViewManager(SUIT_ViewManager* theViewManager)
+{
+  SUIT_ViewModel::setViewManager(theViewManager);
+
+  if ( !theViewManager )
+    return;
+
+  connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*)));
+  
+  connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*)));
+  
+  connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), 
+          this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*)));
+}
+
+//==========================================================
+void SVTK_Viewer::contextMenuPopup( QPopupMenu* thePopup )
+{
+  thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) );
+  thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) );
+
+  thePopup->insertSeparator();
+
+  SVTK_ViewWindow* aView = (SVTK_ViewWindow*)(myViewManager->getActiveView());
+  if ( aView && !aView->getToolBar()->isVisible() )
+    thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) );
+}
+
+//==========================================================
+void SVTK_Viewer::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event)
+{
+  if(SVTK_ViewWindow* aVW = dynamic_cast<SVTK_ViewWindow*>(vw)){
+    if(SVTK_RenderWindowInteractor* aRWI = aVW->getRWInteractor()){
+      switch(event->button()) {
+      case LeftButton:
+       aRWI->LeftButtonPressed(event) ;
+       break ;
+      case MidButton:
+       aRWI->MiddleButtonPressed(event) ;
+       break ;
+      case RightButton:
+       aRWI->RightButtonPressed(event) ;
+       break;
+      default:
+       break ;
+      }
+    }
+  }
+}
+
+//==========================================================
+void 
+SVTK_Viewer
+::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event)
+{
+  if(SVTK_ViewWindow* aVW = dynamic_cast<SVTK_ViewWindow*>(vw)){
+    if(SVTK_RenderWindowInteractor* aRWI = aVW->getRWInteractor()){
+      aRWI->MouseMove( event );
+    }
+  }
+}
+
+//==========================================================
+void 
+SVTK_Viewer
+::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event)
+{
+  if(SVTK_ViewWindow* aVW = dynamic_cast<SVTK_ViewWindow*>(vw)){
+    if(SVTK_RenderWindowInteractor* aRWI = aVW->getRWInteractor()){
+      switch(event->button()) {
+      case LeftButton:
+       aRWI->LeftButtonReleased(event) ;
+       break ;
+      case MidButton:
+       aRWI->MiddleButtonReleased(event) ;
+       break ;
+      case RightButton:
+       aRWI->RightButtonReleased(event) ;
+       break;
+      default:
+       break ;
+      }
+    }
+  }
+}
+
+//==========================================================
+void 
+SVTK_Viewer
+::enableSelection(bool isEnabled)
+{
+  mySelectionEnabled = isEnabled;
+  //!! To be done for view windows
+}
+
+//==========================================================
+void
+SVTK_Viewer
+::enableMultiselection(bool isEnable)
+{
+  myMultiSelectionEnabled = isEnable;
+  //!! To be done for view windows
+}
+
+void SVTK_Viewer::onDumpView()
+{
+  SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(myViewManager->getActiveView());
+  if ( aView )
+    aView->onDumpView();
+}
+
+//==========================================================
+void SVTK_Viewer::onChangeBgColor()
+{
+  SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(myViewManager->getActiveView());
+  if ( aView ) {
+    QColor aColor = QColorDialog::getColor( aView->backgroundColor(), aView );
+    if ( aColor.isValid() )
+      aView->setBackgroundColor( aColor );
+  }
+}
+
+//==========================================================
+void
+SVTK_Viewer
+::onShowToolbar() 
+{
+  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
+    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))
+       aView->getToolBar()->show();    
+}
+
+//==========================================================
+void
+SVTK_Viewer
+::Display( const SALOME_VTKPrs* prs )
+{
+  // try do downcast object
+  if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>( prs )){
+    if(aPrs->IsNull())
+      return;
+    if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
+      // get SALOMEDS Study
+      // Temporarily commented to avoid awful dependecy on SALOMEDS
+      // TODO: better mechanism of storing display/erse status in a study
+      // should be provided...
+      // _PTR(Study) aStudy(getStudyDS());
+      anActorCollection->InitTraversal();
+      while(vtkActor* anActor = anActorCollection->GetNextActor()){
+       if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
+         // Set visibility flag
+          // Temporarily commented to avoid awful dependecy on SALOMEDS
+          // TODO: better mechanism of storing display/erse status in a study
+          // should be provided...
+         //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+         //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
+         //  ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),true,this);
+         //}
+         // just display the object
+         QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+         for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+           if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
+             if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)){
+               if(SVTK_RenderWindowInteractor* aRWI = aView->getRWInteractor()){
+                 aRWI->Display(anAct,false);
+                 if(anAct->IsSetCamera()){
+                   vtkRenderer* aRenderer =  aView->getRenderer();
+                   anAct->SetCamera( aRenderer->GetActiveCamera() );
+                 }
+               }
+             }
+           }
+         }
+       }
+      }
+    }
+  }
+}
+
+//==========================================================
+void
+SVTK_Viewer
+::Erase( const SALOME_VTKPrs* prs, const bool forced )
+{
+  // try do downcast object
+  if(const SVTK_Prs* aPrs = dynamic_cast<const SVTK_Prs*>( prs )){
+    if(aPrs->IsNull())
+      return;
+    if(vtkActorCollection* anActorCollection = aPrs->GetObjects()){
+      // get SALOMEDS Study
+      // Temporarily commented to avoid awful dependecy on SALOMEDS
+      // TODO: better mechanism of storing display/erse status in a study
+      // should be provided...
+      //_PTR(Study) aStudy(getStudyDS());
+      anActorCollection->InitTraversal();
+      while(vtkActor* anActor = anActorCollection->GetNextActor())
+       if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
+         // Set visibility flag
+          // Temporarily commented to avoid awful dependecy on SALOMEDS
+          // TODO: better mechanism of storing display/erse status in a study
+          // should be provided...
+         //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+         //if(!anObj.IsNull() && anObj->hasEntry() && aStudy){
+         //  ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+         //}
+         // just display the object
+         QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+         for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+           if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+             if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))
+               if(SVTK_RenderWindowInteractor* aRWI = aView->getRWInteractor())
+                 if ( forced )
+                   aRWI->Remove(anAct,false);
+                 else
+                   aRWI->Erase(anAct,forced);
+         }
+       }
+    }
+  }
+}
+  
+//==========================================================
+void
+SVTK_Viewer
+::EraseAll( const bool forced )
+{
+  // Temporarily commented to avoid awful dependecy on SALOMEDS
+  // TODO: better mechanism of storing display/erse status in a study
+  // should be provided...
+  //_PTR(Study) aStudy(getStudyDS());
+  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){
+    if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){
+      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)){
+
+       aView->unHighlightAll();
+
+       vtkRenderer* aRenderer =  aView->getRenderer();
+       vtkActorCollection* anActorCollection = aRenderer->GetActors();
+       anActorCollection->InitTraversal();
+       while(vtkActor* anActor = anActorCollection->GetNextActor()){
+         if(SALOME_Actor* anAct = SALOME_Actor::SafeDownCast(anActor)){
+           // Set visibility flag
+            // Temporarily commented to avoid awful dependecy on SALOMEDS
+            // TODO: better mechanism of storing display/erse status in a study
+            // should be provided...
+           //Handle(SALOME_InteractiveObject) anObj = anAct->getIO();
+           //if(!anObj.IsNull() && anObj->hasEntry() && aStudy)
+           //  ToolsGUI::SetVisibility(aStudy,anObj->getEntry(),false,this);
+           if(forced)
+             aRenderer->RemoveActor(anAct);
+           else{
+             // just erase actor
+             anAct->SetVisibility( false );
+             // erase dependent actors
+             vtkActorCollection* aCollection = vtkActorCollection::New();
+             anAct->GetChildActors( aCollection );
+             aCollection->InitTraversal();
+             while(vtkActor* aSubAct = aCollection->GetNextActor())
+               aSubAct->SetVisibility( false );
+             aCollection->Delete();
+           }
+         }
+       }
+      }
+    }
+  }
+  Repaint();
+}
+
+//==========================================================
+SALOME_Prs* 
+SVTK_Viewer
+::CreatePrs( const char* entry )
+{
+  SVTK_Prs* prs = new SVTK_Prs();
+  if ( entry ) {
+    vtkRenderer* rnr =  ( (SVTK_ViewWindow*) getViewManager()->getActiveView() )->getRenderer();
+    vtkActorCollection* theActors = rnr->GetActors();
+    theActors->InitTraversal();
+    vtkActor* ac;
+    while( ( ac = theActors->GetNextActor() ) ) {
+      SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac );
+      if ( anActor && anActor->hasIO() && !strcmp( anActor->getIO()->getEntry(), entry ) ) {
+       prs->AddObject( ac );
+      }
+    }
+  }
+  return prs;
+}
+
+//==========================================================
+void
+SVTK_Viewer
+::BeforeDisplay( SALOME_Displayer* d )
+{
+  d->BeforeDisplay( this, SALOME_VTKViewType() );
+}
+
+//==========================================================
+void
+SVTK_Viewer::AfterDisplay( SALOME_Displayer* d )
+{
+  d->AfterDisplay( this, SALOME_VTKViewType() );
+}
+
+//==========================================================
+bool
+SVTK_Viewer
+::isVisible( const Handle(SALOME_InteractiveObject)& io )
+{
+  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
+    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))
+       if(SVTK_RenderWindowInteractor* aRWI = aView->getRWInteractor())
+         if(!aRWI->isVisible( io ))
+           return false;
+  return true;
+}
+
+//==========================================================
+void 
+SVTK_Viewer
+::Repaint()
+{
+//  if (theUpdateTrihedron) onAdjustTrihedron();
+  QPtrVector<SUIT_ViewWindow> aViews = myViewManager->getViews();
+  for(int i = 0, iEnd = aViews.size(); i < iEnd; i++)
+    if(SUIT_ViewWindow* aViewWindow = aViews.at(i))
+      if(SVTK_ViewWindow* aView = dynamic_cast<SVTK_ViewWindow*>(aViewWindow))
+       if(SVTK_RenderWindow* aRW = aView->getRenderWindow())
+         aRW->update();
+}
+
+void 
+SVTK_Viewer
+::onSelectionChanged()
+{
+  emit selectionChanged();
+}
+
index 26df49c6c67ec9f26b0b3c5d8b67a6c90e8a5fb1..690b13b52ce9fa7be7a45b180ce636e13fdfec4c 100644 (file)
@@ -80,7 +80,8 @@ SalomeApp_Application::SalomeApp_Application()
  */
 SalomeApp_Application::~SalomeApp_Application()
 {
-  SalomeApp_EventFilter::Destroy();
+  // Do not destroy. It's a singleton !
+  //SalomeApp_EventFilter::Destroy();
 }
 
 /*!Start application.*/
@@ -101,27 +102,27 @@ void SalomeApp_Application::createActions()
   //! Dump study
   createAction( DumpStudyId, tr( "TOT_DESK_FILE_DUMP_STUDY" ), QIconSet(),
                tr( "MEN_DESK_FILE_DUMP_STUDY" ), tr( "PRP_DESK_FILE_DUMP_STUDY" ),
-               0, desk, false, this, SLOT( onDumpStudy() ) );
+               CTRL+Key_D, desk, false, this, SLOT( onDumpStudy() ) );
     
   //! Load script
   createAction( LoadScriptId, tr( "TOT_DESK_FILE_LOAD_SCRIPT" ), QIconSet(),
                tr( "MEN_DESK_FILE_LOAD_SCRIPT" ), tr( "PRP_DESK_FILE_LOAD_SCRIPT" ),
-               0, desk, false, this, SLOT( onLoadScript() ) );
+               CTRL+Key_T, desk, false, this, SLOT( onLoadScript() ) );
 
   //! Properties
   createAction( PropertiesId, tr( "TOT_DESK_PROPERTIES" ), QIconSet(),
                tr( "MEN_DESK_PROPERTIES" ), tr( "PRP_DESK_PROPERTIES" ),
-               0, desk, false, this, SLOT( onProperties() ) );
+               CTRL+Key_P, desk, false, this, SLOT( onProperties() ) );
 
   //! Catalog Generator
   createAction( CatalogGenId, tr( "TOT_DESK_CATALOG_GENERATOR" ),  QIconSet(),
                tr( "MEN_DESK_CATALOG_GENERATOR" ), tr( "PRP_DESK_CATALOG_GENERATOR" ),
-               0, desk, false, this, SLOT( onCatalogGen() ) );
+               SHIFT+Key_G, desk, false, this, SLOT( onCatalogGen() ) );
 
   //! Registry Display
   createAction( RegDisplayId, tr( "TOT_DESK_REGISTRY_DISPLAY" ),  QIconSet(),
                tr( "MEN_DESK_REGISTRY_DISPLAY" ), tr( "PRP_DESK_REGISTRY_DISPLAY" ),
-               0, desk, false, this, SLOT( onRegDisplay() ) );
+               SHIFT+Key_D, desk, false, this, SLOT( onRegDisplay() ) );
 
   int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 );
 
@@ -347,67 +348,60 @@ void SalomeApp_Application::onSelectionChanged()
    LightApp_SelectionMgr* mgr = selectionMgr();
    mgr->selectedObjects(list);
 
-   SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
-   if(study == NULL) return;
+   bool canCopy  = false;
+   bool canPaste = false;
 
-   _PTR(Study) stdDS = study->studyDS();
-   if(!stdDS) return;
+   SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(activeStudy());
+   if (study != NULL) {
+     _PTR(Study) stdDS = study->studyDS();
 
-   QAction* qaction;
+     if (stdDS) {
+       SALOME_ListIteratorOfListIO it ( list );
 
-   SALOME_ListIteratorOfListIO it( list );
-   if(it.More() && list.Extent() == 1)
-   {
-      _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
+       if (it.More() && list.Extent() == 1) {
+         _PTR(SObject) so = stdDS->FindObjectID(it.Value()->getEntry());
 
-      qaction = action(EditCopyId);
-      if( so ) {
-        SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(so.get());
-        if ( aSO && studyMgr()->CanCopy(so) ) qaction->setEnabled(true);  
-        else qaction->setEnabled(false);
-      }
-      else qaction->setEnabled(false);
+         if ( so ) {
+           SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(so.get());
 
-      qaction = action(EditPasteId);
-      if( so ) {
-        SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(so.get());
-        if( aSO && studyMgr()->CanPaste(so) ) qaction->setEnabled(true);
-        qaction->setEnabled(false);
-      }
-      else qaction->setEnabled(false);
-   }
-   else {
-     qaction = action(EditCopyId);
-     qaction->setEnabled(false);
-     qaction = action(EditPasteId);
-     qaction->setEnabled(false);
+           if ( aSO ) {
+             canCopy = studyMgr()->CanCopy(so);
+             canPaste = studyMgr()->CanPaste(so);
+           }
+         }
+       }
+     }
    }
+
+   action(EditCopyId)->setEnabled(canCopy);
+   action(EditPasteId)->setEnabled(canPaste);
 }
 
 /*!Delete references.*/
-void SalomeApp_Application::onDeleteReferences()
+void SalomeApp_Application::onDeleteInvalidReferences()
 {
   SALOME_ListIO aList;
   LightApp_SelectionMgr* mgr = selectionMgr();
-  mgr->selectedObjects(aList);
+  mgr->selectedObjects( aList, QString::null, false );
 
-  if (aList.Extent() < 1) return;
+  if( aList.IsEmpty() )
+    return;
 
   SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(activeStudy());
   _PTR(Study) aStudyDS = aStudy->studyDS();
   _PTR(StudyBuilder) aStudyBuilder = aStudyDS->NewBuilder();
   _PTR(SObject) anObj;
 
-  for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() )
+  for( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() )
+    if ( it.Value()->hasEntry() )
     {
-      if ( it.Value()->hasEntry() )
-       {
-         _PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() );
-         if ( aSObject->ReferencedObject(anObj) )
-           aStudyBuilder->RemoveReference(aSObject);
-       }
-    }
+      _PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() ), aRefObj = aSObject;
+      while( aRefObj && aRefObj->ReferencedObject( anObj ) )
+       aRefObj = anObj;
 
+      if( aRefObj && aRefObj!=aSObject && QString( aRefObj->GetName().c_str() ).isEmpty() )
+        aStudyBuilder->RemoveReference( aSObject );
+    }
   updateObjectBrowser();
 }
 
@@ -469,10 +463,8 @@ void SalomeApp_Application::updateCommandsStatus()
   if( a )
     a->setEnabled( activeStudy() );
 
-  a = action(EditCopyId);
-  a->setEnabled(false);
-  a = action(EditPasteId);
-  a->setEnabled(false);
+  // update state of Copy/Paste menu items
+  onSelectionChanged();
 }
 
 /*!Private SLOT. On dump study.*/
@@ -548,7 +540,8 @@ QString SalomeApp_Application::getFileFilter() const
 /*!Create window.*/
 QWidget* SalomeApp_Application::createWindow( const int flag )
 {
-  QWidget* wid = LightApp_Application::createWindow(flag);
+  QWidget* wid = 0;
+  if ( flag != WT_PyConsole ) wid = LightApp_Application::createWindow(flag);
 
   SUIT_ResourceMgr* resMgr = resourceMgr();
 
@@ -556,7 +549,8 @@ QWidget* SalomeApp_Application::createWindow( const int flag )
   {
     OB_Browser* ob = (OB_Browser*)wid;
     connect( ob->listView(), SIGNAL( doubleClicked( QListViewItem* ) ), this, SLOT( onDblClick( QListViewItem* ) ) );
-    bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false );
+    bool autoSize = resMgr->booleanValue( "ObjectBrowser", "auto_size", false ),
+         autoSizeFirst = resMgr->booleanValue( "ObjectBrowser", "auto_size_first", true );
     for ( int i = SalomeApp_DataObject::CT_Value; i <= SalomeApp_DataObject::CT_RefEntry; i++ )
     {
       ob->addColumn( tr( QString().sprintf( "OBJ_BROWSER_COLUMN_%d", i ) ), i );
@@ -564,15 +558,16 @@ QWidget* SalomeApp_Application::createWindow( const int flag )
                                                    QString().sprintf( "visibility_column_%d", i ), true ) );
     }
     ob->setWidthMode( autoSize ? QListView::Maximum : QListView::Manual );
+    ob->listView()->setColumnWidthMode( 0, autoSizeFirst ? QListView::Maximum : QListView::Manual );
+    ob->resize( desktop()->width()/3, ob->height() );
   }
   else if ( flag == WT_PyConsole )
   {
-    delete wid;
-    wid = 0;
     PythonConsole* pyCons = new PythonConsole( desktop(), new SalomeApp_PyInterp() );
     pyCons->setCaption( tr( "PYTHON_CONSOLE" ) );
     wid = pyCons;
-    //    pyCons->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
+    pyCons->resize( pyCons->width(), desktop()->height()/4 );
+    //pyCons->connectPopupRequest(this, SLOT(onConnectPopupRequest(SUIT_PopupClient*, QContextMenuEvent*)));
   }
   return wid;
 }
@@ -594,9 +589,6 @@ void SalomeApp_Application::createPreferences( LightApp_Preferences* pref )
                          LightApp_Preferences::Bool, "ObjectBrowser", QString().sprintf( "visibility_column_%d", i ) );
   }
   pref->setItemProperty( defCols, "columns", 1 );
-
-  int objSetGroup = pref->addPreference( tr( "PREF_OBJ_BROWSER_SETTINGS" ), obTab );
-  pref->addPreference( tr( "PREF_AUTO_SIZE" ), objSetGroup, LightApp_Preferences::Bool, "ObjectBrowser", "auto_size" );
 }
 
 /*!Update desktop title.*/
@@ -701,42 +693,37 @@ void SalomeApp_Application::contextMenuPopup( const QString& type, QPopupMenu* t
   // Get selected objects
   SALOME_ListIO aList;
   LightApp_SelectionMgr* mgr = selectionMgr();
-  mgr->selectedObjects(aList);
+  mgr->selectedObjects( aList, QString::null, false );
 
   // "Delete reference" item should appear only for invalid references
 
-  // Check if selected objects is invalid references
-  bool isInvalidRefs = true;
-
-  if ( aList.Extent() < 1 )
-    isInvalidRefs = false;
+  // isInvalidRefs will be true, if at least one of selected objects is invalid reference
+  bool isInvalidRefs = false;
+  SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(activeStudy());
+  _PTR(Study) aStudyDS = aStudy->studyDS();
+  _PTR(SObject) anObj;
 
-  if ( isInvalidRefs )
+  for( SALOME_ListIteratorOfListIO it( aList ); it.More() && !isInvalidRefs; it.Next() )
+    if( it.Value()->hasEntry() )
     {
-      SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(activeStudy());
-      _PTR(Study) aStudyDS = aStudy->studyDS();
-      _PTR(SObject) anObj;
+      _PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() ), aRefObj = aSObject;
+      while( aRefObj && aRefObj->ReferencedObject( anObj ) )
+       aRefObj = anObj;
 
-      for ( SALOME_ListIteratorOfListIO it( aList ); it.More() && isInvalidRefs; it.Next() )
-       {
-         if ( it.Value()->hasEntry() )
-           {
-             _PTR(SObject) aSObject = aStudyDS->FindObjectID( it.Value()->getEntry() );
-              SALOMEDS_SObject* aSO = dynamic_cast<SALOMEDS_SObject*>(aSObject.get());
-              if( aSO )
-                if ( aSObject->ReferencedObject(anObj) == false || !QString(anObj->GetName().c_str()).isEmpty() )
-                  isInvalidRefs = false;
-           }
-       }
+      if( aRefObj && aRefObj!=aSObject && QString( aRefObj->GetName().c_str() ).isEmpty() )
+       isInvalidRefs = true;
     }
 
-  // Add "Delete refrence" item to popup
+  // Add "Delete reference" item to popup
   if ( isInvalidRefs )
-    {
-      thePopup->insertSeparator();
-      thePopup->insertItem( tr( "MEN_DELETE_REFERENCE" ), this, SLOT( onDeleteReferences() ) );
-      return;
-    }
+  {
+    thePopup->insertSeparator();
+    thePopup->insertItem( tr( "MEN_DELETE_INVALID_REFERENCE" ), this, SLOT( onDeleteInvalidReferences() ) );
+    return;
+  }
+
+  aList.Clear();
+  mgr->selectedObjects( aList );
 
   // "Activate module" item should appear only if it's necessary
   if (aList.Extent() != 1)
@@ -748,7 +735,6 @@ void SalomeApp_Application::contextMenuPopup( const QString& type, QPopupMenu* t
   if (currentModule && currentModule->moduleName() == aModuleTitle)
     return;
   thePopup->insertItem( tr( "MEN_OPENWITH" ), this, SLOT( onOpenWith() ) );
-
 }
 
 /*!Update obect browser:
@@ -782,7 +768,7 @@ void SalomeApp_Application::updateObjectBrowser( const bool updateModels )
   if ( objectBrowser() )
   {
     objectBrowser()->updateGeometry();
-    objectBrowser()->updateTree();
+    objectBrowser()->updateTree( 0, false );
   }
 }
 
index 865fd2bd09904ed74f2c4356c5c7022fc66a016b..2462e557b770edd06345a45f22b3cbc1a88fad7c 100644 (file)
@@ -85,7 +85,7 @@ protected:
   virtual void                        updateDesktopTitle();
 
 private slots:
-  void                                onDeleteReferences();
+  void                                onDeleteInvalidReferences();
   void                                onDblClick( QListViewItem* );
   void                                onProperties();
   void                                onDumpStudy();
index a6549f64696df4d2c56b18cbc85814b499fc7d36..19bc57559e4d7651cad1c77a8bdfbcc80ffd6fa5 100755 (executable)
@@ -37,6 +37,7 @@
 #include "PyInterp_base.h" // this include must be first (see PyInterp_base.h)!
 
 #include <cStringIO.h>
+using namespace std;
 
 /*!
  * constructor : multi Python interpreter, one per SALOME study.
@@ -56,7 +57,7 @@ SalomeApp_PyInterp::~SalomeApp_PyInterp()
  
 /*!\class SalomeApp_PyInterp
  * EDF-CCAR
- * Wasashen SALOME uses multi Python interpreter feature,
+ * 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
  * BUT some Python modules must be imported only once. In multi interpreter context Python
@@ -83,14 +84,12 @@ bool SalomeApp_PyInterp::initContext()
   if ( !PythonConsole_PyInterp::initContext() )
     return false;
 
-  // Debut modif CCAR
   // Import special module to change the import mechanism
   PyObjWrapper m1( PyImport_ImportModule( "import_hook" ) );
   if ( !m1 )
   {
     MESSAGE( "initContext: problem with import_hook import" );
     PyErr_Print();
-    PyErr_Clear();
     ASSERT( 0 );
     return false;
   }
@@ -100,10 +99,9 @@ bool SalomeApp_PyInterp::initContext()
   PyObjWrapper m2( PyObject_CallMethod( m1, "init_shared_modules", "O", KERNEL_PYTHON::salome_shared_modules_module ) );
   if ( !m2 )
   {
-         MESSAGE( "initContext: problem with init_shared_modules call" );
-         PyErr_Print();
-         PyErr_Clear();
-         ASSERT( 0 );
+    MESSAGE( "initContext: problem with init_shared_modules call" );
+    PyErr_Print();
+    ASSERT( 0 );
     return false;
   }
 
@@ -113,19 +111,13 @@ bool SalomeApp_PyInterp::initContext()
 void SalomeApp_PyInterp::init_python()
 {
   /*
-   * Initialize the main state (_gtstate) if not already done
-   * The lock is released on init_python output
-   * It is the caller responsability to acquire it if needed
+   * Do nothing
+   * The initialization has been done in main
    */
   MESSAGE("PyInterp_base::init_python");
   ASSERT(KERNEL_PYTHON::_gtstate); // initialisation in main
   SCRUTE(KERNEL_PYTHON::_gtstate);
-//  if(!_gtstate){
-//  PyReleaseLock aReleaseLock;
-//  Py_Initialize(); // Initialize the interpreter
-//  PyEval_InitThreads(); // Initialize and acquire the global interpreter lock
-//  PySys_SetArgv(_argc,_argv); // initialize sys.argv
-//    _gtstate = PyThreadState_Get();
-//  }
+  _gtstate=KERNEL_PYTHON::_gtstate;
+  _interp=KERNEL_PYTHON::_interp;
 }
 
index b32780274da45b31df639eff6df63853356a1870..ffdee1fd9bff76102c61de88903bd4d5c5222cc9 100644 (file)
     <parameter name="xterm"      value="no"/>
     <parameter name="portkill"   value="no"/>
     <parameter name="killall"    value="no"/>
+    <parameter name="noexcepthandler"  value="no"/>
     <parameter name="modules"    value="GEOM,SMESH,VISU,SUPERV,MED,COMPONENT"/>
     <parameter name="pyModules"  value=""/>
-    <parameter name="embedded"   value="SalomeAppEngine,study"/>
-    <parameter name="standalone" value="pyContainer,cppContainer,registry,moduleCatalog"/>
+    <parameter name="embedded"   value="SalomeAppEngine,study,cppContainer,registry,moduleCatalog"/>
+    <parameter name="standalone" value="pyContainer,supervContainer"/>
   </section>
   <section name="language">
     <parameter name="language"    value="en"/>
     <parameter name="MED"          value="${MED_ROOT_DIR}/share/salome/resources"/>
     <parameter name="StdMeshers"   value="${SMESH_ROOT_DIR}/share/salome/resources"/>
     <parameter name="COMPONENT"    value="${COMPONENT_ROOT_DIR}/share/salome/resources"/>
-    <parameter name="HELLO"        value="${HELLO1_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="HELLO"        value="${HELLO_ROOT_DIR}/share/salome/resources"/>
+    <parameter name="PYHELLO"      value="${PYHELLO_ROOT_DIR}/share/salome/resources"/>
     <parameter name="NETGENPlugin" value="${NETGENPLUGIN_ROOT_DIR}/share/salome/resources"/>
     <parameter name="GHS3DPlugin"  value="${GHS3DPLUGIN_ROOT_DIR}/share/salome/resources"/>
     <parameter name="ToolsGUI"     value="${SUITRoot}/resources"/>
   </section>
+  <section name="PyConsole">
+    <parameter name="font" value="Helvetic,12" />
+  </section>
+  <section name="Study">
+    <parameter name="store_positions" value="false" />
+  </section>
   <section name="GEOM">
     <parameter name="name"       value="Geometry"/>
     <parameter name="icon"       value="ModuleGeom.png"/>
     <parameter name="name"       value="Hello"/>
     <parameter name="icon"       value="HELLO.png"/>
   </section>
+  <section name="PYHELLO">
+    <parameter name="name"       value="PyHello"/>
+    <parameter name="icon"       value="PYHELLO.png"/>
+    <parameter name="library"    value="SalomePyQtGUI"/>
+  </section>
 
 <!-- values below this line are just an example, they are not used  -->
   <section name="application">
   </section>
   <section name="ObjectBrowser" >
     <parameter value="false" name="auto_size" />
-    <parameter value="true" name="visibility_column_0" />
+    <parameter value="true"  name="auto_size_first" />
+    <parameter value="true"  name="visibility_column_0" />
     <parameter value="false" name="visibility_column_1" />
     <parameter value="false" name="visibility_column_2" />
     <parameter value="false" name="visibility_column_3" />
     <parameter value="105" name="trihedron_size" />
     <parameter value="true" name="relative_size" />
  </section>
+ <section name="ExternalBrowser" >
+    <parameter value="/usr/bin/mozilla" name="application" />
+  </section>
  <section name="Plot2d" >
     <parameter value="255, 255, 255" name="Background" />
     <parameter value="1" name="CurveType" />
     <parameter value="5" name="selection_width" />
     <parameter value="5" name="highlight_width" />
     <parameter value="0" name="controls_precision" />
-    <parameter value="0.12" name="scalar_bar_horizontal_height" />
-    <parameter value="0.6" name="scalar_bar_horizontal_width" />
-    <parameter value="0.2" name="scalar_bar_horizontal_x" />
+    <parameter value="0.05" name="scalar_bar_horizontal_height" />
+    <parameter value="0.5" name="scalar_bar_horizontal_width" />
+    <parameter value="0.01" name="scalar_bar_horizontal_x" />
     <parameter value="0.01" name="scalar_bar_horizontal_y" />
     <parameter value="255, 255, 255" name="scalar_bar_label_color" />
     <parameter value="Arial,12" name="scalar_bar_label_font" />
     <parameter value="0" name="scalar_bar_orientation" />
     <parameter value="255, 255, 255" name="scalar_bar_title_color" />
     <parameter value="Arial,12" name="scalar_bar_title_font" />
-    <parameter value="0.8" name="scalar_bar_vertical_height" />
-    <parameter value="0.1" name="scalar_bar_vertical_width" />
+    <parameter value="0.5" name="scalar_bar_vertical_height" />
+    <parameter value="0.05" name="scalar_bar_vertical_width" />
     <parameter value="0.01" name="scalar_bar_vertical_x" />
-    <parameter value="0.1" name="scalar_bar_vertical_y" />
+    <parameter value="0.01" name="scalar_bar_vertical_y" />
     <parameter value="true" name="DisplayMode" />
     <parameter value="true" name="auto_update" />
     <parameter value="1" name="display_mode" />
   </section>
   <section name="VISU" >
   <parameter value="false" name="full_med_loading" />
-  <parameter value="0.12" name="scalar_bar_horizontal_height" />
-  <parameter value="0.6" name="scalar_bar_horizontal_width" />
-  <parameter value="0.2" name="scalar_bar_horizontal_x" />
+  <parameter value="false" name="represent_shading" />
+  <parameter value="0.05" name="scalar_bar_horizontal_height" />
+  <parameter value="0.5" name="scalar_bar_horizontal_width" />
+  <parameter value="0.01" name="scalar_bar_horizontal_x" />
   <parameter value="0.01" name="scalar_bar_horizontal_y" />
   <parameter value="255, 255, 255" name="scalar_bar_label_color" />
   <parameter value="Arial,Bold,Italic,Underline,12" name="scalar_bar_label_font" />
   <parameter value="0" name="scalar_bar_orientation" />
   <parameter value="255, 255, 255" name="scalar_bar_title_color" />
   <parameter value="Arial,Bold,Italic,Underline,12" name="scalar_bar_title_font" />
-  <parameter value="0.8" name="scalar_bar_vertical_height" />
-  <parameter value="0.1" name="scalar_bar_vertical_width" />
+  <parameter value="0.5" name="scalar_bar_vertical_height" />
+  <parameter value="0.05" name="scalar_bar_vertical_width" />
   <parameter value="0.01" name="scalar_bar_vertical_x" />
-  <parameter value="0.1" name="scalar_bar_vertical_y" />
+  <parameter value="0.01" name="scalar_bar_vertical_y" />
   <parameter value="0" name="scalar_range_max" />
   <parameter value="0" name="scalar_range_min" />
   <parameter value="0" name="scalar_range_type" />
index ef835c709304b901b50d319f5f17692df9e4373f..a739779d2805bfbf389326b6cecd7974b7416812 100644 (file)
@@ -37,7 +37,7 @@ msgid "SalomeApp_Application::TOT_DESK_FILE_DUMP_STUDY"
 msgstr "Dump study"
 
 msgid "SalomeApp_Application::MEN_DESK_FILE_DUMP_STUDY"
-msgstr "Dump study..."
+msgstr "&Dump study..."
 
 msgid "SalomeApp_Application::PRP_DESK_FILE_DUMP_STUDY"
 msgstr "Dumps study to the python script"
@@ -46,7 +46,7 @@ msgid "SalomeApp_Application::TOT_DESK_FILE_LOAD_SCRIPT"
 msgstr "Load python script"
 
 msgid "SalomeApp_Application::MEN_DESK_FILE_LOAD_SCRIPT"
-msgstr "Load script..."
+msgstr "Load scrip&t..."
 
 msgid "SalomeApp_Application::PRP_DESK_FILE_LOAD_SCRIPT"
 msgstr "Loads python script from file"
@@ -55,13 +55,13 @@ msgid "SalomeApp_Application::TOT_FILE_DESK_PREFERENCES"
 msgstr "Preferences"
 
 msgid "SalomeApp_Application::MEN_DESK_TOOLS"
-msgstr "Tools"
+msgstr "&Tools"
 
 msgid "SalomeApp_Application::TOT_DESK_CATALOG_GENERATOR"
 msgstr "Catalog generator"
 
 msgid "SalomeApp_Application::MEN_DESK_CATALOG_GENERATOR"
-msgstr "Catalog generator"
+msgstr "Catalog &generator"
 
 msgid "SalomeApp_Application::PRP_DESK_CATALOG_GENERATOR"
 msgstr "Generates XML catalog of a component's interface"
@@ -70,7 +70,7 @@ msgid "SalomeApp_Application::TOT_DESK_REGISTRY_DISPLAY"
 msgstr "Registry display"
 
 msgid "SalomeApp_Application::MEN_DESK_REGISTRY_DISPLAY"
-msgstr "Registry display"
+msgstr "Registry &display"
 
 msgid "SalomeApp_Application::PRP_DESK_REGISTRY_DISPLAY"
 msgstr "Displays content of the Registry CORBA server"
@@ -85,7 +85,7 @@ msgid "SalomeApp_Application::TOT_DESK_PROPERTIES"
 msgstr "Study properties"
 
 msgid "SalomeApp_Application::MEN_DESK_PROPERTIES"
-msgstr "Properties..."
+msgstr "Pro&perties..."
 
 msgid "SalomeApp_Application::PRP_DESK_PROPERTIES"
 msgstr "Edits study properties"
@@ -99,8 +99,8 @@ msgstr "Object browser"
 msgid "SalomeApp_Application::MEN_OPENWITH"
 msgstr "Activate Module"
 
-msgid "SalomeApp_Application::MEN_DELETE_REFERENCE"
-msgstr "Delete Reference"
+msgid "SalomeApp_Application::MEN_DELETE_INVALID_REFERENCE"
+msgstr "Delete Invalid Reference"
 
 //=======================================================================================
 
@@ -118,9 +118,6 @@ msgstr "Default columns"
 msgid "SalomeApp_Application::PREF_OBJ_BROWSER_SETTINGS"
 msgstr "Settings"
 
-msgid "SalomeApp_Application::PREF_AUTO_SIZE"
-msgstr "Auto size columns"
-
 //=======================================================================================
 
 msgid "SalomeApp_Application::OBJ_BROWSER_NAME"
index 84c7f7a816a769ad18ab28304c90dc00cb79b9d2..ac7738582d033d4c2aeca4277a32af12747c6d50 100755 (executable)
@@ -295,7 +295,6 @@ int main( int argc, char **argv )
     {
       INFOS( "salome_shared_modules_module == NULL" );
       PyErr_Print();
-      PyErr_Clear();
     }
     PyEval_ReleaseThread( KERNEL_PYTHON::_gtstate );
 
@@ -413,8 +412,9 @@ int main( int argc, char **argv )
       SUIT_Application* aGUIApp = aGUISession->startApplication( "SalomeApp", 0, 0 );
       if ( aGUIApp )
       {
-       _qappl.setHandler( aGUISession->handler() ); // after loading SalomeApp application
-                                                    // aGUISession contains SalomeApp_ExceptionHandler
+       if ( !isFound( "noexcepthandler", argc, argv ) )
+         _qappl.setHandler( aGUISession->handler() ); // after loading SalomeApp application
+                                                      // aGUISession contains SalomeApp_ExceptionHandler
        // Run GUI loop
        MESSAGE( "run(): starting the main event loop" );
        result = _qappl.exec();
index 47f8bff0f0daba352e84960473242ac2e9b38e61..7e3714518365081811f7215aa8e1c70099fa7267 100755 (executable)
@@ -168,6 +168,7 @@ void Session_ServerThread::Init()
            {
              NamingService_WaitForServerReadiness(_NS,"/myStudyManager");
              ActivateEngine(_argc, _argv);
+             break;
            }
          case 6: // Container Manager
            {