3

I'm developing QGIS plugins using PyDev in Aptana Studio 3 and I would like to know if it's possible to make it aware of the QGIS API and add some "intellisense" functionnalities when programming. For example, I would like to see the available methods of an object when typing the dot "." after it...

UPDATE: I also see this message:

module not in pythonpath

When Hovering any QGIS object in code... Is it supposed to show me something more usefull?

enter image description here

Thanks a lot

Etienne

7

You can for Aptana Studio (and I guess PyDev is the same):

enter image description here

I start Aptana with this script:

@ECHO OFF
set OSGEO4W_ROOT=C:\OSGeo4W
set PATH=%OSGEO4W_ROOT%\bin;%OSGEO4W_ROOT%\apps\qgis-dev\bin;%PATH%
SET PYTHONHOME=%OSGEO4W_ROOT%\apps\Python27
set PYTHONPATH=%OSGEO4W_ROOT%\apps\qgis-dev\python
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT%\apps\qgis-dev\
call "C:\Program Files (x86)\Aptana Studio 3\studio3.bat" %*

In order for it to find my OSGeo4W Python, PyQt4, pyqgis libs.

QGIS Dev (soon to be 2.0) ships with pregenerated API files that Aptana use (See image 1):

enter image description here

This is what my PYTHONPATH screen looks like:

enter image description here

  • Thanks a lot for the very descriptive answer... The code completion is now working great. The only issue left is the messages: xxxobject Found at:"module not in pythonpath" that appear in popup when I hover an QGIS object in code... Is it normal behavior (check my updated question for more detail)? – Etienne Desgagné May 31 '13 at 13:17
  • 1
    I have added a screenshot of my PYTHONPATH setup. – Nathan W May 31 '13 at 23:05
0

Do you get any warnings from pydev when you import the QIS modules? If not, you have as much code completion as you're going to get. This is one of the downsides of a dynamic language like python.

There's a way to force completions, but it's not trivial: http://pydev.org/manual_101_interpreter.html#PyDevInterpreterConfiguration-PredefinedCompletions

0

I found useful this little tutorial:

I'm on debian.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.