fix: update asset path handling in MainWindow for improved compatibility with frozen applications

This commit is contained in:
Vxrtrauter
2026-02-11 01:55:03 +01:00
parent 375925e56c
commit a58cda7e8a
2 changed files with 20 additions and 9 deletions
+13 -3
View File
@@ -131,12 +131,9 @@ jobs:
run: | run: |
python -m nuitka \ python -m nuitka \
--onefile \ --onefile \
--onefile-no-compression \
--onefile-tempdir-spec="{CACHE_DIR}/${{ env.APP_NAME }}/${{ env.VERSION }}" \ --onefile-tempdir-spec="{CACHE_DIR}/${{ env.APP_NAME }}/${{ env.VERSION }}" \
--assume-yes-for-downloads \ --assume-yes-for-downloads \
--enable-plugin=pyside6 \ --enable-plugin=pyside6 \
--enable-plugin=upx \
--upx-binary="${{ env.UPX_BINARY }}" \
--include-data-dir=core/interface/assets=core/interface/assets \ --include-data-dir=core/interface/assets=core/interface/assets \
--include-data-files=build_info.json=build_info.json \ --include-data-files=build_info.json=build_info.json \
--include-data-files=build_info.json=core/build_info.json \ --include-data-files=build_info.json=core/build_info.json \
@@ -185,9 +182,16 @@ jobs:
chmod +x release/SoftwareManager-dev-*-linux release/SoftwareManager-dev-*-macos chmod +x release/SoftwareManager-dev-*-linux release/SoftwareManager-dev-*-macos
ls -la release/ ls -la release/
- name: Generate checksums
run: |
cd release
sha256sum * > SHA256SUMS.txt
cat SHA256SUMS.txt
- name: Generate release notes - name: Generate release notes
run: | run: |
SHORT_SHA="${{ needs.build.outputs.short_sha }}" SHORT_SHA="${{ needs.build.outputs.short_sha }}"
CHECKSUMS=$(cat release/SHA256SUMS.txt)
cat > release_notes.md << EOF cat > release_notes.md << EOF
## Development Build ## Development Build
@@ -200,6 +204,11 @@ jobs:
- Linux: \`SoftwareManager-dev-${SHORT_SHA}-linux\` - Linux: \`SoftwareManager-dev-${SHORT_SHA}-linux\`
- Windows: \`SoftwareManager-dev-${SHORT_SHA}-windows.exe\` - Windows: \`SoftwareManager-dev-${SHORT_SHA}-windows.exe\`
- macOS: \`SoftwareManager-dev-${SHORT_SHA}-macos\` - macOS: \`SoftwareManager-dev-${SHORT_SHA}-macos\`
### SHA-256 Checksums
\`\`\`
${CHECKSUMS}
\`\`\`
EOF EOF
cat release_notes.md cat release_notes.md
@@ -213,5 +222,6 @@ jobs:
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-linux release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-linux
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-windows.exe release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-windows.exe
release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-macos release/SoftwareManager-dev-${{ needs.build.outputs.short_sha }}-macos
release/SHA256SUMS.txt
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+7 -6
View File
@@ -73,15 +73,16 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.log_signal.connect(self._on_log_signal) self.log_signal.connect(self._on_log_signal)
def get_asset_path(filename): def get_asset_path(filename):
if getattr(sys, 'frozen', False): base_path = os.path.dirname(os.path.abspath(__file__))
base_path = sys._MEIPASS asset_path = os.path.join(base_path, 'assets', filename)
else:
base_path = os.path.dirname(__file__)
asset_path = os.path.join(base_path, 'core', 'interface', 'assets', filename)
if os.path.exists(asset_path): if os.path.exists(asset_path):
return asset_path return asset_path
if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
asset_path = os.path.join(sys._MEIPASS, 'core', 'interface', 'assets', filename)
if os.path.exists(asset_path):
return asset_path
return os.path.join('core', 'interface', 'assets', filename) return os.path.join('core', 'interface', 'assets', filename)
self.setWindowIcon(QIcon(get_asset_path("logo.png"))) self.setWindowIcon(QIcon(get_asset_path("logo.png")))