Rename OSX->MacOS
This commit is contained in:
parent
2618a0f527
commit
bb53c2e77f
@ -181,8 +181,8 @@ MPV_SLAVE_ARGS_NEW = ['--term-playing-msg=<SyncplayUpdateFile>\nANS_filename=${f
|
|||||||
MPV_NEW_VERSION = False
|
MPV_NEW_VERSION = False
|
||||||
VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
|
VLC_SLAVE_ARGS = ['--extraintf=luaintf', '--lua-intf=syncplay', '--no-quiet', '--no-input-fast-seek',
|
||||||
'--play-and-pause', '--start-time=0']
|
'--play-and-pause', '--start-time=0']
|
||||||
VLC_SLAVE_OSX_ARGS = ['--verbose=2', '--no-file-logging']
|
VLC_SLAVE_MACOS_ARGS = ['--verbose=2', '--no-file-logging']
|
||||||
VLC_SLAVE_NONOSX_ARGS = ['--no-one-instance', '--no-one-instance-when-started-from-file']
|
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_SUPERSEDE_IF_DUPLICATE_COMMANDS = ["no-osd set time-pos ", "loadfile "]
|
||||||
MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS = ["cycle pause"]
|
MPV_REMOVE_BOTH_IF_DUPLICATE_COMMANDS = ["cycle pause"]
|
||||||
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_-]+)=(.+)$|^(Exiting)\.\.\. \((.+)\)$"
|
MPLAYER_ANSWER_REGEX = "^ANS_([a-zA-Z_-]+)=(.+)$|^(Exiting)\.\.\. \((.+)\)$"
|
||||||
@ -228,6 +228,6 @@ PRIVATE_FILE_FIELDS = ["path"]
|
|||||||
|
|
||||||
OS_WINDOWS = "win"
|
OS_WINDOWS = "win"
|
||||||
OS_LINUX = "linux"
|
OS_LINUX = "linux"
|
||||||
OS_OSX = "darwin"
|
OS_MACOS = "darwin"
|
||||||
OS_BSD = "freebsd"
|
OS_BSD = "freebsd"
|
||||||
OS_DRAGONFLY = "dragonfly"
|
OS_DRAGONFLY = "dragonfly"
|
||||||
@ -11,7 +11,7 @@ import asynchat, asyncore
|
|||||||
import urllib
|
import urllib
|
||||||
import time
|
import time
|
||||||
from syncplay.messages import getMessage
|
from syncplay.messages import getMessage
|
||||||
from syncplay.utils import isBSD, isLinux, isWindows, isOSX
|
from syncplay.utils import isBSD, isLinux, isWindows, isMacOS
|
||||||
|
|
||||||
class VlcPlayer(BasePlayer):
|
class VlcPlayer(BasePlayer):
|
||||||
speedSupported = True
|
speedSupported = True
|
||||||
@ -21,10 +21,10 @@ class VlcPlayer(BasePlayer):
|
|||||||
|
|
||||||
RE_ANSWER = re.compile(constants.VLC_ANSWER_REGEX)
|
RE_ANSWER = re.compile(constants.VLC_ANSWER_REGEX)
|
||||||
SLAVE_ARGS = constants.VLC_SLAVE_ARGS
|
SLAVE_ARGS = constants.VLC_SLAVE_ARGS
|
||||||
if isOSX():
|
if isMacOS():
|
||||||
SLAVE_ARGS.extend(constants.VLC_SLAVE_OSX_ARGS)
|
SLAVE_ARGS.extend(constants.VLC_SLAVE_MACOS_ARGS)
|
||||||
else:
|
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
|
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):
|
def __init__(self, client, playerPath, filePath, args):
|
||||||
@ -335,7 +335,7 @@ class VlcPlayer(BasePlayer):
|
|||||||
if isLinux():
|
if isLinux():
|
||||||
playerController.vlcIntfPath = "/usr/lib/vlc/lua/intf/"
|
playerController.vlcIntfPath = "/usr/lib/vlc/lua/intf/"
|
||||||
playerController.vlcIntfUserPath = os.path.join(os.getenv('HOME', '.'), ".local/share/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.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/")
|
playerController.vlcIntfUserPath = os.path.join(os.getenv('HOME', '.'), "Library/Application Support/org.videolan.vlc/lua/intf/")
|
||||||
elif isBSD():
|
elif isBSD():
|
||||||
@ -388,7 +388,7 @@ class VlcPlayer(BasePlayer):
|
|||||||
playerController._client.ui.showErrorMessage(
|
playerController._client.ui.showErrorMessage(
|
||||||
getMessage("media-player-error").format(line), True)
|
getMessage("media-player-error").format(line), True)
|
||||||
break
|
break
|
||||||
if not isOSX():
|
if not isMacOS():
|
||||||
self.__process.stderr = None
|
self.__process.stderr = None
|
||||||
else:
|
else:
|
||||||
vlcoutputthread = threading.Thread(target = self.handle_vlcoutput, args=())
|
vlcoutputthread = threading.Thread(target = self.handle_vlcoutput, args=())
|
||||||
|
|||||||
@ -6,7 +6,7 @@ import ast
|
|||||||
from syncplay import constants, utils, version, milestone
|
from syncplay import constants, utils, version, milestone
|
||||||
from syncplay.messages import getMessage, setLanguage, isValidLanguage
|
from syncplay.messages import getMessage, setLanguage, isValidLanguage
|
||||||
from syncplay.players.playerFactory import PlayerFactory
|
from syncplay.players.playerFactory import PlayerFactory
|
||||||
from syncplay.utils import isOSX
|
from syncplay.utils import isMacOS
|
||||||
import codecs
|
import codecs
|
||||||
|
|
||||||
class InvalidConfigValue(Exception):
|
class InvalidConfigValue(Exception):
|
||||||
@ -412,7 +412,7 @@ class ConfigurationGetter(object):
|
|||||||
if QCoreApplication.instance() is None:
|
if QCoreApplication.instance() is None:
|
||||||
self.app = QtWidgets.QApplication(sys.argv)
|
self.app = QtWidgets.QApplication(sys.argv)
|
||||||
qt5reactor.install()
|
qt5reactor.install()
|
||||||
if isOSX():
|
if isMacOS():
|
||||||
import appnope
|
import appnope
|
||||||
appnope.nope()
|
appnope.nope()
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import sys
|
|||||||
import threading
|
import threading
|
||||||
from syncplay.messages import getMessage, getLanguages, setLanguage, getInitialLanguage
|
from syncplay.messages import getMessage, getLanguages, setLanguage, getInitialLanguage
|
||||||
from syncplay import constants
|
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
|
from syncplay.utils import resourcespath, posixresourcespath
|
||||||
class GuiConfiguration:
|
class GuiConfiguration:
|
||||||
def __init__(self, config, error=None, defaultConfig=None):
|
def __init__(self, config, error=None, defaultConfig=None):
|
||||||
@ -241,7 +241,7 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
defaultdirectory = os.environ["ProgramW6432"]
|
defaultdirectory = os.environ["ProgramW6432"]
|
||||||
elif isLinux():
|
elif isLinux():
|
||||||
defaultdirectory = "/usr/bin"
|
defaultdirectory = "/usr/bin"
|
||||||
elif isOSX():
|
elif isMacOS():
|
||||||
defaultdirectory = "/Applications/"
|
defaultdirectory = "/Applications/"
|
||||||
elif isBSD():
|
elif isBSD():
|
||||||
defaultdirectory = "/usr/local/bin"
|
defaultdirectory = "/usr/local/bin"
|
||||||
@ -251,7 +251,7 @@ class ConfigDialog(QtWidgets.QDialog):
|
|||||||
defaultdirectory,
|
defaultdirectory,
|
||||||
browserfilter, "", options)
|
browserfilter, "", options)
|
||||||
if fileName:
|
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.
|
# 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
|
# 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
|
# executable. I would have used plistlib here, but since the version of this library in
|
||||||
|
|||||||
@ -10,13 +10,13 @@ import sys
|
|||||||
import time
|
import time
|
||||||
import urllib
|
import urllib
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from syncplay.utils import isLinux, isWindows, isOSX
|
from syncplay.utils import isLinux, isWindows, isMacOS
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
from syncplay.utils import formatTime, sameFilename, sameFilesize, sameFileduration, RoomPasswordProvider, formatSize, isURL
|
from syncplay.utils import formatTime, sameFilename, sameFilesize, sameFileduration, RoomPasswordProvider, formatSize, isURL
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from twisted.internet import task
|
from twisted.internet import task
|
||||||
if isOSX() and IsPySide:
|
if isMacOS() and IsPySide:
|
||||||
from Foundation import NSURL
|
from Foundation import NSURL
|
||||||
lastCheckedForUpdates = None
|
lastCheckedForUpdates = None
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ class AboutDialog(QtWidgets.QDialog):
|
|||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super(AboutDialog, self).__init__(parent)
|
super(AboutDialog, self).__init__(parent)
|
||||||
if isOSX():
|
if isMacOS():
|
||||||
self.setWindowTitle("")
|
self.setWindowTitle("")
|
||||||
else:
|
else:
|
||||||
self.setWindowTitle(getMessage("about-dialog-title"))
|
self.setWindowTitle(getMessage("about-dialog-title"))
|
||||||
@ -205,7 +205,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
indexRow = window.playlist.count() if window.clearedPlaylistNote else 0
|
indexRow = window.playlist.count() if window.clearedPlaylistNote else 0
|
||||||
|
|
||||||
for url in urls[::-1]:
|
for url in urls[::-1]:
|
||||||
if isOSX() and IsPySide:
|
if isMacOS() and IsPySide:
|
||||||
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
|
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
|
||||||
else:
|
else:
|
||||||
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
|
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
|
||||||
@ -310,7 +310,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
if indexRow == -1:
|
if indexRow == -1:
|
||||||
indexRow = window.playlist.count()
|
indexRow = window.playlist.count()
|
||||||
for url in urls[::-1]:
|
for url in urls[::-1]:
|
||||||
if isOSX() and IsPySide:
|
if isMacOS() and IsPySide:
|
||||||
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
|
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
|
||||||
else:
|
else:
|
||||||
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
|
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
|
||||||
@ -850,7 +850,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self.loadMediaBrowseSettings()
|
self.loadMediaBrowseSettings()
|
||||||
if isOSX() and IsPySide:
|
if isMacOS() and IsPySide:
|
||||||
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.DontUseNativeDialog)
|
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.DontUseNativeDialog)
|
||||||
else:
|
else:
|
||||||
options = QtWidgets.QFileDialog.Options()
|
options = QtWidgets.QFileDialog.Options()
|
||||||
@ -878,7 +878,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
return
|
return
|
||||||
|
|
||||||
self.loadMediaBrowseSettings()
|
self.loadMediaBrowseSettings()
|
||||||
if isOSX() and IsPySide:
|
if isMacOS() and IsPySide:
|
||||||
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.DontUseNativeDialog)
|
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.DontUseNativeDialog)
|
||||||
else:
|
else:
|
||||||
options = QtWidgets.QFileDialog.Options()
|
options = QtWidgets.QFileDialog.Options()
|
||||||
@ -1029,7 +1029,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
|
|
||||||
@needsClient
|
@needsClient
|
||||||
def openAddMediaDirectoryDialog(self, MediaDirectoriesTextbox, MediaDirectoriesDialog):
|
def openAddMediaDirectoryDialog(self, MediaDirectoriesTextbox, MediaDirectoriesDialog):
|
||||||
if isOSX() and IsPySide:
|
if isMacOS() and IsPySide:
|
||||||
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
|
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog)
|
||||||
else:
|
else:
|
||||||
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.ShowDirsOnly)
|
options = QtWidgets.QFileDialog.Options(QtWidgets.QFileDialog.ShowDirsOnly)
|
||||||
@ -1430,7 +1430,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
getMessage("update-menu-label"))
|
getMessage("update-menu-label"))
|
||||||
window.updateAction.triggered.connect(self.userCheckForUpdates)
|
window.updateAction.triggered.connect(self.userCheckForUpdates)
|
||||||
|
|
||||||
if not isOSX():
|
if not isMacOS():
|
||||||
window.helpMenu.addSeparator()
|
window.helpMenu.addSeparator()
|
||||||
window.about = window.helpMenu.addAction(QtGui.QPixmap(resourcespath + 'syncplay.png'),
|
window.about = window.helpMenu.addAction(QtGui.QPixmap(resourcespath + 'syncplay.png'),
|
||||||
getMessage("about-menu-label"))
|
getMessage("about-menu-label"))
|
||||||
@ -1439,7 +1439,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
window.about.triggered.connect(self.openAbout)
|
window.about.triggered.connect(self.openAbout)
|
||||||
|
|
||||||
window.menuBar.addMenu(window.helpMenu)
|
window.menuBar.addMenu(window.helpMenu)
|
||||||
if not isOSX():
|
if not isMacOS():
|
||||||
window.mainLayout.setMenuBar(window.menuBar)
|
window.mainLayout.setMenuBar(window.menuBar)
|
||||||
|
|
||||||
def openAbout(self):
|
def openAbout(self):
|
||||||
@ -1575,7 +1575,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
data = event.mimeData()
|
data = event.mimeData()
|
||||||
urls = data.urls()
|
urls = data.urls()
|
||||||
if urls and urls[0].scheme() == 'file':
|
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())
|
dropfilepath = os.path.abspath(NSURL.URLWithString_(str(url.toString())).filePathURL().path())
|
||||||
else:
|
else:
|
||||||
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
|
dropfilepath = os.path.abspath(unicode(url.toLocalFile()))
|
||||||
@ -1710,7 +1710,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
|||||||
self._syncplayClient = None
|
self._syncplayClient = None
|
||||||
self.folderSearchEnabled = True
|
self.folderSearchEnabled = True
|
||||||
self.QtGui = QtGui
|
self.QtGui = QtGui
|
||||||
if isOSX():
|
if isMacOS():
|
||||||
self.setWindowFlags(self.windowFlags())
|
self.setWindowFlags(self.windowFlags())
|
||||||
else:
|
else:
|
||||||
self.setWindowFlags(self.windowFlags() & Qt.AA_DontUseNativeMenuBar)
|
self.setWindowFlags(self.windowFlags() & Qt.AA_DontUseNativeMenuBar)
|
||||||
|
|||||||
@ -23,8 +23,8 @@ def isWindows():
|
|||||||
def isLinux():
|
def isLinux():
|
||||||
return sys.platform.startswith(constants.OS_LINUX)
|
return sys.platform.startswith(constants.OS_LINUX)
|
||||||
|
|
||||||
def isOSX():
|
def isMacOS():
|
||||||
return sys.platform.startswith(constants.OS_OSX)
|
return sys.platform.startswith(constants.OS_MACOS)
|
||||||
|
|
||||||
def isBSD():
|
def isBSD():
|
||||||
return constants.OS_BSD in sys.platform or sys.platform.startswith(constants.OS_DRAGONFLY)
|
return constants.OS_BSD in sys.platform or sys.platform.startswith(constants.OS_DRAGONFLY)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user