diff --git a/buildPy2app.py b/buildPy2app.py new file mode 100644 index 0000000..5cc8ccb --- /dev/null +++ b/buildPy2app.py @@ -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'], +) diff --git a/resources/icon.icns b/resources/icon.icns new file mode 100644 index 0000000..10fb766 Binary files /dev/null and b/resources/icon.icns differ diff --git a/syncplay/ui/gui.py b/syncplay/ui/gui.py index 4250d6f..fa0b075 100644 --- a/syncplay/ui/gui.py +++ b/syncplay/ui/gui.py @@ -1342,6 +1342,10 @@ class MainWindow(QtGui.QMainWindow): # Help menu 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'), getMessage("userguide-menu-label")) window.userguideAction.triggered.connect(self.openUserGuide) @@ -1353,6 +1357,15 @@ class MainWindow(QtGui.QMainWindow): if not sys.platform.startswith('darwin'): 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): window.mainFrame = QtGui.QFrame() window.mainFrame.setLineWidth(0) @@ -1618,7 +1631,10 @@ class MainWindow(QtGui.QMainWindow): self.resourcespath = utils.findWorkingDir() + u"\\resources\\" else: 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.mainLayout = QtGui.QVBoxLayout() self.addTopLayout(self) diff --git a/syncplay/utils.py b/syncplay/utils.py index 1857127..5b8cbb4 100644 --- a/syncplay/utils.py +++ b/syncplay/utils.py @@ -124,6 +124,8 @@ def findWorkingDir(): path = os.path.dirname(os.path.dirname(__file__)) elif frozen in ('dll', 'console_exe', 'windows_exe'): 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: path = "" return path