HOWTO: Configure Eclipse to run PyUIC

1,658 views
Skip to first unread message

Brendan

unread,
Aug 17, 2009, 4:19:12 PM8/17/09
to python(x,y)
This seems a good a place as any to post this - it took me a while to
figure out so I though you might find it useful,

To generate the Python code stubs from the QT Designer .ui files one
uses the pyuic.py script. To run this from within Eclipse, do the
following,

1. Click Run -> External Tools -> External Tools Configurations ...
2. In the resulting dialog, click 'New' icon in the top left
3. Under 'Name' put 'PyUIC'
4. Under 'Location' enter 'C:\Program Files\Python\2.5\Python.exe' or
the path to your Python executable (probably C:\Python25\Python.exe)
5. Under 'Arguments' enter '"C:\Program Files\Python\2.5\Lib\site-
packages\PyQt4\uic\pyuic.py" "${resource_loc}"' substituting the path
to your PyQt4 installation - be sure also to include the double quotes
6. Change to the 'Common' tab and check 'File' under 'Standard Input/
Output' and enter '${resource_loc}.py'
7. Change to the 'Build' tab and uncheck 'Build before launch'
8. Change to the 'Refresh' tab and check 'Refresh resources upon
completion'
9. Click 'Apply' then 'Run'

To use,

1. Select a .ui file in the 'PyDev Package Explorer' to the left of
the Eclipse window
2. Click 'Run PyUIC' in the toolbar
3. A new file with suffix .ui.py should have appeared with all the
auto generated code

Brendan

Pierre Raybaut

unread,
Aug 17, 2009, 5:19:57 PM8/17/09
to python(x,y)
Thanks for the tip, Brendan, that's interesting - personnally I don't
use the pyuic.py script (I prefer to load dynamically the .ui files
when I use them), but I know that a lot of people do so they may be
interested indeed.

I'll take a look at it before 2.6.0 final release to see if I can
configure this automatically when installing Pydev:
http://code.google.com/p/pythonxy/issues/detail?id=112

Anyway, thanks for sharing!

Pierre
Reply all
Reply to author
Forward
0 new messages