Feature request #3408
Enhancement - Patch to add extra edit area and syntax highlighting to python console
|Assigned to:||Martin Dobias||% Done:||
|Category:||Python plugins and bindings|
|Target version:||Future Release - Nice to have|
|Platform version:||Pull Request or Patch supplied:||No|
This patch adds a second non-interactive python coding area to the python console. This lets the users write and rearrange python code before running it in the interactive console. Code from the edit area can be run in the interactive area using ctrl+return.
Syntax highlighting has also been implemented, for both the interactive console and the new edit area.
I also run reindent.py which is why the patch has more then what was just added by me.
Updated by Martin Dobias about 6 years ago
- I don't really like the vertical split between the console text edit box and "source" text edit box - it takes away a lot of space of console. So now I see just very few lines of the console. I would suggest to rework this for better usability. For example, there could be a small tool button which would show/hide the additional edit box - that one would be hidden by default. Also I would suggest to make the split horizontal rather than vertical (the lines are typically not that long). Or even instead of a split it could open a new window for source editing (optionally with the possibility to load/save the code).
- the syntax highlighter tries to handle everything as python code. This is a bit unfortunate in the console since the output isn't typically python code. As you've noted, that's also why error messages are not highlighted correctly. If you'd like to dig a bit more into syntax highlighting, there's a nice python module "tokenize" which is able to split the text to python tokens: that could be used for parsing python instead of using those nasty regexps.
It would be good to address the issues mentioned above in order to get this into trunk.
Btw. maybe you are aware of Mark Summerfield's nice example of an interactive python console with GUI. It can also do completion and shows tooltips with help on method arguments. It can serve as a source of inspiration for further improvements of the python console in qgis:
Updated by Nathan Woodrow about 6 years ago
No worries. I agree with both points, and both were a concern of mine when I first wrote it. Now that other people are thinking the same I will see how I can improve the usability.
I didn't know about Mark Summerfield's example. That will help a lot.
Updated by Giovanni Manghi over 5 years ago
- Target version changed from Version 1.7.0 to Version 1.7.4
Updated by Giovanni Manghi almost 5 years ago
- Target version changed from Version 1.7.4 to Version 2.0.0
Updated by Pirmin Kalberer over 4 years ago
- Target version changed from Version 2.0.0 to Future Release - Nice to have
Also available in: Atom