Skip to content

Instantly share code, notes, and snippets.

@fstanley
Created February 21, 2013 06:44
Show Gist options
  • Save fstanley/5002766 to your computer and use it in GitHub Desktop.
Save fstanley/5002766 to your computer and use it in GitHub Desktop.
Enabling code completion with PyQt4 and SublimeCodeIntel on OSX

After struggling with this for 30 minutes, this is what finally got it working.

get this file: http://www.dannywynne.com/blog/wp-content/uploads/2012/10/pyqt4.zip

Open Sublime Text editor and go to the preferences->Browse Package and select the SublimeCodeIntel folder.

Paste the unzipped pyqt4.cix file in to the libs/CodeIntel2/catalogs folder

Open ~/.codeintel/config in sublime and paste in the following:

{
    "Python": {
        "python": '/Library/Frameworks/Python.framework/Versions/2.7/bin/python',
        "pythonExtraPaths": ['/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7']
    },
}

Of course, if your library path is different, modify as needed. If you are struggling to find the library, try typing find . | grep QtCore.so and then use that directory in the pythonExtraPaths list

In a python file, try typing:

from PyQt4.QtCore import *
QTime.  

and wait for autocompletion. It may take a few seconds the first time you try this, as the index needs to build. There will be a status message indicating this in the bottom toolbar if it is indeed indexing.

References: http://www.dannywynne.com/blog/?p=66

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment