gui.dialogs.about_dialog

 1# Copyright (C) 2026  David Vaquero <pepesan@gmail.com>
 2#
 3# This program is free software: you can redistribute it and/or modify
 4# it under the terms of the GNU General Public License as published by
 5# the Free Software Foundation, either version 3 of the License, or
 6# (at your option) any later version.
 7#
 8# This program is distributed in the hope that it will be useful,
 9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program.  If not, see <https://www.gnu.org/licenses/>.
15
16from PySide6.QtWidgets import (
17    QDialog, QVBoxLayout, QHBoxLayout, QLabel, QPushButton,
18)
19from PySide6.QtCore import Qt
20
21from lib import __version__ as _VERSION, APPIMAGE_VARIANT
22from lib.i18n import _
23
24_AUTHOR   = 'David Vaquero'
25_REPO_URL = 'https://gitlab.com/pepesan/temario-app'
26_WEB_URL  = 'https://temario.app'
27
28
29class AboutDialog(QDialog):
30    def __init__(self, parent=None):
31        super().__init__(parent)
32        self.setWindowTitle(_('Acerca de Temario'))
33        self.setFixedWidth(360)
34        self.setModal(True)
35        self._build_ui()
36
37    def _build_ui(self) -> None:
38        layout = QVBoxLayout(self)
39        layout.setSpacing(10)
40        layout.setContentsMargins(24, 24, 24, 20)
41
42        title = QLabel('<b style="font-size:17px">Temario</b>')
43        title.setAlignment(Qt.AlignmentFlag.AlignCenter)
44        layout.addWidget(title)
45
46        ver = QLabel(f'v{_VERSION}')
47        ver.setObjectName('file_label')
48        ver.setAlignment(Qt.AlignmentFlag.AlignCenter)
49        layout.addWidget(ver)
50
51        if APPIMAGE_VARIANT == 'full':
52            variant_lbl = QLabel(_('AppImage · LibreOffice incluido'))
53            variant_lbl.setObjectName('file_label')
54            variant_lbl.setAlignment(Qt.AlignmentFlag.AlignCenter)
55            layout.addWidget(variant_lbl)
56        elif APPIMAGE_VARIANT == 'slim':
57            variant_lbl = QLabel(_('AppImage · requiere libreoffice del sistema'))
58            variant_lbl.setObjectName('file_label')
59            variant_lbl.setAlignment(Qt.AlignmentFlag.AlignCenter)
60            layout.addWidget(variant_lbl)
61
62        layout.addSpacing(6)
63
64        desc = QLabel(_('Generador de presentaciones ODP/PDF\na partir de ficheros YAML.'))
65        desc.setAlignment(Qt.AlignmentFlag.AlignCenter)
66        desc.setWordWrap(True)
67        layout.addWidget(desc)
68
69        layout.addSpacing(10)
70
71        for html in (
72            f'{_("Desarrollador:")} <b>{_AUTHOR}</b>',
73            f'<a href="{_REPO_URL}">{_("Repositorio GitLab")}</a>',
74            f'<a href="{_WEB_URL}">{_WEB_URL}</a>',
75        ):
76            lbl = QLabel(html)
77            lbl.setOpenExternalLinks(True)
78            lbl.setAlignment(Qt.AlignmentFlag.AlignCenter)
79            layout.addWidget(lbl)
80
81        layout.addSpacing(14)
82
83        btn = QPushButton(_('Cerrar'))
84        btn.setDefault(True)
85        btn.clicked.connect(self.accept)
86        hlay = QHBoxLayout()
87        hlay.addStretch()
88        hlay.addWidget(btn)
89        hlay.addStretch()
90        layout.addLayout(hlay)
class AboutDialog(PySide6.QtWidgets.QDialog):
30class AboutDialog(QDialog):
31    def __init__(self, parent=None):
32        super().__init__(parent)
33        self.setWindowTitle(_('Acerca de Temario'))
34        self.setFixedWidth(360)
35        self.setModal(True)
36        self._build_ui()
37
38    def _build_ui(self) -> None:
39        layout = QVBoxLayout(self)
40        layout.setSpacing(10)
41        layout.setContentsMargins(24, 24, 24, 20)
42
43        title = QLabel('<b style="font-size:17px">Temario</b>')
44        title.setAlignment(Qt.AlignmentFlag.AlignCenter)
45        layout.addWidget(title)
46
47        ver = QLabel(f'v{_VERSION}')
48        ver.setObjectName('file_label')
49        ver.setAlignment(Qt.AlignmentFlag.AlignCenter)
50        layout.addWidget(ver)
51
52        if APPIMAGE_VARIANT == 'full':
53            variant_lbl = QLabel(_('AppImage · LibreOffice incluido'))
54            variant_lbl.setObjectName('file_label')
55            variant_lbl.setAlignment(Qt.AlignmentFlag.AlignCenter)
56            layout.addWidget(variant_lbl)
57        elif APPIMAGE_VARIANT == 'slim':
58            variant_lbl = QLabel(_('AppImage · requiere libreoffice del sistema'))
59            variant_lbl.setObjectName('file_label')
60            variant_lbl.setAlignment(Qt.AlignmentFlag.AlignCenter)
61            layout.addWidget(variant_lbl)
62
63        layout.addSpacing(6)
64
65        desc = QLabel(_('Generador de presentaciones ODP/PDF\na partir de ficheros YAML.'))
66        desc.setAlignment(Qt.AlignmentFlag.AlignCenter)
67        desc.setWordWrap(True)
68        layout.addWidget(desc)
69
70        layout.addSpacing(10)
71
72        for html in (
73            f'{_("Desarrollador:")} <b>{_AUTHOR}</b>',
74            f'<a href="{_REPO_URL}">{_("Repositorio GitLab")}</a>',
75            f'<a href="{_WEB_URL}">{_WEB_URL}</a>',
76        ):
77            lbl = QLabel(html)
78            lbl.setOpenExternalLinks(True)
79            lbl.setAlignment(Qt.AlignmentFlag.AlignCenter)
80            layout.addWidget(lbl)
81
82        layout.addSpacing(14)
83
84        btn = QPushButton(_('Cerrar'))
85        btn.setDefault(True)
86        btn.clicked.connect(self.accept)
87        hlay = QHBoxLayout()
88        hlay.addStretch()
89        hlay.addWidget(btn)
90        hlay.addStretch()
91        layout.addLayout(hlay)

QDialog(self, /, parent: PySide6.QtWidgets.QWidget | None = None, f: PySide6.QtCore.Qt.WindowType = Default(Qt.WindowFlags), *, sizeGripEnabled: bool | None = None, modal: bool | None = None) -> None

AboutDialog(parent=None)
31    def __init__(self, parent=None):
32        super().__init__(parent)
33        self.setWindowTitle(_('Acerca de Temario'))
34        self.setFixedWidth(360)
35        self.setModal(True)
36        self._build_ui()
staticMetaObject = PySide6.QtCore.QMetaObject("AboutDialog" inherits "QDialog": )