PyQGIS Auto-completion and Call Tips in Eric Python Editor

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

PyQGIS Auto-completion and Call Tips in Eric Python Editor

Larry_S
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.

This allows for auto code completion and/or call tips for 3,450 items in the QGIS API:

    qgis.core.api
    qgis.gui.api
    qgis.analysis.api
    qgis.utils.api
    qgis.console.api

Also included in the archive is a description of how to reproduce the API files and some screen snaps on using with Eric4. The CMake edit might be considered for inclusion in the QGIS source, but (I suggest) only with an additional compile option for triggering creation of the API files, since it is not usually necessary to produce them, excepting for when the API changes.

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota

[0] http://dl.dropbox.com/u/4058089/qgis/qgis-qsci-apis.zip

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PyQGIS Auto-completion and Call Tips in Eric Python Editor

Larry_S
On Sun, Apr 8, 2012 at 7:48 PM, Larry Shaffer <[hidden email]> 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]:

--- python/CMakeLists_orig.txt    2012-02-19 13:41:41.000000000 -0700
+++ python/CMakeLists.txt    2012-04-08 21:00:16.000000000 -0600
@@ -54,0 +55 @@
+set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.core.api)
@@ -68,0 +70 @@
+set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.gui.api)
@@ -79,0 +82 @@
+set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a ${CMAKE_BINARY_DIR}/python/qgis.analysis.api)

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.

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota

[0] http://dl.dropbox.com/u/4058089/qgis/CMakeLists.txt

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PyQGIS Auto-completion and Call Tips in Eric Python Editor

Tim Sutton-4
Hi Larry

On Mon, Apr 9, 2012 at 5:20 AM, Larry Shaffer <[hidden email]> wrote:

> On Sun, Apr 8, 2012 at 7:48 PM, Larry Shaffer <[hidden email]>
> 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]:
>
> --- python/CMakeLists_orig.txt    2012-02-19 13:41:41.000000000 -0700
> +++ python/CMakeLists.txt    2012-04-08 21:00:16.000000000 -0600
> @@ -54,0 +55 @@
> +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
> ${CMAKE_BINARY_DIR}/python/qgis.core.api)
> @@ -68,0 +70 @@
> +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
> ${CMAKE_BINARY_DIR}/python/qgis.gui.api)
> @@ -79,0 +82 @@
> +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
> ${CMAKE_BINARY_DIR}/python/qgis.analysis.api)
>
> 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.
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....


Regards

Tim

>
> Regards,
>
> Larry Shaffer
> Dakota Cartography
> Black Hills, South Dakota
>
> [0] http://dl.dropbox.com/u/4058089/qgis/CMakeLists.txt
>
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



--
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PyQGIS Auto-completion and Call Tips in Eric Python Editor

giohappy
I would seriously consider upgrading the Python console, first of all to support autocompletion. I suggested the incorporation of QScintilla a couple of years ago, but it didn't raise much interest. A few weeks ago I gave a look to iPython, and it's Qt console [1].

giovanni

[1]  http://ipython.org/ipython-doc/dev/interactive/qtconsole.html 


2012/4/9 Tim Sutton <[hidden email]>
Hi Larry

On Mon, Apr 9, 2012 at 5:20 AM, Larry Shaffer <[hidden email]> wrote:
> On Sun, Apr 8, 2012 at 7:48 PM, Larry Shaffer <[hidden email]>
> 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]:
>
> --- python/CMakeLists_orig.txt    2012-02-19 13:41:41.000000000 -0700
> +++ python/CMakeLists.txt    2012-04-08 21:00:16.000000000 -0600
> @@ -54,0 +55 @@
> +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
> ${CMAKE_BINARY_DIR}/python/qgis.core.api)
> @@ -68,0 +70 @@
> +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
> ${CMAKE_BINARY_DIR}/python/qgis.gui.api)
> @@ -79,0 +82 @@
> +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
> ${CMAKE_BINARY_DIR}/python/qgis.analysis.api)
>
> 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.
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....


Regards

Tim

>
> Regards,
>
> Larry Shaffer
> Dakota Cartography
> Black Hills, South Dakota
>
> [0] http://dl.dropbox.com/u/4058089/qgis/CMakeLists.txt
>
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>



--
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer


_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PyQGIS Auto-completion and Call Tips in Eric Python Editor

Etienne Tourigny-3
It certainly looks good - but how about installing it along with it's
dependencies (such ZeroMQ and PyZMQ), particularly in windows or mac?

Etienne


On Mon, Apr 9, 2012 at 5:06 PM, G. Allegri <[hidden email]> wrote:

> I would seriously consider upgrading the Python console, first of all to
> support autocompletion. I suggested the incorporation of QScintilla a couple
> of years ago, but it didn't raise much interest. A few weeks ago I gave a
> look to iPython, and it's Qt console [1].
>
> giovanni
>
> [1]  http://ipython.org/ipython-doc/dev/interactive/qtconsole.html
>
>
>
> 2012/4/9 Tim Sutton <[hidden email]>
>>
>> Hi Larry
>>
>> On Mon, Apr 9, 2012 at 5:20 AM, Larry Shaffer <[hidden email]>
>> wrote:
>> > On Sun, Apr 8, 2012 at 7:48 PM, Larry Shaffer <[hidden email]>
>> > 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]:
>> >
>> > --- python/CMakeLists_orig.txt    2012-02-19 13:41:41.000000000 -0700
>> > +++ python/CMakeLists.txt    2012-04-08 21:00:16.000000000 -0600
>> > @@ -54,0 +55 @@
>> > +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
>> > ${CMAKE_BINARY_DIR}/python/qgis.core.api)
>> > @@ -68,0 +70 @@
>> > +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
>> > ${CMAKE_BINARY_DIR}/python/qgis.gui.api)
>> > @@ -79,0 +82 @@
>> > +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
>> > ${CMAKE_BINARY_DIR}/python/qgis.analysis.api)
>> >
>> > 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.
>> 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....
>>
>>
>> Regards
>>
>> Tim
>>
>> >
>> > Regards,
>> >
>> > Larry Shaffer
>> > Dakota Cartography
>> > Black Hills, South Dakota
>> >
>> > [0] http://dl.dropbox.com/u/4058089/qgis/CMakeLists.txt
>> >
>> > _______________________________________________
>> > Qgis-developer mailing list
>> > [hidden email]
>> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
>> >
>>
>>
>>
>> --
>> Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
>> ==============================================
>> Please do not email me off-list with technical
>> support questions. Using the lists will gain
>> more exposure for your issues and the knowledge
>> surrounding your issue will be shared with all.
>>
>> Visit http://linfiniti.com to find out about:
>>  * QGIS programming and support services
>>  * Mapserver and PostGIS based hosting plans
>>  * FOSS Consulting Services
>> Skype: timlinux
>> Irc: timlinux on #qgis at freenode.net
>> ==============================================
>> _______________________________________________
>> Qgis-developer mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>
> _______________________________________________
> Qgis-developer mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PyQGIS Auto-completion and Call Tips in Eric Python Editor

Tim Sutton-4
In reply to this post by giohappy
Hi

On Mon, Apr 9, 2012 at 10:06 PM, G. Allegri <[hidden email]> wrote:
> I would seriously consider upgrading the Python console, first of all to
> support autocompletion. I suggested the incorporation of QScintilla a couple
> of years ago, but it didn't raise much interest.

Sometimes these things take time to gather interest....we have a much
larger python userbase and probably these ideas are more likely to
gain critical mass...


>A few weeks ago I gave a
> look to iPython, and it's Qt console [1].

Larry has a very nice simple integrated IDE plugin in the works that
also uses scintilla, which I would like to see become part of QGIS
core, so scintilla is probably a good fit (though I don't know if it
is mutually exclusive of iPython Qt).

Regards

Tim

>
> giovanni
>
> [1]  http://ipython.org/ipython-doc/dev/interactive/qtconsole.html
>
>
>
> 2012/4/9 Tim Sutton <[hidden email]>
>>
>> Hi Larry
>>
>> On Mon, Apr 9, 2012 at 5:20 AM, Larry Shaffer <[hidden email]>
>> wrote:
>> > On Sun, Apr 8, 2012 at 7:48 PM, Larry Shaffer <[hidden email]>
>> > 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]:
>> >
>> > --- python/CMakeLists_orig.txt    2012-02-19 13:41:41.000000000 -0700
>> > +++ python/CMakeLists.txt    2012-04-08 21:00:16.000000000 -0600
>> > @@ -54,0 +55 @@
>> > +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
>> > ${CMAKE_BINARY_DIR}/python/qgis.core.api)
>> > @@ -68,0 +70 @@
>> > +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
>> > ${CMAKE_BINARY_DIR}/python/qgis.gui.api)
>> > @@ -79,0 +82 @@
>> > +set(SIP_EXTRA_OPTIONS ${PYQT4_SIP_FLAGS} -o -a
>> > ${CMAKE_BINARY_DIR}/python/qgis.analysis.api)
>> >
>> > 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.
>> 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....
>>
>>
>> Regards
>>
>> Tim
>>
>> >
>> > Regards,
>> >
>> > Larry Shaffer
>> > Dakota Cartography
>> > Black Hills, South Dakota
>> >
>> > [0] http://dl.dropbox.com/u/4058089/qgis/CMakeLists.txt
>> >
>> > _______________________________________________
>> > Qgis-developer mailing list
>> > [hidden email]
>> > http://lists.osgeo.org/mailman/listinfo/qgis-developer
>> >
>>
>>
>>
>> --
>> Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
>> ==============================================
>> Please do not email me off-list with technical
>> support questions. Using the lists will gain
>> more exposure for your issues and the knowledge
>> surrounding your issue will be shared with all.
>>
>> Visit http://linfiniti.com to find out about:
>>  * QGIS programming and support services
>>  * Mapserver and PostGIS based hosting plans
>>  * FOSS Consulting Services
>> Skype: timlinux
>> Irc: timlinux on #qgis at freenode.net
>> ==============================================
>> _______________________________________________
>> Qgis-developer mailing list
>> [hidden email]
>> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>



--
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PyQGIS Auto-completion and Call Tips in Eric Python Editor

Larry_S
In reply to this post by Tim Sutton-4
Hi Tim,

On Mon, Apr 9, 2012 at 1:00 PM, Tim Sutton <[hidden email]> wrote:
Hi Larry

On Mon, Apr 9, 2012 at 5:20 AM, Larry Shaffer <[hidden email]> wrote:
> On Sun, Apr 8, 2012 at 7:48 PM, Larry Shaffer <[hidden email]>
> 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


_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PyQGIS Auto-completion and Call Tips in Eric Python Editor

Larry_S

On Mon, Apr 9, 2012 at 4:37 PM, Larry Shaffer <[hidden email]> wrote:
Hi Tim,

On Mon, Apr 9, 2012 at 1:00 PM, Tim Sutton <[hidden email]> wrote:
...
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).


Having played around with the code completion, I added another .api file for the qgis.utils.iface instance [0]. This allows direct access to the 149 QgisInterface slots/functions when typing just 'iface' [1], which is common.

@Tim - I have recently added templates (built-in and custom) to Plugin Editor as well. Using the run_script() template (formulated as per Script Runner) you can quickly open a test script, with code completion and call tips, type a few lines and run it within the Editor. Also, you can copy text selections via drag/drop to the PyQGIS console for running. Those steps would help you to show some example code quickly.

Switching from QTextEdit to QScintilla for the console looks like about a 50% rewrite, plus some refactoring. Certainly an all-weekend kinda project, considering new features would be added, too.

Regards,

Larry Shaffer
Dakota Cartography
Black Hills, South Dakota

[0] http://dl.dropbox.com/u/4058089/qgis/qgis.utils.iface.api
[1] http://dl.dropbox.com/u/4058089/qgis/qgis-qsci-iface.png


_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PyQGIS Auto-completion and Call Tips in Eric Python Editor

Tim Sutton-4
Hi

On Tue, Apr 10, 2012 at 7:10 AM, Larry Shaffer <[hidden email]> wrote:

>
> On Mon, Apr 9, 2012 at 4:37 PM, Larry Shaffer <[hidden email]>
> wrote:
>>
>> Hi Tim,
>>
>> On Mon, Apr 9, 2012 at 1:00 PM, Tim Sutton <[hidden email]> wrote:
>>>
>>> ...
>>>
>>> 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).
>
>
>
> Having played around with the code completion, I added another .api file for
> the qgis.utils.iface instance [0]. This allows direct access to the 149
> QgisInterface slots/functions when typing just 'iface' [1], which is common.
>
> @Tim - I have recently added templates (built-in and custom) to Plugin
> Editor as well. Using the run_script() template (formulated as per Script
> Runner) you can quickly open a test script, with code completion and call
> tips, type a few lines and run it within the Editor. Also, you can copy text
> selections via drag/drop to the PyQGIS console for running. Those steps
> would help you to show some example code quickly.
>

Awesome stuff!

> Switching from QTextEdit to QScintilla for the console looks like about a
> 50% rewrite, plus some refactoring. Certainly an all-weekend kinda project,
> considering new features would be added, too.
>

Maybe not needed as a priority if you think you could achieve the same
using your script runner like support in the editor?

Regards

Tim

> Regards,
>
> Larry Shaffer
> Dakota Cartography
> Black Hills, South Dakota
>
> [0] http://dl.dropbox.com/u/4058089/qgis/qgis.utils.iface.api
> [1] http://dl.dropbox.com/u/4058089/qgis/qgis-qsci-iface.png
>



--
Tim Sutton - QGIS Project Steering Committee Member (Release  Manager)
==============================================
Please do not email me off-list with technical
support questions. Using the lists will gain
more exposure for your issues and the knowledge
surrounding your issue will be shared with all.

Visit http://linfiniti.com to find out about:
 * QGIS programming and support services
 * Mapserver and PostGIS based hosting plans
 * FOSS Consulting Services
Skype: timlinux
Irc: timlinux on #qgis at freenode.net
==============================================
_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer