From: abn Date: Mon, 27 Oct 2014 10:57:50 +0000 (+0100) Subject: Fixing menus. X-Git-Tag: V7_5_0b1~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0bf4516a9f38b6770ca4e81f570076ec9f3190d0;p=modules%2Fparavis.git Fixing menus. --- diff --git a/src/ENGINE/no_wrap/PVSERVER.py b/src/ENGINE/no_wrap/PVSERVER.py index fa3fd7d3..379fd8df 100644 --- a/src/ENGINE/no_wrap/PVSERVER.py +++ b/src/ENGINE/no_wrap/PVSERVER.py @@ -60,7 +60,9 @@ class PVSERVER_Impl: ZE_KEY_TO_FIND_PV_ROOT_DIR="lib" li=tmp.split(os.path.sep) ; li.reverse() if ZE_KEY_TO_FIND_PV_ROOT_DIR not in li: - raise Exception("PVSERVER_Impl.__init__ : error during dynamic deduction of PARAVIEW_ROOT_DIR : Loc of paraview module is \"%s\" ! \"%s\" is supposed to be the key to deduce it !"%(tmp,ZE_KEY_TO_FIND_PV_ROOT_DIR)) + raise SALOME.SALOME_Exception(SALOME.ExceptionStruct(SALOME.INTERNAL_ERROR, + "PVSERVER_Impl.__init__ : error during dynamic deduction of PARAVIEW_ROOT_DIR : Loc of paraview module is \"%s\" ! \"%s\" is supposed to be the key to deduce it !"%(tmp,ZE_KEY_TO_FIND_PV_ROOT_DIR), + "PVSERVER.py", 0)) li=li[li.index("lib")+1:] ; li.reverse() self.PARAVIEW_ROOT_DIR = os.path.sep.join(li) diff --git a/src/PVGUI/PVGUI_Module.cxx b/src/PVGUI/PVGUI_Module.cxx index c8c1f421..525d2777 100644 --- a/src/PVGUI/PVGUI_Module.cxx +++ b/src/PVGUI/PVGUI_Module.cxx @@ -643,12 +643,12 @@ bool PVGUI_Module::activateModule( SUIT_Study* study ) if ( myToolbarsMenuId != -1 ) menuMgr()->show(myToolbarsMenuId); // Update the various menus with the content pre-loaded in myGuiElements - QMenu* srcMenu = menuMgr()->findMenu( mySourcesMenuId ); - myGuiElements->updateSourcesMenu(srcMenu); - QMenu* filtMenu = menuMgr()->findMenu( myFiltersMenuId ); - myGuiElements->updateFiltersMenu(filtMenu); - QMenu* macMenu = menuMgr()->findMenu( myMacrosMenuId ); - myGuiElements->updateMacrosMenu(macMenu); +// QMenu* srcMenu = menuMgr()->findMenu( mySourcesMenuId ); +// myGuiElements->updateSourcesMenu(srcMenu); +// QMenu* filtMenu = menuMgr()->findMenu( myFiltersMenuId ); +// myGuiElements->updateFiltersMenu(filtMenu); +// QMenu* macMenu = menuMgr()->findMenu( myMacrosMenuId ); +// myGuiElements->updateMacrosMenu(macMenu); setMenuShown( true ); setToolShown( true ); diff --git a/src/PVGUI/PVGUI_Module_actions.cxx b/src/PVGUI/PVGUI_Module_actions.cxx index 69411dae..271c01aa 100644 --- a/src/PVGUI/PVGUI_Module_actions.cxx +++ b/src/PVGUI/PVGUI_Module_actions.cxx @@ -24,6 +24,7 @@ #include "PVGUI_Module.h" #include +#include #include #include @@ -482,21 +483,22 @@ void PVGUI_Module::pvCreateMenus() // --- Menu "Sources" // Install ParaView managers for "Sources" menu QMenu* aRes = 0; + QMenu* filtersMenu = 0; PVViewer_GUIElements * guiElements = PVViewer_GUIElements::GetInstance(desk); mySourcesMenuId = createMenu( tr( "MEN_DESK_SOURCES" ), -1, -1, 60); if ( (aRes = getMenu( mySourcesMenuId )) ) - guiElements->updateSourcesMenu(aRes); + pqParaViewMenuBuilders::buildSourcesMenu(*aRes, desk); // --- Menu "Filters" // Install ParaView managers for "Filters" menu myFiltersMenuId = createMenu( tr( "MEN_DESK_FILTERS" ), -1, -1, 70 ); - if ( (aRes = getMenu( myFiltersMenuId )) ) - guiElements->updateFiltersMenu(aRes); + if ( (filtersMenu = getMenu( myFiltersMenuId )) ) + pqParaViewMenuBuilders::buildFiltersMenu(*filtersMenu, desk); // --- Menu "Macros" myMacrosMenuId = createMenu( tr( "MEN_MACROS" ), -1, -1, 80 ); if ( (aRes = getMenu( myMacrosMenuId )) ) - guiElements->updateMacrosMenu(aRes); + pqParaViewMenuBuilders::buildMacrosMenu(*aRes); // --- Menu "Tools" int aToolsMnu = createMenu( tr( "MEN_DESK_TOOLS" ), -1, -1, 90 ); @@ -533,6 +535,20 @@ void PVGUI_Module::pvCreateMenus() createMenu( separator(), aPVHelpMnu ); #endif createMenu( AboutParaViewId, aPVHelpMnu ); + + // Reload configuration to populate dynamic menus from ParaView: + PVViewer_ViewManager::ParaviewLoadConfigurations(true); + + // Disable all filters for now (for some weird reasons they are all on when starting?) + QList sub_menus = filtersMenu->findChildren(); + foreach(QMenu * m, sub_menus) + { + QList act_list = m->actions(); + foreach(QAction * a, act_list) + { + a->setEnabled(false); + } + } } /*!