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

chore(*): 重构项目文件目录结构

- 将 src/gui 目录下的 Qt 资源文件移动到 src/gui/resources 目录下
- 将 src/gui 目录下的 Qt UI 设计文件移动到 src/gui/resources/ui 目录下
- 将 src/gui/icons 目录下的图标文件移动到 src/gui/resources/icons 目录下
- 将 src/gui/translators 目录下移动到 src/gui/resources/translators 目录下
- 将 src/gui/configs 目录移动到 templates 目录下
- 将 document, driver, model 目录重命名为 manuals, drivers, models
- 由于上述目录移动和重命名,相应的更改了代码和批处理脚本中的文件路径
This commit is contained in:
2026-02-11 20:00:51 +08:00
parent eda16f01f1
commit ce14be2555
36 changed files with 107 additions and 80 deletions
+14 -14
View File
@@ -94,13 +94,13 @@ jobs:
exit 1 exit 1
} }
if (-not (Test-Path "model")) { if (-not (Test-Path "models")) {
New-Item -ItemType Directory -Path "model" | Out-Null New-Item -ItemType Directory -Path "models" | Out-Null
Write-Host "✓ Created model directory" Write-Host "✓ Created models directory"
} }
$onnxSource = Join-Path $ddddocrPath "common.onnx" $onnxSource = Join-Path $ddddocrPath "common.onnx"
$onnxDest = "model/common.onnx" $onnxDest = "models/common.onnx"
if (Test-Path $onnxSource) { if (Test-Path $onnxSource) {
Copy-Item $onnxSource $onnxDest -Force Copy-Item $onnxSource $onnxDest -Force
Write-Host "✓ Copied ONNX model from: $onnxSource" Write-Host "✓ Copied ONNX model from: $onnxSource"
@@ -119,18 +119,18 @@ jobs:
} }
shell: pwsh shell: pwsh
- name: Compile Qt UI files
run: |
cd src/gui/batchs
./compile_ui.bat
shell: cmd
- name: Compile Qt Resource files - name: Compile Qt Resource files
run: | run: |
cd src/gui/batchs cd batchs
./compile_rc.bat ./compile_rc.bat
shell: cmd shell: cmd
- name: Compile Qt UI files
run: |
cd batchs
./compile_ui.bat
shell: cmd
- name: Generate 'Main.spec' - name: Generate 'Main.spec'
run: | run: |
$version = "${{ steps.get_version.outputs.VERSION }}" $version = "${{ steps.get_version.outputs.VERSION }}"
@@ -148,8 +148,8 @@ jobs:
" pathex=[]," " pathex=[],"
" binaries=[]," " binaries=[],"
" datas=[" " datas=["
" ('model\\common.onnx', 'ddddocr')," " ('models\\common.onnx', 'ddddocr'),"
" ('src\\gui\\icons\\AutoLibrary_32x32.ico', 'gui\\icons')," " ('src\\gui\\resources\\icons\\AutoLibrary_32x32.ico', 'gui\\resources\\icons'),"
" ]," " ],"
" hiddenimports=[]," " hiddenimports=[],"
" hookspath=[]," " hookspath=[],"
@@ -180,7 +180,7 @@ jobs:
" target_arch=None," " target_arch=None,"
" codesign_identity=None," " codesign_identity=None,"
" entitlements_file=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 $specLines | Out-File -FilePath "Main.spec" -Encoding UTF8
+11 -8
View File
@@ -6,13 +6,16 @@
__pycache__/ __pycache__/
build/ build/
dist/ dist/
model/*.*
!model/*.md models/*.*
driver/*.* drivers/*.*
!driver/*.md !models/*.md
src/gui/configs/*.json !drivers/*.md
src/gui/translators/qtbase_zh_CN.qm !templates/*.md
src/gui/ALResource.py !templates/configs/*.md
src/gui/Ui_*.py
src/gui/resources/ui/Ui_*.py
src/gui/resources/translators/qtbase_zh_CN.qm
src/gui/resources/ALResource.py
Main.spec Main.spec
@@ -2,7 +2,7 @@
chcp 65001 >nul chcp 65001 >nul
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
cd /d "%~dp0.." cd src/gui/resources
echo [AutoLibrary compile] 检查翻译文件... echo [AutoLibrary compile] 检查翻译文件...
if exist translators ( if exist translators (
@@ -18,12 +18,11 @@ if exist translators (
pyside6-lrelease "%%f" pyside6-lrelease "%%f"
if !errorlevel! equ 0 ( if !errorlevel! equ 0 (
echo [AutoLibrary compile] 翻译文件 "%%f" 编译成功,输出文件: "!qm_filename!" echo [AutoLibrary compile] 翻译文件 "%%f" 编译成功,输出文件: "!qm_filename!"
) else ( ) else (
echo [AutoLibrary compile] 翻译文件 "%%f" 编译失败 echo [AutoLibrary compile] 翻译文件 "%%f" 编译失败
) )
) )
echo.
) else ( ) else (
echo [AutoLibrary compile] 未找到任何 .ts 翻译文件 echo [AutoLibrary compile] 未找到任何 .ts 翻译文件
) )
@@ -52,11 +51,10 @@ for %%f in (*.qrc) do (
pyside6-rcc "%%f" -o "!output_file!" pyside6-rcc "%%f" -o "!output_file!"
if !errorlevel! equ 0 ( if !errorlevel! equ 0 (
echo [AutoLibrary compile] 文件 "%%f" 编译成功,输出文件: "!output_file!" echo [AutoLibrary compile] 文件 "%%f" 编译成功,输出文件: "!output_file!"
) else ( ) else (
echo [AutoLibrary compile] 文件 "%%f" 编译失败 echo [AutoLibrary compile] 文件 "%%f" 编译失败
) )
echo.
) )
echo [AutoLibrary compile] 所有操作完成。 echo [AutoLibrary compile] 所有操作完成。
@@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PARENT_DIR="$(dirname "$SCRIPT_DIR")"
cd "$PARENT_DIR" cd "$SCRIPT_DIR/src/gui/resources"
echo "[AutoLibrary compile] 检查翻译文件..." echo "[AutoLibrary compile] 检查翻译文件..."
if [ -d "translators" ]; then if [ -d "translators" ]; then
@@ -10,7 +10,6 @@ if [ -d "translators" ]; then
ts_files=(*.ts) ts_files=(*.ts)
ts_count=${#ts_files[@]} ts_count=${#ts_files[@]}
# 如果第一个元素是"*.ts"(表示没有匹配),则数量为0
if [ "$ts_count" -eq 1 ] && [ "${ts_files[0]}" = "*.ts" ]; then if [ "$ts_count" -eq 1 ] && [ "${ts_files[0]}" = "*.ts" ]; then
ts_count=0 ts_count=0
fi fi
@@ -23,12 +22,11 @@ if [ -d "translators" ]; then
echo "[AutoLibrary compile] 正在编译翻译文件: \"$file\" -> \"$qm_file\"" echo "[AutoLibrary compile] 正在编译翻译文件: \"$file\" -> \"$qm_file\""
if pyside6-lrelease "$file"; then if pyside6-lrelease "$file"; then
echo "[AutoLibrary compile] 翻译文件 \"$file\" 编译成功,输出文件: \"$qm_file\"" echo "[AutoLibrary compile] 翻译文件 \"$file\" 编译成功,输出文件: \"$qm_file\""
else else
echo "[AutoLibrary compile] 翻译文件 \"$file\" 编译失败" echo "[AutoLibrary compile] 翻译文件 \"$file\" 编译失败"
fi fi
done done
echo
else else
echo "[AutoLibrary compile] 未找到任何 .ts 翻译文件" echo "[AutoLibrary compile] 未找到任何 .ts 翻译文件"
fi fi
@@ -36,7 +34,6 @@ if [ -d "translators" ]; then
else else
echo "[AutoLibrary compile] 未找到 translators 目录" echo "[AutoLibrary compile] 未找到 translators 目录"
fi fi
echo
file_count=$(ls *.qrc 2>/dev/null | wc -l) file_count=$(ls *.qrc 2>/dev/null | wc -l)
@@ -46,7 +43,6 @@ if [ $file_count -eq 0 ]; then
fi fi
echo "[AutoLibrary compile] 找到 $file_count 个 .qrc 文件,开始编译..." echo "[AutoLibrary compile] 找到 $file_count 个 .qrc 文件,开始编译..."
echo
for file in *.qrc; do for file in *.qrc; do
base_name=$(basename "$file" .qrc) base_name=$(basename "$file" .qrc)
@@ -54,11 +50,10 @@ for file in *.qrc; do
echo "[AutoLibrary compile] 正在编译: \"$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 compile] 文件 \"$file\" 编译成功,输出文件: \"$output_file\"" echo "[AutoLibrary compile] 文件 \"$file\" 编译成功,输出文件: \"$output_file\""
else else
echo "[AutoLibrary compile] 文件 \"$file\" 编译失败" echo "[AutoLibrary compile] 文件 \"$file\" 编译失败"
fi fi
echo
done done
echo "[AutoLibrary compile] 所有操作完成。" echo "[AutoLibrary compile] 所有操作完成。"
@@ -2,7 +2,7 @@
chcp 65001 >nul chcp 65001 >nul
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
cd /d "%~dp0.." cd src/gui/resources/ui
set count=0 set count=0
for %%f in (*.ui) do set /a count+=1 for %%f in (*.ui) do set /a count+=1
@@ -23,11 +23,10 @@ for %%f in (*.ui) do (
pyside6-uic "%%f" -o "!output_file!" pyside6-uic "%%f" -o "!output_file!"
if !errorlevel! equ 0 ( if !errorlevel! equ 0 (
echo [AutoLibrary compile] 文件 "%%f" 编译成功,输出文件: "!output_file!" echo [AutoLibrary compile] 文件 "%%f" 编译成功,输出文件: "!output_file!"
) else ( ) else (
echo [AutoLibrary compile] 文件 "%%f" 编译失败 echo [AutoLibrary compile] 文件 "%%f" 编译失败
) )
echo.
) )
echo [AutoLibrary compile] 所有操作完成。 echo [AutoLibrary compile] 所有操作完成。
@@ -1,8 +1,8 @@
#!/bin/bash #!/bin/bash
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" 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) file_count=$(ls *.ui 2>/dev/null | wc -l)
@@ -12,7 +12,6 @@ if [ $file_count -eq 0 ]; then
fi fi
echo "[AutoLibrary compile] 找到 $file_count 个 .ui 文件,开始编译..." echo "[AutoLibrary compile] 找到 $file_count 个 .ui 文件,开始编译..."
echo
for file in *.ui; do for file in *.ui; do
base_name=$(basename "$file" .ui) base_name=$(basename "$file" .ui)
@@ -20,11 +19,10 @@ for file in *.ui; do
echo "[AutoLibrary compile] 正在编译: \"$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 compile] 文件 \"$file\" 编译成功,输出文件: \"$output_file\"" echo "[AutoLibrary compile] 文件 \"$file\" 编译成功,输出文件: \"$output_file\""
else else
echo "[AutoLibrary compile] 文件 \"$file\" 编译失败" echo "[AutoLibrary compile] 文件 \"$file\" 编译失败"
fi fi
echo
done done
echo "[AutoLibrary compile] 所有操作完成。" echo "[AutoLibrary compile] 所有操作完成。"
+1
View File
@@ -0,0 +1 @@
This folder is used to store the batch scripts.
-1
View File
@@ -1 +0,0 @@
For more infomation, please visit our website: https://www.autolibrary.top
-1
View File
@@ -1 +0,0 @@
This folder is used to store the browser driver using by selenium.
+1
View File
@@ -0,0 +1 @@
This folder is used to store the browser drivers using by selenium.
+3
View File
@@ -0,0 +1,3 @@
This folder is used to store the manuals.
Our manuals are available at https://www.autolibrary.top/manuals
-1
View File
@@ -1 +0,0 @@
This folder is used to store the model using by ddddocr.
+1
View File
@@ -0,0 +1 @@
This folder is used to store the models using by ddddocr.
+2 -2
View File
@@ -2,7 +2,7 @@
# AutoLibrary # 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) [![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) ![License](https://img.shields.io/github/license/KenanZhu/AutoLibrary)
@@ -40,7 +40,7 @@
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` 目录下运行 `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 的资源文件。 4. 在上一步相同目录内运行 `compile_rc.bat` linux 和 macOS 系统使用 `compile_rc.sh` 文件来编译 Qt 的资源文件。
5. 待上述步骤完成后,运行 `src/Main.py` 文件即可。 5. 待上述步骤完成后,运行 `src/Main.py` 文件即可。
+1 -1
View File
@@ -13,7 +13,7 @@ from PySide6.QtCore import QTranslator
from PySide6.QtWidgets import QApplication from PySide6.QtWidgets import QApplication
from gui.ALMainWindow import ALMainWindow from gui.ALMainWindow import ALMainWindow
from gui import ALResource from gui.resources import ALResource
def main(): def main():
+9 -6
View File
@@ -10,7 +10,7 @@ See the LICENSE file for details.
import platform import platform
from PySide6.QtGui import ( from PySide6.QtGui import (
QIcon QIcon, QFont
) )
from PySide6.QtWidgets import ( from PySide6.QtWidgets import (
QDialog, QApplication QDialog, QApplication
@@ -22,9 +22,9 @@ from PySide6.QtCore import (
from gui.ALVersionInfo import ( from gui.ALVersionInfo import (
AL_VERSION, AL_COMMIT_SHA, AL_COMMIT_DATE, AL_BUILD_DATE 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): 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)) self.LogoIconLabel.setPixmap(QIcon(":/res/icon/icons/AutoLibrary_32x32.ico").pixmap(48, 48))
info_text = self.generateAboutText() info_text = self.generateAboutText()
self.AboutInfoEdit.setHtml(info_text) self.AboutInfoBrowser.setHtml(info_text)
self.AboutInfoEdit.setTextInteractionFlags(Qt.TextBrowserInteraction) browser_font = self.AboutInfoBrowser.font()
browser_font.setFamily("Courier New")
self.AboutInfoBrowser.setFont(browser_font)
self.AboutInfoBrowser.setTextInteractionFlags(Qt.TextBrowserInteraction)
def connectSignals( def connectSignals(
@@ -137,7 +140,7 @@ GitHub: <a href="https://www.github.com/KenanZhu" style="text-decoration: none;"
self self
): ):
about_text = self.AboutInfoEdit.toPlainText() about_text = self.AboutInfoBrowser.toPlainText()
clipboard = QApplication.clipboard() clipboard = QApplication.clipboard()
clipboard.setText(about_text) clipboard.setText(about_text)
original_text = self.CopyButton.text() original_text = self.CopyButton.text()
+1 -1
View File
@@ -21,7 +21,7 @@ from PySide6.QtGui import (
QCloseEvent, QAction QCloseEvent, QAction
) )
from gui.Ui_ALConfigWidget import Ui_ALConfigWidget from gui.resources.ui.Ui_ALConfigWidget import Ui_ALConfigWidget
from gui.ALSeatMapSelectDialog import ALSeatMapSelectDialog from gui.ALSeatMapSelectDialog import ALSeatMapSelectDialog
from gui.ALSeatMapTable import ALSeatMapTable from gui.ALSeatMapTable import ALSeatMapTable
from gui.ALUserTreeWidget import ALUserTreeWidget, ALUserTreeItemType from gui.ALUserTreeWidget import ALUserTreeWidget, ALUserTreeItemType
+2 -2
View File
@@ -23,13 +23,13 @@ from PySide6.QtGui import (
from base.MsgBase import MsgBase from base.MsgBase import MsgBase
from gui.Ui_ALMainWindow import Ui_ALMainWindow from gui.resources.ui.Ui_ALMainWindow import Ui_ALMainWindow
from gui.ALConfigWidget import ALConfigWidget from gui.ALConfigWidget import ALConfigWidget
from gui.ALTimerTaskManageWidget import ALTimerTaskManageWidget from gui.ALTimerTaskManageWidget import ALTimerTaskManageWidget
from gui.ALAboutDialog import ALAboutDialog from gui.ALAboutDialog import ALAboutDialog
from gui.ALMainWorkers import TimerTaskWorker, AutoLibWorker from gui.ALMainWorkers import TimerTaskWorker, AutoLibWorker
from gui import ALResource from gui.resources import ALResource
class ALMainWindow(MsgBase, QMainWindow, Ui_ALMainWindow): class ALMainWindow(MsgBase, QMainWindow, Ui_ALMainWindow):
+1 -1
View File
@@ -20,7 +20,7 @@ from PySide6.QtWidgets import (
QHBoxLayout, QGridLayout, QDateTimeEdit QHBoxLayout, QGridLayout, QDateTimeEdit
) )
from gui.Ui_ALTimerTaskAddDialog import Ui_ALTimerTaskAddDialog from gui.resources.ui.Ui_ALTimerTaskAddDialog import Ui_ALTimerTaskAddDialog
class ALTimerTaskStatus(Enum): class ALTimerTaskStatus(Enum):
+2 -3
View File
@@ -24,7 +24,7 @@ from PySide6.QtGui import (
QCloseEvent QCloseEvent
) )
from gui.Ui_ALTimerTaskManageWidget import Ui_ALTimerTaskManageWidget from gui.resources.ui.Ui_ALTimerTaskManageWidget import Ui_ALTimerTaskManageWidget
from gui.ALTimerTaskAddDialog import ALTimerTaskAddDialog, ALTimerTaskStatus from gui.ALTimerTaskAddDialog import ALTimerTaskAddDialog, ALTimerTaskStatus
from utils.ConfigReader import ConfigReader from utils.ConfigReader import ConfigReader
@@ -146,7 +146,6 @@ class ALTimerTaskManageWidget(QWidget, Ui_ALTimerTaskManageWidget):
): ):
super().__init__(parent) super().__init__(parent)
self.__timer_tasks = [] self.__timer_tasks = []
self.__check_timer = None self.__check_timer = None
self.__sort_policy = self.SortPolicy.BY_EXECUTE_TIME self.__sort_policy = self.SortPolicy.BY_EXECUTE_TIME
@@ -157,7 +156,7 @@ class ALTimerTaskManageWidget(QWidget, Ui_ALTimerTaskManageWidget):
self.connectSignals() self.connectSignals()
self.setupTimer() self.setupTimer()
if not self.initializeTimerTasks(): if not self.initializeTimerTasks():
return raise Exception("定时任务配置文件初始化失败 !")
def connectSignals( def connectSignals(
-1
View File
@@ -1 +0,0 @@
this folder is used to store the batch scripts.
-1
View File
@@ -1 +0,0 @@
this folder is used to store the config files.

Before

Width:  |  Height:  |  Size: 785 KiB

After

Width:  |  Height:  |  Size: 785 KiB

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

@@ -129,21 +129,24 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTextEdit" name="AboutInfoEdit"> <widget class="QTextBrowser" name="AboutInfoBrowser">
<property name="font"> <property name="frameShadow">
<font> <enum>QFrame::Shadow::Plain</enum>
<family>Courier New</family> </property>
<bold>false</bold> <property name="verticalScrollBarPolicy">
</font> <enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property>
<property name="horizontalScrollBarPolicy">
<enum>Qt::ScrollBarPolicy::ScrollBarAlwaysOff</enum>
</property> </property>
<property name="lineWrapMode"> <property name="lineWrapMode">
<enum>QTextEdit::LineWrapMode::NoWrap</enum> <enum>QTextEdit::LineWrapMode::NoWrap</enum>
</property> </property>
<property name="readOnly"> <property name="openExternalLinks">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="textInteractionFlags"> <property name="openLinks">
<set>Qt::TextInteractionFlag::TextBrowserInteraction</set> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
+1
View File
@@ -0,0 +1 @@
This folder is used to store the template config files.
+18
View File
@@ -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
}
}
+3
View File
@@ -0,0 +1,3 @@
{
"groups": []
}
+6
View File
@@ -0,0 +1,6 @@
This folder is used to store the template files.
Directory structure:
templates
|─── configs // template config files