Eclipse external tool for Qt .ui to .py with pyuic

后端 未结 3 1067
温柔的废话
温柔的废话 2020-12-19 10:49

I use PyDev in Eclipse with the Qt integration. With an external tool I can create python source in a .py from a qt .ui file. This is the external tool: http://permalink.gma

3条回答
  •  太阳男子
    2020-12-19 11:24

    There is an easy solution to this problem that requires no scripting at all.

    1. Install pathtools plugin either through Eclipse updates or via the Eclipse marketplace:

    2. Setup an External Tools Configurations option in Eclipse as follows

    In Main:

    1. Name: pyuic_run. (or something similar)
    2. Location: path to the python interpreter (or pyside-uic.exe if you use this)
    3. Arguments: On the first line, put the path to pyuic.py (not needed if you use pyside-uic.exe as it will be above). Use double quotes around the path if it contains spaces. On the second line put "${resource_loc}" (this will set the name of the resource file)
    4. In refresh: Enable "Refresh resources upon completion" (to see the final file)
    5. In Build: Disable "Build before launch" #not necessary here
    6. In Environment: No changes
    7. In Common: Activate the "File" option and set the path to be: ${parent-path}/${name-sans-extension}.py

    Note that ${parent-path} and ${name-sans-extension} are arguments made available through the pathtools plugin.

    If you apply this and then run the configuration on a .ui resource file, you'll see a new .py file created.

提交回复
热议问题