def add_data_to_table(self, route):
self.tableWidget_path.setRowCount(len(route))
for i, row in enumerate(route):
for j, col in enumerate(row):
item = QtGui.QTableWidgetItem("{}".format(col))
self.tableWidget_path.setItem(i, j, item)
if j in [1, 2]:
self.tableWidget_path.item(i, j).setTextAlignment(QtCore.Qt.AlignHCenter | QtCore.Qt.AlignVCenter)
if row[1] == "HS":
color = QtGui.QColor(223, 240, 216)
elif row[1] == "LS":
color = QtGui.QColor(252, 248, 227)
elif row[1] == "NS":
color = QtGui.QColor(242, 222, 222)
else:
color = QtGui.QColor(210, 226, 242)
if j == 3 and "wormhole" in col:
self.tableWidget_path.item(i, j).setIcon(self.icon_wormhole)
self.tableWidget_path.item(i, j).setBackground(color)
self.tableWidget_path.item(i, j).setForeground(QtGui.QColor(0, 0, 0))
评论列表
文章目录