Skip to content

Introduce Auto Save State feature

Nicolas Vuaille requested to merge nicolas.vuaille/paraview:AutoSaveState into master

ParaView has a new Auto Save State feature.

With the Auto Save State, a statefile will be written at each significant change in ParaView. This includes any pipeline modification or rendering property modification.

This feature can be enabled in the settings Edit -> Settings.... You can also choose the statefile format (python or pvsm) and its location.

The default directory on linux is .local/share/ParaView/ParaView (from Qt QStandardPaths::AppLocalDataLocation https://doc.qt.io/qt-5/qstandardpaths.html#StandardLocation-enum)

impl design

To trigger a save, we look at the undo stack modifications. As it emits a signal before the change is really applied, we trigger another save on the next Update event of the active view, to ensure that the saved state correctly apply.

So we keep the last 2 states. In case of a crash, the .bak should be the last valid and the other contains the faulty modification. This can be useful to reproduce issues.

Example of use While reproducing the issue #22544, the diff highlights the faulty `ConvertToMultiblock`.

Using the .bak allows to restart just before the crash, making investigation easier.

--- ParaView-autosave.bak.pvsm	2024-08-12 13:24:48.878214316 +0200
+++ ParaView-autosave.pvsm	2024-08-12 13:24:48.894881078 +0200
@@ -1909,6 +1909,11 @@
         <Element index="2" value="1"/>
       </Property>
     </Proxy>
+    <Proxy group="misc" type="RepresentationAnimationHelper" id="8355" servers="16">
+      <Property name="Source" id="8355.Source" number_of_elements="1">
+        <Proxy value="8344"/>
+      </Property>
+    </Proxy>
     <Proxy group="representations" type="AMRRepresentation" id="8292" servers="21">
       <Property name="DataAxesGrid" id="8292.DataAxesGrid" number_of_elements="1">
         <Proxy value="8075"/>
@@ -2916,6 +2921,13 @@
         <Domain name="range" id="7998.ZPulseWidth.range"/>
       </Property>
     </Proxy>
+    <Proxy group="filters" type="ConvertToMultiBlock" id="8344" servers="1">
+      <Property name="Input" id="8344.Input" number_of_elements="1">
+        <Proxy value="7998" output_port="0"/>
+        <Domain name="groups" id="8344.Input.groups"/>
+        <Domain name="input_type" id="8344.Input.input_type"/>
+      </Property>
+    </Proxy>
     <Proxy group="misc" type="TimeKeeper" id="256" servers="16">
       <Property name="SuppressedTimeSources" id="256.SuppressedTimeSources"/>
       <Property name="Time" id="256.Time" number_of_elements="1">
@@ -2929,8 +2941,9 @@
         <Element index="0" value="0"/>
         <Element index="1" value="1"/>
       </Property>
-      <Property name="TimeSources" id="256.TimeSources" number_of_elements="1">
+      <Property name="TimeSources" id="256.TimeSources" number_of_elements="2">
         <Proxy value="7998"/>
+        <Proxy value="8344"/>
       </Property>
       <Property name="TimestepValues" id="256.TimestepValues"/>
       <Property name="Views" id="256.Views" number_of_elements="1">
@@ -3633,6 +3646,9 @@
       <Item id="8234" name="ScaleTransferFunction" logname="AMRRepresentation1/PointGaussianRepresentation/ScaleTransferFunction/PiecewiseFunction"/>
       <Item id="8269" name="TextureTransform" logname="AMRRepresentation1/SurfaceRepresentation/TextureTransform/Transform2"/>
     </ProxyCollection>
+    <ProxyCollection name="pq_helper_proxies.8344">
+      <Item id="8355" name="RepresentationAnimationHelper"/>
+    </ProxyCollection>
     <ProxyCollection name="representations">
       <Item id="8292" name="AMRRepresentation1" logname="AMRRepresentation1"/>
     </ProxyCollection>
@@ -3641,6 +3657,7 @@
     </ProxyCollection>
     <ProxyCollection name="sources">
       <Item id="7998" name="AMRGaussianPulseSource1" logname="AMRGaussianPulseSource1"/>
+      <Item id="8344" name="ConvertToMultiBlock1" logname="ConvertToMultiBlock1"/>
     </ProxyCollection>
     <ProxyCollection name="timekeeper">
       <Item id="256" name="TimeKeeper1"/>

Notes

We may update the CrashRecoveryBehavior to use the autosave in some way.

Also still need to find a way to test, as by default our test suite does not support QSettings modifications... Testing QSettings is now possible thanks to the alertSettingsModified signal.

Edited by Nicolas Vuaille

Merge request reports

Loading