Improvements coming to the Python Editor

There are improvements coming to the Python Editor, some have already been merged and other are on the way.

Already merged:

  • Line numbers
  • Undo/Redo support
  • Faster syntax highlighting
  • Access via the Tools menu
  • All around fixes

In developpements:

  • Multitab support
  • Autosave and autosave recovery
  • Adding the concept of Programmable Scripts, similar to the way Macros are handled

Regarding the last two points, I want to make sure that our proposition is fitting with as many usecases as possible.

Autosave and autosave recovery

in .config/ParaView, a new directory is added (SwapFiles?) where the python editor can write temporary files whenever a file change. If the file is saved, the temp file is removed. The temp file name is unique to the path of the file. If ParaView crashes for some reason, the file can be recovered when opening the file OR when opening the editor (suggestions?).

Programmable Scripts
in .config/ParaView, a new directory is added (ProgrammableScripts?) which is here to contains python scripts to be used in the different Programmable Filters in ParaView. The python editor will know when such a scripts is edited and will tag it accordingly. It will be made easy for user to use the available programmable scripts in their programmable filters.

This last part is not completely fleshed out, but if you have any inputs or concers, please let us know.

3 Likes

I could imagine some people would want to keep their scripts in some arbitrary directory to, for instance, have them under version control. Maybe you want to add a concept of python script paths.

What will it mean to make a script available to programmable filters? Does it mean copying the full contents of a file into the Script field of a Programmable Filter? Is there some decorator that can be added to enable designating part of a file as the request data part, another part that is the request information, etc.

That is an interesting idea, but not something that was already present for Macros. This could come later I think.

Here is what I have in mind:

  • When a user edit a script field a programmable filter, the “detach” button, instead of detaching the multilinewidget, will open the python editor with the content mirrored
  • When a user edit a script field of a programmable filter, a specific will let the user use a file from the Programmable scripts folder easily

That is basically it, one python file by field.
Of course,one could imagine more complex behavior, we are only trying to mirror the Macros behavior with the programmable filter script field.

It may be out of scope but note that there is another place where people edit python in the GUI : the Python Animation Track.

Another feature request: some find / find and replace tool may be useful in the future.

Indeed, and there is also the python view.