ActiveState Community

Komodo Python Qt and PyQt catalog files (CIX)

Posted by toddw on 2007-08-14 18:24
OS: All / Any

The Komodo team have been working on creating tools for the automatic generation of the codeintel description files for python binary modules.

Attached are CIX files that covers both qt3 and qt4 (PyQt4). This means you should be able to get completions from code like this:

for qt3:

from qt
qt.<|>  # et all...

or a PyQt4 sample:

from PyQt4 import QtGui
QtGui.<|>  # et all...

More PyQt4 samples here:
http://zetcode.com/tutorials/pyqt4/firstprograms/

Installation
Unzip the attached file(s). Inside Komodo, go to your preferences and select the "Code Intelligence" category, then in the API Catalogs section, click on the "Add an API Catalog...", navigate to the cix file you previously extracted and add this. You should now have the qt completions (if not, try a restart to ensure all the codeintel information is synced).

Cheers,
Todd

AttachmentSize
PyQt4-2-0.cix_.zip44.58 KB
qt-3-3-6.cix_.zip43.83 KB
PyQt4-3-3.cix_.zip7.9 KB

BlaQ_PhoeniX | Mon, 2008-12-08 22:20

Is there no newer version of this file available?

toddw | Tue, 2008-12-09 12:15

I've added an updated version for PyQt 4.3.3.

Let me know if you have any problems with it.

Cheers,
Todd

cray | Mon, 2008-12-22 07:53

(Thanks for the 4.3 update!)

FYI...

As with the 4.2.0 version, once I add the API catalog, two entries appear in the listing. Both are for PyQt4 and are the same version. If I remove one of the entries, the other disappears, I had the same behavior with 4.2.0.

CI works fine as long as only one of the entries are checked.

If I delete and re-add the catalog, I get two entries again... I'm running Komodo IDE, version 4.4.1, build 20896, platform macosx-x86 on OSX 10.5.5.

toddw | Mon, 2008-12-22 12:55

I'm not sure why this is occurring, it seems to be only occurring on the Mac OS X version of Komodo 4.4.1, with Komodo 5.0.3 Mac version not showing these symptoms either.

The API catalog should still work, even if there are two instances that are checked.

You could also try manually copying the API catalog to the Komodo application directory, example:

cp PyQt-4.3.3.cix "/Applications/Komodo IDE 4.app/Contents/MacOS/python/komodo/codeintel2/catalogs/"

Cheers,
Todd

cray | Tue, 2008-12-23 08:24

That worked, thanks!

kscraja | Sat, 2009-05-02 23:39

Hi,
I have PyQt-win-gpl-4.5-snapshot-20090430 on my system. The latest cix file here is for the version 4.3.3.
It would be great if you can post an update for pyqt-4.5 version or even better would be to detail the process you are following to generate these cix files.
I will update the generated cix files here for others.

regards,
raja

toddw | Mon, 2009-05-04 12:12

Here are the steps I used to create the qt cix file:

  • Checkout the Komodo gencix tools
    # Argh, the website is formatting the URL below, you will need
    # to manually copy/update the URL link from below
    svn co http://svn.openkomodo.com/repos/openkomodo/trunk/src/codeintel/support/g... python_gencix
    cd python_gencix
    # Argh, the website is formatting the URL below, you will need
    # to manually copy/update the URL link from below
    svn co http://svn.openkomodo.com/repos/openkomodo/trunk/src/codeintel/support/g... python_gencix
    cd python_gencix
  • Generate the base cix file
    python gencix.py --onefile=PyQt4-3-3.cix --name="PyQt4" --description="Python QT bindings - version 4.3.3" PyQt4.QtCore PyQt4.QtGui PyQt4.QtNetwork PyQt4.QtOpenGL PyQt4.QtScript PyQt4.QtSql PyQt4.QtSvg PyQt4.QtTest PyQt4.QtXml PyQt4.QtAssistant PyQt4.QtDesigner
    python gencix.py --onefile=PyQt4-3-3.cix --name="PyQt4" --description="Python QT bindings - version 4.3.3" PyQt4.QtCore PyQt4.QtGui PyQt4.QtNetwork PyQt4.QtOpenGL PyQt4.QtScript PyQt4.QtSql PyQt4.QtSvg PyQt4.QtTest PyQt4.QtXml PyQt4.QtAssistant PyQt4.QtDesigner
  • Tweak the cix
    I'm not sure if this is still required, but looking at the PyQt4.3 cix file it looks as though it is. I added a base PyQt4.so with a bunch of the modules names that I converted, so that the "from PyQt4 import xxx" should work:

    <file lang="Python" mtime="1228847885" path="PyQt4.so">
       <scope ilk="blob" lang="Python" name="PyQt4">
          <import module="QtCore" />
          <import module="QtGui" />
          <import module="QtNetwork" />
          <import module="QtOpenGL" />
          <import module="QtScript" />
          <import module="QtSql" />
          <import module="QtSvg" />
          <import module="QtTest" />
          <import module="QtXml" />
          <import module="QtAssistant" />
          <import module="QtDesigner" />
        </scope>
      </file>
    <file lang="Python" mtime="1228847885" path="PyQt4.so">
       <scope ilk="blob" lang="Python" name="PyQt4">
          <import module="QtCore" />
          <import module="QtGui" />
          <import module="QtNetwork" />
          <import module="QtOpenGL" />
          <import module="QtScript" />
          <import module="QtSql" />
          <import module="QtSvg" />
          <import module="QtTest" />
          <import module="QtXml" />
          <import module="QtAssistant" />
          <import module="QtDesigner" />
        </scope>
      </file>

Cheers,
Todd

kscraja | Thu, 2009-05-07 06:31

Thanks for your posting.
I followed your instructions. But I am not able to generate.
I am working on windows with python 2.6.2 & pyqt-4.5(latest snapshot).

I am getting following errro:
--------------------------------------------------------------------
D:\sources\python_gencix>python gencix.py --onefile=PyQt4-5-1.cix --name="PyQt4" --description="Python QT bindings - version 4.5.1" PyQt4.QtCore
-------------------------------------------------------------
'import site' failed; use -v for traceback
Generating CIX for PyQt4.QtCore
Traceback (most recent call last):
File "gencix.py", line 427, in
docmodule(arg, root, options.force, usefile=True)
File "gencix.py", line 351, in docmodule
process_class(moduleElt, value, key, callables)
File "gencix.py", line 248, in process_class
[(name, getattr(obj, name)) for name in obj.__dict__])
AttributeError: 'MSG' object attribute 'wParam' is an instance attribute
------------------------------------------------------------------------
please advice.
thanks & regards,
raja