From 24c517bf2e4399f19933645a7afbf048d76c55a2 Mon Sep 17 00:00:00 2001 From: Uriziel Date: Mon, 15 Oct 2012 10:24:04 +0200 Subject: [PATCH] Changes in messages --- syncplay/__init__.py | 2 +- syncplay/client.py | 15 +++++++++------ syncplay/protocols.py | 2 -- syncplay/ui/consoleUI.py | 5 +++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/syncplay/__init__.py b/syncplay/__init__.py index 4393e9a..cb7584e 100644 --- a/syncplay/__init__.py +++ b/syncplay/__init__.py @@ -1,3 +1,3 @@ -version = '1.0.1' +version = '1.0.3' milestone = 'Tequila' projectURL = 'http://uriziel.github.com/syncplay/' \ No newline at end of file diff --git a/syncplay/client.py b/syncplay/client.py index c137abf..8bc9075 100644 --- a/syncplay/client.py +++ b/syncplay/client.py @@ -335,7 +335,7 @@ class SyncplayUserlist(object): elif (room and file_): duration = self.ui.formatTime(file_['duration']) message = "<{}> is playing '{}' ({})".format(username, file_['name'], duration) - if(self.currentUser.room <> room): + if(self.currentUser.room <> room or self.currentUser.username == username): message += " in room: '{}'".format(room) self.ui.showMessage(message) if(self.currentUser.file and not self.currentUser.isFileSame(file_)): @@ -362,11 +362,14 @@ class SyncplayUserlist(object): elif (room and room != user.room): self.__showUserChangeMessage(username, room, None) - def modUser(self, username, room, file_, noMessage = False): + def modUser(self, username, room, file_): if(self._users.has_key(username)): user = self._users[username] - if(not noMessage): - self.__displayModUserMessage(username, room, file_, user) + self.__displayModUserMessage(username, room, file_, user) + user.room = room + user.file = file_ + elif(username == self.currentUser.username): + self.__showUserChangeMessage(username, room, file_) else: self.addUser(username, room, file_) @@ -401,9 +404,9 @@ class SyncplayUserlist(object): def __displayFileWatchersInRoomList(self, key, users): self.ui.showMessage("File: {} is being played by:".format(key), True, True) for user in sorted(users.itervalues()): - message = user.username + message = "<"+user.username+">" message = self.__addDifferentFileMessageIfNecessary(user, message) - self.ui.showMessage("\t<" + message + ">", True, True) + self.ui.showMessage("\t" + message, True, True) def __displayPeopleInRoomWithNoFile(self, noFileList): if (noFileList): diff --git a/syncplay/protocols.py b/syncplay/protocols.py index c84ac23..8c9cf04 100644 --- a/syncplay/protocols.py +++ b/syncplay/protocols.py @@ -87,8 +87,6 @@ class SyncClientProtocol(JSONCommandProtocol): else: self._client.setUsername(username) self._client.setRoom(roomName) - message = "You have joined room {} as <{}>".format(roomName, username) - self._client.ui.showMessage(message) self.logged = True self._client.sendFile() diff --git a/syncplay/ui/consoleUI.py b/syncplay/ui/consoleUI.py index 7d97a95..9c58b5c 100644 --- a/syncplay/ui/consoleUI.py +++ b/syncplay/ui/consoleUI.py @@ -6,6 +6,8 @@ import syncplay import os class ConsoleUI(threading.Thread): + RE_ROOM = re.compile("^room( (.+))?") + def __init__(self): self.promptMode = threading.Event() self.PromptResult = "" @@ -49,8 +51,7 @@ class ConsoleUI(threading.Thread): print("ERROR:\t" + message) def _executeCommand(self, data): - RE_ROOM = re.compile("^room( (\w+))?") - matched_room = RE_ROOM.match(data) + matched_room = self.RE_ROOM.match(data) if matched_room: room = matched_room.group(2) if room == None: