Move from @requireMinServerVersion to @requireServerVersion and apply to sendChat
This commit is contained in:
parent
7ca76620dd
commit
cae66b7a58
@ -585,11 +585,6 @@ class SyncplayClient(object):
|
|||||||
self.userlist.currentUser.room = roomName
|
self.userlist.currentUser.room = roomName
|
||||||
if resetAutoplay:
|
if resetAutoplay:
|
||||||
self.resetAutoPlayState()
|
self.resetAutoPlayState()
|
||||||
|
|
||||||
def sendChat(self,message):
|
|
||||||
if self._protocol and self._protocol.logged:
|
|
||||||
message = utils.truncateText(message,constants.MAX_CHAT_MESSAGE_LENGTH)
|
|
||||||
self._protocol.sendChatMessage(message)
|
|
||||||
|
|
||||||
def sendRoom(self):
|
def sendRoom(self):
|
||||||
room = self.userlist.currentUser.room
|
room = self.userlist.currentUser.room
|
||||||
@ -685,19 +680,27 @@ class SyncplayClient(object):
|
|||||||
if promptForAction:
|
if promptForAction:
|
||||||
self.ui.promptFor(getMessage("enter-to-exit-prompt"))
|
self.ui.promptFor(getMessage("enter-to-exit-prompt"))
|
||||||
|
|
||||||
def requireMinServerVersion(minVersion):
|
def requireServerFeature(featureRequired):
|
||||||
def requireMinVersionDecorator(f):
|
def requireServerFeatureDecorator(f):
|
||||||
@wraps(f)
|
@wraps(f)
|
||||||
def wrapper(self, *args, **kwds):
|
def wrapper(self, *args, **kwds):
|
||||||
if not utils.meetsMinVersion(self.serverVersion,minVersion):
|
if self.serverVersion == "0.0.0":
|
||||||
if self.serverVersion != "0.0.0":
|
self.ui.showDebugMessage(
|
||||||
self.ui.showErrorMessage(getMessage("not-supported-by-server-error").format(minVersion, self.serverVersion))
|
"Tried to check server version too soon (testing support for: {})".format(featureRequired))
|
||||||
else:
|
return None
|
||||||
self.ui.showDebugMessage("Tried to check server version too soon (threshold: {})".format(minVersion))
|
if not self.serverFeatures.has_key(featureRequired) or not self.serverFeatures[featureRequired]:
|
||||||
|
featureName = getMessage(u"feature-{}".format(featureRequired))
|
||||||
|
self.ui.showErrorMessage(getMessage("not-supported-by-server-error").format(featureName))
|
||||||
return
|
return
|
||||||
return f(self, *args, **kwds)
|
return f(self, *args, **kwds)
|
||||||
return wrapper
|
return wrapper
|
||||||
return requireMinVersionDecorator
|
return requireServerFeatureDecorator
|
||||||
|
|
||||||
|
@requireServerFeature("chat")
|
||||||
|
def sendChat(self,message):
|
||||||
|
if self._protocol and self._protocol.logged:
|
||||||
|
message = utils.truncateText(message,constants.MAX_CHAT_MESSAGE_LENGTH)
|
||||||
|
self._protocol.sendChatMessage(message)
|
||||||
|
|
||||||
def changePlaylistEnabledState(self, newState):
|
def changePlaylistEnabledState(self, newState):
|
||||||
oldState = self.sharedPlaylistIsEnabled()
|
oldState = self.sharedPlaylistIsEnabled()
|
||||||
@ -777,11 +780,11 @@ class SyncplayClient(object):
|
|||||||
self.ui.updateAutoPlayState(False)
|
self.ui.updateAutoPlayState(False)
|
||||||
self.stopAutoplayCountdown()
|
self.stopAutoplayCountdown()
|
||||||
|
|
||||||
@requireMinServerVersion(constants.USER_READY_MIN_VERSION)
|
@requireServerFeature("readiness")
|
||||||
def toggleReady(self, manuallyInitiated=True):
|
def toggleReady(self, manuallyInitiated=True):
|
||||||
self._protocol.setReady(not self.userlist.currentUser.isReady(), manuallyInitiated)
|
self._protocol.setReady(not self.userlist.currentUser.isReady(), manuallyInitiated)
|
||||||
|
|
||||||
@requireMinServerVersion(constants.USER_READY_MIN_VERSION)
|
@requireServerFeature("readiness")
|
||||||
def changeReadyState(self, newState, manuallyInitiated=True):
|
def changeReadyState(self, newState, manuallyInitiated=True):
|
||||||
oldState = self.userlist.currentUser.isReady()
|
oldState = self.userlist.currentUser.isReady()
|
||||||
if newState != oldState:
|
if newState != oldState:
|
||||||
@ -796,7 +799,7 @@ class SyncplayClient(object):
|
|||||||
if oldReadyState != isReady:
|
if oldReadyState != isReady:
|
||||||
self._warnings.checkReadyStates()
|
self._warnings.checkReadyStates()
|
||||||
|
|
||||||
@requireMinServerVersion(constants.CONTROLLED_ROOMS_MIN_VERSION)
|
@requireServerFeature("managedRooms")
|
||||||
def createControlledRoom(self, roomName):
|
def createControlledRoom(self, roomName):
|
||||||
controlPassword = utils.RandomStringGenerator.generate_room_password()
|
controlPassword = utils.RandomStringGenerator.generate_room_password()
|
||||||
self.lastControlPasswordAttempt = controlPassword
|
self.lastControlPasswordAttempt = controlPassword
|
||||||
@ -815,7 +818,7 @@ class SyncplayClient(object):
|
|||||||
else:
|
else:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
@requireMinServerVersion(constants.CONTROLLED_ROOMS_MIN_VERSION)
|
@requireServerFeature("managedRooms")
|
||||||
def identifyAsController(self, controlPassword):
|
def identifyAsController(self, controlPassword):
|
||||||
controlPassword = self.stripControlPassword(controlPassword)
|
controlPassword = self.stripControlPassword(controlPassword)
|
||||||
self.ui.showMessage(getMessage("identifying-as-controller-notification").format(controlPassword))
|
self.ui.showMessage(getMessage("identifying-as-controller-notification").format(controlPassword))
|
||||||
|
|||||||
@ -134,7 +134,13 @@ de = {
|
|||||||
"vlc-failed-versioncheck": u"Diese VLC-Version wird von Syncplay nicht unterstützt. Bitte nutze VLC 2.0",
|
"vlc-failed-versioncheck": u"Diese VLC-Version wird von Syncplay nicht unterstützt. Bitte nutze VLC 2.0",
|
||||||
"vlc-failed-other" : u"Beim Laden des syncplay.lua Interface-Skripts durch VLC trat folgender Fehler auf: {}", # Syncplay Error
|
"vlc-failed-other" : u"Beim Laden des syncplay.lua Interface-Skripts durch VLC trat folgender Fehler auf: {}", # Syncplay Error
|
||||||
|
|
||||||
"not-supported-by-server-error" : u"Dieses Feature wird vom Server nicht unterstützt. Es wird ein Server mit Syncplay Version {}+ benötigt, aktuell verwendet wird jedoch Version {}.", #minVersion, serverVersion
|
"feature-sharedPlaylists": u"shared playlists", # used for not-supported-by-server-error # TODO: Translate
|
||||||
|
"feature-chat": u"chat", # used for not-supported-by-server-error # TODO: Translate
|
||||||
|
"feature-readiness": u"readiness", # used for not-supported-by-server-error # TODO: Translate
|
||||||
|
"feature-managedRooms": u"managed rooms", # used for not-supported-by-server-error # TODO: Translate
|
||||||
|
|
||||||
|
"not-supported-by-server-error": u"The {} feature is not supported by this server..", # feature # TODO: Translate
|
||||||
|
#OLD TRANSLATION: "not-supported-by-server-error" : u"Dieses Feature wird vom Server nicht unterstützt. Es wird ein Server mit Syncplay Version {}+ benötigt, aktuell verwendet wird jedoch Version {}.", #minVersion, serverVersion
|
||||||
"shared-playlists-not-supported-by-server-error" : "The shared playlists feature may not be supported by the server. To ensure that it works correctly requires a server running Syncplay {}+, but the server is running Syncplay {}.", #minVersion, serverVersion # TODO: Translate
|
"shared-playlists-not-supported-by-server-error" : "The shared playlists feature may not be supported by the server. To ensure that it works correctly requires a server running Syncplay {}+, but the server is running Syncplay {}.", #minVersion, serverVersion # TODO: Translate
|
||||||
"shared-playlists-disabled-by-server-error" : "The shared playlist feature has been disabled in the server configuration. To use this feature you will need to connect to a different server.", # TODO: Translate
|
"shared-playlists-disabled-by-server-error" : "The shared playlist feature has been disabled in the server configuration. To use this feature you will need to connect to a different server.", # TODO: Translate
|
||||||
|
|
||||||
|
|||||||
@ -132,7 +132,12 @@ en = {
|
|||||||
"vlc-failed-noscript": "VLC has reported that the syncplay.lua interface script has not been installed. Please refer to http://syncplay.pl/LUA/ for instructions.",
|
"vlc-failed-noscript": "VLC has reported that the syncplay.lua interface script has not been installed. Please refer to http://syncplay.pl/LUA/ for instructions.",
|
||||||
"vlc-failed-versioncheck": "This version of VLC is not supported by Syncplay.",
|
"vlc-failed-versioncheck": "This version of VLC is not supported by Syncplay.",
|
||||||
|
|
||||||
"not-supported-by-server-error" : "This feature is not supported by the server. The feature requires a server running Syncplay {}+, but the server is running Syncplay {}.", #minVersion, serverVersion
|
"feature-sharedPlaylists" : u"shared playlists", # used for not-supported-by-server-error
|
||||||
|
"feature-chat" : u"chat", # used for not-supported-by-server-error
|
||||||
|
"feature-readiness" : u"readiness", # used for not-supported-by-server-error
|
||||||
|
"feature-managedRooms" : u"managed rooms", # used for not-supported-by-server-error
|
||||||
|
|
||||||
|
"not-supported-by-server-error" : u"The {} feature is not supported by this server..", #feature
|
||||||
"shared-playlists-not-supported-by-server-error" : "The shared playlists feature may not be supported by the server. To ensure that it works correctly requires a server running Syncplay {}+, but the server is running Syncplay {}.", #minVersion, serverVersion
|
"shared-playlists-not-supported-by-server-error" : "The shared playlists feature may not be supported by the server. To ensure that it works correctly requires a server running Syncplay {}+, but the server is running Syncplay {}.", #minVersion, serverVersion
|
||||||
"shared-playlists-disabled-by-server-error" : "The shared playlist feature has been disabled in the server configuration. To use this feature you will need to connect to a different server.",
|
"shared-playlists-disabled-by-server-error" : "The shared playlist feature has been disabled in the server configuration. To use this feature you will need to connect to a different server.",
|
||||||
|
|
||||||
|
|||||||
@ -134,7 +134,13 @@ ru = {
|
|||||||
"vlc-failed-versioncheck" : u"Данная версия VLC не поддерживается Syncplay. Пожалуйста, используйте VLC версии 2 или выше.",
|
"vlc-failed-versioncheck" : u"Данная версия VLC не поддерживается Syncplay. Пожалуйста, используйте VLC версии 2 или выше.",
|
||||||
"vlc-failed-other" : u"Во время загрузки скрипта интерфейса syncplay.lua в VLC произошла следующая ошибка: {}", # Syncplay Error
|
"vlc-failed-other" : u"Во время загрузки скрипта интерфейса syncplay.lua в VLC произошла следующая ошибка: {}", # Syncplay Error
|
||||||
|
|
||||||
"not-supported-by-server-error" : u"Эта возможность не поддерживается сервером. Требуется сервер Syncplay {}+, вы подключены к серверу Syncplay {}.", #minVersion, serverVersion
|
"feature-sharedPlaylists": u"shared playlists", # used for not-supported-by-server-error # TODO: Translate
|
||||||
|
"feature-chat": u"chat", # used for not-supported-by-server-error # TODO: Translate
|
||||||
|
"feature-readiness": u"readiness", # used for not-supported-by-server-error # TODO: Translate
|
||||||
|
"feature-managedRooms": u"managed rooms", # used for not-supported-by-server-error # TODO: Translate
|
||||||
|
|
||||||
|
"not-supported-by-server-error": u"The {} feature is not supported by this server..", # feature # TODO: Translate
|
||||||
|
#OLD TRANSLATION: "not-supported-by-server-error" : u"Эта возможность не поддерживается сервером. Требуется сервер Syncplay {}+, вы подключены к серверу Syncplay {}.", #minVersion, serverVersion
|
||||||
"shared-playlists-not-supported-by-server-error" : u"Общие списки воспроизведения могут не поддерживаться сервером. Для корректной работы требуется сервер Syncplay {}+, вы подключены к серверу Syncplay {}.", #minVersion, serverVersion
|
"shared-playlists-not-supported-by-server-error" : u"Общие списки воспроизведения могут не поддерживаться сервером. Для корректной работы требуется сервер Syncplay {}+, вы подключены к серверу Syncplay {}.", #minVersion, serverVersion
|
||||||
"shared-playlists-disabled-by-server-error" : "The shared playlist feature has been disabled in the server configuration. To use this feature you will need to connect to a different server.", # TODO: Translate
|
"shared-playlists-disabled-by-server-error" : "The shared playlist feature has been disabled in the server configuration. To use this feature you will need to connect to a different server.", # TODO: Translate
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user