kujira70 / pythonxy

Automatically exported from code.google.com/p/pythonxy
0 stars 0 forks source link

Eclipse/Pydev: auto configure the pyuic.py script in external tools #112

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
http://groups.google.com/group/pythonxy/browse_thread/thread/5297a34dccc2c2?
hl=en

Original issue reported on code.google.com by pierre.raybaut on 17 Aug 2009 at 9:19

GoogleCodeExporter commented 9 years ago
Is there a way to prevent double endings? Otherwise the name of the script will 
look
like foo.ui.py which prolly confuses the python interpreter.

otherwise +1 :)

Original comment by adarma...@gmail.com on 21 Dec 2009 at 1:06

GoogleCodeExporter commented 9 years ago
Eric IDE by default names the python file Ui_foo.py.  I would like to be able 
to reuse this naming convention if possible.

Original comment by airdrik@gmail.com on 3 Dec 2010 at 5:05

GoogleCodeExporter commented 9 years ago
To avoid double endings like .ui.py create a pyuic.bat under:
C:\Python26\Lib\site-packages\PyQt4\uic

The bat-file has the following content:
"C:\Python26\python.exe" "C:\Python26\Lib\site-packages\PyQt4\uic\pyuic.py" %1 
-o "%~d1%~p1%~n1.py"

Configure Eclipse as in the first post, but pointing to 
"C:\Python26\Lib\site-packages\PyQt4\uic\pyuic.bat"

Original comment by markus.r...@gmail.com on 11 Feb 2011 at 11:27

GoogleCodeExporter commented 9 years ago
上面的方法貌似在我的机子上有问题,所以在网上收集了些��
�料自己重新想了个办法搞定了。我的机器环境是Python2.7
It didn't work in my computer, so I find another way.

1. Create a pyuicrename.py under:
C:\Python27\Lib\site-packages\PyQt4\uic

首先新建一个.py文件,可自定义名字,并把它放在你认为比较�
��适的一个位置。

pyuicrename.py has the following content:
这里我将它命名为pyuicrename.py 内容如下:
import sys,os  
if len(sys.argv) <=1:  
    print("no input .ui file found!")  
    sys.exit()  
uifile = sys.argv[1]  
outfile = uifile.replace(".","_")+".py"
print(uifile)
print(outfile)
cmdstr = "pyuic4 "  
os.system(cmdstr + uifile + ">" + outfile)

2. Eclipse external tools configurations
第二部配置eclipse的external tools

location:
C:\Python27\python.exe
你的python的安装位置

arguments:
"C:\Python27\Lib\site-packages\PyQt4\uic\pyuicrename.py"  "${resource_loc}"
前面创建的pyuicremane.py的保存位置

剩下的步骤都一样啦
Change to the 'Build' tab and uncheck 'Build before launch'
Change to the 'Refresh' tab and check 'Refresh resources upon
completion'
Click 'Apply' then 'Run' 

Original comment by zouyou...@gmail.com on 12 Sep 2011 at 3:27

GoogleCodeExporter commented 9 years ago
Since Eclipse is no longer part of the main distribution, we won't take action 
on this.

Original comment by pierre.raybaut on 18 Dec 2011 at 9:30