From a0e8baac65f96614028cb00fc929133b3f3925f9 Mon Sep 17 00:00:00 2001 From: jfa Date: Wed, 28 Dec 2005 09:21:56 +0000 Subject: [PATCH] Join modifications from branch BR_3_1_0deb --- INSTALL | 8 +- bin/VERSION | 2 +- build_configure | 2 +- doc/salome/tui/VISU/doxyfile | 2 +- doc/salome/tui/VISU/sources/static/tree.js | 2 +- resources/VISUCatalog.xml | 2 +- src/VISUGUI/VISU_msg_en.po | 15 +++ src/VISUGUI/VisuGUI.cxx | 101 +++++++++++++++------ src/VISUGUI/VisuGUI_ScalarBarDlg.cxx | 9 +- src/VISUGUI/VisuGUI_ScalarBarDlg.h | 1 - src/VISUGUI/VisuGUI_TimeAnimation.cxx | 5 +- src/VISU_I/VISU_ScalarMap_i.cc | 3 + src/VISU_I/VISU_TimeAnimation.cxx | 22 ++++- src/VISU_I/VISU_TimeAnimation.h | 3 + src/VISU_SWIG/VISU_Example_01.py | 13 ++- src/VISU_SWIG/VISU_Example_02.py | 28 ++++-- src/VISU_SWIG/VISU_Example_04.py | 2 +- src/VISU_SWIG/VISU_Example_06.py | 2 +- 18 files changed, 163 insertions(+), 59 deletions(-) diff --git a/INSTALL b/INSTALL index 5ded8bc4..151559b0 100644 --- a/INSTALL +++ b/INSTALL @@ -1,5 +1,5 @@ -This is the version 3.1.0b1 of VISU +This is the version 3.1.0 of VISU Compatible with : - - KERNEL 3.1.0b1 - - SALOMEGUI 3.1.0b1 - - MED 3.1.0b1 + - KERNEL 3.1.0 + - SALOMEGUI 3.1.0 + - MED 3.1.0 diff --git a/bin/VERSION b/bin/VERSION index 4ac09cce..12ccd0e5 100755 --- a/bin/VERSION +++ b/bin/VERSION @@ -1 +1 @@ -THIS IS SALOME - VISU VERSION: 3.1.0b1 +THIS IS SALOME - VISU VERSION: 3.1.0 diff --git a/build_configure b/build_configure index 6dc4d8ee..05354d02 100755 --- a/build_configure +++ b/build_configure @@ -111,7 +111,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/tui/VISU/doxyfile b/doc/salome/tui/VISU/doxyfile index 3ee35aea..e4d7a67d 100755 --- a/doc/salome/tui/VISU/doxyfile +++ b/doc/salome/tui/VISU/doxyfile @@ -3,7 +3,7 @@ #--------------------------------------------------------------------------- # General configuration options #--------------------------------------------------------------------------- -PROJECT_NAME = "SALOME - VISU - v.2.1.0" +PROJECT_NAME = "SALOME - VISU - v.3.1.0" PROJECT_NUMBER = id#1.1 OUTPUT_DIRECTORY = ../ OUTPUT_LANGUAGE = English diff --git a/doc/salome/tui/VISU/sources/static/tree.js b/doc/salome/tui/VISU/sources/static/tree.js index 72b94f7c..55430919 100755 --- a/doc/salome/tui/VISU/sources/static/tree.js +++ b/doc/salome/tui/VISU/sources/static/tree.js @@ -1,4 +1,4 @@ -foldersTree = gFld("SALOME v.2.1.0 ", "", "") +foldersTree = gFld("SALOME v.3.1.0 ", "", "") insDoc(foldersTree, gLnk("Main Page", "", "main.html")) aux1 = insFld(foldersTree, gFld("TUI Reference Guide", "")) diff --git a/resources/VISUCatalog.xml b/resources/VISUCatalog.xml index b5f39ac4..32e2edb5 100644 --- a/resources/VISUCatalog.xml +++ b/resources/VISUCatalog.xml @@ -16,7 +16,7 @@ Post-Pro VISU NRI - 3.1.0b1 + 3.1.0 Post-Pro component 1 ModuleVisu.png diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index a4c8815c..e25236e9 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -101,6 +101,9 @@ msgstr "Width:" msgid "VISU_HEIGHT" msgstr "Height:" +msgid "VISU_PREF_SECOND_TAB" +msgstr "Scalar range, Sweep, MED import, Shading" + msgid "VISU_SCALAR_RANGE" msgstr "Scalar range" @@ -146,6 +149,18 @@ msgstr "Number of cycles" msgid "VISU_NB_STEPS" msgstr "Number of steps" +msgid "VISU_PREF_MED_IMPORT" +msgstr "MED files import" + +msgid "VISU_PREF_MED_FULL_LOAD" +msgstr "Full MED loading" + +msgid "VISU_PREF_REPRESENT_PROPS" +msgstr "Representation properties" + +msgid "VISU_PREF_SHADING" +msgstr "Use Shading" + #: VisuGUI.cxx msgid "VisuGUI::MEN_IMPORT_FROM_FILE" diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index bb3f6b94..ee5f57a2 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2847,21 +2847,30 @@ extern "C" { } } */ + void VisuGUI::createPreferences() { + // TAB: "Scalar Bar" int sbarTab = addPreference( tr( "VISU_SCALAR_BAR" ) ); + // group: "Font" int fontGr = addPreference( tr( "VISU_FONT" ), sbarTab ); - int tfont = addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Font, "VISU", "scalar_bar_title_font" ); - addPreference( tr( "VISU_TITLE" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" ); - int lfont = addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Font, "VISU", "scalar_bar_label_font" ); - addPreference( tr( "VISU_LABELS" ), fontGr, LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" ); + int tfont = addPreference( tr( "VISU_TITLE" ), fontGr, + LightApp_Preferences::Font, "VISU", "scalar_bar_title_font" ); + addPreference( tr( "VISU_TITLE" ), fontGr, + LightApp_Preferences::Color, "VISU", "scalar_bar_title_color" ); + int lfont = addPreference( tr( "VISU_LABELS" ), fontGr, + LightApp_Preferences::Font, "VISU", "scalar_bar_label_font" ); + addPreference( tr( "VISU_LABELS" ), fontGr, + LightApp_Preferences::Color, "VISU", "scalar_bar_label_color" ); QStringList fam; fam.append( tr( "VISU_FONT_ARIAL" ) ); fam.append( tr( "VISU_FONT_COURIER" ) ); fam.append( tr( "VISU_FONT_TIMES" ) ); - int wflag = ( QtxListResourceEdit::FontItem::All & ( ~( QtxListResourceEdit::FontItem::Size | QtxListResourceEdit::FontItem::UserSize ) ) ); + int wflag = ( QtxListResourceEdit::FontItem::All & + ( ~( QtxListResourceEdit::FontItem::Size | + QtxListResourceEdit::FontItem::UserSize ) ) ); setPreferenceProperty( tfont, "families", fam ); setPreferenceProperty( tfont, "system", false ); @@ -2870,18 +2879,23 @@ void VisuGUI::createPreferences() setPreferenceProperty( lfont, "system", false ); setPreferenceProperty( lfont, "widget_flags", wflag ); + // group: "Colors & Labels" int colorsLabelsGr = addPreference( tr( "VISU_COLORS_AND_LABELS" ), sbarTab ); - int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr, LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" ); + int numcol = addPreference( tr( "VISU_NB_COLORS" ), colorsLabelsGr, + LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_colors" ); setPreferenceProperty( numcol, "min", 2 ); setPreferenceProperty( numcol, "max", 64 ); - int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr, LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" ); + int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr, + LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" ); setPreferenceProperty( numlab, "min", 2 ); setPreferenceProperty( numlab, "max", 65 ); + // group: "Orientation" int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab ); - int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" ); + int orient = addPreference( tr( "VISU_ORIENTATION" ), orientGr, + LightApp_Preferences::Selector, "VISU", "scalar_bar_orientation" ); QStringList orients; orients.append( tr( "VISU_VERTICAL" ) ); orients.append( tr( "VISU_HORIZONTAL" ) ); @@ -2891,11 +2905,16 @@ void VisuGUI::createPreferences() setPreferenceProperty( orient, "strings", orients ); setPreferenceProperty( orient, "indexes", indices ); + // group: "Origin & Size Vertical" int posVSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_VERTICAL" ), sbarTab ); - int xv = addPreference( tr( "VISU_X" ), posVSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" ); - int yv = addPreference( tr( "VISU_Y" ), posVSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" ); - int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" ); - int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" ); + int xv = addPreference( tr( "VISU_X" ), posVSizeGr, + LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_x" ); + int yv = addPreference( tr( "VISU_Y" ), posVSizeGr, + LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_y" ); + int wv = addPreference( tr( "VISU_WIDTH" ), posVSizeGr, + LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_width" ); + int hv = addPreference( tr( "VISU_HEIGHT" ), posVSizeGr, + LightApp_Preferences::DblSpin, "VISU", "scalar_bar_vertical_height" ); setPreferenceProperty( xv, "step", 0.1 ); setPreferenceProperty( yv, "step", 0.1 ); setPreferenceProperty( wv, "step", 0.1 ); @@ -2909,11 +2928,16 @@ void VisuGUI::createPreferences() setPreferenceProperty( wv, "max", 1.0 ); setPreferenceProperty( hv, "max", 1.0 ); + // group: "Origin & Size Horizontal" int posHSizeGr = addPreference( tr( "VISU_ORIGIN_AND_SIZE" ) + " " + tr( "VISU_HORIZONTAL" ), sbarTab ); - int xh = addPreference( tr( "VISU_X" ), posHSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" ); - int yh = addPreference( tr( "VISU_Y" ), posHSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" ); - int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" ); - int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr, LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" ); + int xh = addPreference( tr( "VISU_X" ), posHSizeGr, + LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_x" ); + int yh = addPreference( tr( "VISU_Y" ), posHSizeGr, + LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_y" ); + int wh = addPreference( tr( "VISU_WIDTH" ), posHSizeGr, + LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_width" ); + int hh = addPreference( tr( "VISU_HEIGHT" ), posHSizeGr, + LightApp_Preferences::DblSpin, "VISU", "scalar_bar_horizontal_height" ); setPreferenceProperty( xh, "step", 0.1 ); setPreferenceProperty( yh, "step", 0.1 ); setPreferenceProperty( wh, "step", 0.1 ); @@ -2927,15 +2951,20 @@ void VisuGUI::createPreferences() setPreferenceProperty( wh, "max", 1.0 ); setPreferenceProperty( hh, "max", 1.0 ); + // group: "Scalar bars default position" int scalarBarGr = addPreference( tr( "Scalar bars default position" ), sbarTab ); - addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" ); + addPreference( tr( "Arrange Scalar Bars" ), scalarBarGr, + LightApp_Preferences::Bool, "VISU", "scalar_bars_default_position" ); - int srangeTab = addPreference( tr( "Scalar range, Sweep, MED import" ) ); + // TAB: "Scalar range, Sweep, MED import, Shading" + int srangeTab = addPreference( tr( "VISU_PREF_SECOND_TAB" ) ); + // group: "Scalar range" int rangeGr = addPreference( tr( "VISU_SCALAR_RANGE" ), srangeTab ); setPreferenceProperty( rangeGr, "columns", 1 ); - int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" ); + int mode = addPreference( tr( "VISU_SCALAR_MODE" ), rangeGr, + LightApp_Preferences::Selector, "VISU", "scalar_bar_mode" ); QStringList modes; modes.append( tr( "VISU_MODULUS" ) ); modes.append( tr( "VISU_COMPONENT" ) + tr("1") ); @@ -2949,9 +2978,11 @@ void VisuGUI::createPreferences() setPreferenceProperty( mode, "strings", modes ); setPreferenceProperty( mode, "indexes", indices ); - addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" ); + addPreference( tr( "VISU_LOGARITHMIC_SCALING" ), rangeGr, + LightApp_Preferences::Bool, "VISU", "scalar_bar_logarithmic" ); - int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, LightApp_Preferences::Selector, "VISU", "scalar_range_type" ); + int rangetype = addPreference( tr( "VISU_RANGE_TO_USE" ), rangeGr, + LightApp_Preferences::Selector, "VISU", "scalar_range_type" ); QStringList types; types.append( tr( "VISU_FIELD_RANGE" ) ); types.append( tr( "VISU_IMPOSED_RANGE" ) ); @@ -2961,27 +2992,41 @@ void VisuGUI::createPreferences() setPreferenceProperty( rangetype, "strings", types ); setPreferenceProperty( rangetype, "indexes", indices ); + // group: "Min and max for imposed range" int imposedGr = addPreference( tr( "VISU_MINMAX_IMPOSED_RANGE" ), srangeTab ); - int min = addPreference( tr( "VISU_MIN" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" ); - int max = addPreference( tr( "VISU_MAX" ), imposedGr, LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" ); + int min = addPreference( tr( "VISU_MIN" ), imposedGr, + LightApp_Preferences::DblSpin, "VISU", "scalar_range_min" ); + int max = addPreference( tr( "VISU_MAX" ), imposedGr, + LightApp_Preferences::DblSpin, "VISU", "scalar_range_max" ); setPreferenceProperty( min, "step", 0.1 ); setPreferenceProperty( max, "step", 0.1 ); + // group: "Sweeping preferences" int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab ); setPreferenceProperty( sweepGr, "columns", 1 ); - int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr, LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" ); - int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr, LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" ); - int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr, LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" ); + int timestep = addPreference( tr( "VISU_TIME_STEP" ), sweepGr, + LightApp_Preferences::DblSpin, "VISU", "sweeping_time_step" ); + int nbcycles = addPreference( tr( "VISU_NB_CYCLES" ), sweepGr, + LightApp_Preferences::IntSpin, "VISU", "sweeping_number_cycles" ); + int nbsteps = addPreference( tr( "VISU_NB_STEPS" ), sweepGr, + LightApp_Preferences::IntSpin, "VISU", "sweeping_number_steps" ); setPreferenceProperty( timestep, "min", 0.1 ); setPreferenceProperty( timestep, "step", 0.1 ); setPreferenceProperty( timestep, "max", 1000 ); setPreferenceProperty( nbcycles, "max", 100 ); setPreferenceProperty( nbsteps, "max", 200 ); - int importGr = addPreference( tr( "MED files import" ), srangeTab ); - addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" ); + // group: "MED files import" + int importGr = addPreference( tr( "VISU_PREF_MED_IMPORT" ), srangeTab ); + addPreference( tr( "VISU_PREF_MED_FULL_LOAD" ), importGr, + LightApp_Preferences::Bool, "VISU", "full_med_loading" ); + + // group: "Representation properties" + int representGr = addPreference( tr( "VISU_PREF_REPRESENT_PROPS" ), srangeTab ); + addPreference( tr( "VISU_PREF_SHADING" ), representGr, + LightApp_Preferences::Bool, "VISU", "represent_shading" ); } void VisuGUI::preferencesChanged( const QString&, const QString& ) diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index 4bdf982d..5d89779d 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -610,7 +610,7 @@ void VisuGUI_ScalarBarPane::createScalarBar() if (myPreviewActor != 0) return; if (myScalarMap == NULL) return; - if(!check()) return; + if (!check()) return; if ( myBusy ) return; @@ -706,9 +706,9 @@ void VisuGUI_ScalarBarPane::createScalarBar() void VisuGUI_ScalarBarPane::deleteScalarBar() { if ( myBusy ) return; - + if (myPreviewActor == 0) return; - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()){ + if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { vf->RemoveActor(myPreviewActor); myPreviewActor->GetScalarBar()->VisibilityOff(); } @@ -724,7 +724,8 @@ void VisuGUI_ScalarBarPane::deletePreview() /** * Store values to presentation object */ -int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ScalarMap_i* thePrs) { +int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ScalarMap_i* thePrs) +{ thePrs->SetScalarMode(myModeCombo->currentItem()); thePrs->SetPosition(XSpin->value(), YSpin->value()); thePrs->SetSize(WidthSpin->value(), HeightSpin->value()); diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.h b/src/VISUGUI/VisuGUI_ScalarBarDlg.h index d6da0b48..ccb704ad 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.h +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.h @@ -24,7 +24,6 @@ // File : VisuGUI_ScalarBarDlg.h // Author : Laurent CORNABE & Hubert ROLLAND // Module : VISU -// $Header$ #ifndef VISUGUI_SCALARBARDLG_H #define VISUGUI_SCALARBARDLG_H diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 1e7ac208..12ce55ee 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -1018,6 +1018,7 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu aSaveLay->addWidget(aPathLbl, 1, 0); myPathEdit = new QLineEdit(aSaveBox); + myPathEdit->setReadOnly(true); myPathEdit->setEnabled(false); connect(mySaveCheck, SIGNAL( toggled(bool)), myPathEdit, SLOT( setEnabled(bool) )); @@ -1227,9 +1228,9 @@ void VisuGUI_TimeAnimationDlg::onSetupDlg() //************************************************************************ void VisuGUI_TimeAnimationDlg::onBrowse() { - QString aPath = SUIT_FileDlg::getExistingDirectory(this, "/","Select path"); + QString aPath = SUIT_FileDlg::getExistingDirectory(this, "/", "Select path"); if (!aPath.isEmpty()) - myPathEdit->setText(aPath); + myPathEdit->setText(Qtx::addSlash(aPath)); } //************************************************************************ diff --git a/src/VISU_I/VISU_ScalarMap_i.cc b/src/VISU_I/VISU_ScalarMap_i.cc index e818c1cc..c8ef879e 100644 --- a/src/VISU_I/VISU_ScalarMap_i.cc +++ b/src/VISU_I/VISU_ScalarMap_i.cc @@ -508,6 +508,9 @@ VISU_Actor* VISU::ScalarMap_i::CreateActor(const Handle(SALOME_InteractiveObject VISU::Prs3d_i::CreateActor(anActor,theIO); anActor->SetBarVisibility(true); anActor->SetRepresentation(2); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + bool toUseShading = aResourceMgr->booleanValue("VISU", "represent_shading", false); + anActor->SetShading(toUseShading); UpdateActor(anActor); }catch(...){ anActor->Delete(); diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 0c24e562..e9a04037 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -61,6 +61,7 @@ VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy, VISU::View3D_i* pView = dynamic_cast(GetServant(theView3D).in()); SUIT_ViewWindow* aVW = pView->GetViewWindow(); myView = VISU::GetViewWindow(aVW); + connect( myView, SIGNAL( destroyed() ), this, SLOT( onViewDeleted() ) ); } myMaxVal = 0; @@ -117,6 +118,9 @@ void VISU_TimeAnimation::addField (SALOMEDS::SObject_ptr theField) //************************************************************************ void VISU_TimeAnimation::clearData(FieldData& theData) { + if( !myView ) + return; + theData.myTiming.clear(); vtkRenderer* aRen = myView->getRenderer(); if (!theData.myActors.empty()) { @@ -355,6 +359,9 @@ void VISU_TimeAnimation::startAnimation() { //************************************************************************ void VISU_TimeAnimation::nextFrame() { + if( !myView ) + return; + stopAnimation(); if (myFrame < (myFieldsLst[0].myNbFrames-1)) { int i; @@ -374,6 +381,8 @@ void VISU_TimeAnimation::nextFrame() { //************************************************************************ void VISU_TimeAnimation::prevFrame() { + if( !myView ) + return; stopAnimation(); if (myFrame > 0) { int i; @@ -393,6 +402,9 @@ void VISU_TimeAnimation::prevFrame() { //************************************************************************ void VISU_TimeAnimation::firstFrame() { + if( !myView ) + return; + stopAnimation(); int i; for (i = 0; i < getNbFields(); i++) @@ -412,6 +424,9 @@ void VISU_TimeAnimation::firstFrame() { //************************************************************************ void VISU_TimeAnimation::lastFrame() { + if( !myView ) + return; + stopAnimation(); int i; for (i = 0; i < getNbFields(); i++) @@ -431,7 +446,7 @@ void VISU_TimeAnimation::lastFrame() { //************************************************************************ // For Batchmode using void VISU_TimeAnimation::gotoFrame(CORBA::Long theFrame) { - if ((theFrame < 0) || (theFrame > (getNbFrames()-1))) + if ((theFrame < 0) || (theFrame > (getNbFrames()-1)) || !myView ) return; stopAnimation(); qApp->lock(); @@ -825,6 +840,11 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) myAnimEntry = aStr.c_str(); } +void VISU_TimeAnimation::onViewDeleted() +{ + myView = 0; +} + //======================================================================== //======================================================================== diff --git a/src/VISU_I/VISU_TimeAnimation.h b/src/VISU_I/VISU_TimeAnimation.h index 26cc764c..59bf57cb 100644 --- a/src/VISU_I/VISU_TimeAnimation.h +++ b/src/VISU_I/VISU_TimeAnimation.h @@ -129,6 +129,9 @@ class VISU_TimeAnimation: public QObject, public QThread void run(); QString GenerateName(); + private slots: + void onViewDeleted(); + private: QString myLastError; diff --git a/src/VISU_SWIG/VISU_Example_01.py b/src/VISU_SWIG/VISU_Example_01.py index 82228544..d8c19b65 100644 --- a/src/VISU_SWIG/VISU_Example_01.py +++ b/src/VISU_SWIG/VISU_Example_01.py @@ -82,11 +82,16 @@ myView.DisplayOnly(cutplanes) #%====================Stage4: Opening a new study and Med file import====================% -print "**** Stage4: Opening a new study and Med file import" +# Opening a new study tempoparily commented due to a problem +# with python initialization. To be restored after bug 10000 fixing. -print "Creating a new study..................", -newStudy = salome.myStudyManager.NewStudy('newStudy') -myVisu.SetCurrentStudy(newStudy) +#print "**** Stage4: Opening a new study and Med file import" +print "**** Stage4: Med file import" + +#print "Creating a new study..................", +#newStudy = salome.myStudyManager.NewStudy('newStudy') +newStudy = salome.myStudy # temporarily +#myVisu.SetCurrentStudy(newStudy) myViewManager = myVisu.GetViewManager() myView = myViewManager.Create3DView() if myView is None : print "Error" diff --git a/src/VISU_SWIG/VISU_Example_02.py b/src/VISU_SWIG/VISU_Example_02.py index be71fa76..38f2b6b6 100644 --- a/src/VISU_SWIG/VISU_Example_02.py +++ b/src/VISU_SWIG/VISU_Example_02.py @@ -222,28 +222,37 @@ file = str+'/VISU_005.hdf' salome.myStudyManager.SaveAs(file, salome.myStudy, 0) study_id = salome.myStudy._get_StudyId() -#salome.sg.CloseStudy(study_id) -#salome.myStudyManager.Close(salome.myStudy) -#salome.myStudy.Close() print "OK" -print "Opening just saved study..............", +file_new = str+'/VISU_005_new.hdf' +command = "mv " + file + " " + file_new +os.system(command) +file = file_new -openedStudy = salome.myStudyManager.Open(file) -myVisu.SetCurrentStudy(openedStudy) +# Opening a study tempoparily commented due to a problem +# with python initialization. To be restored after bug 10000 fixing. + +#print "Opening just saved study..............", +# +#openedStudy = salome.myStudyManager.Open(file)] +openedStudy = salome.myStudy # temporarily +#myVisu.SetCurrentStudy(openedStudy) myViewManager = myVisu.GetViewManager() myView1 = myViewManager.Create3DView() if myView1 is None : print "Error" else : print "OK" +import time +time.sleep(1) + print "Restoring first view parameters.......", aRestoreRes = myView1.RestoreViewParams(aViewParamsName1) if aRestoreRes != 1 : print "Error" else : print "OK" Builder = openedStudy.NewBuilder() -SCom = openedStudy.FindComponent("VISU") -Builder.LoadWith(SCom ,myVisu) +#SCom = openedStudy.FindComponent("VISU") +#Builder.LoadWith(SCom ,myVisu) print "Displaying Scalar Map.................", SObj = openedStudy.FindObject('ScalarMap') @@ -346,3 +355,6 @@ aRestoreRes = myView1.RestoreViewParams(aViewParamsName2) if aRestoreRes != 1 : print "Error" else : print "OK" +# Remove the study file +command = "rm -r " + file +os.system(command) diff --git a/src/VISU_SWIG/VISU_Example_04.py b/src/VISU_SWIG/VISU_Example_04.py index a50a831a..9ae4d110 100644 --- a/src/VISU_SWIG/VISU_Example_04.py +++ b/src/VISU_SWIG/VISU_Example_04.py @@ -46,7 +46,7 @@ aMeshName ="LE VOLUME" anEntity = VISU.NODE aTimeStampId = 1 -medFile = os.getenv('DATA_DIR') + '/MedFIles/' + medFile +medFile = os.getenv('DATA_DIR') + '/MedFiles/' + medFile myResult = myVisu.ImportFile(medFile) myView = myViewManager.Create3DView(); diff --git a/src/VISU_SWIG/VISU_Example_06.py b/src/VISU_SWIG/VISU_Example_06.py index f31b80e4..622b6cb4 100644 --- a/src/VISU_SWIG/VISU_Example_06.py +++ b/src/VISU_SWIG/VISU_Example_06.py @@ -4,7 +4,7 @@ import salome import math import SALOMEDS import VISU -#from visu_gui import * +from visu_gui import * # >>> Getting study builder ================================================== myStudy = salome.myStudy -- 2.39.2