def make_title_label(title): title_font = QtGui.QFont() title_font.setBold(True) label = QtWidgets.QLabel(title) label.setFont(title_font) label.setAlignment(Qt.AlignCenter) return label
def on_actionAbout_triggered(self): try: from . import mc_version version = mc_version.version except ImportError: version = "devel version" d = QtWidgets.QDialog(self) d.setWindowTitle("About mesycontrol") license = QtWidgets.QTextBrowser(parent=d) license.setWindowFlags(Qt.Window) license.setWindowTitle("mesycontrol license") license.setText("") try: f = QtCore.QFile(":/gpl-notice.txt") if not f.open(QtCore.QIODevice.ReadOnly | QtCore.QIODevice.Text): return license.setPlainText(str(f.readAll(), 'utf-8')) finally: f.close() l = QtWidgets.QVBoxLayout(d) logo = QtWidgets.QLabel() logo.setPixmap( QtGui.QPixmap(":/mesytec-logo.png").scaledToWidth( 300, Qt.SmoothTransformation)) l.addWidget(logo) t = "mesycontrol - %s" % version label = QtWidgets.QLabel(t) font = label.font() font.setPointSize(15) font.setBold(True) label.setFont(font) l.addWidget(label) l.addWidget(QtWidgets.QLabel("Remote control for mesytec devices.")) l.addWidget(QtWidgets.QLabel("© 2014-2022 mesytec GmbH & Co. KG")) t = '<a href="mailto:[email protected]">[email protected]</a> - <a href="http://www.mesytec.com">www.mesytec.com</a>' label = QtWidgets.QLabel(t) label.setOpenExternalLinks(True) l.addWidget(label) t = 'Running on Python %s using PySide2 %s with Qt %s.' % ( platform.python_version(), PySide2.__version__, PySide2.QtCore.__version__) l.addWidget(QtWidgets.QLabel(t)) l.addSpacing(20) bl = QtWidgets.QHBoxLayout() def license_button_clicked(): sz = license.size() sz = sz.expandedTo(QtCore.QSize(500, 300)) license.resize(sz) license.show() license.raise_() b = QtWidgets.QPushButton("&License", clicked=license_button_clicked) bl.addWidget(b) b = QtWidgets.QPushButton("&Close", clicked=d.close) b.setAutoDefault(True) b.setDefault(True) bl.addWidget(b) l.addLayout(bl) for item in (l.itemAt(i) for i in range(l.count())): item.setAlignment(Qt.AlignHCenter) w = item.widget() if isinstance(w, QtWidgets.QLabel): w.setTextInteractionFlags(Qt.TextBrowserInteraction) d.exec_()