def new_client(self, session_id, profiles): ''' This method is invoked when the main window handles events from the controller (via the bridge). Here we create a new subtree for the client and add it to the list of connections. ''' # create the subtree containing profiles newClientTreeItem = ClientTreeItem(session_id, self.rootItem) for profile in profiles: newConnProfileItem = ConnectionProfileTreeItem( newClientTreeItem, profile, RESULT_PENDING) newClientTreeItem.appendChild(newConnProfileItem) # insert the new node under the parent node n = self.rootItem.childCount() self.beginInsertRows(QtCore.QModelIndex(), n, n) self.rootItem.appendChild(newClientTreeItem) self.parents[session_id] = newClientTreeItem self.endInsertRows()
def __init__(self, parent=None): super(ClientServerTestResultTreeTableModel, self).__init__(parent) self.rootItem = ClientTreeItem('ALL', None) # XXX wtf self.parents = {0: self.rootItem}