Rename OSX->MacOS

This commit is contained in:
Etoh 2017-12-10 15:19:23 +00:00
parent 2618a0f527
commit bb53c2e77f
6 changed files with 28 additions and 28 deletions

View File

@ -181,8 +181,8 @@ MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=<SyncplayUpdateFile>\nANS_filename=${f
MPV_NEW_VERSION = False
VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
'--play-and-pause', '--start-time=0']
VLC_SLAVE_OSX_ARGS = ['--verbose=2', '--no-file-logging']
VLC_SLAVE_NONOSX_ARGS = ['--no-one-instance', '--no-one-instance-when-started-from-file']
VLC_SLAVE_MACOS_ARGS = ['--verbose=2', '--no-file-logging']
VLC_SLAVE_NONMACOS_ARGS = ['--no-one-instance', '--no-one-instance-when-started-from-file']
MPV_SUPERSEDE_IF_DUPLICATE_COMMANDS = ["no-osd set time-pos ", "loadfile "]
MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS = ["cycle pause"]
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_-]+)=(.+)$|^(Exiting)\.\.\. \((.+)\)$"
@ -228,6 +228,6 @@ PRIVATE_FILE_FIELDS = ["path"]
OS_WINDOWS = "win"
OS_LINUX = "linux"
OS_OSX = "darwin"
OS_MACOS = "darwin"
OS_BSD = "freebsd"
OS_DRAGONFLY = "dragonfly"

View File

@ -11,7 +11,7 @@ import asynchat, asyncore
import urllib
import time
from syncplay.messages import getMessage
from syncplay.utils import isBSD, isLinux, isWindows, isOSX
from syncplay.utils import isBSD, isLinux, isWindows, isMacOS
class VlcPlayer(BasePlayer):
speedSupported = True
@ -21,10 +21,10 @@ class VlcPlayer(BasePlayer):
RE_ANSWER = re.compile(constants.VLC_ANSWER_REGEX)
SLAVE_ARGS = constants.VLC_SLAVE_ARGS
if isOSX():
SLAVE_ARGS.extend(constants.VLC_SLAVE_OSX_ARGS)
if isMacOS():
SLAVE_ARGS.extend(constants.VLC_SLAVE_MACOS_ARGS)
else:
SLAVE_ARGS.extend(constants.VLC_SLAVE_NONOSX_ARGS)
SLAVE_ARGS.extend(constants.VLC_SLAVE_NONMACOS_ARGS)
vlcport = random.randrange(constants.VLC_MIN_PORT, constants.VLC_MAX_PORT) if (constants.VLC_MIN_PORT < constants.VLC_MAX_PORT) else constants.VLC_MIN_PORT
def __init__(self, client, playerPath, filePath, args):
@ -335,7 +335,7 @@ class VlcPlayer(BasePlayer):
if isLinux():
playerController.vlcIntfPath = "/usr/lib/vlc/lua/intf/"
playerController.vlcIntfUserPath = os.path.join(os.getenv('HOME', '.'), ".local/share/vlc/lua/intf/")
elif isOSX():
elif isMacOS():
playerController.vlcIntfPath = "/Applications/VLC.app/Contents/MacOS/share/lua/intf/"
playerController.vlcIntfUserPath = os.path.join(os.getenv('HOME', '.'), "Library/Application Support/org.videolan.vlc/lua/intf/")
elif isBSD():
@ -388,7 +388,7 @@ class VlcPlayer(BasePlayer):
playerController._client.ui.showErrorMessage(
getMessage("media-player-error").format(line), True)
break
if not isOSX():
if not isMacOS():
self.__process.stderr = None
else:
vlcoutputthread = threading.Thread(target = self.handle_vlcoutput, args=())

View File

@ -6,7 +6,7 @@ import ast
from syncplay import constants, utils, version, milestone
from syncplay.messages import getMessage, setLanguage, isValidLanguage
from syncplay.players.playerFactory import PlayerFactory
from syncplay.utils import isOSX
from syncplay.utils import isMacOS
import codecs
class InvalidConfigValue(Exception):
@ -412,7 +412,7 @@ class ConfigurationGetter(object):
if QCoreApplication.instance() is None:
self.app = QtWidgets.QApplication(sys.argv)
qt5reactor.install()
if isOSX():
if isMacOS():
import appnope
appnope.nope()
except ImportError:

View File

@ -12,7 +12,7 @@ import sys
import threading
from syncplay.messages import getMessage, getLanguages, setLanguage, getInitialLanguage
from syncplay import constants
from syncplay.utils import isBSD, isLinux, isWindows, isOSX
from syncplay.utils import isBSD, isLinux, isMacOS
from syncplay.utils import resourcespath, posixresourcespath
class GuiConfiguration:
def __init__(self, config, error=None, defaultConfig=None):
@ -241,7 +241,7 @@ class ConfigDialog(QtWidgets.QDialog):
defaultdirectory = os.environ["ProgramW6432"]
elif isLinux():
defaultdirectory = "/usr/bin"
elif isOSX():
elif isMacOS():
defaultdirectory = "/Applications/"
elif isBSD():
defaultdirectory = "/usr/local/bin"
@ -251,7 +251,7 @@ class ConfigDialog(QtWidgets.QDialog):
defaultdirectory,
browserfilter, "", options)
if fileName:
if isOSX() and fileName.endswith('.app'): # see GitHub issue #91
if isMacOS() and fileName.endswith('.app'): # see GitHub issue #91
# Mac OS X application bundles contain a Info.plist in the Contents subdirectory of the .app.
# This plist file includes the 'CFBundleExecutable' key, which specifies the name of the
# executable. I would have used plistlib here, but since the version of this library in

View File

@ -10,13 +10,13 @@ import sys
import time
import urllib
from datetime import datetime
from syncplay.utils import isLinux, isWindows, isOSX
from syncplay.utils import isLinux, isWindows, isMacOS
import re
import os
from syncplay.utils import formatTime, sameFilename, sameFilesize, sameFileduration, RoomPasswordProvider, formatSize, isURL
from functools import wraps
from twisted.internet import task
if isOSX() and IsPySide:
if isMacOS() and IsPySide:
from Foundation import NSURL
lastCheckedForUpdates = None
@ -87,7 +87,7 @@ class AboutDialog(QtWidgets.QDialog):
def __init__(self, parent=None):
super(AboutDialog, self).__init__(parent)
if isOSX():
if isMacOS():
self.setWindowTitle("")
else:
self.setWindowTitle(getMessage("about-dialog-title"))
@ -205,7 +205,7 @@ class MainWindow(QtWidgets.QMainWindow):
indexRow = window.playlist.count() if window.clearedPlaylistNote else 0
for url in urls[::-1]:
if isOSX() and IsPySide:
if isMacOS() and IsPySide:
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
else:
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
@ -310,7 +310,7 @@ class MainWindow(QtWidgets.QMainWindow):
if indexRow == -1:
indexRow = window.playlist.count()
for url in urls[::-1]:
if isOSX() and IsPySide:
if isMacOS() and IsPySide:
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
else:
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
@ -850,7 +850,7 @@ class MainWindow(QtWidgets.QMainWindow):
return
self.loadMediaBrowseSettings()
if isOSX() and IsPySide:
if isMacOS() and IsPySide:
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.DontUseNativeDialog)
else:
options = QtWidgets.QFileDialog.Options()
@ -878,7 +878,7 @@ class MainWindow(QtWidgets.QMainWindow):
return
self.loadMediaBrowseSettings()
if isOSX() and IsPySide:
if isMacOS() and IsPySide:
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.DontUseNativeDialog)
else:
options = QtWidgets.QFileDialog.Options()
@ -1029,7 +1029,7 @@ class MainWindow(QtWidgets.QMainWindow):
@needsClient
def openAddMediaDirectoryDialog(self, MediaDirectoriesTextbox, MediaDirectoriesDialog):
if isOSX() and IsPySide:
if isMacOS() and IsPySide:
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
else:
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.ShowDirsOnly)
@ -1430,7 +1430,7 @@ class MainWindow(QtWidgets.QMainWindow):
getMessage("update-menu-label"))
window.updateAction.triggered.connect(self.userCheckForUpdates)
if not isOSX():
if not isMacOS():
window.helpMenu.addSeparator()
window.about = window.helpMenu.addAction(QtGui.QPixmap(resourcespath + 'syncplay.png'),
getMessage("about-menu-label"))
@ -1439,7 +1439,7 @@ class MainWindow(QtWidgets.QMainWindow):
window.about.triggered.connect(self.openAbout)
window.menuBar.addMenu(window.helpMenu)
if not isOSX():
if not isMacOS():
window.mainLayout.setMenuBar(window.menuBar)
def openAbout(self):
@ -1575,7 +1575,7 @@ class MainWindow(QtWidgets.QMainWindow):
data = event.mimeData()
urls = data.urls()
if urls and urls[0].scheme() == 'file':
if isOSX() and IsPySide:
if isMacOS() and IsPySide:
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
else:
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
@ -1710,7 +1710,7 @@ class MainWindow(QtWidgets.QMainWindow):
self._syncplayClient = None
self.folderSearchEnabled = True
self.QtGui = QtGui
if isOSX():
if isMacOS():
self.setWindowFlags(self.windowFlags())
else:
self.setWindowFlags(self.windowFlags() & Qt.AA_DontUseNativeMenuBar)

View File

@ -23,8 +23,8 @@ def isWindows():
def isLinux():
return sys.platform.startswith(constants.OS_LINUX)
def isOSX():
return sys.platform.startswith(constants.OS_OSX)
def isMacOS():
return sys.platform.startswith(constants.OS_MACOS)
def isBSD():
return constants.OS_BSD in sys.platform or sys.platform.startswith(constants.OS_DRAGONFLY)