def tm_add_readers_ui_load_artist_list(self, workrom_name):
table = self.selectReadersDialog.select_from_list_data_list_table
workroom_dict = self.selectReadersDialog.workroom_dict
self.clear_table(table)
result = self.db_workroom.read_artist_of_workroom(workroom_dict[workrom_name]['id'])
if not result[0]:
self.message(result[1], 2)
artirs_dict = result[1]
# load table
headers = ['nik_name', 'level']
num_column = len(headers)
num_row = 0
if artirs_dict:
num_row = len(artirs_dict)
table.setColumnCount(num_column)
table.setRowCount(num_row)
table.setHorizontalHeaderLabels(headers)
if artirs_dict:
for i,reader_name in enumerate(artirs_dict):
for j,key in enumerate(headers):
newItem = QtGui.QTableWidgetItem()
newItem.setText(artirs_dict[reader_name][key])
newItem.reader_name = reader_name
if key == 'nik_name':
color = self.artist_color
brush = QtGui.QBrush(color)
newItem.setBackground(brush)
if self.current_readers_list:
if reader_name in self.current_readers_list.keys():
color = self.grey_color
brush = QtGui.QBrush(color)
newItem.setBackground(brush)
table.setItem(i, j, newItem)
评论列表
文章目录