Feature request #3408
Enhancement - Patch to add extra edit area and syntax highlighting to python console
Status: | Closed | ||
---|---|---|---|
Priority: | Low | ||
Assignee: | Martin Dobias | ||
Category: | Python plugins | ||
Pull Request or Patch supplied: | No | Resolution: | |
Easy fix?: | No | Copied to github as #: | 13468 |
Description
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.
History
#1 Updated by Martin Dobias almost 14 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:
http://www.qtrac.eu/sandbox.pyw
Martin
#2 Updated by Nathan Woodrow almost 14 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.
- Nathan
#3 Updated by Giovanni Manghi almost 13 years ago
- Target version changed from Version 1.7.0 to Version 1.7.4
#4 Updated by Giovanni Manghi over 12 years ago
- Target version changed from Version 1.7.4 to Version 2.0.0
#5 Updated by Pirmin Kalberer about 12 years ago
- Target version changed from Version 2.0.0 to Future Release - Nice to have
#6 Updated by Nathan Woodrow over 11 years ago
- Pull Request or Patch supplied set to No
- Status changed from Open to Closed
Better version in master now.