1
1
mirror of https://github.com/KenanZhu/AutoLibrary.git synced 2026-06-18 07:23:03 +08:00

chore(gui.batchs): 将编译脚本的错误命名 complie_*.bat/sh 修改为 compile_*.bat/sh

This commit is contained in:
2025-12-27 23:12:37 +08:00
parent 8c4f463889
commit cde1e966e7
5 changed files with 40 additions and 40 deletions
+2 -2
View File
@@ -58,8 +58,8 @@
1. 确保系统安装了 Python 3.13 版本 (推荐,过低或高版本会导致兼容问题)。 1. 确保系统安装了 Python 3.13 版本 (推荐,过低或高版本会导致兼容问题)。
2. 安装 pyside6 selenium ddddocr 库,命令为 `pip install pyside6 selenium ddddocr` 2. 安装 pyside6 selenium ddddocr 库,命令为 `pip install pyside6 selenium ddddocr`
3.`src/gui/batchs` 目录下运行 `complie_ui.bat` linux 和 macOS 系统使用 `complie_ui.sh`) 文件来编译 Qt 的 UI 文件。 3.`src/gui/batchs` 目录下运行 `compile_ui.bat` linux 和 macOS 系统使用 `compile_ui.sh`) 文件来编译 Qt 的 UI 文件。
4. 在上一步相同目录内运行 `complie_rc.bat` linux 和 macOS 系统使用 `complie_rc.sh` 文件来编译 Qt 的资源文件。 4. 在上一步相同目录内运行 `compile_rc.bat` linux 和 macOS 系统使用 `compile_rc.sh` 文件来编译 Qt 的资源文件。
5. 待上述步骤完成后,运行 `src/Main.py` 文件即可。 5. 待上述步骤完成后,运行 `src/Main.py` 文件即可。
*注意 1*:如果 python 使用的是虚拟环境,请在虚拟环境安装依赖后,在激活的虚拟环境终端中使用 `cd src/gui/batchs` 命令切换到 `batchs` 目录下,再运行编译脚本。否则会提示缺少必要的 Qt PySide 依赖库。 *注意 1*:如果 python 使用的是虚拟环境,请在虚拟环境安装依赖后,在激活的虚拟环境终端中使用 `cd src/gui/batchs` 命令切换到 `batchs` 目录下,再运行编译脚本。否则会提示缺少必要的 Qt PySide 依赖库。
@@ -4,32 +4,32 @@ setlocal enabledelayedexpansion
cd /d "%~dp0.." cd /d "%~dp0.."
echo [AutoLibrary complie] 检查翻译文件... echo [AutoLibrary compile] 检查翻译文件...
if exist translators ( if exist translators (
cd translators cd translators
set ts_count=0 set ts_count=0
for %%f in (*.ts) do set /a ts_count+=1 for %%f in (*.ts) do set /a ts_count+=1
if !ts_count! gtr 0 ( if !ts_count! gtr 0 (
echo [AutoLibrary complie] 找到 !ts_count! 个 .ts 文件,开始编译翻译文件... echo [AutoLibrary compile] 找到 !ts_count! 个 .ts 文件,开始编译翻译文件...
for %%f in (*.ts) do ( for %%f in (*.ts) do (
set "qm_filename=%%~nf.qm" set "qm_filename=%%~nf.qm"
echo [AutoLibrary complie] 正在编译翻译文件: "%%f" -> "!qm_filename!" echo [AutoLibrary compile] 正在编译翻译文件: "%%f" -> "!qm_filename!"
pyside6-lrelease "%%f" pyside6-lrelease "%%f"
if !errorlevel! equ 0 ( if !errorlevel! equ 0 (
echo [AutoLibrary complie] 翻译文件 "%%f" ✓ 编译成功,输出文件: "!qm_filename!" echo [AutoLibrary compile] 翻译文件 "%%f" ✓ 编译成功,输出文件: "!qm_filename!"
) else ( ) else (
echo [AutoLibrary complie] 翻译文件 "%%f" ✗ 编译失败 echo [AutoLibrary compile] 翻译文件 "%%f" ✗ 编译失败
) )
) )
echo. echo.
) else ( ) else (
echo [AutoLibrary complie] 未找到任何 .ts 翻译文件 echo [AutoLibrary compile] 未找到任何 .ts 翻译文件
) )
cd .. cd ..
) else ( ) else (
echo [AutoLibrary complie] 未找到 translators 目录 echo [AutoLibrary compile] 未找到 translators 目录
) )
echo. echo.
@@ -37,26 +37,26 @@ set count=0
for %%f in (*.qrc) do set /a count+=1 for %%f in (*.qrc) do set /a count+=1
if %count% equ 0 ( if %count% equ 0 (
echo [AutoLibrary complie] 错误: 未找到任何 .qrc 文件 echo [AutoLibrary compile] 错误: 未找到任何 .qrc 文件
pause pause
exit /b 1 exit /b 1
) )
echo [AutoLibrary complie] 找到 %count% 个 .qrc 文件,开始编译... echo [AutoLibrary compile] 找到 %count% 个 .qrc 文件,开始编译...
echo. echo.
for %%f in (*.qrc) do ( for %%f in (*.qrc) do (
set "filename=%%~nf" set "filename=%%~nf"
set "output_file=!filename!.py" set "output_file=!filename!.py"
echo [AutoLibrary complie] 正在编译: "%%f" -> "!output_file!" echo [AutoLibrary compile] 正在编译: "%%f" -> "!output_file!"
pyside6-rcc "%%f" -o "!output_file!" pyside6-rcc "%%f" -o "!output_file!"
if !errorlevel! equ 0 ( if !errorlevel! equ 0 (
echo [AutoLibrary complie] 文件 "%%f" ✓ 编译成功,输出文件: "!output_file!" echo [AutoLibrary compile] 文件 "%%f" ✓ 编译成功,输出文件: "!output_file!"
) else ( ) else (
echo [AutoLibrary complie] 文件 "%%f" ✗ 编译失败 echo [AutoLibrary compile] 文件 "%%f" ✗ 编译失败
) )
echo. echo.
) )
echo [AutoLibrary complie] 所有操作完成。 echo [AutoLibrary compile] 所有操作完成。
@@ -4,7 +4,7 @@ SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PARENT_DIR="$(dirname "$SCRIPT_DIR")" PARENT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PARENT_DIR" cd "$PARENT_DIR"
echo "[AutoLibrary complie] 检查翻译文件..." echo "[AutoLibrary compile] 检查翻译文件..."
if [ -d "translators" ]; then if [ -d "translators" ]; then
cd translators cd translators
ts_files=(*.ts) ts_files=(*.ts)
@@ -16,49 +16,49 @@ if [ -d "translators" ]; then
fi fi
if [ $ts_count -gt 0 ]; then if [ $ts_count -gt 0 ]; then
echo "[AutoLibrary complie] 找到 $ts_count 个 .ts 文件,开始编译翻译文件..." echo "[AutoLibrary compile] 找到 $ts_count 个 .ts 文件,开始编译翻译文件..."
for file in *.ts; do for file in *.ts; do
base_name=$(basename "$file" .ts) base_name=$(basename "$file" .ts)
qm_file="${base_name}.qm" qm_file="${base_name}.qm"
echo "[AutoLibrary complie] 正在编译翻译文件: \"$file\" -> \"$qm_file\"" echo "[AutoLibrary compile] 正在编译翻译文件: \"$file\" -> \"$qm_file\""
if pyside6-lrelease "$file"; then if pyside6-lrelease "$file"; then
echo "[AutoLibrary complie] 翻译文件 \"$file\" ✓ 编译成功,输出文件: \"$qm_file\"" echo "[AutoLibrary compile] 翻译文件 \"$file\" ✓ 编译成功,输出文件: \"$qm_file\""
else else
echo "[AutoLibrary complie] 翻译文件 \"$file\" ✗ 编译失败" echo "[AutoLibrary compile] 翻译文件 \"$file\" ✗ 编译失败"
fi fi
done done
echo echo
else else
echo "[AutoLibrary complie] 未找到任何 .ts 翻译文件" echo "[AutoLibrary compile] 未找到任何 .ts 翻译文件"
fi fi
cd .. cd ..
else else
echo "[AutoLibrary complie] 未找到 translators 目录" echo "[AutoLibrary compile] 未找到 translators 目录"
fi fi
echo echo
file_count=$(ls *.qrc 2>/dev/null | wc -l) file_count=$(ls *.qrc 2>/dev/null | wc -l)
if [ $file_count -eq 0 ]; then if [ $file_count -eq 0 ]; then
echo "[AutoLibrary complie] 错误: 未找到任何 .qrc 文件" echo "[AutoLibrary compile] 错误: 未找到任何 .qrc 文件"
exit 1 exit 1
fi fi
echo "[AutoLibrary complie] 找到 $file_count 个 .qrc 文件,开始编译..." echo "[AutoLibrary compile] 找到 $file_count 个 .qrc 文件,开始编译..."
echo echo
for file in *.qrc; do for file in *.qrc; do
base_name=$(basename "$file" .qrc) base_name=$(basename "$file" .qrc)
output_file="${base_name}.py" output_file="${base_name}.py"
echo "[AutoLibrary complie] 正在编译: \"$file\" -> \"$output_file\"" echo "[AutoLibrary compile] 正在编译: \"$file\" -> \"$output_file\""
if pyside6-rcc "$file" -o "$output_file"; then if pyside6-rcc "$file" -o "$output_file"; then
echo "[AutoLibrary complie] 文件 \"$file\" ✓ 编译成功,输出文件: \"$output_file\"" echo "[AutoLibrary compile] 文件 \"$file\" ✓ 编译成功,输出文件: \"$output_file\""
else else
echo "[AutoLibrary complie] 文件 \"$file\" ✗ 编译失败" echo "[AutoLibrary compile] 文件 \"$file\" ✗ 编译失败"
fi fi
echo echo
done done
echo "[AutoLibrary complie] 所有操作完成。" echo "[AutoLibrary compile] 所有操作完成。"
@@ -8,26 +8,26 @@ set count=0
for %%f in (*.ui) do set /a count+=1 for %%f in (*.ui) do set /a count+=1
if %count% equ 0 ( if %count% equ 0 (
echo [AutoLibrary complie] 错误: 未找到任何 .ui 文件 echo [AutoLibrary compile] 错误: 未找到任何 .ui 文件
pause pause
exit /b 1 exit /b 1
) )
echo [AutoLibrary complie] 找到 %count% 个 .ui 文件,开始编译... echo [AutoLibrary compile] 找到 %count% 个 .ui 文件,开始编译...
echo. echo.
for %%f in (*.ui) do ( for %%f in (*.ui) do (
set "filename=%%~nf" set "filename=%%~nf"
set "output_file=Ui_!filename!.py" set "output_file=Ui_!filename!.py"
echo [AutoLibrary complie] 正在编译: "%%f" -> "!output_file!" echo [AutoLibrary compile] 正在编译: "%%f" -> "!output_file!"
pyside6-uic "%%f" -o "!output_file!" pyside6-uic "%%f" -o "!output_file!"
if !errorlevel! equ 0 ( if !errorlevel! equ 0 (
echo [AutoLibrary complie] 文件 "%%f" ✓ 编译成功,输出文件: "!output_file!" echo [AutoLibrary compile] 文件 "%%f" ✓ 编译成功,输出文件: "!output_file!"
) else ( ) else (
echo [AutoLibrary complie] 文件 "%%f" ✗ 编译失败 echo [AutoLibrary compile] 文件 "%%f" ✗ 编译失败
) )
echo. echo.
) )
echo [AutoLibrary complie] 所有操作完成。 echo [AutoLibrary compile] 所有操作完成。
@@ -7,24 +7,24 @@ cd "$PARENT_DIR"
file_count=$(ls *.ui 2>/dev/null | wc -l) file_count=$(ls *.ui 2>/dev/null | wc -l)
if [ $file_count -eq 0 ]; then if [ $file_count -eq 0 ]; then
echo "[AutoLibrary complie] 错误: 未找到任何 .ui 文件" echo "[AutoLibrary compile] 错误: 未找到任何 .ui 文件"
exit 1 exit 1
fi fi
echo "[AutoLibrary complie] 找到 $file_count 个 .ui 文件,开始编译..." echo "[AutoLibrary compile] 找到 $file_count 个 .ui 文件,开始编译..."
echo echo
for file in *.ui; do for file in *.ui; do
base_name=$(basename "$file" .ui) base_name=$(basename "$file" .ui)
output_file="Ui_${base_name}.py" output_file="Ui_${base_name}.py"
echo "[AutoLibrary complie] 正在编译: \"$file\" -> \"$output_file\"" echo "[AutoLibrary compile] 正在编译: \"$file\" -> \"$output_file\""
if pyside6-uic "$file" -o "$output_file"; then if pyside6-uic "$file" -o "$output_file"; then
echo "[AutoLibrary complie] 文件 \"$file\" ✓ 编译成功,输出文件: \"$output_file\"" echo "[AutoLibrary compile] 文件 \"$file\" ✓ 编译成功,输出文件: \"$output_file\""
else else
echo "[AutoLibrary complie] 文件 \"$file\" ✗ 编译失败" echo "[AutoLibrary compile] 文件 \"$file\" ✗ 编译失败"
fi fi
echo echo
done done
echo "[AutoLibrary complie] 所有操作完成。" echo "[AutoLibrary compile] 所有操作完成。"