If you installed Qt4, you have Qt Designer. If you used the installer with qt.nokia.com, it should be in / Developer / Applications / Qt.
The Qt developer itself works great with PyQt. The Qt designer simply spills out XML describing the structure of the user interface. If you used standard Qt with C ++, you need to run the uic tool to create C ++ from .ui files. Similarly, with PyQt4, you must run pyuic4 in the generated .ui file to create a python source from it.
If you are looking for a complete IDE solution that automatically handles all this with PyQt, I donβt know about the existence of one of them. I just have a build_helper.py script that processes all my .ui files and puts them in the appropriate place in the python package that I am developing. I run the build assistant script before running the main program to make sure that the generated code is updated.
All my .ui files are in the ui subfolder at the root of the project. Then the script creates a python source and puts it in 'myapp / ui / generated'.
For example:
import os.path from PyQt4 import uic generated_ui_output = 'myapp/ui/generated' def process_ui_files(): ui_files = (glob.glob('ui/*.ui'), glob.glob('ui/Dialogs/*.ui'), glob.glob('ui/Widgets/*.ui'))) for f in ui_files: out_filename = ( os.path.join( generated_ui_output, os.path.splitext( os.path.basename(f))[0].replace(' ', '')+'.py') ) out_file = open(out_filename, 'w') uic.compileUi(f, out_file) out_file.close() if __name__ == '__main__': process_ui_files()
I also have several other functions to run pyrcc4 to compile resources and pylupdate4 and lrelease to generate translations.
Grant limberg
source share