def loadTableFromServer(self): """Loads the lines that belongs to the table with listId = id and stores the information in the table variable. """ server = Server() self.table = [list(line) for line in server.getLinesFromList(self.id)] for line in self.table: self.lineIds.append(line[0]) line.pop(0)
def addRow(self): """Checks if the current number of rows in the TagTable widget is less than 50, if it is, a row is added to the lines table on the server and an empty row is added to the TagTable widget. """ if self.rowCount() < 50: server = Server() server.addLine("", "", "", "", "NULL", self.id) for value in [ line[0] for line in server.getLinesFromList(self.id) ]: if value not in self.lineIds: newId = value self.insertRow(self.rowCount()) for column in range(0, self.columnCount()): item = TagTableWidgetItem("", newId) self.setItem(self.rowCount(), column, item) else: error = QtWidgets.QErrorMessage() message = "O número máximo de linhas permitidas em uma lista é 50!" error.showMessage(message) error.exec_()