File: about.py

package info (click to toggle)
linux-show-player 0.5.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,896 kB
  • sloc: python: 12,408; sh: 154; makefile: 17; xml: 8
file content (159 lines) | stat: -rw-r--r-- 6,277 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# -*- coding: utf-8 -*-
#
# This file is part of Linux Show Player
#
# Copyright 2012-2016 Francesco Ceruti <ceppofrancy@gmail.com>
#
# Linux Show Player is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Linux Show Player is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Linux Show Player.  If not, see <http://www.gnu.org/licenses/>

from collections import OrderedDict

from PyQt5 import QtCore
from PyQt5.QtCore import Qt, QT_TRANSLATE_NOOP
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QDialog, QGridLayout, QLabel, QWidget, QTabWidget, \
    QTextBrowser, QDialogButtonBox

import lisp
from lisp.ui.ui_utils import translate


class About(QDialog):
    LICENSE = '''
    <p>
    Linux Show Player is free software: you can redistribute it and/or<br />
    modify it under the terms of the GNU General Public License as published by<br />
    the Free Software Foundation, either version 3 of the License, or<br />
    (at your option) any later version.<br />
    <br />
    Linux Show Player is distributed in the hope that it will be useful,<br />
    but WITHOUT ANY WARRANTY; without even the implied warranty of<br />
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the<br />
    GNU General Public License for more details.
    </p>
    '''

    DESCRIPTION = QT_TRANSLATE_NOOP('AboutDialog',
        'Linux Show Player is a cue-player designed for stage productions.')
    WEB_SITE = 'https://www.linux-show-player.org/'
    USER_GROUP = 'https://gitter.im/linux-show-player/linux-show-player'
    SOURCE_CODE = 'https://github.com/FrancescoCeruti/linux-show-player'

    CONTRIBUTORS = OrderedDict({
        QT_TRANSLATE_NOOP('About', 'Authors'): [
            ('Francesco Ceruti', 'ceppofrancy@gmail.com')
        ],
        QT_TRANSLATE_NOOP('About', 'Contributors'): [
            ('Yinameah', 'https://github.com/Yinameah'),
            ('nodiscc', 'https://github.com/nodiscc'),
            ('Thomas Achtner', 'info@offtools.de')
        ],
        QT_TRANSLATE_NOOP('About', 'Translators'): [
            ('aroomthedoomed', 'https://github.com/aroomthedoomed'),
            ('fri', 'https://www.transifex.com/user/profile/fri'),
            ('Luis García-Tornel', 'tornel@gmail.com'),
            ('miharix', 'https://github.com/miharix'),
            ('Olivier Humbert - français', 'trebmuh@tuxfamily.org'),
            ('Santiago Benejam Torres', 'sbenejam@gmail.com')
        ],
    })

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.setWindowModality(QtCore.Qt.ApplicationModal)
        self.setWindowTitle(translate('About', 'About Linux Show Player'))
        self.setMaximumSize(500, 420)
        self.setMinimumSize(500, 420)
        self.resize(500, 420)

        self.setLayout(QGridLayout())

        self.iconLabel = QLabel(self)
        self.iconLabel.setPixmap(
            QIcon.fromTheme('linux-show-player').pixmap(100, 100))
        self.layout().addWidget(self.iconLabel, 0, 0)

        self.shortInfo = QLabel(self)
        self.shortInfo.setAlignment(Qt.AlignCenter)
        self.shortInfo.setText('<h2>Linux Show Player   {0}</h2>'
                               'Copyright © Francesco Ceruti'
                               .format(str(lisp.__version__)))
        self.layout().addWidget(self.shortInfo, 0, 1)

        self.layout().addWidget(QWidget(), 1, 0, 1, 2)

        # Information tabs
        self.tabWidget = QTabWidget(self)
        self.layout().addWidget(self.tabWidget, 2, 0, 1, 2)

        self.info = QTextBrowser(self)
        self.info.setOpenExternalLinks(True)
        self.info.setHtml('''
            <center><br />{0}<br /><br />
            <a href="{1}">{2}</a><br />
            <a href="{3}">{4}</a><br />
            <a href="{5}">{6}</a><br /><center>'''.format(
            translate('AboutDialog', self.DESCRIPTION),
            self.WEB_SITE, translate('AboutDialog', 'Web site'),
            self.USER_GROUP, translate('AboutDialog', 'Users  group'),
            self.SOURCE_CODE, translate('AboutDialog', 'Source code'))
        )
        self.tabWidget.addTab(self.info, translate('AboutDialog', 'Info'))

        self.license = QTextBrowser(self)
        self.license.setOpenExternalLinks(True)
        self.license.setHtml(self.LICENSE)
        self.tabWidget.addTab(self.license, translate('AboutDialog', 'License'))

        self.contributors = QTextBrowser(self)
        self.contributors.setOpenExternalLinks(True)

        self.contributors.setHtml(self.__contributors())
        self.tabWidget.addTab(self.contributors,
                              translate('AboutDialog', 'Contributors'))

        # Ok button
        self.buttons = QDialogButtonBox(QDialogButtonBox.Ok)
        self.buttons.accepted.connect(self.accept)
        self.layout().addWidget(self.buttons, 3, 1)

        self.layout().setColumnStretch(0, 1)
        self.layout().setColumnStretch(1, 3)

        self.layout().setRowStretch(0, 6)
        self.layout().setRowStretch(1, 1)
        self.layout().setRowStretch(2, 16)
        self.layout().setRowStretch(3, 3)

        self.buttons.setFocus()

    def __contributors(self):
        text = ''
        for section, people in self.CONTRIBUTORS.items():
            text += '<u><b>{0}:</b></u><br />'.format(translate('About',
                                                                section))

            for person in people:
                text += person[0]
                if '://' in person[1]:
                    text += ' - <a href="{0}">{1}</a>'.format(
                        person[1], person[1][person[1].index('://')+3:])
                elif person[1]:
                    text += ' - <a href="mailto:{0}">{0}</a>'.format(person[1])
                text += '<br />'

            text += '<br />'

        return text