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

Tim Sutton lists at linfiniti.com
Tue Apr 10 01:14:54 EDT 2012


Hi

On Tue, Apr 10, 2012 at 7:10 AM, Larry Shaffer <larrys at dakotacarto.com> wrote:
>
> On Mon, Apr 9, 2012 at 4:37 PM, Larry Shaffer <larrys at dakotacarto.com>
> wrote:
>>
>> Hi Tim,
>>
>> On Mon, Apr 9, 2012 at 1:00 PM, Tim Sutton <lists at linfiniti.com> 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
==============================================


More information about the Qgis-developer mailing list