# Improvements coming to the Python Editor

**URL:** https://discourse.paraview.org/t/improvements-coming-to-the-python-editor/6389
**Category:** Development
**Created:** [February 4, 2021, 9:49am UTC](https://discourse.paraview.org/t/improvements-coming-to-the-python-editor/6389 "2021-02-04T09:49:42Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 4, 2021, 9:49am UTC](https://discourse.paraview.org/t/improvements-coming-to-the-python-editor/6389/1 "2021-02-04T09:49:42Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [February 4, 2021, 2:44pm UTC](https://discourse.paraview.org/t/improvements-coming-to-the-python-editor/6389/2 "2021-02-04T14:44:18Z")

</div>

> [@mwestphal](#):
>
> 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.

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 4, 2021, 2:56pm UTC](https://discourse.paraview.org/t/improvements-coming-to-the-python-editor/6389/3 "2021-02-04T14:56:41Z")

</div>

> [@cory.quammen](#):
>
> 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.

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

> [@cory.quammen](#):
>
> 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.

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.

---

<div class="post-metadata">

### Author: ![nicolas.vuaille](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nicolas.vuaille/32/5873_2.png) [@nicolas.vuaille](https://discourse.paraview.org/u/nicolas.vuaille)
#### Post date: [February 8, 2021, 8:21am UTC](https://discourse.paraview.org/t/improvements-coming-to-the-python-editor/6389/4 "2021-02-08T08:21:46Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [February 8, 2021, 9:20am UTC](https://discourse.paraview.org/t/improvements-coming-to-the-python-editor/6389/5 "2021-02-08T09:20:54Z")

</div>

Indeed, and there is also the python view.
