def fill_project_table(self, table):
#copy = db.studio() # self.db_studio
self.db_group.get_list_projects()
if not self.db_group.list_projects:
return
projects = []
for key in self.db_group.list_projects.keys():
projects.append({'name' : key,'status' : self.db_group.list_projects[key]['status'], 'path': self.db_group.list_projects[key]['path']})
# get table data
columns = ('name', 'status', 'path')
num_row = len(projects)
num_column = len(columns)
headers = columns
# make table
table.setColumnCount(num_column)
table.setRowCount(num_row)
table.setHorizontalHeaderLabels(headers)
# fill table
for i, project in enumerate(projects):
for j,key in enumerate(headers):
newItem = QtGui.QTableWidgetItem()
newItem.setText(project[key])
if key == 'name':
color = self.project_color
brush = QtGui.QBrush(color)
newItem.setBackground(brush)
table.setItem(i, j, newItem)
table.resizeRowsToContents()
table.resizeColumnsToContents()
print('fill project table')
评论列表
文章目录