add about dialog

This commit is contained in:
Jan Grewe 2025-01-22 22:20:41 +01:00
parent 12287df477
commit b89d73c26c

View File

@ -0,0 +1,51 @@
import os
from PySide6.QtGui import QPixmap
from PySide6.QtWidgets import QDialog, QDialogButtonBox, QLabel, QVBoxLayout, QWidget
from PySide6.QtCore import Qt
class AboutDialog(QDialog):
def __init__(self, parent=None) -> None:
super().__init__(parent=parent)
self.setModal(True)
about = About(self)
self.setLayout(QVBoxLayout())
self.layout().addWidget(about)
bbox = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok)
bbox.accepted.connect(self.accept)
self.layout().addWidget(bbox)
class About(QWidget):
def __init__(self, parent=None) -> None:
super().__init__(parent=parent)
self.setLayout(QVBoxLayout())
heading = QLabel("FixTracks")
font = heading.font()
font.setPointSize(18)
font.setBold(True)
heading.setFont(font)
heading.setAlignment(Qt.AlignCenter)
subheading = QLabel("Tools to fix some tracking problems.\nby Jan Grewe@bendalab")
subheading.setAlignment(Qt.AlignCenter)
nix_link = QLabel("https://neuroetho.uni-tuebingen.de")
nix_link.setOpenExternalLinks(True)
nix_link.setAlignment(Qt.AlignCenter)
iconlabel = QLabel()
pixmap = QPixmap(":/icons/logo")
s = pixmap.size()
new_height = int(s.height() * 300/s.width())
pixmap = pixmap.scaled(300, new_height, Qt.KeepAspectRatio, Qt.FastTransformation)
iconlabel.setPixmap(pixmap)
iconlabel.setMaximumWidth(300)
iconlabel.setAlignment(Qt.AlignCenter)
iconlabel.setScaledContents(True)
self.layout().addWidget(heading)
self.layout().addWidget(subheading)
self.layout().addWidget(iconlabel)
self.layout().addWidget(nix_link)