Unclear about script editor workflows

This question is similar to ParaView Python Script Editor but differs in that several of the editor buttons don’t change anything for me.

In particular I’d love to not be reliant on the copy/paste method for getting code into programmable sources from external files. The issue is that when I click this button nothing happens. Any tips would be greatly appreciated!

I’d also love to hear whether this is the preferred workflow for extensive use of files developed with an external editor, or if there’s another method that makes paraview watch for changes to a selected file or something.

Hi @Devin_Richard_Bayly

I agree that the python editor should still be improved, in any case here is how I use it with Programmable Filters and Sources.

  1. Writing a new script of a prog filter
  • Create Programmable Filter
  • Click on the squere button to open the python editor
  • Python editor pops up, tab is linked
  • Write your code in the python editor, press apply, repeat until it works
  • in the python editor, File → Save as script
  • Close python editor
  1. Using/Modifying a script for the prog filter
  • Create programmable filter
  • Click on the squere button to open the python editor
  • Python editor pops up, tab is linked
  • in the Python Editor, Script → Use as current script → select your script
  • Edit if needed and save as script if needed
  • Close the python editor
  • Press Apply

hth

Apologies for the delay! I think the workflow with 1. goes well, but my problems are with 2. I’m on a different machine right now with paraview 5.11 so I think the options under Scripts are slightly different. The issue appears to be the same though in that none of the buttons appear to cause anything to change. Is the idea that when I make a new tab and open a file there and then select Load script into current editor tab that my programmable script will suddenly get the text and I can hit apply?


If so that’s where the issue seems to be, because I don’t see any changes in the linked editor tab or within the script view in the properties

Should I submit a ticket to the github repo? Or is this still in developement and the buttons haven’t been hooked up?

Devin

Hi,

Indeed, the option change name for a more clear one, but the workflow stays the same:

  • Create programmable filter
  • Click on the square button to open the python editor
  • Python editor pops up, tab is linked
  • in the Python Editor, Script → Load script into current editor tab → select your script
  • Edit if needed and save as script if needed
  • Close the python editor
  • Press Apply

However, this assume you already have a script in ParaView Scripts, if you want to load from a random .py file from your computer, it is a bit more involved (and definitely should be improved):

  • Create programmable filter
  • Click on the square button to open the python editor
  • Python editor pops up, tab is linked
  • File → Open → Select a file on your computer
  • File → SaveAsScript
  • File → CloseCurrentTab, swtich to the linked tab
  • in the linked tab, Script → Load script into current editor tab → select your script
  • Edit if needed and save as script if needed
  • Close the python editor
  • Press Apply

Oh I finally get it. Yes I was attempting to use a .py from my system that I hadn’t made into a script how paraview wanted it. Thanks for that!

Yes, and it should be much more easy to do that. Well, lets hope someone takes the time to improve this :slight_smile:

I’m only going to make side mention of this here since we are talking about improvements.

I wrote a small script that I would launch in the paraview python shell that would start a thread and in the background every couple of seconds check for modifications made to a filename I was using as a script. If the changes were found it would get reference to the programmable source I added to the pipeline and it would use the file’s contents as the Script field. This worked but had a strange condition where in order for the thread’s execution to be noticed and effect changes I had to hit return in the python shell every once in a while. Any idea how I could get around that last bit of manual work?

I’ll post the code when I get to my work machine tomorrow.

I have no idea tbh, but such a feature should be added natively in ParaView and not require an external script imo.

but such a feature should be added natively in ParaView and not require an external script imo.

I’m with you on that one. Thanks again @mwestphal !

1 Like