def ajoutColumns(): if horizontalscrollbar.value() == horizontalscrollbar.maximum(): for _ in range(self.initialColumnsNumber // 3): self.insertColumn(self.columnCount()) item = QtWidgets.QTableWidgetItem() self.setHorizontalHeaderItem(self.columnCount() - 1, item) item = self.horizontalHeaderItem(self.columnCount() - 1) columns_labels.add(self.columnsLabels, 1) item.setText(_translate("MainWindow", self.columnsLabels[self.columnCount() - 1])) network.addColumn()
def recalc(self, network): self.resetTable() matrix = network.matrix for _ in range(self.columnCount(), len(matrix[0])): self.insertColumn(self.columnCount()) item = QtWidgets.QTableWidgetItem() self.setHorizontalHeaderItem(self.columnCount() - 1, item) item = self.horizontalHeaderItem(self.columnCount() - 1) columns_labels.add(self.columnsLabels, 1) item.setText(str(self.columnsLabels[self.columnCount() - 1])) for _ in range(self.rowCount(), len(matrix)): self.insertRow(self.rowCount()) for c in range(len(matrix[0])): for r in range(len(matrix)): self.setItem(r, c, QtWidgets.QTableWidgetItem(network.getCell(r, c).value))