[Paraview-developers] vtkSMDirectoryProxy::List

Martin Rehr rehr at nbi.ku.dk
Fri Apr 14 06:59:12 EDT 2017


Greetings,

I have trouble getting a list of directory entries through the ParaviewWeb Visualizer.

The ParaviewWeb Visualizer utilizes the ParaView source file: 'Web/Python2/paraview/web/protocols.py’

I have isolated the python code causing trouble and made a simple test:

--------------------------------------------------------------
from paraview import simple

pxm = simple.servermanager.ProxyManager()
directory_proxy = pxm.NewProxy('misc', 'ListDirectory’)
directory_proxy.List(path)
file_list = directory_proxy.GetProperty('FileList’)
print "file_list.GetNumberOfElements(): %s" % file_list.GetNumberOfElements()
--------------------------------------------------------------

‘file_list' remain empty no matter how many files located in ‘path’

I have tracked the problem down to that ‘vtkSIDirectoryProxy::Pull'[1] is never called and therefore the 'FileList' and ‘DirectoryList’ properties of ‘vtkSMDirectoryProxy' is never updated.
This can be fixed by modifying vtkSMDirectoryProxy::List[2] to:

--------------------------------------------------------------
bool vtkSMDirectoryProxy::List(const char* dir)
{
  bool result = this->CallDirectoryMethod("OpenDirectory", dir);
  if (result)
  {
    this->UpdatePropertyInformation(this->GetProperty("DirectoryList"));
    this->UpdatePropertyInformation(this->GetProperty("FileList"));
  }
  return result;
}
--------------------------------------------------------------

And changing ‘vtkSIDirectoryProxy::ReadXMLProperty’[1]:
--------------------------------------------------------------------------------
if (strcmp(name.c_str(), "FileList") == 0 || strcmp(name.c_str(), "DirectoryList”))
->
if (strcmp(name.c_str(), "FileList") == 0 || strcmp(name.c_str(), "DirectoryList") == 0)
--------------------------------------------------------------------------------

I’m new to the ParaView code-base so I don’t know if this is the correct way to fix the above problem, any comments is appreciated.

The above tests are performed on an Ubuntu 14.04 with kernel 3.13.0-112-generic #159-Ubuntu SMP and the official 5.3 source release (ParaView-v5.3.0.tar.gz) as well as the latest git checkout.

Best Regards,
   Martin Rehr

[1] ParaViewCore/ServerImplementation/Core/vtkSIDirectoryProxy.cxx
[2] ParaViewCore/ServerManager/Default/vtkSMDirectoryProxy.cxx




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP
URL: <http://public.kitware.com/pipermail/paraview-developers/attachments/20170414/5142f15d/attachment.sig>


More information about the Paraview-developers mailing list