Add About dialog with license info on macOS
This commit is contained in:
parent
e298e88cdd
commit
39b346c884
@ -11,7 +11,7 @@ import syncplay
|
||||
|
||||
APP = ['syncplayClient.py']
|
||||
DATA_FILES = [
|
||||
('resources', glob('resources/*.png')),
|
||||
('resources', glob('resources/*.png') + glob('resources/*.txt')),
|
||||
]
|
||||
OPTIONS = {
|
||||
'iconfile':'resources/icon.icns',
|
||||
|
||||
1
resources/third-party-notices.txt
Normal file
1
resources/third-party-notices.txt
Normal file
@ -0,0 +1 @@
|
||||
Write here third party copyright notices.
|
||||
@ -86,6 +86,46 @@ class UserlistItemDelegate(QtGui.QStyledItemDelegate):
|
||||
optionQStyleOptionViewItem.rect.setX(optionQStyleOptionViewItem.rect.x()+16)
|
||||
QtGui.QStyledItemDelegate.paint(self, itemQPainter, optionQStyleOptionViewItem, indexQModelIndex)
|
||||
|
||||
class AboutDialog(QtGui.QDialog):
|
||||
if sys.platform.startswith('win'):
|
||||
resourcespath = utils.findWorkingDir() + u"\\resources\\"
|
||||
else:
|
||||
resourcespath = utils.findWorkingDir() + u"/resources/"
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super(AboutDialog, self).__init__(parent)
|
||||
self.setWindowTitle("")
|
||||
nameLabel = QtGui.QLabel("<center><strong>Syncplay</strong></center>")
|
||||
nameLabel.setFont(QtGui.QFont("Helvetica", 20))
|
||||
linkLabel = QtGui.QLabel("<center><a href=\"http://syncplay.pl\">syncplay.pl</a></center>")
|
||||
linkLabel.setOpenExternalLinks(True)
|
||||
versionLabel = QtGui.QLabel("<center>Version v" + version + "</center>")
|
||||
licenseLabel = QtGui.QLabel("<center><p>Copyright © 2017 Syncplay</p><p>Licensed under the Apache License, Version 2.0</p></center>")
|
||||
aboutIconPixmap = QtGui.QPixmap(self.resourcespath + u"syncplay.png")
|
||||
aboutIconLabel = QtGui.QLabel()
|
||||
aboutIconLabel.setPixmap(aboutIconPixmap.scaled(120, 120, Qt.KeepAspectRatio))
|
||||
aboutLayout = QtGui.QGridLayout()
|
||||
aboutLayout.addWidget(aboutIconLabel, 0, 0, 4, 2)
|
||||
aboutLayout.addWidget(nameLabel, 0, 2, 1, 2)
|
||||
aboutLayout.addWidget(linkLabel, 1, 2, 1, 2)
|
||||
aboutLayout.addWidget(versionLabel, 2, 2, 1, 2)
|
||||
aboutLayout.addWidget(licenseLabel, 3, 2, 1, 2)
|
||||
licenseButton = QtGui.QPushButton("License")
|
||||
licenseButton.clicked.connect(self.openLicense)
|
||||
aboutLayout.addWidget(licenseButton, 4, 2)
|
||||
dependenciesButton = QtGui.QPushButton("Dependencies")
|
||||
dependenciesButton.clicked.connect(self.openDependencies)
|
||||
aboutLayout.addWidget(dependenciesButton, 4, 3)
|
||||
aboutLayout.setSizeConstraint(QtGui.QLayout.SetFixedSize)
|
||||
self.setSizeGripEnabled(False)
|
||||
self.setLayout(aboutLayout)
|
||||
|
||||
def openLicense(self):
|
||||
QtGui.QDesktopServices.openUrl(QUrl("file://" + self.resourcespath + u"license.txt"))
|
||||
|
||||
def openDependencies(self):
|
||||
QtGui.QDesktopServices.openUrl(QUrl("file://" + self.resourcespath + u"third-party-notices.txt"))
|
||||
|
||||
class MainWindow(QtGui.QMainWindow):
|
||||
insertPosition = None
|
||||
playlistState = []
|
||||
@ -1376,15 +1416,8 @@ class MainWindow(QtGui.QMainWindow):
|
||||
window.mainLayout.setMenuBar(window.menuBar)
|
||||
|
||||
def openAbout(self):
|
||||
#AboutMsgBox = QtGui.QMessageBox.about(self,"Syncplay","Syncplay v" + version)
|
||||
AboutMsgBox = QtGui.QMessageBox(self)
|
||||
AboutMsgBox.setText("<center>Syncplay<br><small><a href=\"http://syncplay.pl\">syncplay.pl</a></center>")
|
||||
AboutMsgBox.setInformativeText("<center>Version v" + version + "<p>Copyright © 2017 Syncplay</p><p>Licensed under the Apache License, Version 2.0</p></center>")
|
||||
AboutIcon = QtGui.QPixmap(self.resourcespath + u"syncplay.png")
|
||||
AboutMsgBox.setIconPixmap(AboutIcon.scaled(120, 120))
|
||||
AboutMsgBox.setModal(True)
|
||||
AboutMsgBox.exec_()
|
||||
|
||||
aboutMsgBox = AboutDialog()
|
||||
aboutMsgBox.exec_()
|
||||
|
||||
def addMainFrame(self, window):
|
||||
window.mainFrame = QtGui.QFrame()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user