From: rnv Date: Wed, 10 Aug 2016 14:46:10 +0000 (+0300) Subject: Merge branch 'abn/configuration' X-Git-Tag: V8_1_0b1^0 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=957677f54b03a149d8f154638a97a2c7b294c8d3;hp=81a421e5b4d4b622ab0467e7870f426f509ca2fc;p=modules%2Fparavis.git Merge branch 'abn/configuration' --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a32e193..04a77463 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,6 +27,9 @@ ENDIF(WIN32) # Ensure a proper linker behavior: CMAKE_POLICY(SET CMP0003 NEW) +IF(WIN32) + CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib +ENDIF(WIN32) # Versioning # =========== diff --git a/src/Plugins/MEDReader/IO/CMakeLists.txt b/src/Plugins/MEDReader/IO/CMakeLists.txt index 853c885c..474cbcd2 100644 --- a/src/Plugins/MEDReader/IO/CMakeLists.txt +++ b/src/Plugins/MEDReader/IO/CMakeLists.txt @@ -39,6 +39,8 @@ FOREACH(class ${MEDReader_CLASSES}) SET(MEDReader_HDRS ${MEDReader_HDRS} ${class}.h) ENDFOREACH(class) +SET(MEDReader_HDRS ${MEDReader_HDRS} MEDFileFieldRepresentationTree.hxx MEDTimeReq.hxx MEDUtilities.hxx MEDLoaderForPV.h) + ADD_LIBRARY(MEDLoaderForPV SHARED MEDFileFieldRepresentationTree.cxx MEDTimeReq.cxx MEDUtilities.cxx vtkGenerateVectors.cxx) IF(HDF5_IS_PARALLEL) diff --git a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx index 97593535..540464ce 100644 --- a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx +++ b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.cxx @@ -1108,52 +1108,15 @@ int MEDFileFieldRepresentationTree::getMaxNumberOfTimeSteps() const /*! * */ -void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts) +void MEDFileFieldRepresentationTree::loadInMemory(MEDCoupling::MEDFileFields *fields, MEDCoupling::MEDFileMeshes *meshes) { - if(isMEDOrSauv) - { - if((iPart==-1 && nbOfParts==-1) || (iPart==0 && nbOfParts==1)) - { - _ms=MEDFileMeshes::New(fileName); - _fields=MEDFileFields::New(fileName,false);//false is important to not read the values - } - else - { -#ifdef MEDREADER_USE_MPI - _ms=ParaMEDFileMeshes::New(iPart,nbOfParts,fileName); - int nbMeshes(_ms->getNumberOfMeshes()); - for(int i=0;igetMeshAtPos(i)); - MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast(tmp)); - if(tmp2) - MCAuto tmp3(tmp2->zipCoords()); - } - _fields=MEDFileFields::LoadPartOf(fileName,false,_ms);//false is important to not read the values -#else - std::ostringstream oss; oss << "MEDFileFieldRepresentationTree::loadMainStructureOfFile : request for iPart/nbOfParts=" << iPart << "/" << nbOfParts << " whereas Plugin not compiled with MPI !"; - throw INTERP_KERNEL::Exception(oss.str().c_str()); -#endif - } - } - else - { - MCAuto sr(MEDCoupling::SauvReader::New(fileName)); - MCAuto mfd(sr->loadInMEDFileDS()); - _ms=mfd->getMeshes(); _ms->incrRef(); - int nbMeshes(_ms->getNumberOfMeshes()); - for(int i=0;igetMeshAtPos(i)); - MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast(tmp)); - if(tmp2) - tmp2->forceComputationOfParts(); - } - _fields=mfd->getFields(); - if((MEDCoupling::MEDFileFields *)_fields) - _fields->incrRef(); - } - if(!((MEDCoupling::MEDFileFields *)_fields)) + _fields=fields; _ms=meshes; + if(_fields.isNotNull()) + _fields->incrRef(); + if(_ms.isNotNull()) + _ms->incrRef(); + // + if(_fields.isNull()) { _fields=BuildFieldFromMeshes(_ms); } @@ -1263,6 +1226,56 @@ void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileNam this->computeFullNameInLeaves(); } +void MEDFileFieldRepresentationTree::loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts) +{ + MCAuto ms; + MCAuto fields; + if(isMEDOrSauv) + { + if((iPart==-1 && nbOfParts==-1) || (iPart==0 && nbOfParts==1)) + { + ms=MEDFileMeshes::New(fileName); + fields=MEDFileFields::New(fileName,false);//false is important to not read the values + } + else + { +#ifdef MEDREADER_USE_MPI + ms=ParaMEDFileMeshes::New(iPart,nbOfParts,fileName); + int nbMeshes(ms->getNumberOfMeshes()); + for(int i=0;igetMeshAtPos(i)); + MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast(tmp)); + if(tmp2) + MCAuto tmp3(tmp2->zipCoords()); + } + fields=MEDFileFields::LoadPartOf(fileName,false,ms);//false is important to not read the values +#else + std::ostringstream oss; oss << "MEDFileFieldRepresentationTree::loadMainStructureOfFile : request for iPart/nbOfParts=" << iPart << "/" << nbOfParts << " whereas Plugin not compiled with MPI !"; + throw INTERP_KERNEL::Exception(oss.str().c_str()); +#endif + } + } + else + { + MCAuto sr(MEDCoupling::SauvReader::New(fileName)); + MCAuto mfd(sr->loadInMEDFileDS()); + ms=mfd->getMeshes(); ms->incrRef(); + int nbMeshes(ms->getNumberOfMeshes()); + for(int i=0;igetMeshAtPos(i)); + MEDCoupling::MEDFileUMesh *tmp2(dynamic_cast(tmp)); + if(tmp2) + tmp2->forceComputationOfParts(); + } + fields=mfd->getFields(); + if(fields.isNotNull()) + fields->incrRef(); + } + loadInMemory(fields,ms); +} + void MEDFileFieldRepresentationTree::removeEmptyLeaves() { std::vector< std::vector< std::vector< MEDFileFieldRepresentationLeaves > > > newSD; diff --git a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx index cedccc75..800e8c47 100644 --- a/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx +++ b/src/Plugins/MEDReader/IO/MEDFileFieldRepresentationTree.hxx @@ -155,6 +155,7 @@ public: std::map dumpState() const; //non const methods void loadMainStructureOfFile(const char *fileName, bool isMEDOrSauv, int iPart, int nbOfParts); + void loadInMemory(MEDCoupling::MEDFileFields *fields, MEDCoupling::MEDFileMeshes *meshes); void removeEmptyLeaves(); // static methods static bool IsFieldMeshRegardingInfo(const std::vector& compInfos); diff --git a/src/Plugins/ParaMEDCorba/CMakeLists.txt b/src/Plugins/ParaMEDCorba/CMakeLists.txt index 1c0280fc..2d61a70f 100644 --- a/src/Plugins/ParaMEDCorba/CMakeLists.txt +++ b/src/Plugins/ParaMEDCorba/CMakeLists.txt @@ -20,6 +20,10 @@ PROJECT( ParaMEDCorba ) CMAKE_MINIMUM_REQUIRED( VERSION 2.8.7 ) + IF(WIN32) + CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib + ENDIF(WIN32) + ## !!! This definition corrupts wrapping process #SET( LIBRARY_OUTPUT_PATH ${ParaMEDCorba_BINARY_DIR}/bin CACHE INTERNAL "Single place for output" ) #SET( EXECUTABLE_OUTPUT_PATH ${ParaMEDCorba_BINARY_DIR}/bin CACHE INTERNAL "Single place for output" ) diff --git a/test/VisuPrs/bugs/A5.py b/test/VisuPrs/bugs/A5.py index d5af545e..357194dc 100644 --- a/test/VisuPrs/bugs/A5.py +++ b/test/VisuPrs/bugs/A5.py @@ -34,9 +34,10 @@ data_file = datadir + "TimeStamps.med" tmp_dir = os.getenv("TmpDir") if tmp_dir == None: - tmp_dir = "/tmp" + import tempfile + tmp_dir = tempfile.mkdtemp() -save_file = tmp_dir + "/TimeStamps_save.hdf" +save_file = os.path.join(tmp_dir, "TimeStamps_save.hdf") print "Save to file ", save_file pvsimple.OpenDataFile(data_file) diff --git a/test/VisuPrs/bugs/C5.py b/test/VisuPrs/bugs/C5.py index d1e47240..f48af7b6 100644 --- a/test/VisuPrs/bugs/C5.py +++ b/test/VisuPrs/bugs/C5.py @@ -144,7 +144,8 @@ theDuration = 20 NbOfLoops = 4 #thePath = os.getenv("TMP_DIR") thePrefix = "TestPngFromAnim" -thePath = os.path.join("/tmp", thePrefix) +import tempfile +thePath = os.path.join(tempfile.mkdtemp(), thePrefix) thePath += ".png" displayMng = DisplayManager() diff --git a/test/standalone/CMakeLists.txt b/test/standalone/CMakeLists.txt index 5c48d05b..86bf9f6c 100644 --- a/test/standalone/CMakeLists.txt +++ b/test/standalone/CMakeLists.txt @@ -20,6 +20,9 @@ PROJECT(LightPARAVIS) CMAKE_MINIMUM_REQUIRED(VERSION 2.8.10) +IF(WIN32) + CMAKE_POLICY(SET CMP0020 OLD) # disable automatic linking to qtmain.lib +ENDIF(WIN32) SET(CMAKE_BUILD_TYPE "Debug") OPTION(LIGHTPARAVIS_WITH_GUI "Build GUI test app" ON) diff --git a/test/standalone/gui/CMakeLists.txt b/test/standalone/gui/CMakeLists.txt index a4b18ca2..20f62f86 100644 --- a/test/standalone/gui/CMakeLists.txt +++ b/test/standalone/gui/CMakeLists.txt @@ -57,8 +57,8 @@ SET(ui_resources GENERATE_QT_RESOURCE_FROM_FILES( "${ui_resources}" - "/LightPara/Configuration" - "${PROJECT_SOURCE_DIR}/gui/xml/ParaViewReaders.xml") + "LightPara/Configuration" + "${PROJECT_SOURCE_DIR}/gui/xml/ParaViewReaders.xml;${PROJECT_SOURCE_DIR}/gui/xml/ParaViewFilters.xml") QT_ADD_RESOURCES(rcs_sources ${ui_resources} diff --git a/test/standalone/gui/PLMainWindow.cxx b/test/standalone/gui/PLMainWindow.cxx index e2754985..40b4e9ba 100644 --- a/test/standalone/gui/PLMainWindow.cxx +++ b/test/standalone/gui/PLMainWindow.cxx @@ -50,7 +50,8 @@ PLMainWindow::PLMainWindow(QWidget *parent) : QMainWindow(parent), _pAppC(0), _simplePipeline(), - _autoApply(true) + _autoApply(true), + _filterMenu(0) { _mainWindow.setupUi(this); _autoApply = _mainWindow.actionAuto_apply->isChecked(); @@ -63,25 +64,23 @@ PLMainWindow::PLMainWindow(QWidget *parent) : void PLMainWindow::finishUISetup() { _pAppC = PVViewer_Core::GetPVApplication(); - PVViewer_GUIElements * pvgui = PVViewer_GUIElements::GetInstance(this); - QWidget * wprop = pvgui->getPropertiesPanel(); - QWidget * wpipe = pvgui->getPipelineBrowserWidget(); + _pvgui = PVViewer_GUIElements::GetInstance(this); + + QWidget * wprop = _pvgui->getPropertiesPanel(); + QWidget * wpipe = _pvgui->getPipelineBrowserWidget(); wprop->setParent(_mainWindow.propFrame); _mainWindow.verticalLayoutProp->addWidget(wprop); wpipe->setParent(_mainWindow.pipelineFrame); _mainWindow.verticalLayoutPipe->addWidget(wpipe); - PVViewer_GUIElements * pvge = PVViewer_GUIElements::GetInstance(this); -// pvge->setToolBarVisible(false); - // In this mockup, we play on the parent widget visibility (a QFrame), so show these: - pvge->getPipelineBrowserWidget()->show(); - pvge->getPropertiesPanel()->show(); + _pvgui->getPipelineBrowserWidget()->show(); + _pvgui->getPropertiesPanel()->show(); // and hide these: _mainWindow.propFrame->hide(); _mainWindow.pipelineFrame->hide(); -// pvge->setToolBarEnabled(false); -// pvge->setToolBarVisible(false); +// _pvgui->setToolBarEnabled(false); +// _pvgui->setToolBarVisible(false); } @@ -110,6 +109,19 @@ void PLMainWindow::showPipeline(bool isChecked) isChecked ? _mainWindow.pipelineFrame->show() : _mainWindow.pipelineFrame->hide(); } +void PLMainWindow::onBuildFilterMenu() +{ + if(_filterMenu == 0) + { + _filterMenu = _pvgui->getFiltersMenu(); +// _filterMenu = new QMenu(); + _filterMenu->setTitle("Filters"); + this->menuBar()->addMenu(_filterMenu); + } + else + QMessageBox::warning(this, "Warning", "Filter menu already added!"); +} + void PLMainWindow::addTab() { int c = _mainWindow.tabWidget->count(); @@ -120,6 +132,7 @@ void PLMainWindow::addTab() // Connect buttons QObject::connect(newTab, SIGNAL(onInsertSingleView(PLViewTab *)), this, SLOT(insertSingleView(PLViewTab *))); QObject::connect(newTab, SIGNAL(onInsertMultiView(PLViewTab *)), this, SLOT(insertMultiView(PLViewTab *))); + QObject::connect(newTab, SIGNAL(onInsertSpreadsheetView(PLViewTab *)), this, SLOT(insertSpreadsheetView(PLViewTab *))); } void PLMainWindow::deleteTab() @@ -202,6 +215,26 @@ void PLMainWindow::insertSingleView(PLViewTab * tab) pqActiveObjects::instance().setActiveView(pqview); } +void PLMainWindow::insertSpreadsheetView(PLViewTab * tab) +{ + // Create a new view proxy on the server + pqObjectBuilder* builder = _pAppC->getObjectBuilder(); + pqServer* active_serv = pqActiveObjects::instance().activeServer(); + + std::cout << "About to create spreadsheet view ..." << std::endl; + pqView * pqview = builder->createView(QString("SpreadSheetView"), active_serv); + std::cout << "Created: " << pqview << "!" << std::endl; + + // Retrieve its widget and pass it to the Qt tab: + QWidget* viewWidget = pqview->widget(); + +// QWidget* viewWidget = new QPushButton("toto"); + tab->hideAndReplace(viewWidget, pqview); + + pqActiveObjects::instance().setActiveView(pqview); +} + + void PLMainWindow::insertMultiView(PLViewTab * tab) { // Retrieve TabbedMultiView and see if it is already attached to someone: @@ -221,7 +254,6 @@ void PLMainWindow::insertMultiView(PLViewTab * tab) } } - void PLMainWindow::doShrink() { if(!_simplePipeline.isEmpty()) diff --git a/test/standalone/gui/PLMainWindow.hxx b/test/standalone/gui/PLMainWindow.hxx index 91bd85a4..727361ce 100644 --- a/test/standalone/gui/PLMainWindow.hxx +++ b/test/standalone/gui/PLMainWindow.hxx @@ -31,6 +31,7 @@ class pqServer; class pqProxy; class PLViewTab; +class PVViewer_GUIElements; /** Main window of the application. */ @@ -73,18 +74,25 @@ private slots: void insertSingleView(PLViewTab *); void insertMultiView(PLViewTab *); + void insertSpreadsheetView(PLViewTab *); void currentTabChanged(int); + void onBuildFilterMenu(); + private: Ui::MainWindow _mainWindow; + PVViewer_GUIElements * _pvgui; + pqPVApplicationCore * _pAppC; //pqServer * _activeServer; //pqPipelineSource * _activeSource; // last pipeline element QStack _simplePipeline; bool _autoApply; + + QMenu * _filterMenu; }; #endif /* PLVIEWWIDGET_H_ */ diff --git a/test/standalone/gui/PLViewTab.cxx b/test/standalone/gui/PLViewTab.cxx index 9411d513..1840d446 100644 --- a/test/standalone/gui/PLViewTab.cxx +++ b/test/standalone/gui/PLViewTab.cxx @@ -28,6 +28,11 @@ _renderView(0) _viewTab.setupUi(this); } +void PLViewTab::insertSpreadsheetView() +{ + emit onInsertSpreadsheetView(this); +} + void PLViewTab::insertSingleView() { emit onInsertSingleView(this); diff --git a/test/standalone/gui/PLViewTab.hxx b/test/standalone/gui/PLViewTab.hxx index 6ff4dac9..75248dfe 100644 --- a/test/standalone/gui/PLViewTab.hxx +++ b/test/standalone/gui/PLViewTab.hxx @@ -42,11 +42,13 @@ public: private slots: void insertSingleView(); void insertMultiView(); + void insertSpreadsheetView(); void viewDestroyed(); signals: void onInsertSingleView(PLViewTab *); void onInsertMultiView(PLViewTab *); + void onInsertSpreadsheetView(PLViewTab *); private: Ui::ViewTab _viewTab; diff --git a/test/standalone/gui/PVViewer_GUIElements.cxx b/test/standalone/gui/PVViewer_GUIElements.cxx index 7daff83c..23ea9348 100644 --- a/test/standalone/gui/PVViewer_GUIElements.cxx +++ b/test/standalone/gui/PVViewer_GUIElements.cxx @@ -70,7 +70,7 @@ PVViewer_GUIElements::PVViewer_GUIElements(QMainWindow* desk) : macrosMenu = new QMenu(0); pqParaViewMenuBuilders::buildMacrosMenu(*macrosMenu); - //myBuildToolbars(desk); +// myBuildToolbars(desk); } PVViewer_GUIElements * PVViewer_GUIElements::GetInstance(QMainWindow* desk) diff --git a/test/standalone/gui/main.cpp b/test/standalone/gui/main.cpp index bcb3f303..c7e3d08e 100644 --- a/test/standalone/gui/main.cpp +++ b/test/standalone/gui/main.cpp @@ -58,8 +58,8 @@ int main(int argc, char ** argv) //para_widget->updateActiveServer(); - //std::cout << "Load config ..." << std::endl; - //PVViewer_Core::ParaviewLoadConfigurations(QString(":/LightPara/Configuration/")); + std::cout << "Load config ..." << std::endl; + PVViewer_Core::ParaviewLoadConfigurations(QString(":/LightPara/Configuration")); /* Inspired from ParaView source code: * leave time for the GUI to update itself before displaying the main window: */ diff --git a/test/standalone/gui/ui/light_para.ui b/test/standalone/gui/ui/light_para.ui index 47c38e3a..2c0e833b 100644 --- a/test/standalone/gui/ui/light_para.ui +++ b/test/standalone/gui/ui/light_para.ui @@ -276,6 +276,7 @@ + @@ -346,6 +347,11 @@ Show pipeline + + + Build filter menu + + @@ -637,6 +643,22 @@ + + actionBuild_filter_menu + triggered() + MainWindow + onBuildFilterMenu() + + + -1 + -1 + + + 504 + 338 + + + changedCurrentFile(QString) @@ -650,5 +672,6 @@ showPipeline(bool) showProp(bool) currentTabChanged(int) + onBuildFilterMenu() diff --git a/test/standalone/gui/ui/view_tab.ui b/test/standalone/gui/ui/view_tab.ui index 67cae6a8..2d001bdd 100644 --- a/test/standalone/gui/ui/view_tab.ui +++ b/test/standalone/gui/ui/view_tab.ui @@ -69,6 +69,13 @@ + + + + Spreadsheet view + + + @@ -136,9 +143,26 @@ + + spreadsheetViewButton + clicked() + ViewTab + insertSpreadsheetView() + + + 89 + 286 + + + 274 + 309 + + + insertMultiView() insertSingleView() + insertSpreadsheetView() diff --git a/test/standalone/gui/xml/ParaViewFilters.xml b/test/standalone/gui/xml/ParaViewFilters.xml new file mode 100644 index 00000000..d1da9c30 --- /dev/null +++ b/test/standalone/gui/xml/ParaViewFilters.xml @@ -0,0 +1,247 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +