I have a python reader reading an HDF5 and I have added a property to allow to select which group of the HDF5 the user wants to read. However, since it may be complicated to know the correct path of the group, I have added a view which shows all the possible groups
I would like to know if there is a way to disable the checkboxes on the list. And even better, when selecting an element of the list, copying directly that string to the RootPath string.
Relevant code is here
@smproperty.dataarrayselection(name="Groups")
def GetGroupNames(self):
from vtkmodules.vtkCommonCore import vtkDataArraySelection
arrayselection = vtkDataArraySelection()
for name in self.group_names:
arrayselection.AddArray(name)
return arrayselection
# "StringInfo" and "String" demonstrate how one can add a selection widget
# that lets user choose a string from the list of strings.
@smproperty.stringvector(name="StringInfo", information_only="1")
def GetStrings(self):
return ["one", "two", "three"]
@smproperty.stringvector(name="String", number_of_elements="1")
@smdomain.xml(\
"""<StringListDomain name="list">
<RequiredProperties>
<Property name="StringInfo" function="StringInfo"/>
</RequiredProperties>
</StringListDomain>
""")
def SetString(self, value):
print("Setting ", value)
So if I understand correctly, the property String uses the property StringInfo, which calls the function StringInfo, to get the strings that are shown in the list?
How are the different names related?
There are at least 5:
first stringvector property name (StringInfo)
GetStrings function. Does the name of this function have any constraints?
second stringvector property name (String)
name and function in the required properties in the StringListDomain
SetString function
I guess the python function can be called as we wish, and the decorators are the ones that must match, right?
I was testing in Paraview 5.10, which comes from Archlinux repos, but I have also tested in 5.11, directly downloaded from the web, and the example you linked to gitlab fails to load also there. I have had to remove everything in the Source algorithm but the String and StringInfo stuff we are talking about to make it work.