Source code for radioviz.views.about_dialog

#  Copyright 2025–2026 European Union
#  Author: Bulgheroni Antonio (antonio.bulgheroni@ec.europa.eu)
#  SPDX-License-Identifier: EUPL-1.2
"""
About dialog for RadioViz application.

This module provides a dialog that displays version information, copyright,
and other details about the RadioViz application.
"""

from datetime import datetime
from pathlib import Path
from typing import Optional

from PySide6.QtCore import Qt
from PySide6.QtGui import QPixmap
from PySide6.QtWidgets import QDialog, QHBoxLayout, QLabel, QPushButton, QVBoxLayout, QWidget

from radioviz.__about__ import __initial_development__, __version__


[docs] class AboutDialog(QDialog): """ Dialog displaying information about the RadioViz application. This dialog shows the application logo, version information, copyright details, author information, and licensing information. :param parent: The parent widget :type parent: QWidget or None """ def __init__(self, parent: Optional[QWidget] = None) -> None: """ Initialize the About dialog with application information. Creates a dialog with application logo, version information, copyright notice, author details, and license information. """ super().__init__(parent) self.setWindowTitle('About RadioViz') self.setMinimumWidth(500) # Copyright year logic initial_year = __initial_development__ # The initial copyright year current_year = datetime.now().year # Format copyright year based on whether current year is different from initial if current_year > initial_year: copyright_year = f'{initial_year} - {current_year}' else: copyright_year = str(initial_year) # Main layout main_layout = QVBoxLayout() self.setLayout(main_layout) # Top section with icon and title top_layout = QHBoxLayout() # Icon icon_path = Path(__file__).parent.parent / 'resources' / 'radioviz-logo-trasp.ico' icon_label = QLabel() if icon_path.exists(): pixmap = QPixmap(str(icon_path)) icon_label.setPixmap(pixmap.scaled(64, 64, Qt.AspectRatioMode.KeepAspectRatio)) top_layout.addWidget(icon_label) # Title and version title_layout = QVBoxLayout() title_label = QLabel('<h1>RadioViz</h1>') version_label = QLabel(f'Version {__version__}') title_layout.addWidget(title_label) title_layout.addWidget(version_label) top_layout.addLayout(title_layout) main_layout.addLayout(top_layout) # Description description_label = QLabel('<p>A tool to display and manipulate autoradiography grayscale images</p>') main_layout.addWidget(description_label) # Copyright and author info copyright_label = QLabel(f'Copyright © {copyright_year} European Union') author_label = QLabel('Author: Antonio Bulgheroni (antonio.bulgheroni@ec.europa.eu)') license_label = QLabel( 'License: <a href="https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12">EUPL-1.2</a>' ) license_label.setOpenExternalLinks(True) source_code_label = QLabel('Source code: <a href="https://code.europa.eu/kada/radioviz">GitLab</a>') source_code_label.setOpenExternalLinks(True) main_layout.addWidget(copyright_label) main_layout.addWidget(author_label) main_layout.addWidget(license_label) main_layout.addWidget(source_code_label) # OK button button_layout = QHBoxLayout() ok_button = QPushButton('OK') ok_button.clicked.connect(self.accept) button_layout.addStretch() button_layout.addWidget(ok_button) main_layout.addLayout(button_layout)