Commit ec8e9c64 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Adding new "Live Programmable Source" and test

Adds a "Live Programmable Source" to make it easier to add data sources
that are "live" and then add a test for the same.
parent 3f8dcc88
......@@ -18,6 +18,7 @@
<Proxy group="sources" name="PointSource" />
<Proxy group="sources" name="PolyLineSource" />
<Proxy group="sources" name="ProgrammableSource" />
<Proxy group="sources" name="LiveProgrammableSource" />
<Proxy group="sources" name="Ruler" />
<Proxy group="sources" name="SphereSource" />
<Proxy group="sources" name="SplineSource" />
......
......@@ -602,13 +602,14 @@ endif()
if(PARAVIEW_ENABLE_PYTHON)
list(APPEND TESTS_WITH_BASELINES
${CMAKE_CURRENT_SOURCE_DIR}/ColorByComponentNames.xml # needs programmable filter
${CMAKE_CURRENT_SOURCE_DIR}/LiveProgrammableSource.xml
${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadStatePython.xml
${CMAKE_CURRENT_SOURCE_DIR}/SelectionLabels.xml
${CMAKE_CURRENT_SOURCE_DIR}/TraceExodus.xml
${CMAKE_CURRENT_SOURCE_DIR}/TraceExportAndSaveData.xml
${CMAKE_CURRENT_SOURCE_DIR}/TraceSaveGeometry.xml
${CMAKE_CURRENT_SOURCE_DIR}/TraceStatisticsFilter.xml
${CMAKE_CURRENT_SOURCE_DIR}/TraceSupplementalProxiesFully.xml
${CMAKE_CURRENT_SOURCE_DIR}/SaveLoadStatePython.xml
)
list(APPEND TESTS_WITH_INLINE_COMPARES
${CMAKE_CURRENT_SOURCE_DIR}/RestoreArrayDefaultTransferFunction.xml
......
<?xml version="1.0" ?>
<pqevents>
<pqevent object="pqClientMainWindow/menubar" command="activate" arguments="menuSources" />
<pqevent object="pqClientMainWindow/menubar/menuSources" command="activate" arguments="LiveProgrammableSource" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/Script/1pqPopOutWidget0/Script" command="set_string" arguments="if not hasattr(self, &quot;_my_counter&quot;):&#xA; setattr(self, &quot;_my_counter&quot;, -1)&#xA;&#xA;counter = self._my_counter&#xA;if counter &lt; 10:&#xA; counter += 1&#xA;setattr(self, &quot;_my_counter&quot;, counter)&#xA;&#xA;from paraview.vtk.vtkFiltersSources import vtkSphereSource&#xA;src = vtkSphereSource()&#xA;src.SetStartTheta(275.0 * counter / 10.0)&#xA;src.Update()&#xA;&#xA;self.GetOutputDataObject(0).ShallowCopy(src.GetOutput())&#xA; " />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/scrollArea/qt_scrollarea_viewport/scrollAreaWidgetContents/PropertiesFrame/ProxyPanel/CheckNeedsUpdateScript/1pqPopOutWidget0/CheckNeedsUpdateScript" command="set_string" arguments="if hasattr(self, &quot;_my_counter&quot;) and getattr(self, &quot;_my_counter&quot;) &lt; 10:&#xA; self.SetNeedsUpdate(True)" />
<pqevent object="pqClientMainWindow/propertiesDock/propertiesPanel/Accept" command="activate" arguments="" />\
<pqevent object="pqClientMainWindow" command="process_events" arguments="3000"/>
</pqevents>
# Live Programmable Source
To support use-cases where one wants to develop a programmable source that is *refreshed*
periodically, we have added **Live Programmable Source**. With this source, one can provide a
Python script for **CheckNeedsUpdateScript** that can indicate that the source may have new data
and hence should be updated. The ParaView Qt client can periodically check such source and update
them, if needed.
......@@ -531,6 +531,32 @@ annotation text.
</DoubleVectorProperty>
<!-- End ProgrammableSource -->
</SourceProxy>
<SourceProxy class="vtkPythonProgrammableFilter"
label="Live Programmable Source"
name="LiveProgrammableSource"
base_proxygroup="sources"
base_proxyname="ProgrammableSource">
<Documentation>
A programmable source that can produce new data autonomously.
</Documentation>
<StringVectorProperty command="SetCheckNeedsUpdateScript"
label="Script (CheckNeedsUpdate)"
name="CheckNeedsUpdateScript"
number_of_elements="1">
<Hints>
<Widget type="multi_line" syntax="python" />
</Hints>
<Documentation>
Specify the script to use to check if the filter/source has new data.
This is only needed for "live" sources, that can cause data to be available
outside of ParaView.
</Documentation>
</StringVectorProperty>
<Hints>
<LiveSource />
</Hints>
</SourceProxy>
</ProxyGroup>
<!-- =================================================================== -->
<ProxyGroup name="animation">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment