diff --git a/.gitignore b/.gitignore index 4845697..3163496 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ __pycache__/ *.pyc *.pyo .venv/ +.build-venv/ venv/ *.egg-info/ dist/ @@ -12,3 +13,10 @@ build/ *~ *.csv *_frames/ +# 打包产物(不进仓库) +*.deb +*.tar.gz +# Flatpak 和 deb 里的大二进制文件 +packaging/deb/actuator-reader/usr/bin/ +packaging/flatpak/actuator-reader +packaging/flatpak/*.png diff --git a/actuator-reader.spec b/actuator-reader.spec new file mode 100644 index 0000000..9e76faf --- /dev/null +++ b/actuator-reader.spec @@ -0,0 +1,43 @@ +# -*- mode: python ; coding: utf-8 -*- + +a = Analysis( + ['main.py'], + pathex=[], + binaries=[], + datas=[], + hiddenimports=[ + 'cv2', + 'numpy', + 'PyQt6.QtCore', + 'PyQt6.QtGui', + 'PyQt6.QtWidgets', + ], + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + noarchive=False, +) + +pyz = PYZ(a.pure) + +exe = EXE( + pyz, + a.scripts, + a.binaries, + a.datas, + [], + name='actuator-reader', + debug=False, + bootloader_ignore_signals=False, + strip=False, + upx=True, + upx_exclude=[], + runtime_tmpdir=None, + console=False, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, +) diff --git a/build-release.sh b/build-release.sh new file mode 100644 index 0000000..640987e --- /dev/null +++ b/build-release.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash +# 构建所有平台的发布包 +set -e + +VERSION="1.0.0" +ROOT="$(cd "$(dirname "$0")" && pwd)" +DIST="$ROOT/dist" + +echo "=== Building Actuator Reader v$VERSION ===" + +# 1. PyInstaller Linux binary +echo "[1/3] Building Linux binary..." +cd "$ROOT" +if [ ! -d .build-venv ]; then + python3 -m venv .build-venv + .build-venv/bin/pip install pyinstaller opencv-python numpy PyQt6 +fi +.build-venv/bin/pyinstaller --clean --noconfirm actuator-reader.spec + +# 2. DEB package +echo "[2/3] Building .deb package..." +rm -rf packaging/deb/actuator-reader/usr/bin/actuator-reader +cp "$DIST/actuator-reader" packaging/deb/actuator-reader/usr/bin/ +cd packaging/deb +dpkg-deb --build --root-owner-group actuator-reader "actuator-reader_${VERSION}_amd64.deb" +cp "actuator-reader_${VERSION}_amd64.deb" "$DIST/" +cd "$ROOT" + +# 3. Flatpak bundle (manifest + binary) +echo "[3/3] Preparing Flatpak..." +cp "$DIST/actuator-reader" packaging/flatpak/ +cd packaging/flatpak +tar czf "$DIST/actuator-reader-${VERSION}-flatpak-sources.tar.gz" \ + actuator-reader \ + top.qyhhh.actuator-reader.yml \ + top.qyhhh.actuator-reader.desktop \ + top.qyhhh.actuator-reader.png \ + top.qyhhh.actuator-reader.metainfo.xml +cd "$ROOT" + +echo "" +echo "=== Done ===" +echo "Linux binary: dist/actuator-reader" +echo "DEB package: dist/actuator-reader_${VERSION}_amd64.deb" +echo "Flatpak sources: dist/actuator-reader-${VERSION}-flatpak-sources.tar.gz" +echo "Windows: packaging/windows/build.bat (在 Windows 上运行)" diff --git a/packaging/deb/actuator-reader/DEBIAN/control b/packaging/deb/actuator-reader/DEBIAN/control new file mode 100644 index 0000000..e6f9789 --- /dev/null +++ b/packaging/deb/actuator-reader/DEBIAN/control @@ -0,0 +1,11 @@ +Package: actuator-reader +Version: 1.0.0 +Section: science +Priority: optional +Architecture: amd64 +Depends: libc6 (>= 2.28), libgl1, libglib2.0-0, libxcb-cursor0 +Maintainer: Newbie +Description: 制动器角度读取工具 + 读取视频中的制动器弯曲角度。 + 手动点击标记点 O(圆心)、M(初始尾端)、M2(当前尾端), + 计算偏离角 ∠M2-O-M,支持逐帧测量、方向矫正、CSV 导出。 diff --git a/packaging/deb/actuator-reader/usr/share/applications/actuator-reader.desktop b/packaging/deb/actuator-reader/usr/share/applications/actuator-reader.desktop new file mode 100644 index 0000000..fb22d61 --- /dev/null +++ b/packaging/deb/actuator-reader/usr/share/applications/actuator-reader.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Type=Application +Name=Actuator Reader +Name[zh_CN]=制动器角度读取 +Comment=Brake actuator angle measurement tool +Comment[zh_CN]=制动器弯曲角度测量工具 +Exec=actuator-reader +Icon=actuator-reader +Terminal=false +Categories=Science;Engineering; diff --git a/packaging/deb/actuator-reader/usr/share/icons/hicolor/256x256/apps/actuator-reader.png b/packaging/deb/actuator-reader/usr/share/icons/hicolor/256x256/apps/actuator-reader.png new file mode 100644 index 0000000..cf56bf5 Binary files /dev/null and b/packaging/deb/actuator-reader/usr/share/icons/hicolor/256x256/apps/actuator-reader.png differ diff --git a/packaging/flatpak/top.qyhhh.actuator-reader.desktop b/packaging/flatpak/top.qyhhh.actuator-reader.desktop new file mode 100644 index 0000000..46590c1 --- /dev/null +++ b/packaging/flatpak/top.qyhhh.actuator-reader.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=Actuator Reader +Comment=Brake actuator angle measurement tool +Exec=actuator-reader +Icon=top.qyhhh.actuator-reader +Terminal=false +Categories=Science;Engineering; diff --git a/packaging/flatpak/top.qyhhh.actuator-reader.metainfo.xml b/packaging/flatpak/top.qyhhh.actuator-reader.metainfo.xml new file mode 100644 index 0000000..416bf5b --- /dev/null +++ b/packaging/flatpak/top.qyhhh.actuator-reader.metainfo.xml @@ -0,0 +1,20 @@ + + + top.qyhhh.actuator-reader + MIT + MIT + Actuator Reader + 制动器角度读取 + Brake actuator angle measurement tool + 制动器弯曲角度测量工具 + +

Read actuator bending angles from video. Click marker points O (center), + M (initial tip), M2 (current tip) to measure deviation angle ∠M2-O-M.

+

从视频中读取制动器弯曲角度。点击标记点 O(圆心)、 + M(初始尾端)、M2(当前尾端),计算偏离角 ∠M2-O-M。

+
+ https://git.qyhhh.top/newbie/Actuators + + + +
diff --git a/packaging/flatpak/top.qyhhh.actuator-reader.yml b/packaging/flatpak/top.qyhhh.actuator-reader.yml new file mode 100644 index 0000000..9ec698e --- /dev/null +++ b/packaging/flatpak/top.qyhhh.actuator-reader.yml @@ -0,0 +1,30 @@ +app-id: top.qyhhh.actuator-reader +runtime: org.kde.Platform +runtime-version: "6.7" +sdk: org.kde.Sdk +command: actuator-reader +finish-args: + - --socket=wayland + - --socket=fallback-x11 + - --socket=pulseaudio + - --share=ipc + - --device=dri + - --filesystem=host + +modules: + - name: actuator-reader + buildsystem: simple + build-commands: + - install -Dm755 actuator-reader /app/bin/actuator-reader + - install -Dm644 top.qyhhh.actuator-reader.desktop /app/share/applications/top.qyhhh.actuator-reader.desktop + - install -Dm644 top.qyhhh.actuator-reader.png /app/share/icons/hicolor/256x256/apps/top.qyhhh.actuator-reader.png + - install -Dm644 top.qyhhh.actuator-reader.metainfo.xml /app/share/metainfo/top.qyhhh.actuator-reader.metainfo.xml + sources: + - type: file + path: actuator-reader + - type: file + path: top.qyhhh.actuator-reader.desktop + - type: file + path: top.qyhhh.actuator-reader.png + - type: file + path: top.qyhhh.actuator-reader.metainfo.xml diff --git a/packaging/windows/build.bat b/packaging/windows/build.bat new file mode 100644 index 0000000..bcb767b --- /dev/null +++ b/packaging/windows/build.bat @@ -0,0 +1,15 @@ +:: Windows 打包脚本 — 在 Windows 上运行 +:: 前提:安装 Python 3.10+,然后 pip install pyinstaller opencv-python numpy PyQt6 + +pyinstaller --clean --noconfirm ^ + --name "actuator-reader" ^ + --windowed ^ + --hidden-import cv2 ^ + --hidden-import numpy ^ + --hidden-import PyQt6.QtCore ^ + --hidden-import PyQt6.QtGui ^ + --hidden-import PyQt6.QtWidgets ^ + main.py + +echo Build complete: dist\actuator-reader.exe +pause