Update consoleUI.py -executeCommand use grpsymlink

This commit is contained in:
Etoh 2012-12-27 14:29:08 +00:00
parent 3d5112fa1d
commit 9305b5e97b

View File

@ -82,19 +82,19 @@ class ConsoleUI(threading.Thread):
return False return False
def _executeCommand(self, data): def _executeCommand(self, data):
command = re.match(r"^([^\ ]+)(?:\ (.+))?", data) command = re.match(r"^(?P<command>[^\ ]+)(?:\ (?P<parameter>.+))?", data)
if(not command): if(not command):
return return
if(command.group(1) in ["u", "undo", "revert"]): if(command.group('command') in ["u", "undo", "revert"]):
tmp_pos = self._syncplayClient.getPlayerPosition() tmp_pos = self._syncplayClient.getPlayerPosition()
self._syncplayClient.setPosition(self._syncplayClient.playerPositionBeforeLastSeek) self._syncplayClient.setPosition(self._syncplayClient.playerPositionBeforeLastSeek)
self._syncplayClient.playerPositionBeforeLastSeek = tmp_pos self._syncplayClient.playerPositionBeforeLastSeek = tmp_pos
elif (command.group(1) in ["l", "list", "users"]): elif (command.group('command') in ["l", "list", "users"]):
self._syncplayClient.getUserList() self._syncplayClient.getUserList()
elif (command.group(1) in ["p", "play", "pause"]): elif (command.group('command') in ["p", "play", "pause"]):
self._syncplayClient.setPaused(not self._syncplayClient.getPlayerPaused()) self._syncplayClient.setPaused(not self._syncplayClient.getPlayerPaused())
elif (command.group(1) in ["r", "room"]): elif (command.group('command') in ["r", "room"]):
room = command.group(2) room = command.group('parameter')
if room == None: if room == None:
if self._syncplayClient.userlist.currentUser.file: if self._syncplayClient.userlist.currentUser.file:
room = self._syncplayClient.userlist.currentUser.file["name"] room = self._syncplayClient.userlist.currentUser.file["name"]
@ -106,7 +106,7 @@ class ConsoleUI(threading.Thread):
else: else:
if(self._tryAdvancedCommands(data)): if(self._tryAdvancedCommands(data)):
return return
if (command.group(1) not in ['help', 'h', '?', '/?', '\?']): if (command.group('command') not in ['help', 'h', '?', '/?', '\?']):
self.showMessage("Unrecognized command") self.showMessage("Unrecognized command")
self.showMessage("Available commands:", True) self.showMessage("Available commands:", True)
self.showMessage("\tr [name] - change room", True) self.showMessage("\tr [name] - change room", True)