diff --git a/install_desktop_integration.sh b/install_desktop_integration.sh new file mode 100755 index 0000000..4d5f6e5 --- /dev/null +++ b/install_desktop_integration.sh @@ -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." diff --git a/pyPhotoAlbum/icons/icon.png b/pyPhotoAlbum/icons/icon.png new file mode 100644 index 0000000..bd33f98 Binary files /dev/null and b/pyPhotoAlbum/icons/icon.png differ diff --git a/pyPhotoAlbum/main.py b/pyPhotoAlbum/main.py index f0bb659..a8ce8f0 100644 --- a/pyPhotoAlbum/main.py +++ b/pyPhotoAlbum/main.py @@ -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) diff --git a/pyphotoalbum.desktop b/pyphotoalbum.desktop new file mode 100644 index 0000000..16078ab --- /dev/null +++ b/pyphotoalbum.desktop @@ -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 diff --git a/pyproject.toml b/pyproject.toml index e1a1c15..801d11d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"]