]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Initial version of files for OCC developers OCC_initial_01
authoradmin <salome-admin@opencascade.com>
Wed, 22 Dec 2004 11:19:47 +0000 (11:19 +0000)
committeradmin <salome-admin@opencascade.com>
Wed, 22 Dec 2004 11:19:47 +0000 (11:19 +0000)
15 files changed:
bin/salome/runIDLparser.in
idl/SALOME_ModuleCatalog.idl
src/Container/Container_i.cxx
src/Loader/SALOME_Session_Loader.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_Handler.cxx
src/ModuleCatalog/SALOME_ModuleCatalog_Handler.hxx
src/ModuleCatalog/SALOME_ModuleCatalog_Parser.hxx
src/ModuleCatalog/SALOME_ModuleCatalog_impl.cxx
src/Plot2d/Plot2d_ViewFrame.cxx
src/SALOMEGUI/QAD_Desktop.cxx
src/SALOMEGUI/QAD_DirListDlg.cxx
src/SALOMEGUI/QAD_PyEditor.cxx
src/SALOMEGUI/QAD_PyEditor.h
src/SALOMEGUI/SALOMEGUI_TableDlg.cxx
src/Session/SALOME_Session_Server.cxx

index 085ac77d8145c89e857b2e0e7da1f15c254c3872..9f3afa8619ce53879cbaae1b44bb6b1424147d8e 100644 (file)
@@ -36,10 +36,8 @@ fi
 @ENVSCRIPT@
 
 cd $DIR
-
-PYTHONPATH=${PYTHONPATH}:${SALOME_HOME_DIR}/bin
 #============================================================
 
 # omiidl ====================================================
-omniidl -bIDLparser -I ${SALOME_SRC_DIR}/idl $@
+omniidl -bIDLparser -I ${KERNEL_ROOT_DIR}/idl/salome $@
 #============================================================
index 1bac5ce711c059ce661c9424de8e64f6278864bd..6ff8899094aa108462d5814e800e91796d8d3cf0 100644 (file)
@@ -169,9 +169,11 @@ This struct contains GUI elements used for representation of the module in %IAPP
 */
   struct IAPP_Affich
   {
-    string modulename; /*!<Name of the module.*/
+    string modulename;     /*!<Name of the module.*/
     string moduleusername; /*!<UserName of the module.*/
-    string moduleicone; /*!<Icone representing the module.*/
+    string moduleicone;    /*!<Icone representing the module.*/
+    string moduleversion;  /*!<Version of the module.*/
+    string modulecomment;  /*!<Comment to the module.*/
   };
 /*!
 List of pair GUI elements (component name, component icone)
index ca47f23d9da2532f8aa3c385cf20e820ec7a2e30..e36089f5e2493ec8ea9ac850cd2cfcdcaca35441 100644 (file)
@@ -210,9 +210,29 @@ Engines::Container_ptr Engines_Container_i::start_impl(
     shstr += " " ;
     shstr += _argv[ 3 ] ;
   }
-  shstr += " > /tmp/" ;
-  shstr += ContainerName ;
-  shstr += ".log 2>&1 &" ;
+
+  // asv : 16.11.04 : creation of log file in /tmp/logs/$USER dir. 
+  // "/tmp/logs/$USER" was created by  runSalome.py -> orbmodule.py.
+  string tempfilename = "/tmp/logs/";
+  tempfilename += getenv( "USER" ) ;
+  tempfilename += "/" ;
+  tempfilename += ContainerName ;
+  tempfilename += ".log" ;
+  FILE* f = fopen ( tempfilename.c_str(), "a" );
+  if ( f ) { // check if file can be opened for writing
+    fclose( f );
+    shstr += " > " ;
+    shstr += tempfilename;
+    shstr += " 2>&1 &" ;
+  }
+  else { // if file can't be opened - use a guaranteed temp file name
+    char* tmpFileName = tempnam( NULL, ContainerName );
+    shstr += " > ";
+    shstr += tmpFileName;
+    shstr += " 2>&1 &";
+    free( tmpFileName );    
+  }
+
   MESSAGE("system(" << shstr << ")") ;
   int status = system( shstr.c_str() ) ;
   if (status == -1) {
@@ -448,7 +468,7 @@ void SigIntHandler(int what , siginfo_t * siginfo ,
 
 // Get the PID of the Container
 
-CORBA::Long Engines_Container_i::getPID() {
+long Engines_Container_i::getPID() {
     return (long)getpid();
 }
 
index 0db216d3c63524247f2032b54dd5e58cc1afded0..9928b93605ba7d228978b030dbfe042029fc9c26 100644 (file)
 #include "InquireServersQThread.h"
 using namespace std;
 
+void MessageOutput( QtMsgType type, const char *msg )
+{
+  switch ( type ) {
+  case QtDebugMsg:
+    MESSAGE( "Debug: " << msg );
+    break;
+  case QtWarningMsg:
+    MESSAGE( "Warning: " << msg );
+    break;
+  case QtFatalMsg:
+    MESSAGE( "Fatal: " << msg );
+    break;
+  }
+}
+
 int main(int argc, char **argv)
 {
-  CORBA::ORB_ptr orb = CORBA::ORB_init(argc,argv) ;
-  LocalTraceCollector *myThreadTrace = LocalTraceCollector::instance(orb);
+  qInstallMsgHandler( MessageOutput );
 //VRV: T2.4 - Trace management improvement
   QApplication myQApp(argc, argv) ;
   InquireServersGUI myIS;
@@ -46,7 +60,9 @@ int main(int argc, char **argv)
 //VRV: T2.4 - Trace management improvement
   if (myIS.withGUI()) {
     try
-      {        
+      {
+       CORBA::ORB_ptr orb = CORBA::ORB_init(argc,argv) ;
+       
        SALOME_NamingService &NS = *SINGLETON_<SALOME_NamingService>::Instance() ;
        ASSERT(SINGLETON_<SALOME_NamingService>::IsAlreadyExisting()) ;
        NS.init_orb( orb ) ;
@@ -86,9 +102,10 @@ int main(int argc, char **argv)
       {
        INFOS("Caught unknown exception.");
       }
+    return 0 ;
   }
   INFOS("Normal Exit"); // without this trace, Splash remains on screen !
-  delete myThreadTrace;
+//  delete myThreadTrace;
   return 0 ;
 }
 
index 0a8f27f4e3d7acb9991bfb1bddb358ba5cf996e3..d698f6459d8033555bc695ea4c103e726cbd4175 100644 (file)
@@ -61,6 +61,8 @@ SALOME_ModuleCatalog_Handler::SALOME_ModuleCatalog_Handler()
   test_component_multistudy = "component-multistudy";
   test_component_icon       = "component-icone" ;
   test_component_impltype   = "component-impltype";
+  test_component_version    = "component-version";
+  test_component_comment    = "component-comment";
 
   test_interface_name       = "component-interface-name" ;
   
@@ -256,6 +258,18 @@ bool SALOME_ModuleCatalog_Handler::endElement(const QString&,
      return true;
    }
 
+  // tag test_component_version
+   if((qName.compare(test_component_version)==0)) {
+     _aModule.version = content ;
+     return true;
+   }
+
+  // tag test_component_comment
+   if((qName.compare(test_component_comment)==0)) {
+     _aModule.comment = content ;
+     return true;
+   }
+
    // interface identification
 
    // tag test_interface_name
index 775966ae7b59f4969f2027c5422434b4cc938302..43701c9832ae8484f1da24c37aaef75e6ca73d7e 100644 (file)
@@ -116,6 +116,8 @@ private:
   QString test_component_multistudy ;
   QString test_component_icon ;
   QString test_component_impltype;
+  QString test_component_version;
+  QString test_component_comment;
 
   QString test_interface_name;
 
index 2fac493679dcc5b1a7d9a8ec893e2877fad6af58..c23dde27ef3b3a9e7ba92bc500217f3cfceef159 100644 (file)
@@ -96,6 +96,8 @@ struct ParserComponent
   ParserInterfaces    interfaces;
   ParserPathPrefixes  prefixes;
   bool                implementationType;
+  std::string         version;
+  std::string         comment;
 };
 
 typedef std::vector<ParserComponent> ParserComponents ;
index 7018c1cacb2a7a5a04bc093864c428796133113d..845e341dcda6f62634e35b2b1331cb52710ff745 100644 (file)
@@ -301,6 +301,8 @@ SALOME_ModuleCatalogImpl::GetComponentIconeList()
     _list_components_icone[ind].modulename=(_personal_module_list[ind].name).c_str();
     _list_components_icone[ind].moduleusername=(_personal_module_list[ind].username).c_str();
     _list_components_icone[ind].moduleicone=(_personal_module_list[ind].icon).c_str();
+    _list_components_icone[ind].moduleversion=(_personal_module_list[ind].version).c_str();
+    _list_components_icone[ind].modulecomment=(_personal_module_list[ind].comment).c_str();
     //if(MYDEBUG) SCRUTE(_list_components_icone[ind].modulename); 
     //if(MYDEBUG) SCRUTE(_list_components_icone[ind].moduleicone);
   }
@@ -325,6 +327,8 @@ SALOME_ModuleCatalogImpl::GetComponentIconeList()
       _list_components_icone[indice].modulename=_general_module_list[ind].name.c_str();  
       _list_components_icone[indice].moduleusername=_general_module_list[ind].username.c_str();  
       _list_components_icone[indice].moduleicone=_general_module_list[ind].icon.c_str(); 
+      _list_components_icone[indice].moduleversion=_general_module_list[ind].version.c_str();
+      _list_components_icone[indice].modulecomment=_general_module_list[ind].comment.c_str();
       //if(MYDEBUG) SCRUTE(_list_components_icone[indice].modulename) ;
       //if(MYDEBUG) SCRUTE(_list_components_icone[indice].moduleicone);
       
index 49f5cbdd347110ef3cfc45ad419fe947f644a2f8..ae6234cb822bada485c49f20f50e7f164ba16fea 100644 (file)
@@ -387,6 +387,21 @@ void Plot2d_ViewFrame::Erase( const Handle(SALOME_InteractiveObject)& IObject, b
   Plot2d_Curve* curve = getCurveByIO( IObject );
   if ( curve )
     eraseCurve( curve, update );
+  // it can be table or container object selected
+  QAD_Study* activeStudy = QAD_Application::getDesktop()->getActiveStudy();
+  SALOMEDS::SObject_var aSO = activeStudy->getStudyDocument()->FindObjectID(IObject->getEntry());
+  if ( !aSO->_is_nil() ) {
+    SALOMEDS::ChildIterator_var aIter = activeStudy->getStudyDocument()->NewChildIterator( aSO );
+    for ( ; aIter->More(); aIter->Next() ) {
+      SALOMEDS::SObject_var aChildSO = aIter->Value();
+      SALOMEDS::SObject_var refSO;
+      if ( aChildSO->ReferencedObject( refSO ) && !refSO->_is_nil() )
+       aChildSO = refSO;
+      curve = getCurveByIO( new SALOME_InteractiveObject( aChildSO->GetID(), "", "" ) );
+      if ( curve )
+       eraseCurve( curve, update );
+    }
+  }
 }
 /*!
   Actually this method just re-displays all curves which are presented in the viewer
index 69bde6093a0dd6315c543f5fa8cf04c5af67f9e5..49d457d6367e3f22c7848026e174b71cb4614e6f 100644 (file)
@@ -97,7 +97,7 @@
 #include <qlineedit.h>
 #include <qdatetime.h>
 #include <qthread.h>
-
+#include <qtooltip.h>
 #include <qstringlist.h>
 
 #if QT_VERSION > 300
@@ -292,6 +292,8 @@ myAboutToClose( false )
     QString iconfile = CORBA::string_dup(list_composants[ind].moduleicone) ;
     QString modulename = CORBA::string_dup(list_composants[ind].modulename) ;
     QString moduleusername = CORBA::string_dup(list_composants[ind].moduleusername) ;
+    QString moduleversion = CORBA::string_dup(list_composants[ind].moduleversion) ;
+    QString modulecomment = CORBA::string_dup(list_composants[ind].modulecomment) ;
 
     //    MESSAGE ( " MODULE = " << modulename )
     //    MESSAGE ( " MODULE icon = " << iconfile )
@@ -313,7 +315,10 @@ myAboutToClose( false )
        QToolButton * toolb = 
          new QToolButton( QIconSet( Icone ), moduleusername, QString::null, this, 
                           SLOT( onButtonActiveComponent () ),tbComponent );
+       QString ttip = QString("<b>") + moduleusername + QString("</b>");
+       if ( !moduleversion.isEmpty() ) ttip += QString("<br>Version:&nbsp;") + moduleversion;
        toolb->setToggleButton( true );
+       QToolTip::add(toolb, ttip, this->toolTipGroup(), modulecomment);
        myComponentButton.append(toolb);
       }
     else
index 542df51cf581cfa7abe3446dbe864a832b33c039..a0479d94492917011876b13c5946d98c29b3ad26 100644 (file)
@@ -142,9 +142,41 @@ void QAD_DirListDlg::setPathList(const QStringList& list) {
 /*!
   Validates entered path, returns true if OK
 */
+#ifndef WNT
+#include <pwd.h>
+#endif
 bool QAD_DirListDlg::validate() {
   if (myEdited) {
     QString dirPath = myEdit->text().stripWhiteSpace();
+#ifndef WNT
+    if ( dirPath.startsWith( "~") ) {
+      dirPath = dirPath.remove(0,1);
+      QString user;
+      int slashPos = dirPath.find("/");
+      if ( slashPos >= 0 ) {
+       user = dirPath.left(slashPos);
+       dirPath = dirPath.mid(slashPos);
+      }
+      else {
+       user = dirPath;
+       dirPath = "";
+      }
+      if ( user.isEmpty() )
+       user = getenv( "USER" );
+
+      struct passwd* user_data = getpwnam( user.latin1() );
+      if ( user_data == NULL ) {
+       // unknown user or something another error
+       QAD_MessageBox::error1(this, 
+                              tr("ERR_ERROR"),
+                              tr("Unknown user %1").arg(user), 
+                              tr("BUT_OK"));
+       myEdit->setFocus();
+        return false;
+      }
+      dirPath = user_data->pw_dir + dirPath;
+    }
+#endif
     QDir dir(dirPath);
     QListBoxItem* found = 0;
     for (unsigned i = 0; i < myDirList->count()-1; i++) {
index f5258e1a05a9b6bf35d6b397129e6f8aaf0fd31b..ab17fc75697d29d0860e425d2618614eebf938a1 100644 (file)
@@ -316,8 +316,42 @@ void QAD_PyEditor::mousePressEvent (QMouseEvent * event)
 }
 
 /*!
-    Called when a Mouse release event
+    Called when any event occures.  The function is redefined to handle MousePress events
+    in order to provide the following behaviour: on middle mouse button press a previously
+    selected text (by mouse drag or left mouse button double click) is appended to the last
+    paragraph.  This behaviour is similar to standard Unix terminal editor behaviour.
 */
+bool QAD_PyEditor::eventFilter( QObject *o, QEvent *e )
+{
+  const int t = e->type();
+  if ( t == QEvent::MouseButtonPress || t == QEvent::MouseButtonRelease ) {
+    QMouseEvent * event = (QMouseEvent*)e;
+    if ( event->button() == MidButton ) {
+      if ( t == QEvent::MouseButtonPress ) {
+       QString selection = selectedText();
+       QClipboard *cb = QApplication::clipboard();
+       if ( !selection.isNull() && !selection.isEmpty() ) 
+         cb->setText( selection );
+       const int endPara = paragraphs()-1;
+       insertAt( cb->text(), endPara, paragraphLength( endPara )-1 );
+       return true; // don't allow futher event processing
+      }
+      // code from old mouseReleaseEvent() function.  
+      else if ( t == QEvent::MouseButtonRelease ) {
+       int curPara, curCol; // for cursor position
+       int endPara, endCol; // for last edited line
+       getCursorPosition(&curPara, &curCol);
+       endPara = paragraphs() -1;
+       return ( curPara != endPara || curCol < SIZEPR );
+      }
+    }
+  }
+  return QTextEdit::eventFilter( o, e );
+}
+
+/*!
+    Called when a Mouse release event
+
 void QAD_PyEditor::mouseReleaseEvent ( QMouseEvent * e )
 {
   //  MESSAGE("mouseReleaseEvent");
@@ -330,6 +364,7 @@ void QAD_PyEditor::mouseReleaseEvent ( QMouseEvent * e )
   else if ((curPara == endPara) && (curCol >= SIZEPR))
     QTextEdit::mouseReleaseEvent(e);
 }
+*/
 
 /*!
     Called when a drop event (Drag & Drop)
index fd7ff49554fd2e7da8a7263471c657f512a533b4..5c1972909add2bbf29dd2ba627d4ca37c8535c72 100644 (file)
@@ -61,9 +61,10 @@ public:
 protected:
   virtual void keyPressEvent (QKeyEvent * e);
   virtual void mousePressEvent (QMouseEvent * e);
-  virtual void mouseReleaseEvent (QMouseEvent * e);
+  //virtual void mouseReleaseEvent (QMouseEvent * e);
   virtual void dropEvent (QDropEvent *e);
   virtual void customEvent (QCustomEvent *e);
+  virtual bool eventFilter(QObject *o, QEvent *e);
   
 public slots:
   void handleReturn();
index a70b74df42e613d01c916114645fb32ce9666e36..1b24930b363a6c1f9c73fd0f63f8185c6e8b5831 100644 (file)
@@ -579,9 +579,10 @@ void SALOMEGUI_TableWidget::setColTitles( QStringList& tlts )
   // !!! first column contains units !!!
   for ( int i = 0; i < tlts.count(); i++ ) {
     myOrientation == Horizontal ? 
-      myTable->horizontalHeader()->setLabel( i+1, tlts[i] ) :
-      myTable->verticalHeader()->setLabel( i+1, tlts[i] );
+      myTable->horizontalHeader()->setLabel( i+1, tlts[i].isNull() ? "" : tlts[i] ) :
+      myTable->verticalHeader()->setLabel( i+1, tlts[i].isNull() ? "" : tlts[i] );
   }
+  setUnitsTitle( tr( "UNITS_TLT" ) );
 }
 /*!
   Sets columns titles
@@ -606,7 +607,7 @@ void SALOMEGUI_TableWidget::getColTitles( QStringList& tlts )
 */
 void SALOMEGUI_TableWidget::setUnitsTitle( const QString& tlt ) {
   // !!! first column contains units !!!
-  myOrientation == Horizontal ? myTable->horizontalHeader()->setLabel( 0, tlt ) : myTable->verticalHeader()->setLabel( 0, tlt );
+  myOrientation == Horizontal ? myTable->horizontalHeader()->setLabel( 0, tlt.isNull() ? "" : tlt ) : myTable->verticalHeader()->setLabel( 0, tlt.isNull() ? "" : tlt );
 }
 /*!
   Sets units
@@ -614,7 +615,7 @@ void SALOMEGUI_TableWidget::setUnitsTitle( const QString& tlt ) {
 void SALOMEGUI_TableWidget::setUnits( QStringList& units )
 {
   for ( int i = 0; i < units.count(); i++ ) {
-    myOrientation == Horizontal ? myTable->setText( i, 0, units[i] ) : myTable->setText( 0, i, units[i] );
+    myOrientation == Horizontal ? myTable->setText( i, 0, units[i].isNull() ? "" : units[i] ) : myTable->setText( 0, i, units[i].isNull() ? "" : units[i] );
   }
 }
 /*!
index 33d3440a3e61cb287b6fc9b6a485cee02256088b..39df11075c54c7f6fae38028ec5980285bdb13a1 100644 (file)
@@ -90,15 +90,33 @@ static int MYDEBUG = 0;
 static int MYDEBUG = 0;
 #endif
 
+void MessageOutput( QtMsgType type, const char *msg )
+{
+  switch ( type ) {
+  case QtDebugMsg:
+    MESSAGE( "Debug: " << msg );
+    break;
+  case QtWarningMsg:
+    MESSAGE( "Warning: " << msg );
+    break;
+  case QtFatalMsg:
+    MESSAGE( "Fatal: " << msg );
+    break;
+  }
+}
+
 int main(int argc, char **argv)
 {
-  SALOME_Event::GetSessionThread();
-  ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
-  int orbArgc = 1;
-  CORBA::ORB_var &orb = init( orbArgc , argv ) ;
-  LocalTraceCollector *myThreadTrace = LocalTraceCollector::instance(orb);
+  qInstallMsgHandler( MessageOutput );
   try
     {
+      SALOME_Event::GetSessionThread();
+
+      ORB_INIT &init = *SINGLETON_<ORB_INIT>::Instance() ;
+      ASSERT(SINGLETON_<ORB_INIT>::IsAlreadyExisting()) ;
+      int orbArgc = 1;
+      CORBA::ORB_var &orb = init( orbArgc , argv ) ;
+
       CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
       PortableServer::POA_var poa = PortableServer::POA::_narrow(obj);
 
@@ -254,6 +272,6 @@ int main(int argc, char **argv)
       INFOS("Caught unknown exception.");
     }
   MESSAGE("End of SALOME_Session_Server");
-  delete myThreadTrace;
+//  delete myThreadTrace;
   return 0 ;
 }