pyuic5批处理

@echo off

set bat_path=%0
set "ui_dir=%cd%\%1"
set "pyuic5_exe=%bat_path:pyuic5-batch.bat=pyuic5.exe%"

SETLOCAL ENABLEDELAYEDEXPANSION
for /r %ui_dir% %%i in (*.ui) do (
	set ui_file=%%i
	set "py_file=!ui_file:.ui=.py!"
	%pyuic5_exe% !ui_file! -o !py_file! 
	echo %pyuic5_exe% !ui_file! -o !py_file! 
)

pyuic5-batch.bat文件跟pyuic.exe放到同一目录。VS2017中导入外部工具:

UIRes为项目存放*.ui文件的目录,使用这个工具就能把UIRes文件夹下所有*.ui文件转为*.py文件。

猜你喜欢

转载自www.cnblogs.com/marisa/p/9427129.html
今日推荐