[QGIS-trac] Re: [Quantum GIS] #3408: Enhancement - Patch to add extra edit area and syntax highlighting to python console

Quantum GIS qgis at qgis.org
Wed Feb 2 18:01:26 EST 2011


#3408: Enhancement - Patch to add extra edit area and syntax highlighting to
python console
-------------------------------------------+--------------------------------
   Reporter:  NathanW                      |              Owner:  wonder       
       Type:  patch                        |             Status:  new          
   Priority:  minor: annoyance             |          Milestone:  Version 1.7.0
  Component:  Python plugins and bindings  |            Version:  Trunk        
   Keywords:                               |   Platform_version:               
   Platform:  All                          |           Must_fix:  No           
Status_info:  0                            |  
-------------------------------------------+--------------------------------

Comment(by wonder):

 Finally I've got time to take a look at your patch. The proposed
 improvements are welcome, though I have some comments on the
 functionality:
  * 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

-- 
Ticket URL: <https://trac.osgeo.org/qgis/ticket/3408#comment:2>
Quantum GIS <http://qgis.org>
Quantum GIS is an Open Source GIS viewer/editor supporting OGR, PostGIS, and GRASS formats


More information about the QGIS-trac mailing list