Code completion in spyder 2.0.0alpha3

256 views
Skip to first unread message

Duarte Carreira

unread,
Jul 30, 2010, 10:33:53 AM7/30/10
to spyder
Hi all.

Does code completion work in this version with external modules? I can
see PyQt4 modules but other modules I'm using do not show up when I
press TAB.

I have rope installed, and do NOT have QScintilla.

Thanks,
Duarte

Duarte Carreira

unread,
Aug 3, 2010, 6:46:01 AM8/3/10
to spyder
Answering myself...

Yes it works fine.

The only problem I have is with pyd modules. I can't make it work in
the editor. But it works in the Internal console.
For instance, this works in the Internal console:

from qgis.core import *
test=QGis. #at this point pressing tab gives me all the members in
QGis.

But the same code does not work in the editor window/pane.

Other py modules are recognized. Just pyd modules don't work.

Duarte

Duarte Carreira

unread,
Aug 3, 2010, 7:09:57 AM8/3/10
to spyder
More on this...

This works in the editor and internal console:

import qgis.utils
test=qgis.utils.os.getcwd()


This only works in the internal console:

import qgis.core
test=qgis.core.QGis.QGIS_VERSION

Now both modules are in the same folder. qgis.core is qgis\core.pyd,
and qgis.utils is qgis\utils.py.

Duarte

Pierre Raybaut

unread,
Aug 5, 2010, 9:21:09 AM8/5/10
to spyder
The console code completion is simply based on dynamic object
introspection: to show code completion on object 'obj', it basically
does a 'dir(obj)' and show the returned list in a combo box...

In the editor however, one cannot import all modules (otherwise it
would sometimes be very long to process a file) so the code completion
is based on the 'rope' Python module. In Spyder, rope uses 'Static
Object Analysis' to provide code completion, calltips and go-to-
definition features.

Maybe in your case, the 'qgis' module (which I'm not familiar with) is
impossible for rope to analyze for a reason that I do not know.

Pierre

Duarte Carreira

unread,
Aug 5, 2010, 10:10:55 AM8/5/10
to spyd...@googlegroups.com
Thanks for your reply!

I'm using PyScripter and I have code completion with this module (qgis). I think PyScripter also uses rope but I may be wrong.

This module is like PyQt, it's the python bindings for QGIS (written in C):


The bindings are made with SIP. Do see any reason why it should not work with Spyder?

Thanks
Duarte


--
You received this message because you are subscribed to the Google Groups "spyder" group.
To post to this group, send email to spyd...@googlegroups.com.
To unsubscribe from this group, send email to spyderlib+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/spyderlib?hl=en.


Reply all
Reply to author
Forward
0 new messages