Pack Syncplay in a single .app file for macOS distribution
This commit is contained in:
parent
65e51c201d
commit
214fa45759
32
buildPy2app.py
Normal file
32
buildPy2app.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
"""
|
||||||
|
This is a setup.py script generated by py2applet
|
||||||
|
|
||||||
|
Usage:
|
||||||
|
python setup.py py2app
|
||||||
|
"""
|
||||||
|
|
||||||
|
from setuptools import setup
|
||||||
|
from glob import glob
|
||||||
|
import syncplay
|
||||||
|
|
||||||
|
APP = ['syncplayClient.py']
|
||||||
|
DATA_FILES = [
|
||||||
|
('resources', glob('resources/*.png')),
|
||||||
|
]
|
||||||
|
OPTIONS = {
|
||||||
|
'iconfile':'resources/icon.icns',
|
||||||
|
'plist': {
|
||||||
|
'CFBundleName':'Syncplay',
|
||||||
|
'CFBundleShortVersionString':syncplay.version,
|
||||||
|
'CFBundleIdentifier':'pl.syncplay.Syncplay',
|
||||||
|
'NSHumanReadableCopyright': '@ 2017 Syncplay All Rights Reserved'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setup(
|
||||||
|
app=APP,
|
||||||
|
name='Syncplay',
|
||||||
|
data_files=DATA_FILES,
|
||||||
|
options={'py2app': OPTIONS},
|
||||||
|
setup_requires=['py2app'],
|
||||||
|
)
|
||||||
BIN
resources/icon.icns
Normal file
BIN
resources/icon.icns
Normal file
Binary file not shown.
@ -1342,6 +1342,10 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
# Help menu
|
# Help menu
|
||||||
|
|
||||||
window.helpMenu = QtGui.QMenu(getMessage("help-menu-label"), self)
|
window.helpMenu = QtGui.QMenu(getMessage("help-menu-label"), self)
|
||||||
|
if sys.platform.startswith('darwin'):
|
||||||
|
window.about = window.helpMenu.addAction("&About")
|
||||||
|
window.about.triggered.connect(self.openAbout)
|
||||||
|
|
||||||
window.userguideAction = window.helpMenu.addAction(QtGui.QIcon(self.resourcespath + 'help.png'),
|
window.userguideAction = window.helpMenu.addAction(QtGui.QIcon(self.resourcespath + 'help.png'),
|
||||||
getMessage("userguide-menu-label"))
|
getMessage("userguide-menu-label"))
|
||||||
window.userguideAction.triggered.connect(self.openUserGuide)
|
window.userguideAction.triggered.connect(self.openUserGuide)
|
||||||
@ -1353,6 +1357,15 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
if not sys.platform.startswith('darwin'):
|
if not sys.platform.startswith('darwin'):
|
||||||
window.mainLayout.setMenuBar(window.menuBar)
|
window.mainLayout.setMenuBar(window.menuBar)
|
||||||
|
|
||||||
|
def openAbout(self):
|
||||||
|
AboutMsgBox = QtGui.QMessageBox.about(self,"Syncplay","Syncplay v" + version)
|
||||||
|
# AboutMsgBox = QtGui.QMessageBox()
|
||||||
|
# AboutMsgBox.setText("Test text")
|
||||||
|
# AboutMsgBox.setStandardButtons(0)
|
||||||
|
# AboutMsgBox.setModal(True)
|
||||||
|
# AboutMsgBox.exec_()
|
||||||
|
|
||||||
|
|
||||||
def addMainFrame(self, window):
|
def addMainFrame(self, window):
|
||||||
window.mainFrame = QtGui.QFrame()
|
window.mainFrame = QtGui.QFrame()
|
||||||
window.mainFrame.setLineWidth(0)
|
window.mainFrame.setLineWidth(0)
|
||||||
@ -1618,7 +1631,10 @@ class MainWindow(QtGui.QMainWindow):
|
|||||||
self.resourcespath = utils.findWorkingDir() + u"\\resources\\"
|
self.resourcespath = utils.findWorkingDir() + u"\\resources\\"
|
||||||
else:
|
else:
|
||||||
self.resourcespath = utils.findWorkingDir() + u"/resources/"
|
self.resourcespath = utils.findWorkingDir() + u"/resources/"
|
||||||
self.setWindowFlags(self.windowFlags() & Qt.AA_DontUseNativeMenuBar)
|
if sys.platform.startswith('darwin'):
|
||||||
|
self.setWindowFlags(self.windowFlags())
|
||||||
|
else:
|
||||||
|
self.setWindowFlags(self.windowFlags() & Qt.AA_DontUseNativeMenuBar)
|
||||||
self.setWindowTitle("Syncplay v" + version)
|
self.setWindowTitle("Syncplay v" + version)
|
||||||
self.mainLayout = QtGui.QVBoxLayout()
|
self.mainLayout = QtGui.QVBoxLayout()
|
||||||
self.addTopLayout(self)
|
self.addTopLayout(self)
|
||||||
|
|||||||
@ -124,6 +124,8 @@ def findWorkingDir():
|
|||||||
path = os.path.dirname(os.path.dirname(__file__))
|
path = os.path.dirname(os.path.dirname(__file__))
|
||||||
elif frozen in ('dll', 'console_exe', 'windows_exe'):
|
elif frozen in ('dll', 'console_exe', 'windows_exe'):
|
||||||
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
|
||||||
|
elif frozen in ('macosx_app'):
|
||||||
|
path = os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(__file__)))))
|
||||||
else:
|
else:
|
||||||
path = ""
|
path = ""
|
||||||
return path
|
return path
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user