def __showUserChangeMessage(self, username, room, file_, oldRoom=None): if(room): if self.isRoomSame(room) or self.isRoomSame(oldRoom): showOnOSD = constants.SHOW_SAME_ROOM_OSD else: showOnOSD = constants.SHOW_DIFFERENT_ROOM_OSD hideFromOSD = not showOnOSD if(room and not file_): message = getMessage("en", "room-join-notification").format(username, room) self.ui.showMessage(message, hideFromOSD) elif (room and file_): duration = utils.formatTime(file_['duration']) message = getMessage("en", "playing-notification").format(username, file_['name'], duration) if(self.currentUser.room <> room or self.currentUser.username == username): message += getMessage("en", "playing-notification/room-addendum").format(room) self.ui.showMessage(message, hideFromOSD) if(self.currentUser.file and not self.currentUser.isFileSame(file_) and self.currentUser.room == room): message = getMessage("en", "file-different-notification").format(username) self.ui.showMessage(message, not constants.SHOW_OSD_WARNINGS) differences = [] differentName = not utils.sameFilename(self.currentUser.file['name'], file_['name']) differentSize = not utils.sameFilesize(self.currentUser.file['size'], file_['size']) differentDuration = not utils.sameFileduration(self.currentUser.file['duration'], file_['duration']) if(differentName): differences.append("filename") if(differentSize): differences.append("size") if(differentDuration): differences.append("duration") message = getMessage("en", "file-differences-notification") + ", ".join(differences) self.ui.showMessage(message, not constants.SHOW_OSD_WARNINGS)
def showUserList(self, currentUser, rooms): for room in rooms: message = "In room '{}':".format(room) self.showMessage(message, True) for user in rooms[room]: userflags = "" if user.isController(): userflags += "({}) ".format( getMessage("controller-userlist-userflag")) if user.isReady(): userflags += "({}) ".format( getMessage("ready-userlist-userflag")) username = userflags + "*<{}>*".format( user.username ) if user == currentUser else userflags + "<{}>".format( user.username) if user.file: message = getMessage( "userlist-playing-notification").format(username) self.showMessage(message, True) message = " {}: '{}' ({})".format( getMessage("userlist-file-notification"), user.file['name'], formatTime(user.file['duration'])) if currentUser.file: if user.file['name'] == currentUser.file[ 'name'] and user.file[ 'size'] != currentUser.file['size']: message += getMessage( "different-filesize-notification") self.showMessage(message, True) else: message = getMessage("no-file-played-notification").format( username) self.showMessage(message, True)
def __showUserChangeMessage(self, username, room, file_): if(room and not file_): message = getMessage("en", "room-join-notification").format(username, room) self.ui.showMessage(message) elif (room and file_): duration = utils.formatTime(file_['duration']) message = getMessage("en", "playing-notification").format(username, file_['name'], duration) if(self.currentUser.room <> room or self.currentUser.username == username): message += getMessage("en", "playing-notification/room-addendum").format(room) self.ui.showMessage(message) if(self.currentUser.file and not self.currentUser.isFileSame(file_) and self.currentUser.room == room): message = getMessage("en", "file-different-notification").format(username) self.ui.showMessage(message) differences = [] differentName = not utils.sameFilename(self.currentUser.file['name'], file_['name']) differentSize = not utils.sameFilesize(self.currentUser.file['size'], file_['size']) differentDuration = not utils.sameFileduration(self.currentUser.file['duration'], file_['duration']) if(differentName): differences.append("filename") if(differentSize): differences.append("size") if(differentDuration): differences.append("duration") message = getMessage("en", "file-differences-notification") + ", ".join(differences) self.ui.showMessage(message)
def showUserList(self, currentUser, rooms): def stripfilename(filename): return re.sub(constants.FILENAME_STRIP_REGEX,"",filename) self._usertreebuffer = QtGui.QStandardItemModel() self._usertreebuffer.setColumnCount(2) self._usertreebuffer.setHorizontalHeaderLabels(("Room / User","File being played")) usertreeRoot = self._usertreebuffer.invisibleRootItem() for room in rooms: roomitem = QtGui.QStandardItem(room) if (room == currentUser.room): font = QtGui.QFont() font.setWeight(QtGui.QFont.Bold) roomitem.setFont(font) blankitem = QtGui.QStandardItem("") roomitem.setFlags(roomitem.flags() & ~Qt.ItemIsEditable) blankitem.setFlags(blankitem.flags() & ~Qt.ItemIsEditable) usertreeRoot.appendRow((roomitem, blankitem)) for user in rooms[room]: useritem = QtGui.QStandardItem(user.username) fileitem = QtGui.QStandardItem("") if (user.file): fileitem = QtGui.QStandardItem(user.file['name'] + " ("+formatTime(user.file['duration'])+")") if (currentUser.file): sameName = stripfilename(user.file['name']) == stripfilename(currentUser.file['name']) sameSize = user.file['size'] == currentUser.file['size'] sameDuration = abs(round(user.file['duration']) - round(currentUser.file['duration'])) < constants.DIFFFERENT_DURATION_THRESHOLD sameRoom = room == currentUser.room differentName = not sameName differentSize = not sameSize differentDuration = not sameDuration if (sameName or sameRoom): if (differentSize and sameDuration): fileitem = QtGui.QStandardItem(user.file['name'] + " ("+formatTime(user.file['duration'])+")" + " (Different size!)") elif (differentSize and differentDuration): fileitem = QtGui.QStandardItem(user.file['name'] + " ("+formatTime(user.file['duration'])+")" + " (Different size and duration!)") elif (differentDuration): fileitem = QtGui.QStandardItem(user.file['name'] + " ("+formatTime(user.file['duration'])+")" + " (Different duration!)") if (sameRoom and (differentName or differentSize or differentDuration)): fileitem.setForeground(QtGui.QBrush(QtGui.QColor('red'))) else: fileitem = QtGui.QStandardItem("(No file being played)") if (room == currentUser.room): fileitem.setForeground(QtGui.QBrush(QtGui.QColor('blue'))) if(currentUser.username == user.username): font = QtGui.QFont() font.setWeight(QtGui.QFont.Bold) useritem.setFont(font) useritem.setFlags(useritem.flags() & ~Qt.ItemIsEditable) fileitem.setFlags(fileitem.flags() & ~Qt.ItemIsEditable) roomitem.appendRow((useritem, fileitem)) self.listTreeModel = self._usertreebuffer self.listTreeView.setModel(self.listTreeModel) self.listTreeView.setItemsExpandable(False) self.listTreeView.expandAll() self.listTreeView.resizeColumnToContents(0) self.listTreeView.resizeColumnToContents(1)
def showUserList(self, currentUser, rooms): self._usertreebuffer = QtGui.QStandardItemModel() self._usertreebuffer.setColumnCount(2) self._usertreebuffer.setHorizontalHeaderLabels(("Room / User","File being played")) usertreeRoot = self._usertreebuffer.invisibleRootItem() for room in rooms: roomitem = QtGui.QStandardItem(room) if room == currentUser.room: font = QtGui.QFont() font.setWeight(QtGui.QFont.Bold) roomitem.setFont(font) blankitem = QtGui.QStandardItem("") roomitem.setFlags(roomitem.flags() & ~Qt.ItemIsEditable) blankitem.setFlags(blankitem.flags() & ~Qt.ItemIsEditable) usertreeRoot.appendRow((roomitem, blankitem)) for user in rooms[room]: useritem = QtGui.QStandardItem(user.username) fileitem = QtGui.QStandardItem("") if(user.file): fileitem = QtGui.QStandardItem(user.file['name'] + " ("+formatTime(user.file['duration'])+")") if(currentUser.file): if(user.file['name'] == currentUser.file['name'] and user.file['size'] != currentUser.file['size']): fileitem = QtGui.QStandardItem(user.file['name'] + " ("+formatTime(user.file['duration'])+")" + " (Different size!)") if room == currentUser.room: fileitem.setForeground(QtGui.QBrush(QtGui.QColor('red'))) elif (user.file['name'] != currentUser.file['name'] and room == currentUser.room): fileitem.setForeground(QtGui.QBrush(QtGui.QColor('red'))) else: fileitem = QtGui.QStandardItem("(No file being played)") if room == currentUser.room: fileitem.setForeground(QtGui.QBrush(QtGui.QColor('blue'))) if(currentUser.username == user.username): font = QtGui.QFont() font.setWeight(QtGui.QFont.Bold) useritem.setFont(font) useritem.setFlags(useritem.flags() & ~Qt.ItemIsEditable) fileitem.setFlags(fileitem.flags() & ~Qt.ItemIsEditable) roomitem.appendRow((useritem, fileitem)) self.listTreeModel = self._usertreebuffer self.listTreeView.setModel(self.listTreeModel) self.listTreeView.setItemsExpandable(False) self.listTreeView.expandAll() self.listTreeView.resizeColumnToContents(1)
def _serverSeeked(self, position, setBy): if(self.getUsername() <> setBy): self.playerPositionBeforeLastSeek = self.getPlayerPosition() self.setPosition(position) madeChangeOnPlayer = True else: madeChangeOnPlayer = False message = getMessage("en", "seek-notification").format(setBy, utils.formatTime(self.playerPositionBeforeLastSeek), utils.formatTime(position)) self.ui.showMessage(message) return madeChangeOnPlayer
def _serverSeeked(self, position, setBy): hideFromOSD = not constants.SHOW_SAME_ROOM_OSD if(self.getUsername() <> setBy): self.playerPositionBeforeLastSeek = self.getPlayerPosition() self.setPosition(position) madeChangeOnPlayer = True else: madeChangeOnPlayer = False message = getMessage("en", "seek-notification").format(setBy, utils.formatTime(self.playerPositionBeforeLastSeek), utils.formatTime(position)) self.ui.showMessage(message, hideFromOSD) return madeChangeOnPlayer
def __getUserlist(self, room): users = self._functions["getRoomUsers"](room) position = self._functions["getRoomPosition"](room) paused = "Paused" if self._functions["isRoomPaused"](room) else "Playing" files = self.__getListOfFiles(users) message = "" for f in files: if (f[0] == None): message += "No file:\n" else: v = ( ColorCode.BOLD, paused, ColorCode.NORMAL, utils.formatTime(position), utils.formatTime(f[1]), f[0] ) message += "{}<{}>{} [{}/{}] {}\n".format(*v) u = [u['nick'] for u in users if f[0] == u['file'] and f[1] == u['duration']] if (len(u) > 1): message += "Played by: <{}> and <{}>.\n".format(">, <".join(u[:-1]), u[-1]) else: message += "Played by {} alone.\n".format(u[0]) return message
def showUserList(self, currentUser, rooms): for room in rooms: message = u"In room '{}':".format(room) self.showMessage(message, True) for user in rooms[room]: username = "******".format(user.username) if user == currentUser else "<{}>".format(user.username) if(user.file): message = u"{} is playing:".format(username) self.showMessage(message, True) message = u" File: '{}' ({})".format(user.file['name'], formatTime(user.file['duration'])) if(currentUser.file): if(user.file['name'] == currentUser.file['name'] and user.file['size'] != currentUser.file['size']): message += " (their file size is different from yours!)" self.showMessage(message, True) else: message = u"{} is not playing a file".format(username) self.showMessage(message, True)
def showUserList(self, currentUser, rooms): self._usertreebuffer = QtGui.QStandardItemModel() self._usertreebuffer.setColumnCount(2) self._usertreebuffer.setHorizontalHeaderLabels( ("Room / User", "File being played")) usertreeRoot = self._usertreebuffer.invisibleRootItem() for room in rooms: roomitem = QtGui.QStandardItem(room) if (room == currentUser.room): font = QtGui.QFont() font.setWeight(QtGui.QFont.Bold) roomitem.setFont(font) blankitem = QtGui.QStandardItem("") roomitem.setFlags(roomitem.flags() & ~Qt.ItemIsEditable) blankitem.setFlags(blankitem.flags() & ~Qt.ItemIsEditable) usertreeRoot.appendRow((roomitem, blankitem)) for user in rooms[room]: useritem = QtGui.QStandardItem(user.username) fileitem = QtGui.QStandardItem("") if (user.file): fileitem = QtGui.QStandardItem( user.file['name'] + " (" + formatTime(user.file['duration']) + ")") if (currentUser.file): sameName = sameFilename(user.file['name'], currentUser.file['name']) sameSize = sameFilesize(user.file['size'], currentUser.file['size']) sameDuration = sameFileduration( user.file['duration'], currentUser.file['duration']) sameRoom = room == currentUser.room differentName = not sameName differentSize = not sameSize differentDuration = not sameDuration if (sameName or sameRoom): if (differentSize and sameDuration): fileitem = QtGui.QStandardItem( user.file['name'] + " (" + formatTime(user.file['duration']) + ")" + " (Different size!)") elif (differentSize and differentDuration): fileitem = QtGui.QStandardItem( user.file['name'] + " (" + formatTime(user.file['duration']) + ")" + " (Different size and duration!)") elif (differentDuration): fileitem = QtGui.QStandardItem( user.file['name'] + " (" + formatTime(user.file['duration']) + ")" + " (Different duration!)") if (sameRoom and (differentName or differentSize or differentDuration)): fileitem.setForeground( QtGui.QBrush(QtGui.QColor('red'))) else: fileitem = QtGui.QStandardItem("(No file being played)") if (room == currentUser.room): fileitem.setForeground( QtGui.QBrush(QtGui.QColor('blue'))) if (currentUser.username == user.username): font = QtGui.QFont() font.setWeight(QtGui.QFont.Bold) useritem.setFont(font) useritem.setFlags(useritem.flags() & ~Qt.ItemIsEditable) fileitem.setFlags(fileitem.flags() & ~Qt.ItemIsEditable) roomitem.appendRow((useritem, fileitem)) self.listTreeModel = self._usertreebuffer self.listTreeView.setModel(self.listTreeModel) self.listTreeView.setItemsExpandable(False) self.listTreeView.expandAll() self.listTreeView.resizeColumnToContents(0) self.listTreeView.resizeColumnToContents(1)
def irc_onMsg(self, nickFrom, host, to, msg): sleep(0.5) if to[0] == '#': #channel split = msg.split(' ') if split[0].lower() == '!rooms': rooms = self.functions[1]() if len(rooms) == 0: self.msg(to, chr(3) + '12Notice:' + chr(15) + ' No rooms found on server') return out = 'Currently the Syncplay server hosts viewing sessions as follows: ' i = 0 for room in rooms: if i == len(rooms)-1: out += chr(3) + '10' + room + chr(15) + '.' elif i == len(rooms)-2: out += chr(3) + '10' + room + chr(15) + ' and ultimately ' else: out += chr(3) + '10' + room + chr(15) + ', ' i += 1 self.msg(to, out) elif split[0].lower() == '!roominfo': if len(split) >= 2: rooms = self.functions[1]() room = '' for r in split[1:]: room += r + ' ' room = room[:-1] if (room in rooms) == False: self.msg(to, chr(3) + '5Error!' + chr(15) + ' Room does not exists (' + room + ')') else: users = self.functions[4](room) paused = self.functions[5](room) out = chr(2) + '<Paused>' + chr(15) if paused else chr(2) + '<Playing>' + chr(15) time = self.functions[2](room) if time == None: time = 0 for u in users: if u['length'] == None: continue out += ' [' + utils.formatTime(time) + '/' + utils.formatTime(u['length']) + '] ' break else: out += ' ' for u in users: if u['file'] == None: continue out += u['file'] break else: out += '[no file]' self.msg(to, out) out = 'Users: ' i = 0 for user in users: if i == len(users)-1: out += chr(3) + '2' + user['nick'] + chr(15) + '.' elif i == len(users)-2: out += chr(3) + '2' + user['nick'] + chr(15) + ' and ' else: out += chr(3) + '2' + user['nick'] + chr(15) + ', ' i += 1 self.msg(to, out) else: self.msg(to, chr(2) + 'Usage:' + chr(15) + ' !roominfo [room]') elif split[0].lower() == '!pause': rooms = self.functions[1]() for room in rooms: users = self.functions[4](room) for u in users: if u['nick'] == nickFrom: self.functions[0](nickFrom, True) return self.msg(to, chr(3) + '5Error!' + chr(15) + ' Your nick was not found on the server') elif split[0].lower() == '!play': rooms = self.functions[1]() for room in rooms: users = self.functions[4](room) for u in users: if u['nick'] == nickFrom: self.functions[0](nickFrom, False) return self.msg(to, chr(3) + '5Error!' + chr(15) + ' Your nick was not found on the server') elif split[0].lower() == '!help': self.msg(to, chr(2) + 'Available commands:' + chr(15) + ' !rooms / !roominfo [room] / !pause / !play')
def sp_seek(self, who, fromTime, toTime, room): self.msg(self.channel, chr(2) + '<' + who + '>'+ chr(15) +' has jumped from ' + utils.formatTime(fromTime) + ' to ' + utils.formatTime(toTime) +' (room ' + room + ')')
def showUserList(self, currentUser, rooms): for room in rooms: message = u"In room '{}':".format(room) self.showMessage(message, True) for user in rooms[room]: userflags = u"" if user.isController(): userflags += u"({}) ".format(getMessage("controller-userlist-userflag")) if user.isReady(): userflags += u"({}) ".format(getMessage("ready-userlist-userflag")) username = userflags + u"*<{}>*".format(user.username) if user == currentUser else userflags + u"<{}>".format(user.username) if user.file: message = getMessage("userlist-playing-notification").format(username) self.showMessage(message, True) message = u" {}: '{}' ({})".format(getMessage("userlist-file-notification"),user.file['name'], formatTime(user.file['duration'])) if currentUser.file: if user.file['name'] == currentUser.file['name'] and user.file['size'] != currentUser.file['size']: message += getMessage("different-filesize-notification") self.showMessage(message, True) else: message = getMessage("no-file-played-notification").format(username) self.showMessage(message, True)
def showUserList(self, currentUser, rooms): self._usertreebuffer = QtGui.QStandardItemModel() self._usertreebuffer.setHorizontalHeaderLabels( (getMessage("roomuser-heading-label"), getMessage("size-heading-label"), getMessage("duration-heading-label"), getMessage("filename-heading-label") )) usertreeRoot = self._usertreebuffer.invisibleRootItem() for room in rooms: roomitem = QtGui.QStandardItem(room) font = QtGui.QFont() font.setItalic(True) if room == currentUser.room: font.setWeight(QtGui.QFont.Bold) roomitem.setFont(font) roomitem.setFlags(roomitem.flags() & ~Qt.ItemIsEditable) usertreeRoot.appendRow(roomitem) isControlledRoom = RoomPasswordProvider.isControlledRoom(room) if isControlledRoom: if room == currentUser.room and currentUser.isController(): roomitem.setIcon(QtGui.QIcon(self.resourcespath + 'lock_open.png')) else: roomitem.setIcon(QtGui.QIcon(self.resourcespath + 'lock.png')) else: roomitem.setIcon(QtGui.QIcon(self.resourcespath + 'chevrons_right.png')) for user in rooms[room]: useritem = QtGui.QStandardItem(user.username) isController = user.isController() sameRoom = room == currentUser.room if sameRoom: isReadyWithFile = user.isReadyWithFile() else: isReadyWithFile = None useritem.setData(isController, Qt.UserRole + constants.USERITEM_CONTROLLER_ROLE) useritem.setData(isReadyWithFile, Qt.UserRole + constants.USERITEM_READY_ROLE) if user.file: filesizeitem = QtGui.QStandardItem(formatSize(user.file['size'])) filedurationitem = QtGui.QStandardItem("({})".format(formatTime(user.file['duration']))) filenameitem = QtGui.QStandardItem((user.file['name'])) if currentUser.file: sameName = sameFilename(user.file['name'], currentUser.file['name']) sameSize = sameFilesize(user.file['size'], currentUser.file['size']) sameDuration = sameFileduration(user.file['duration'], currentUser.file['duration']) underlinefont = QtGui.QFont() underlinefont.setUnderline(True) if sameRoom: if not sameName: filenameitem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_DIFFERENTITEM_COLOR))) filenameitem.setFont(underlinefont) if not sameSize: if currentUser.file is not None and formatSize(user.file['size']) == formatSize(currentUser.file['size']): filesizeitem = QtGui.QStandardItem(formatSize(user.file['size'],precise=True)) filesizeitem.setFont(underlinefont) filesizeitem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_DIFFERENTITEM_COLOR))) if not sameDuration: filedurationitem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_DIFFERENTITEM_COLOR))) filedurationitem.setFont(underlinefont) else: filenameitem = QtGui.QStandardItem(getMessage("nofile-note")) filedurationitem = QtGui.QStandardItem("") filesizeitem = QtGui.QStandardItem("") if room == currentUser.room: filenameitem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_NOFILEITEM_COLOR))) font = QtGui.QFont() if currentUser.username == user.username: font.setWeight(QtGui.QFont.Bold) self.updateReadyState(currentUser.isReadyWithFile()) if isControlledRoom and not isController: useritem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_NOTCONTROLLER_COLOR))) useritem.setFont(font) useritem.setFlags(useritem.flags() & ~Qt.ItemIsEditable & ~Qt.ItemIsSelectable) filenameitem.setFlags(filenameitem.flags() & ~Qt.ItemIsEditable & ~Qt.ItemIsSelectable) filesizeitem.setFlags(filesizeitem.flags() & ~Qt.ItemIsEditable & ~Qt.ItemIsSelectable) filedurationitem.setFlags(filedurationitem.flags() & ~Qt.ItemIsEditable & ~Qt.ItemIsSelectable) roomitem.appendRow((useritem, filesizeitem, filedurationitem, filenameitem)) self.listTreeModel = self._usertreebuffer self.listTreeView.setModel(self.listTreeModel) self.listTreeView.setItemDelegate(UserlistItemDelegate()) self.listTreeView.setItemsExpandable(False) self.listTreeView.setRootIsDecorated(False) self.listTreeView.expandAll() self.updateListGeometry()
def showUserList(self, currentUser, rooms): self._usertreebuffer = QtGui.QStandardItemModel() self._usertreebuffer.setColumnCount(2) self._usertreebuffer.setHorizontalHeaderLabels((getMessage("roomuser-heading-label"),getMessage("fileplayed-heading-label"))) usertreeRoot = self._usertreebuffer.invisibleRootItem() for room in rooms: roomitem = QtGui.QStandardItem(room) if room == currentUser.room: font = QtGui.QFont() font.setWeight(QtGui.QFont.Bold) roomitem.setFont(font) blankitem = QtGui.QStandardItem("") roomitem.setFlags(roomitem.flags() & ~Qt.ItemIsEditable) blankitem.setFlags(blankitem.flags() & ~Qt.ItemIsEditable) usertreeRoot.appendRow((roomitem, blankitem)) for user in rooms[room]: useritem = QtGui.QStandardItem(user.username) fileitem = QtGui.QStandardItem("") if user.file: fileitem = QtGui.QStandardItem(u"{} ({})".format(user.file['name'], formatTime(user.file['duration']))) if currentUser.file: sameName = sameFilename(user.file['name'], currentUser.file['name']) sameSize = sameFilesize(user.file['size'], currentUser.file['size']) sameDuration = sameFileduration(user.file['duration'], currentUser.file['duration']) sameRoom = room == currentUser.room differentName = not sameName differentSize = not sameSize differentDuration = not sameDuration if sameName or sameRoom: if differentSize and sameDuration: fileitem = QtGui.QStandardItem(u"{} ({}) ({})".format(user.file['name'], formatTime(user.file['duration']), getMessage("differentsize-note"))) elif differentSize and differentDuration: fileitem = QtGui.QStandardItem(u"{} ({}) ({})".format(user.file['name'], formatTime(user.file['duration']), getMessage("differentsizeandduration-note"))) elif differentDuration: fileitem = QtGui.QStandardItem(u"{} ({}) ({})".format(user.file['name'], formatTime(user.file['duration']), getMessage("differentduration-note"))) if sameRoom and (differentName or differentSize or differentDuration): fileitem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_DIFFERENTITEM_COLOR))) else: fileitem = QtGui.QStandardItem(getMessage("nofile-note")) if room == currentUser.room: fileitem.setForeground(QtGui.QBrush(QtGui.QColor(constants.STYLE_NOFILEITEM_COLOR))) if currentUser.username == user.username: font = QtGui.QFont() font.setWeight(QtGui.QFont.Bold) useritem.setFont(font) useritem.setFlags(useritem.flags() & ~Qt.ItemIsEditable) fileitem.setFlags(fileitem.flags() & ~Qt.ItemIsEditable) roomitem.appendRow((useritem, fileitem)) self.listTreeModel = self._usertreebuffer self.listTreeView.setModel(self.listTreeModel) self.listTreeView.setItemsExpandable(False) self.listTreeView.expandAll() self.listTreeView.resizeColumnToContents(0) self.listTreeView.resizeColumnToContents(1)
def __addUserWithFileToList(self, rooms, user): currentPosition = utils.formatTime(user.lastPosition) file_key = '\'{}\' ({}/{})'.format(user.file['name'], currentPosition, utils.formatTime(user.file['duration'])) if (not rooms[user.room].has_key(file_key)): rooms[user.room][file_key] = {} rooms[user.room][file_key][user.username] = user
def sp_seek(self, who, fromTime, toTime, room): v = (ColorCode.BOLD, who, ColorCode.NORMAL, utils.formatTime(fromTime), utils.formatTime(toTime), room,) msg ="{}<{}>{} has jumped from {} to {} (in room `{}`)".format(*v) self._sendChanMessage(msg)