Added ordering to the room list (#120)
This commit is contained in:
parent
496635848f
commit
22c5118e7d
@ -10,6 +10,7 @@ from syncplay.messages import getMessage
|
|||||||
import threading
|
import threading
|
||||||
from syncplay.constants import PRIVACY_SENDHASHED_MODE, PRIVACY_DONTSEND_MODE, \
|
from syncplay.constants import PRIVACY_SENDHASHED_MODE, PRIVACY_DONTSEND_MODE, \
|
||||||
PRIVACY_HIDDENFILENAME, FILENAME_STRIP_REGEX
|
PRIVACY_HIDDENFILENAME, FILENAME_STRIP_REGEX
|
||||||
|
import collections
|
||||||
# <MAL DISABLE>
|
# <MAL DISABLE>
|
||||||
libMal = None
|
libMal = None
|
||||||
'''try:
|
'''try:
|
||||||
@ -468,6 +469,11 @@ class SyncplayUser(object):
|
|||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
return self.username < other.username
|
return self.username < other.username
|
||||||
|
|
||||||
|
def __repr__(self, *args, **kwargs):
|
||||||
|
if(self.file):
|
||||||
|
return "{}: {} ({}, {})".format(self.username, self.file['name'], self.file['duration'], self.file['size'])
|
||||||
|
else:
|
||||||
|
return "{}".format(self.username)
|
||||||
|
|
||||||
class MalUpdater(object):
|
class MalUpdater(object):
|
||||||
def __init__(self, username, password, ui):
|
def __init__(self, username, password, ui):
|
||||||
@ -623,14 +629,17 @@ class SyncplayUserlist(object):
|
|||||||
if(self.currentUser.room not in rooms):
|
if(self.currentUser.room not in rooms):
|
||||||
rooms[self.currentUser.room] = []
|
rooms[self.currentUser.room] = []
|
||||||
rooms[self.currentUser.room].append(self.currentUser)
|
rooms[self.currentUser.room].append(self.currentUser)
|
||||||
|
rooms = self.sortList(rooms)
|
||||||
self.ui.showUserList(self.currentUser, rooms)
|
self.ui.showUserList(self.currentUser, rooms)
|
||||||
|
|
||||||
def clearList(self):
|
def clearList(self):
|
||||||
self._users = {}
|
self._users = {}
|
||||||
|
|
||||||
def sortList(self):
|
def sortList(self, rooms):
|
||||||
pass
|
for room in rooms:
|
||||||
|
rooms[room] = sorted(rooms[room])
|
||||||
|
rooms = collections.OrderedDict(sorted(rooms.items()))
|
||||||
|
return rooms
|
||||||
|
|
||||||
class UiManager(object):
|
class UiManager(object):
|
||||||
def __init__(self, client, ui):
|
def __init__(self, client, ui):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user