[Qgis-developer] Re: PyQGIS Auto-completion and Call Tips in Eric Python Editor

Larry Shaffer larrys at dakotacarto.com
Mon Apr 9 18:37:40 EDT 2012


Hi Tim,

On Mon, Apr 9, 2012 at 1:00 PM, Tim Sutton <lists at linfiniti.com> wrote:

> Hi Larry
>
> On Mon, Apr 9, 2012 at 5:20 AM, Larry Shaffer <larrys at dakotacarto.com>
> wrote:
> > On Sun, Apr 8, 2012 at 7:48 PM, Larry Shaffer <larrys at dakotacarto.com>
> > wrote:
> >>
> >> Hi,
> >>
> >> I've successfully generated QScintilla2 API files for the QGIS Python
> >> bindings and utility modules [0]. If you use the Eric4/5 Python editor
> (or
> >> another based on QScintilla2), you may be interested in installing and
> >> compiling these APIs.
> >
> >
> > Seems a better approach, instead of changing SIPMacros.cmake, would be in
> > python/CMakeLists.txt [0]:
> >
> > ...
> >
> > This worked fine on compile, creating the same output as the
> SIPMacros.cmake
> > edit. Each SIP_EXTRA_OPTIONS could be wrapped with a conditional based
> on a
> > compile option for generating the APIs.
> >
>
> Two quick comments:
>
> 1) Could you submit your patch via github? If it is a cmake
> conditional compilation I see no reason to exclude it from master -
> others may have a different opinion.
>

Sure. I'll sync my local master branch and test the edits (since I only
tested builds of 1.7.4, which didn't have qgis.networkanalysis). I don't
see any issue with leaving the changes as is, if the .api files are not
going to be packaged with the target. Generation of the .api files does not
seem to slow down the compilation, as far as I can tell.


> 2) What I would really *love* is to have QGIS api completion (and
> other standard python modules if it is easy to achieve) in the built
> in python console that is activeated from the QGIS plugins menu. I
> often like to demo stuff to people using the python console and always
> flap around trying to remember syntax. Obviously this would add a
> qsctintilla dependency to QGIS core - how do others feel about this?
> Given the other work you are busy with that dependency is probably
> coming anyway....
>

 :^)  Porting the QTextEdit of PyQGIS console.py to QScintilla was what I
was going to look into next. I have already bootlegged it into Plugin
Editor and done some customizations.

The Eric editor has a nice Python console based on QScintilla (syntax
coloring, code completion and call tips), but I had difficulty trying to
port it to Plugin Editor, because it leverages Eric's entrenched debugger
classes. The ported base debugger I tried consistently crashed QGIS. Maybe
it can be included in a later version.

Currently I have code completion and call tips working well in Plugin
Editor [0]. The compiled API files I am testing with are:

    PyQt4-Qt4.8.api, Python-2.7.api, QScintilla2.api
    qgis.analysis.api, qgis.console.api, qgis.core.api, qgis.gui.api,
qgis.utils.api

The compiled API 'python.pap' file for a given QScintilla editor widget is
~37,500 api items total, and 900 KB in size (yet is still quite responsive).

The IPython console is very powerful, but required compilation of ZeroMQ on
my Mac. I think it would be great to add to Plugin Editor, but a
QScintilla-based PyQGIS console, I think, would be a good first step.

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota

[0]
http://dl.dropbox.com/u/4058089/qgis/plugin-editor_qsci-autocompl-calltips.png
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/qgis-developer/attachments/20120409/a0226851/attachment.html


More information about the Qgis-developer mailing list