Add method "isController" to the user
This commit is contained in:
parent
ea119fca79
commit
a28431340e
@ -435,6 +435,7 @@ class SyncplayClient(object):
|
|||||||
self.ui.showErrorMessage("<{}> failed to identify as a room controller.".format(username))
|
self.ui.showErrorMessage("<{}> failed to identify as a room controller.".format(username))
|
||||||
|
|
||||||
def controllerIdentificationSuccess(self, username):
|
def controllerIdentificationSuccess(self, username):
|
||||||
|
self.userlist.setUserAsController(username)
|
||||||
# TODO: More UI stuff
|
# TODO: More UI stuff
|
||||||
self.ui.showErrorMessage("<{}> authenticated as a room controller".format(username))
|
self.ui.showErrorMessage("<{}> authenticated as a room controller".format(username))
|
||||||
|
|
||||||
@ -494,6 +495,7 @@ class SyncplayUser(object):
|
|||||||
self.username = username
|
self.username = username
|
||||||
self.room = room
|
self.room = room
|
||||||
self.file = file_
|
self.file = file_
|
||||||
|
self._controller = False
|
||||||
|
|
||||||
def setFile(self, filename, duration, size):
|
def setFile(self, filename, duration, size):
|
||||||
file_ = {
|
file_ = {
|
||||||
@ -520,6 +522,12 @@ class SyncplayUser(object):
|
|||||||
else:
|
else:
|
||||||
return "{}".format(self.username)
|
return "{}".format(self.username)
|
||||||
|
|
||||||
|
def setAsController(self):
|
||||||
|
self._controller = True
|
||||||
|
|
||||||
|
def isController(self):
|
||||||
|
return self._controller
|
||||||
|
|
||||||
class SyncplayUserlist(object):
|
class SyncplayUserlist(object):
|
||||||
def __init__(self, ui, client):
|
def __init__(self, ui, client):
|
||||||
self.currentUser = SyncplayUser()
|
self.currentUser = SyncplayUser()
|
||||||
@ -610,6 +618,11 @@ class SyncplayUserlist(object):
|
|||||||
self.addUser(username, room, file_)
|
self.addUser(username, room, file_)
|
||||||
self.userListChange()
|
self.userListChange()
|
||||||
|
|
||||||
|
def setUserAsController(self, username):
|
||||||
|
if self._users.has_key(username):
|
||||||
|
user = self._users[username]
|
||||||
|
user.setAsController()
|
||||||
|
|
||||||
def areAllFilesInRoomSame(self):
|
def areAllFilesInRoomSame(self):
|
||||||
for user in self._users.itervalues():
|
for user in self._users.itervalues():
|
||||||
if user.room == self.currentUser.room and user.file and not self.currentUser.isFileSame(user.file):
|
if user.room == self.currentUser.room and user.file and not self.currentUser.isFileSame(user.file):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user