mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-06-18 07:23:03 +08:00
chore(batchs): 新增界面资源和应用资源的编译脚本
This commit is contained in:
@@ -0,0 +1,62 @@
|
|||||||
|
@echo off
|
||||||
|
chcp 65001 >nul
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
cd /d "%~dp0.."
|
||||||
|
|
||||||
|
echo [AutoLibrary complie] 检查翻译文件...
|
||||||
|
if exist translators (
|
||||||
|
cd translators
|
||||||
|
set ts_count=0
|
||||||
|
for %%f in (*.ts) do set /a ts_count+=1
|
||||||
|
|
||||||
|
if !ts_count! gtr 0 (
|
||||||
|
echo [AutoLibrary complie] 找到 !ts_count! 个 .ts 文件,开始编译翻译文件...
|
||||||
|
for %%f in (*.ts) do (
|
||||||
|
set "qm_filename=%%~nf.qm"
|
||||||
|
echo [AutoLibrary complie] 正在编译翻译文件: "%%f" -> "!qm_filename!"
|
||||||
|
|
||||||
|
pyside6-lrelease "%%f"
|
||||||
|
if !errorlevel! equ 0 (
|
||||||
|
echo [AutoLibrary complie] 翻译文件 "%%f" ✓ 编译成功,输出文件: "!qm_filename!"
|
||||||
|
) else (
|
||||||
|
echo [AutoLibrary complie] 翻译文件 "%%f" ✗ 编译失败
|
||||||
|
)
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
) else (
|
||||||
|
echo [AutoLibrary complie] 未找到任何 .ts 翻译文件
|
||||||
|
)
|
||||||
|
cd ..
|
||||||
|
) else (
|
||||||
|
echo [AutoLibrary complie] 未找到 translators 目录
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
|
||||||
|
set count=0
|
||||||
|
for %%f in (*.qrc) do set /a count+=1
|
||||||
|
|
||||||
|
if %count% equ 0 (
|
||||||
|
echo [AutoLibrary complie] 错误: 未找到任何 .qrc 文件
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo [AutoLibrary complie] 找到 %count% 个 .qrc 文件,开始编译...
|
||||||
|
echo.
|
||||||
|
|
||||||
|
for %%f in (*.qrc) do (
|
||||||
|
set "filename=%%~nf"
|
||||||
|
set "output_file=!filename!.py"
|
||||||
|
echo [AutoLibrary complie] 正在编译: "%%f" -> "!output_file!"
|
||||||
|
|
||||||
|
pyside6-rcc "%%f" -o "!output_file!"
|
||||||
|
if !errorlevel! equ 0 (
|
||||||
|
echo [AutoLibrary complie] 文件 "%%f" ✓ 编译成功,输出文件: "!output_file!"
|
||||||
|
) else (
|
||||||
|
echo [AutoLibrary complie] 文件 "%%f" ✗ 编译失败
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
)
|
||||||
|
|
||||||
|
echo [AutoLibrary complie] 所有操作完成。
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
PARENT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
cd "$PARENT_DIR"
|
||||||
|
|
||||||
|
echo "[AutoLibrary complie] 检查翻译文件..."
|
||||||
|
if [ -d "translators" ]; then
|
||||||
|
cd translators
|
||||||
|
ts_files=(*.ts)
|
||||||
|
ts_count=${#ts_files[@]}
|
||||||
|
|
||||||
|
# 如果第一个元素是"*.ts"(表示没有匹配),则数量为0
|
||||||
|
if [ "$ts_count" -eq 1 ] && [ "${ts_files[0]}" = "*.ts" ]; then
|
||||||
|
ts_count=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $ts_count -gt 0 ]; then
|
||||||
|
echo "[AutoLibrary complie] 找到 $ts_count 个 .ts 文件,开始编译翻译文件..."
|
||||||
|
for file in *.ts; do
|
||||||
|
base_name=$(basename "$file" .ts)
|
||||||
|
qm_file="${base_name}.qm"
|
||||||
|
echo "[AutoLibrary complie] 正在编译翻译文件: \"$file\" -> \"$qm_file\""
|
||||||
|
|
||||||
|
if pyside6-lrelease "$file"; then
|
||||||
|
echo "[AutoLibrary complie] 翻译文件 \"$file\" ✓ 编译成功,输出文件: \"$qm_file\""
|
||||||
|
else
|
||||||
|
echo "[AutoLibrary complie] 翻译文件 \"$file\" ✗ 编译失败"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
echo
|
||||||
|
else
|
||||||
|
echo "[AutoLibrary complie] 未找到任何 .ts 翻译文件"
|
||||||
|
fi
|
||||||
|
cd ..
|
||||||
|
else
|
||||||
|
echo "[AutoLibrary complie] 未找到 translators 目录"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
|
||||||
|
file_count=$(ls *.qrc 2>/dev/null | wc -l)
|
||||||
|
|
||||||
|
if [ $file_count -eq 0 ]; then
|
||||||
|
echo "[AutoLibrary complie] 错误: 未找到任何 .qrc 文件"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[AutoLibrary complie] 找到 $file_count 个 .qrc 文件,开始编译..."
|
||||||
|
echo
|
||||||
|
|
||||||
|
for file in *.qrc; do
|
||||||
|
base_name=$(basename "$file" .qrc)
|
||||||
|
output_file="${base_name}.py"
|
||||||
|
echo "[AutoLibrary complie] 正在编译: \"$file\" -> \"$output_file\""
|
||||||
|
|
||||||
|
if pyside6-rcc "$file" -o "$output_file"; then
|
||||||
|
echo "[AutoLibrary complie] 文件 \"$file\" ✓ 编译成功,输出文件: \"$output_file\""
|
||||||
|
else
|
||||||
|
echo "[AutoLibrary complie] 文件 \"$file\" ✗ 编译失败"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "[AutoLibrary complie] 所有操作完成。"
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
@echo off
|
||||||
|
chcp 65001 >nul
|
||||||
|
setlocal enabledelayedexpansion
|
||||||
|
|
||||||
|
cd /d "%~dp0.."
|
||||||
|
|
||||||
|
set count=0
|
||||||
|
for %%f in (*.ui) do set /a count+=1
|
||||||
|
|
||||||
|
if %count% equ 0 (
|
||||||
|
echo [AutoLibrary complie] 错误: 未找到任何 .ui 文件
|
||||||
|
pause
|
||||||
|
exit /b 1
|
||||||
|
)
|
||||||
|
|
||||||
|
echo [AutoLibrary complie] 找到 %count% 个 .ui 文件,开始编译...
|
||||||
|
echo.
|
||||||
|
|
||||||
|
for %%f in (*.ui) do (
|
||||||
|
set "filename=%%~nf"
|
||||||
|
set "output_file=Ui_!filename!.py"
|
||||||
|
echo [AutoLibrary complie] 正在编译: "%%f" -> "!output_file!"
|
||||||
|
|
||||||
|
pyside6-uic "%%f" -o "!output_file!"
|
||||||
|
if !errorlevel! equ 0 (
|
||||||
|
echo [AutoLibrary complie] 文件 "%%f" ✓ 编译成功,输出文件: "!output_file!"
|
||||||
|
) else (
|
||||||
|
echo [AutoLibrary complie] 文件 "%%f" ✗ 编译失败
|
||||||
|
)
|
||||||
|
echo.
|
||||||
|
)
|
||||||
|
|
||||||
|
echo [AutoLibrary complie] 所有操作完成。
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||||
|
PARENT_DIR="$(dirname "$SCRIPT_DIR")"
|
||||||
|
cd "$PARENT_DIR"
|
||||||
|
|
||||||
|
file_count=$(ls *.ui 2>/dev/null | wc -l)
|
||||||
|
|
||||||
|
if [ $file_count -eq 0 ]; then
|
||||||
|
echo "[AutoLibrary complie] 错误: 未找到任何 .ui 文件"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "[AutoLibrary complie] 找到 $file_count 个 .ui 文件,开始编译..."
|
||||||
|
echo
|
||||||
|
|
||||||
|
for file in *.ui; do
|
||||||
|
base_name=$(basename "$file" .ui)
|
||||||
|
output_file="Ui_${base_name}.py"
|
||||||
|
echo "[AutoLibrary complie] 正在编译: \"$file\" -> \"$output_file\""
|
||||||
|
|
||||||
|
if pyside6-uic "$file" -o "$output_file"; then
|
||||||
|
echo "[AutoLibrary complie] 文件 \"$file\" ✓ 编译成功,输出文件: \"$output_file\""
|
||||||
|
else
|
||||||
|
echo "[AutoLibrary complie] 文件 \"$file\" ✗ 编译失败"
|
||||||
|
fi
|
||||||
|
echo
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "[AutoLibrary complie] 所有操作完成。"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
this folder is used to store the batch scripts.
|
||||||
Reference in New Issue
Block a user