diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 95c1150..0b27fab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -94,13 +94,13 @@ jobs: exit 1 } - if (-not (Test-Path "model")) { - New-Item -ItemType Directory -Path "model" | Out-Null - Write-Host "✓ Created model directory" + if (-not (Test-Path "models")) { + New-Item -ItemType Directory -Path "models" | Out-Null + Write-Host "✓ Created models directory" } $onnxSource = Join-Path $ddddocrPath "common.onnx" - $onnxDest = "model/common.onnx" + $onnxDest = "models/common.onnx" if (Test-Path $onnxSource) { Copy-Item $onnxSource $onnxDest -Force Write-Host "✓ Copied ONNX model from: $onnxSource" @@ -119,18 +119,18 @@ jobs: } shell: pwsh - - name: Compile Qt UI files - run: | - cd src/gui/batchs - ./compile_ui.bat - shell: cmd - - name: Compile Qt Resource files run: | - cd src/gui/batchs + cd batchs ./compile_rc.bat shell: cmd + - name: Compile Qt UI files + run: | + cd batchs + ./compile_ui.bat + shell: cmd + - name: Generate 'Main.spec' run: | $version = "${{ steps.get_version.outputs.VERSION }}" @@ -148,8 +148,8 @@ jobs: " pathex=[]," " binaries=[]," " datas=[" - " ('model\\common.onnx', 'ddddocr')," - " ('src\\gui\\icons\\AutoLibrary_32x32.ico', 'gui\\icons')," + " ('models\\common.onnx', 'ddddocr')," + " ('src\\gui\\resources\\icons\\AutoLibrary_32x32.ico', 'gui\\resources\\icons')," " ]," " hiddenimports=[]," " hookspath=[]," @@ -180,7 +180,7 @@ jobs: " target_arch=None," " codesign_identity=None," " entitlements_file=None," - " icon=['src\\gui\\icons\\AutoLibrary_32x32.ico']," + " icon=['src\\gui\\resources\\icons\\AutoLibrary_32x32.ico']," ")" ) $specLines | Out-File -FilePath "Main.spec" -Encoding UTF8 diff --git a/.gitignore b/.gitignore index 81334f4..a011137 100644 --- a/.gitignore +++ b/.gitignore @@ -6,13 +6,16 @@ __pycache__/ build/ dist/ -model/*.* -!model/*.md -driver/*.* -!driver/*.md -src/gui/configs/*.json -src/gui/translators/qtbase_zh_CN.qm -src/gui/ALResource.py -src/gui/Ui_*.py + +models/*.* +drivers/*.* +!models/*.md +!drivers/*.md +!templates/*.md +!templates/configs/*.md + +src/gui/resources/ui/Ui_*.py +src/gui/resources/translators/qtbase_zh_CN.qm +src/gui/resources/ALResource.py Main.spec \ No newline at end of file diff --git a/src/gui/batchs/compile_rc.bat b/batchs/compile_rc.bat similarity index 74% rename from src/gui/batchs/compile_rc.bat rename to batchs/compile_rc.bat index 6003b11..06fbb6e 100644 --- a/src/gui/batchs/compile_rc.bat +++ b/batchs/compile_rc.bat @@ -2,7 +2,7 @@ chcp 65001 >nul setlocal enabledelayedexpansion -cd /d "%~dp0.." +cd src/gui/resources echo [AutoLibrary compile] 检查翻译文件... if exist translators ( @@ -18,12 +18,11 @@ if exist translators ( pyside6-lrelease "%%f" if !errorlevel! equ 0 ( - echo [AutoLibrary compile] 翻译文件 "%%f" ✓ 编译成功,输出文件: "!qm_filename!" + echo [AutoLibrary compile] 翻译文件 "%%f" 编译成功,输出文件: "!qm_filename!" ) else ( - echo [AutoLibrary compile] 翻译文件 "%%f" ✗ 编译失败 + echo [AutoLibrary compile] 翻译文件 "%%f" 编译失败 ) ) - echo. ) else ( echo [AutoLibrary compile] 未找到任何 .ts 翻译文件 ) @@ -52,11 +51,10 @@ for %%f in (*.qrc) do ( pyside6-rcc "%%f" -o "!output_file!" if !errorlevel! equ 0 ( - echo [AutoLibrary compile] 文件 "%%f" ✓ 编译成功,输出文件: "!output_file!" + echo [AutoLibrary compile] 文件 "%%f" 编译成功,输出文件: "!output_file!" ) else ( - echo [AutoLibrary compile] 文件 "%%f" ✗ 编译失败 + echo [AutoLibrary compile] 文件 "%%f" 编译失败 ) - echo. ) echo [AutoLibrary compile] 所有操作完成。 \ No newline at end of file diff --git a/src/gui/batchs/compile_rc.sh b/batchs/compile_rc.sh similarity index 76% rename from src/gui/batchs/compile_rc.sh rename to batchs/compile_rc.sh index befcbc7..e8a7770 100644 --- a/src/gui/batchs/compile_rc.sh +++ b/batchs/compile_rc.sh @@ -1,8 +1,8 @@ #!/bin/bash SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -PARENT_DIR="$(dirname "$SCRIPT_DIR")" -cd "$PARENT_DIR" + +cd "$SCRIPT_DIR/src/gui/resources" echo "[AutoLibrary compile] 检查翻译文件..." if [ -d "translators" ]; then @@ -10,7 +10,6 @@ if [ -d "translators" ]; then ts_files=(*.ts) ts_count=${#ts_files[@]} - # 如果第一个元素是"*.ts"(表示没有匹配),则数量为0 if [ "$ts_count" -eq 1 ] && [ "${ts_files[0]}" = "*.ts" ]; then ts_count=0 fi @@ -23,12 +22,11 @@ if [ -d "translators" ]; then echo "[AutoLibrary compile] 正在编译翻译文件: \"$file\" -> \"$qm_file\"" if pyside6-lrelease "$file"; then - echo "[AutoLibrary compile] 翻译文件 \"$file\" ✓ 编译成功,输出文件: \"$qm_file\"" + echo "[AutoLibrary compile] 翻译文件 \"$file\" 编译成功,输出文件: \"$qm_file\"" else - echo "[AutoLibrary compile] 翻译文件 \"$file\" ✗ 编译失败" + echo "[AutoLibrary compile] 翻译文件 \"$file\" 编译失败" fi done - echo else echo "[AutoLibrary compile] 未找到任何 .ts 翻译文件" fi @@ -36,7 +34,6 @@ if [ -d "translators" ]; then else echo "[AutoLibrary compile] 未找到 translators 目录" fi -echo file_count=$(ls *.qrc 2>/dev/null | wc -l) @@ -46,7 +43,6 @@ if [ $file_count -eq 0 ]; then fi echo "[AutoLibrary compile] 找到 $file_count 个 .qrc 文件,开始编译..." -echo for file in *.qrc; do base_name=$(basename "$file" .qrc) @@ -54,11 +50,10 @@ for file in *.qrc; do echo "[AutoLibrary compile] 正在编译: \"$file\" -> \"$output_file\"" if pyside6-rcc "$file" -o "$output_file"; then - echo "[AutoLibrary compile] 文件 \"$file\" ✓ 编译成功,输出文件: \"$output_file\"" + echo "[AutoLibrary compile] 文件 \"$file\" 编译成功,输出文件: \"$output_file\"" else - echo "[AutoLibrary compile] 文件 \"$file\" ✗ 编译失败" + echo "[AutoLibrary compile] 文件 \"$file\" 编译失败" fi - echo done echo "[AutoLibrary compile] 所有操作完成。" \ No newline at end of file diff --git a/src/gui/batchs/compile_ui.bat b/batchs/compile_ui.bat similarity index 70% rename from src/gui/batchs/compile_ui.bat rename to batchs/compile_ui.bat index 3f02efd..0426c5d 100644 --- a/src/gui/batchs/compile_ui.bat +++ b/batchs/compile_ui.bat @@ -2,7 +2,7 @@ chcp 65001 >nul setlocal enabledelayedexpansion -cd /d "%~dp0.." +cd src/gui/resources/ui set count=0 for %%f in (*.ui) do set /a count+=1 @@ -23,11 +23,10 @@ for %%f in (*.ui) do ( pyside6-uic "%%f" -o "!output_file!" if !errorlevel! equ 0 ( - echo [AutoLibrary compile] 文件 "%%f" ✓ 编译成功,输出文件: "!output_file!" + echo [AutoLibrary compile] 文件 "%%f" 编译成功,输出文件: "!output_file!" ) else ( - echo [AutoLibrary compile] 文件 "%%f" ✗ 编译失败 + echo [AutoLibrary compile] 文件 "%%f" 编译失败 ) - echo. ) echo [AutoLibrary compile] 所有操作完成。 \ No newline at end of file diff --git a/src/gui/batchs/compile_ui.sh b/batchs/compile_ui.sh similarity index 64% rename from src/gui/batchs/compile_ui.sh rename to batchs/compile_ui.sh index 0c8d38a..a9d392b 100644 --- a/src/gui/batchs/compile_ui.sh +++ b/batchs/compile_ui.sh @@ -1,8 +1,8 @@ #!/bin/bash SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" -PARENT_DIR="$(dirname "$SCRIPT_DIR")" -cd "$PARENT_DIR" + +cd "$SCRIPT_DIR/src/gui/resources/ui" file_count=$(ls *.ui 2>/dev/null | wc -l) @@ -12,7 +12,6 @@ if [ $file_count -eq 0 ]; then fi echo "[AutoLibrary compile] 找到 $file_count 个 .ui 文件,开始编译..." -echo for file in *.ui; do base_name=$(basename "$file" .ui) @@ -20,11 +19,10 @@ for file in *.ui; do echo "[AutoLibrary compile] 正在编译: \"$file\" -> \"$output_file\"" if pyside6-uic "$file" -o "$output_file"; then - echo "[AutoLibrary compile] 文件 \"$file\" ✓ 编译成功,输出文件: \"$output_file\"" + echo "[AutoLibrary compile] 文件 \"$file\" 编译成功,输出文件: \"$output_file\"" else - echo "[AutoLibrary compile] 文件 \"$file\" ✗ 编译失败" + echo "[AutoLibrary compile] 文件 \"$file\" 编译失败" fi - echo done echo "[AutoLibrary compile] 所有操作完成。" \ No newline at end of file diff --git a/batchs/readme.md b/batchs/readme.md new file mode 100644 index 0000000..9c044f6 --- /dev/null +++ b/batchs/readme.md @@ -0,0 +1 @@ +This folder is used to store the batch scripts. diff --git a/document/readme.md b/document/readme.md deleted file mode 100644 index f0cd985..0000000 --- a/document/readme.md +++ /dev/null @@ -1 +0,0 @@ -For more infomation, please visit our website: https://www.autolibrary.top \ No newline at end of file diff --git a/driver/readme.md b/driver/readme.md deleted file mode 100644 index 4af42c7..0000000 --- a/driver/readme.md +++ /dev/null @@ -1 +0,0 @@ -This folder is used to store the browser driver using by selenium. \ No newline at end of file diff --git a/drivers/readme.md b/drivers/readme.md new file mode 100644 index 0000000..0c6dc30 --- /dev/null +++ b/drivers/readme.md @@ -0,0 +1 @@ +This folder is used to store the browser drivers using by selenium. \ No newline at end of file diff --git a/manuals/readme.md b/manuals/readme.md new file mode 100644 index 0000000..4540650 --- /dev/null +++ b/manuals/readme.md @@ -0,0 +1,3 @@ +This folder is used to store the manuals. + +Our manuals are available at https://www.autolibrary.top/manuals diff --git a/model/readme.md b/model/readme.md deleted file mode 100644 index 98c7557..0000000 --- a/model/readme.md +++ /dev/null @@ -1 +0,0 @@ -This folder is used to store the model using by ddddocr. \ No newline at end of file diff --git a/models/readme.md b/models/readme.md new file mode 100644 index 0000000..c68b021 --- /dev/null +++ b/models/readme.md @@ -0,0 +1 @@ +This folder is used to store the models using by ddddocr. \ No newline at end of file diff --git a/readme.md b/readme.md index 2b23f81..c1b5dbb 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ # AutoLibrary --- -![AutoLibrary Logo](./src/gui/icons/AutoLibrary_128x128.ico) +![AutoLibrary Logo](./src/gui/resources/icons/AutoLibrary_128x128.ico) [![GitHub stars](https://img.shields.io/github/stars/KenanZhu/AutoLibrary.svg?style=social&label=Star)](https://github.com/KenanZhu/AutoLibrary) ![License](https://img.shields.io/github/license/KenanZhu/AutoLibrary) @@ -40,7 +40,7 @@ 1. 确保系统安装了 Python 3.13 版本 (推荐,过低或高版本会导致兼容问题)。 2. 安装 pyside6 selenium ddddocr 库,命令为 `pip install pyside6 selenium ddddocr`。 -3. 在 `src/gui/batchs` 目录下运行 `compile_ui.bat` (linux 和 macOS 系统使用 `compile_ui.sh`) 文件来编译 Qt 的 UI 文件。 +3. 在 `batchs` 目录下运行 `compile_ui.bat` (linux 和 macOS 系统使用 `compile_ui.sh`) 文件来编译 Qt 的 UI 文件。 4. 在上一步相同目录内运行 `compile_rc.bat` (linux 和 macOS 系统使用 `compile_rc.sh`) 文件来编译 Qt 的资源文件。 5. 待上述步骤完成后,运行 `src/Main.py` 文件即可。 diff --git a/src/Main.py b/src/Main.py index c11a34c..73b0c4a 100644 --- a/src/Main.py +++ b/src/Main.py @@ -13,7 +13,7 @@ from PySide6.QtCore import QTranslator from PySide6.QtWidgets import QApplication from gui.ALMainWindow import ALMainWindow -from gui import ALResource +from gui.resources import ALResource def main(): diff --git a/src/gui/ALAboutDialog.py b/src/gui/ALAboutDialog.py index f91ed63..2ee3e56 100644 --- a/src/gui/ALAboutDialog.py +++ b/src/gui/ALAboutDialog.py @@ -10,7 +10,7 @@ See the LICENSE file for details. import platform from PySide6.QtGui import ( - QIcon + QIcon, QFont ) from PySide6.QtWidgets import ( QDialog, QApplication @@ -22,9 +22,9 @@ from PySide6.QtCore import ( from gui.ALVersionInfo import ( AL_VERSION, AL_COMMIT_SHA, AL_COMMIT_DATE, AL_BUILD_DATE ) -from gui.Ui_ALAboutDialog import Ui_ALAboutDialog +from gui.resources.ui.Ui_ALAboutDialog import Ui_ALAboutDialog -from gui import ALResource +from gui.resources import ALResource class ALAboutDialog(QDialog, Ui_ALAboutDialog): @@ -46,8 +46,11 @@ class ALAboutDialog(QDialog, Ui_ALAboutDialog): self.LogoIconLabel.setPixmap(QIcon(":/res/icon/icons/AutoLibrary_32x32.ico").pixmap(48, 48)) info_text = self.generateAboutText() - self.AboutInfoEdit.setHtml(info_text) - self.AboutInfoEdit.setTextInteractionFlags(Qt.TextBrowserInteraction) + self.AboutInfoBrowser.setHtml(info_text) + browser_font = self.AboutInfoBrowser.font() + browser_font.setFamily("Courier New") + self.AboutInfoBrowser.setFont(browser_font) + self.AboutInfoBrowser.setTextInteractionFlags(Qt.TextBrowserInteraction) def connectSignals( @@ -137,7 +140,7 @@ GitHub: - - - - Courier New - false - + + + QFrame::Shadow::Plain + + + Qt::ScrollBarPolicy::ScrollBarAlwaysOff + + + Qt::ScrollBarPolicy::ScrollBarAlwaysOff QTextEdit::LineWrapMode::NoWrap - + true - - Qt::TextInteractionFlag::TextBrowserInteraction + + true diff --git a/src/gui/ALConfigWidget.ui b/src/gui/resources/ui/ALConfigWidget.ui similarity index 100% rename from src/gui/ALConfigWidget.ui rename to src/gui/resources/ui/ALConfigWidget.ui diff --git a/src/gui/ALMainWindow.ui b/src/gui/resources/ui/ALMainWindow.ui similarity index 100% rename from src/gui/ALMainWindow.ui rename to src/gui/resources/ui/ALMainWindow.ui diff --git a/src/gui/ALTimerTaskAddDialog.ui b/src/gui/resources/ui/ALTimerTaskAddDialog.ui similarity index 100% rename from src/gui/ALTimerTaskAddDialog.ui rename to src/gui/resources/ui/ALTimerTaskAddDialog.ui diff --git a/src/gui/ALTimerTaskManageWidget.ui b/src/gui/resources/ui/ALTimerTaskManageWidget.ui similarity index 100% rename from src/gui/ALTimerTaskManageWidget.ui rename to src/gui/resources/ui/ALTimerTaskManageWidget.ui diff --git a/templates/configs/readme.md b/templates/configs/readme.md new file mode 100644 index 0000000..7e4a18f --- /dev/null +++ b/templates/configs/readme.md @@ -0,0 +1 @@ +This folder is used to store the template config files. \ No newline at end of file diff --git a/templates/configs/run.json b/templates/configs/run.json new file mode 100644 index 0000000..68ac232 --- /dev/null +++ b/templates/configs/run.json @@ -0,0 +1,18 @@ +{ + "library": { + "host_url": "http://10.1.20.7", + "login_url": "/login" + }, + "login": { + "auto_captcha": true, + "max_attempt": 3 + }, + "web_driver": { + "driver_type": "edge", + "driver_path": "", + "headless": false + }, + "mode": { + "run_mode": 1 + } +} \ No newline at end of file diff --git a/templates/configs/user.json b/templates/configs/user.json new file mode 100644 index 0000000..2c3f8bf --- /dev/null +++ b/templates/configs/user.json @@ -0,0 +1,3 @@ +{ + "groups": [] +} \ No newline at end of file diff --git a/templates/readme.md b/templates/readme.md new file mode 100644 index 0000000..f71cd55 --- /dev/null +++ b/templates/readme.md @@ -0,0 +1,6 @@ +This folder is used to store the template files. + +Directory structure: + + templates + |─── configs // template config files