pythonpyqt4pykdeplasmoid

Autocompletion not working with PyQT4 and PyKDE4 in most of the IDEs


I am trying to develop a plasmoid using python. I have tried eclipse with pydev, vim with pythoncomplete, PIDA and also Komodo, but none of them could give me autocmpletion for method names or members for the classes belonging to PyQT4 or PyKDE4. I added the folders in /usr/share/pyshare in the PYTHONPATH list for the IDEs.

Do I need to do something else ?


Solution

  • There is a number of ways to do it, PyQt4 provides enough information about method names for any object inspecting IDE:

    >>> from PyQt4 import QtGui
    >>> dir(QtGui.QToolBox) 
    ['Box', ... contextMenuPolicy', 'count', 'create', 'currentChanged'...]
    

    All those functions are built-in. This means that you have to push some IDEs slightly to notice them. Be aware that there are no docstrings in compiled PyQt and methods have a funny signature.

    Other possibility is using QScintilla2 and.api file generated during PyQt4 build process. Eric4 IDE is prepared exactly for that.

    <shameless-plug>
    You can also try Komodo IDE/Komodo Edit and a CIX file (download here) that I hacked together not so long ago:

    Screenshot 1

    and,

    Screenshot 2

    Edit: Installation instructions for Komodo 5:

    1. Edit -> Preferences -> Code Intelligence
    2. Add an API Catalog...
    3. Select CIX file, press Open
    4. There is no point 4.

    </shameless-plug>