]> SALOME platform Git repositories - modules/paravis.git/commitdiff
Salome HOME
ParaView menu managers
authorsan <san@opencascade.com>
Mon, 24 Nov 2008 17:22:36 +0000 (17:22 +0000)
committersan <san@opencascade.com>
Mon, 24 Nov 2008 17:22:36 +0000 (17:22 +0000)
Basic plugin test

src/PVGUI/PVGUI_Module.cxx
src/PVGUI/PVGUI_Module.h
src/PVGUI/PVGUI_ViewWindow.cxx
src/PVGUI/resources/PARAVIS_msg_en.ts

index 9cdc4c1b5e2e34bb640467e0c650391ae8e29d36..4826000ea935bc0d3fc5c4c408f859ed657cf233 100644 (file)
@@ -34,6 +34,7 @@
 #include <SUIT_Session.h>
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
 #include <SUIT_Session.h>
 #include <LightApp_Application.h>
 #include <LightApp_SelectionMgr.h>
+#include <QtxActionMenuMgr.h>
 
 #include <QApplication>
 #include <QInputDialog>
 
 #include <QApplication>
 #include <QInputDialog>
@@ -367,7 +368,7 @@ void PVGUI_Module::showView( bool toShow )
     SUIT_ViewWindow* wnd = viewMgr->createViewWindow();  
 
     // Simulate ParaView client main window
     SUIT_ViewWindow* wnd = viewMgr->createViewWindow();  
 
     // Simulate ParaView client main window
-    Implementation = new pqImplementation( wnd );
+    Implementation = new pqImplementation( anApp->desktop() );
     PVGUI_ViewWindow* pvWnd = dynamic_cast<PVGUI_ViewWindow*>( wnd );
     pvWnd->setMultiViewManager( &Implementation->Core.multiViewManager() );
 
     PVGUI_ViewWindow* pvWnd = dynamic_cast<PVGUI_ViewWindow*>( wnd );
     pvWnd->setMultiViewManager( &Implementation->Core.multiViewManager() );
 
@@ -378,19 +379,45 @@ void PVGUI_Module::showView( bool toShow )
  
 /*!
   \brief Create actions for ParaView GUI operations
  
 /*!
   \brief Create actions for ParaView GUI operations
-  duplicating menus and toolbars in pqMainWindow ParaView class
+  duplicating menus and toolbars in MainWindow class of
+  the standard ParaView GUI client application.
+
+  In particular, ParaView is responsible for updating "Sources" and "Filters" menus. 
+  For this, specific menu managers created by pqMainWindowCore class are used, and PVGUI_Module
+  is responsible for creation of corresponding QMenu objects only.
 */
 void PVGUI_Module::pvCreateActions()
 {
   // TODO...
   SUIT_Desktop* desk = application()->desktop();
 
 */
 void PVGUI_Module::pvCreateActions()
 {
   // TODO...
   SUIT_Desktop* desk = application()->desktop();
 
-  // TEST
+  // Manage plug-ins
   int actionManagePlugins = 999;
   createAction( actionManagePlugins, tr( "TOP_MANAGE_PLUGINS" ), QIcon(), tr( "MEN_MANAGE_PLUGINS" ),
                 tr( "STB_MANAGE_PLUGINS" ), 0, desk, false, &Implementation->Core, SLOT( onManagePlugins() ) );
   int actionManagePlugins = 999;
   createAction( actionManagePlugins, tr( "TOP_MANAGE_PLUGINS" ), QIcon(), tr( "MEN_MANAGE_PLUGINS" ),
                 tr( "STB_MANAGE_PLUGINS" ), 0, desk, false, &Implementation->Core, SLOT( onManagePlugins() ) );
-  int aPVMnu = createMenu( tr( "MEN_TEST_PARAVIEW" ), -1, -1, 50 );
+  int aPVMnu = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
   createMenu( actionManagePlugins, aPVMnu, 10 );
   createMenu( actionManagePlugins, aPVMnu, 10 );
+
+  // Install ParaView managers for "Sources" and "Filters" menus
+  QMenu* res = 0;
+  aPVMnu = createMenu( tr( "Sources" ), -1, -1, 60 );
+  res = getMenu( aPVMnu );
+  if ( res ){
+    Implementation->Core.setSourceMenu( res );
+    connect(&this->Implementation->Core,
+            SIGNAL(enableSourceCreate(bool)),
+            res,
+            SLOT(setEnabled(bool)));
+  }
+  aPVMnu = createMenu( tr( "Filters" ), -1, -1, 70 );
+  res = getMenu( aPVMnu );
+  if ( res ){
+    Implementation->Core.setFilterMenu( res );
+    connect(&this->Implementation->Core,
+            SIGNAL(enableFilterCreate(bool)),
+            res,
+            SLOT(setEnabled(bool)));
+  }
 }
 
 
 }
 
 
@@ -412,6 +439,17 @@ pqViewManager* PVGUI_Module::getMultiViewManager() const
   return aMVM;
 }
 
   return aMVM;
 }
 
+QMenu* PVGUI_Module::getMenu( const int id )
+{
+  QMenu* res = 0;
+  LightApp_Application* anApp = getApp();
+  SUIT_Desktop* desk = anApp->desktop();
+  if ( desk ){
+    QtxActionMenuMgr* menuMgr = desk->menuMgr();
+    res = menuMgr->findMenu( id );
+  }
+  return res;
+}
 
 /*!
   \brief Activate module.
 
 /*!
   \brief Activate module.
index 3b9de1455e0646b80253b545dab67c9cec5b6934..48a805cbf1cf466b2e8a951c126234c302b1d020 100644 (file)
@@ -82,7 +82,10 @@ private:
   void                   setupDockWidgets();
 
   //! Shows or hides ParaView view window
   void                   setupDockWidgets();
 
   //! Shows or hides ParaView view window
-  void                   showView( bool );         
+  void                   showView( bool );    
+
+  //! Returns QMenu object for a given menu id
+  QMenu*                 getMenu( const int );
 
 public slots:
   virtual bool           activateModule( SUIT_Study* );
 
 public slots:
   virtual bool           activateModule( SUIT_Study* );
index b186eeef44134306af358cb1022147c58c64704d..51ec369edfd36ac6879ec1477b2050bf6d298f97 100644 (file)
@@ -90,6 +90,8 @@ void PVGUI_ViewWindow::setMultiViewManager( pqViewManager* viewMgr )
 {
   myPVMgr = viewMgr;
   myPVMgr->setParent( this );
 {
   myPVMgr = viewMgr;
   myPVMgr->setParent( this );
+  // This is mandatory, see setParent() documentation 
+  myPVMgr->show();
   setCentralWidget( myPVMgr );
   myPVMgr->installEventFilter( this );
 }
   setCentralWidget( myPVMgr );
   myPVMgr->installEventFilter( this );
 }
index eb885a428d96c8fdcf636e2f94f016d2fbde192a..b981aaf8657c65f6d7cd7e7f5ea1b78ad6ecaed6 100644 (file)
     </message>
 </context>
 <context>
     </message>
 </context>
 <context>
-    <name>LIGHTGUI</name>
+    <name>PVGUI_Module</name>
     <message>
     <message>
-        <source>LIGHTGUI_ADD_LINE</source>
-        <translation>Add new line before the selected one</translation>
+        <source>MEN_TOOLS</source>
+        <translation>Tools</translation>
     </message>
     <message>
     </message>
     <message>
-        <source>LIGHTGUI_MEN_DUMP</source>
-        <translation>Dump</translation>
-    </message>
-    <message>
-        <source>LIGHTGUI_MEN_LOAD</source>
-        <translation>Load</translation>
-    </message>
-    <message>
-        <source>LIGHTGUI_MEN_TXT_FILES</source>
-        <translation>Text Files ( *.txt )</translation>
-    </message>
-    <message>
-        <source>LIGHTGUI_EDIT_LINE</source>
-        <translation>Edit selected line</translation>
-    </message>
-    <message>
-        <source>LIGHTGUI_MEN_ALL_FILES</source>
-        <translation>All Files ( * )</translation>
+        <source>MEN_MANAGE_PLUGINS</source>
+        <translation>Manage plug-ins...</translation>
     </message>
 </context>
 </TS>
     </message>
 </context>
 </TS>