Salome HOME
Fix new layout and split view (broken since a change in Paraview API)
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Tue, 1 Dec 2020 07:46:40 +0000 (08:46 +0100)
committerChristophe Bourcier <christophe.bourcier@cea.fr>
Tue, 1 Dec 2020 07:46:40 +0000 (08:46 +0100)
src/MEDCalc/cmp/MEDPresentation.cxx

index ad2167020ce48f31ef9d9923a17f147ea96c1609..1487a07acdd2b0eb0eddf2df586b08f584027a56 100644 (file)
@@ -399,13 +399,23 @@ MEDPresentation::setOrCreateRenderView()
       oss2 << "pvs.Render();";
       pushAndExecPyLine(oss2.str()); oss2.str("");
   } else if (_viewMode == MEDCALC::VIEW_MODE_NEW_LAYOUT) {
-      oss2 <<  "__layout1 = pvs.servermanager.misc.ViewLayout(registrationGroup='layouts');";
+      oss2 <<  "nbLayouts = len(pvs.GetLayouts());";
+      pushAndExecPyLine(oss2.str()); oss2.str("");
+      oss2 <<  "__layout1 = pvs.CreateLayout('Layout #\%i'%(nbLayouts+1));";
       pushAndExecPyLine(oss2.str()); oss2.str("");
       oss2 << view << " = pvs.CreateView('RenderView');";
       pushAndExecPyLine(oss2.str()); oss2.str("");
+      oss2 <<  "pvs.AssignViewToLayout(view=" << view << ", layout=__layout1, hint=0);";
+      pushAndExecPyLine(oss2.str()); oss2.str("");
   } else if (_viewMode == MEDCALC::VIEW_MODE_SPLIT_VIEW) {
+      oss2 <<  "__activeLayout = pvs.GetLayout();";
+      pushAndExecPyLine(oss2.str()); oss2.str("");
+      oss2 << "__activeLayout.SplitHorizontal(0, 0.5);";
+      pushAndExecPyLine(oss2.str()); oss2.str("");
       oss2 << view << " = pvs.CreateView('RenderView');";
       pushAndExecPyLine(oss2.str()); oss2.str("");
+      oss2 << "pvs.AssignViewToLayout(view=" << view << ", layout=__activeLayout, hint=2);";
+      pushAndExecPyLine(oss2.str()); oss2.str("");
   }
 }