adding application icon
All checks were successful
Python CI / test (push) Successful in 58s
Lint / lint (push) Successful in 1m3s
Tests / test (3.10) (push) Successful in 45s
Tests / test (3.11) (push) Successful in 41s
Tests / test (3.9) (push) Successful in 43s

This commit is contained in:
Duncan Tourolle 2025-10-25 09:02:36 +02:00
parent 4735a78b5d
commit ea4afadf54
5 changed files with 66 additions and 1 deletions

25
install_desktop_integration.sh Executable file
View File

@ -0,0 +1,25 @@
#!/bin/bash
# Install desktop integration files for pyPhotoAlbum
# Create directories if they don't exist
mkdir -p ~/.local/share/applications
mkdir -p ~/.local/share/icons/hicolor/256x256/apps
# Copy desktop file
cp pyphotoalbum.desktop ~/.local/share/applications/
# Copy icon
cp pyPhotoAlbum/icons/icon.png ~/.local/share/icons/hicolor/256x256/apps/pyphotoalbum.png
# Update desktop database
if command -v update-desktop-database &> /dev/null; then
update-desktop-database ~/.local/share/applications
fi
# Update icon cache
if command -v gtk-update-icon-cache &> /dev/null; then
gtk-update-icon-cache ~/.local/share/icons/hicolor/
fi
echo "Desktop integration installed!"
echo "You may need to restart the application for changes to take effect."

BIN
pyPhotoAlbum/icons/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 KiB

View File

@ -6,11 +6,13 @@ This version uses the mixin architecture with auto-generated ribbon configuratio
"""
import sys
from pathlib import Path
from PyQt6.QtWidgets import (
QApplication, QMainWindow, QVBoxLayout, QWidget,
QStatusBar
)
from PyQt6.QtCore import Qt
from PyQt6.QtGui import QIcon
from pyPhotoAlbum.project import Project
from pyPhotoAlbum.template_manager import TemplateManager
@ -80,6 +82,15 @@ class MainWindow(
self.setWindowTitle("pyPhotoAlbum")
self.resize(1200, 800)
# Set window icon
icon_path = Path(__file__).parent / "icons" / "icon.png"
print(f"Window icon path: {icon_path}")
print(f"Icon exists: {icon_path.exists()}")
if icon_path.exists():
icon = QIcon(str(icon_path))
print(f"Icon is null: {icon.isNull()}")
self.setWindowIcon(icon)
# Create main widget with layout
main_widget = QWidget()
main_layout = QVBoxLayout()
@ -163,6 +174,20 @@ def main():
"""Application entry point"""
app = QApplication(sys.argv)
# Set application identity for proper taskbar/window manager integration
app.setApplicationName("pyPhotoAlbum")
app.setApplicationDisplayName("pyPhotoAlbum")
app.setDesktopFileName("pyphotoalbum.desktop")
# Set application icon
icon_path = Path(__file__).parent / "icons" / "icon.png"
print(f"Application icon path: {icon_path}")
print(f"Icon exists: {icon_path.exists()}")
if icon_path.exists():
icon = QIcon(str(icon_path))
print(f"Icon is null: {icon.isNull()}")
app.setWindowIcon(icon)
# Enable high DPI scaling
try:
app.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling, True)

11
pyphotoalbum.desktop Normal file
View File

@ -0,0 +1,11 @@
[Desktop Entry]
Type=Application
Name=pyPhotoAlbum
GenericName=Photo Album Designer
Comment=Design photo albums and export them to PDF
Exec=pyphotoalbum
Icon=pyphotoalbum
Terminal=false
Categories=Graphics;Photography;Qt;
Keywords=photo;album;pdf;design;layout;
StartupWMClass=pyPhotoAlbum

View File

@ -56,7 +56,11 @@ where = ["."]
include = ["pyPhotoAlbum*"]
[tool.setuptools.package-data]
pyPhotoAlbum = ["templates/*.json"]
pyPhotoAlbum = ["templates/*.json", "icons/*.png"]
# Desktop integration files (for Linux)
# Note: The .desktop file should be installed to ~/.local/share/applications or /usr/share/applications
# The icon should be installed to appropriate icon theme directories
[tool.pytest.ini_options]
testpaths = ["tests"]