Hmm, okay. Currently, there's no way. Once a state file is loaded,
ParaView doesn't keep track of the fact that a state file was loaded
as a result has no mechanisms to indicate the selections made when
loading the state file. There are few indirect options for doing what
you want:

1. Package your Python programmable filters in custom XMLs that have a
file name property which points the data files to process. The load
state dialog will update those filenames too when loading the state
file. To package a Programmable Filter into a XML filter with
properties, see
https://blog.kitware.com/easy-customization-of-the-paraview-python-programmable-filter-property-panel/.

2. Create custom readers (which could indeed simply be Python
programmable sources that internally use the real readers to read the
datasets) and pass in FieldData the names of the data directory,
filenames etc, as needed. Then, downstream filters will have access to
those directories in Field Data.

Utkarsh

On Sun, Mar 11, 2018 at 1:09 PM, Roman Kowch <rsko...@gmail.com> wrote:
> Hi Utkarsh,
>
> Your first interpretation is correct. I want to pass the data directory that
> the user chose when loading the pvsm state file. The state file contains
> programmable filters, and I want to insert that directory in each of them.
>
> I don't expect the user to run any of their own Python source after loading
> a state file.
>
> Thanks,
> Roman
>
>
>
> On Sun, Mar 11, 2018 at 10:52 AM, Utkarsh Ayachit
> <utkarsh.ayac...@kitware.com> wrote:
>>
>> Roman,
>>
>> I am a little confused. Can you clarify the user workflow, please?
>> Does the user load a pvsm state file which has Python Programmable
>> Filters in it and you want to access the data directory that the user
>> chose when loading the pvsm state file, is that it? Or does the user
>> load the pvsm state file and then also run some Python scripts from
>> the Python shell and you want to pass the data directory to these
>> scripts run in the Python shell.
>>
>> Utkarsh
>>
>> On Sat, Mar 10, 2018 at 4:26 PM, Roman Kowch <rsko...@gmail.com> wrote:
>> > Hi there,
>> >
>> > I've been developing ways to build data displays through programmable
>> > filters and their associated Python scripts. After I build a display, I
>> > save
>> > the entire layout as a State File. Then, I can give both the State File
>> > and
>> > data files used to build the display to another user, so they can
>> > replicate
>> > the exact same display on their computer.
>> >
>> > A new feature in Paraview allows someone to choose the Data Directory
>> > when
>> > they load a State File. However, I don't know a way to pass this Data
>> > Directory path to my Python scripts. Is the Data Directory accessible as
>> > a
>> > global environment variable through Paraview's Python shell? It would be
>> > nice if a user could place the data files in any directory they want,
>> > then
>> > choose that directory when loading a State File, and have the underlying
>> > Python code (stored in Programmable Filters) in the State File access
>> > that
>> > directory.
>> >
>> > Currently, I need to require the user to put the data directory in a
>> > special
>> > place so that its path matches that written in the Python code. e.g. The
>> > hard-coded directory I've written is "$HOME/Desktop/pvdata". I'm using
>> > Paraview 5.4.1 on OS X.
>> >
>> > Thanks for your help,
>> > Roman
>> >
>> >
>> > _______________________________________________
>> > Powered by www.kitware.com
>> >
>> > Visit other Kitware open-source projects at
>> > http://www.kitware.com/opensource/opensource.html
>> >
>> > Please keep messages on-topic and check the ParaView Wiki at:
>> > http://paraview.org/Wiki/ParaView
>> >
>> > Search the list archives at: http://markmail.org/search/?q=ParaView
>> >
>> > Follow this link to subscribe/unsubscribe:
>> > https://public.kitware.com/mailman/listinfo/paraview
>> >
>
>
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
https://public.kitware.com/mailman/listinfo/paraview

Reply via email to