Skip to content

Commit

Permalink
Fix room context menu when alone in room
Browse files Browse the repository at this point in the history
  • Loading branch information
Et0h committed Jul 14, 2024
1 parent cccdef3 commit 3444e93
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
4 changes: 2 additions & 2 deletions syncplay/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,10 +1332,10 @@ def __init__(self, ui, client):
self._client = client
self._roomUsersChanged = True

def isReadinessSupported(self):
def isReadinessSupported(self, requiresOtherUsers=True):
if not utils.meetsMinVersion(self._client.serverVersion, constants.USER_READY_MIN_VERSION):
return False
elif self.onlyUserInRoomWhoSupportsReadiness():
elif self.onlyUserInRoomWhoSupportsReadiness() and requiresOtherUsers:
return False
else:
return self._client.serverFeatures["readiness"]
Expand Down
5 changes: 1 addition & 4 deletions syncplay/ui/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -820,16 +820,13 @@ def openRoomMenu(self, position):
if path:
menu.addAction(QtGui.QPixmap(resourcespath + "folder_film.png"), getMessage('open-containing-folder'), lambda: utils.open_system_file_browser(path))


if roomToJoin == self._syncplayClient.getRoom() and self._syncplayClient.userlist.currentUser.canControl() and self._syncplayClient.userlist.isReadinessSupported() and self._syncplayClient.serverFeatures["setOthersReadiness"]:
if roomToJoin == self._syncplayClient.getRoom() and self._syncplayClient.userlist.currentUser.canControl() and self._syncplayClient.userlist.isReadinessSupported(requiresOtherUsers=False) and self._syncplayClient.serverFeatures["setOthersReadiness"]:
if self._syncplayClient.userlist.isReady(username):
addSetUserAsReadyText = getMessage("setasnotready-menu-label").format(shortUsername)
menu.addAction(QtGui.QPixmap(resourcespath + "cross.png"), addSetUserAsReadyText, lambda: self._syncplayClient.setOthersReadiness(username, False))
else:
addSetUserAsNotReadyText = getMessage("setasnotready-menu-label").format(shortUsername)
menu.addAction(QtGui.QPixmap(resourcespath + "tick.png"), addSetUserAsNotReadyText, lambda: self._syncplayClient.setOthersReadiness(username, True))
else:
return
menu.exec_(self.listTreeView.viewport().mapToGlobal(position))

def updateListGeometry(self):
Expand Down

0 comments on commit 3444e93

Please sign in to comment.