Show number of users who are ready

This commit is contained in:
Et0h 2015-01-24 00:17:48 +00:00
parent 09d515e97f
commit c7ae68c5bf
2 changed files with 14 additions and 5 deletions

View File

@ -655,14 +655,14 @@ class SyncplayClient(object):
fileDifferencesMessage = getMessage("room-file-differences").format(self._userlist.getFileDifferencesForRoom()) fileDifferencesMessage = getMessage("room-file-differences").format(self._userlist.getFileDifferencesForRoom())
if self._userlist.currentUser.canControl() and self._userlist.isReadinessSupported(): if self._userlist.currentUser.canControl() and self._userlist.isReadinessSupported():
if self._userlist.areAllUsersInRoomReady(): if self._userlist.areAllUsersInRoomReady():
osdMessage = u"{}{}{}".format(fileDifferencesMessage, self._client._player.osdMessageSeparator, getMessage("all-users-ready")) osdMessage = u"{}{}{}".format(fileDifferencesMessage, self._client._player.osdMessageSeparator, getMessage("all-users-ready").format(self._userlist.readyUserCount()))
else: else:
osdMessage = u"{}{}{}".format(fileDifferencesMessage, self._client._player.osdMessageSeparator, getMessage("not-all-ready").format(self._userlist.usersInRoomNotReady())) osdMessage = u"{}{}{}".format(fileDifferencesMessage, self._client._player.osdMessageSeparator, getMessage("not-all-ready").format(self._userlist.usersInRoomNotReady()))
else: else:
osdMessage = fileDifferencesMessage osdMessage = fileDifferencesMessage
elif self._userlist.isReadinessSupported(): elif self._userlist.isReadinessSupported():
if self._userlist.areAllUsersInRoomReady(): if self._userlist.areAllUsersInRoomReady():
osdMessage = getMessage("all-users-ready") osdMessage = getMessage("all-users-ready").format(self._userlist.readyUserCount())
else: else:
osdMessage = getMessage("not-all-ready").format(self._userlist.usersInRoomNotReady()) osdMessage = getMessage("not-all-ready").format(self._userlist.usersInRoomNotReady())
if osdMessage: if osdMessage:
@ -882,6 +882,15 @@ class SyncplayUserlist(object):
return False return False
return True return True
def readyUserCount(self):
readyCount = 0
if self.currentUser.isReady():
readyCount += 1
for user in self._users.itervalues():
if user.room == self.currentUser.room and user.isReady():
readyCount += 1
return readyCount
def usersInRoomNotReady(self): def usersInRoomNotReady(self):
notReady = [] notReady = []
if not self.currentUser.isReady(): if not self.currentUser.isReady():

View File

@ -34,7 +34,7 @@ en = {
"playing-notification/room-addendum" : u" in room: '{}'", # Room "playing-notification/room-addendum" : u" in room: '{}'", # Room
"not-all-ready" : u"Not ready: {}", # Usernames "not-all-ready" : u"Not ready: {}", # Usernames
"all-users-ready" : u"Everyone is ready", "all-users-ready" : u"Everyone is ready ({} users)", #Number of ready users
"identifying-as-controller-notification" : u"Identifying as room controller with password '{}'...", "identifying-as-controller-notification" : u"Identifying as room controller with password '{}'...",
"failed-to-identify-as-controller-notification" : u"<{}> failed to identify as a room controller.", "failed-to-identify-as-controller-notification" : u"<{}> failed to identify as a room controller.",
@ -373,7 +373,7 @@ ru = {
"playing-notification/room-addendum" : u" в комнате: '{}'", # Room "playing-notification/room-addendum" : u" в комнате: '{}'", # Room
"not-all-ready" : u"Not ready: {}", # Usernames # TODO: Translate into Russian "not-all-ready" : u"Not ready: {}", # Usernames # TODO: Translate into Russian
"all-users-ready" : u"Everyone is ready", # TODO: Translate into Russian "all-users-ready" : u"Everyone is ready ({} users)", #Number of ready users # TODO: Translate into Russian
"identifying-as-controller-notification" : u"Identifying as room controller with password '{}'...", # TODO: Translate into Russian "identifying-as-controller-notification" : u"Identifying as room controller with password '{}'...", # TODO: Translate into Russian
"failed-to-identify-as-controller-notification" : u"<{}> failed to identify as a room controller.", # TODO: Translate into Russian "failed-to-identify-as-controller-notification" : u"<{}> failed to identify as a room controller.", # TODO: Translate into Russian
@ -713,7 +713,7 @@ de = {
"playing-notification/room-addendum" : u" in Raum: '{}'", # Room "playing-notification/room-addendum" : u" in Raum: '{}'", # Room
"not-all-ready" : u"Not ready: {}", # Usernames # TODO: Translate into German "not-all-ready" : u"Not ready: {}", # Usernames # TODO: Translate into German
"all-users-ready" : u"Everyone is ready", # TODO: Translate into German "all-users-ready" : u"Everyone is ready ({} users)", #Number of ready users # TODO: Translate into German
"identifying-as-controller-notification" : u"Identifiziere als Raumleiter mit Passwort '{}'...", # TODO: find a better translation to "room controller" "identifying-as-controller-notification" : u"Identifiziere als Raumleiter mit Passwort '{}'...", # TODO: find a better translation to "room controller"
"failed-to-identify-as-controller-notification" : u"<{}> konnte sich nicht als Raumleiter identifizieren.", "failed-to-identify-as-controller-notification" : u"<{}> konnte sich nicht als Raumleiter identifizieren.",