def fill_active_artist_table_at_workroom(self, wr_name):
copy = self.db_workroom
artists = copy.read_artist('all')
if not artists[0]:
print(artists[1])
return
# get worktoom_id
result = copy.get_id_by_name(wr_name)
if not result[0]:
self.message(result[1], 2)
return
wr_id = result[1]
# get artist list
active_artists = []
for artist in artists[1]:
# get workroom
wr_list = []
if artist['workroom']:
wr_list = json.loads(artist['workroom'])
if wr_id in wr_list and artist['status'] == 'active':
active_artists.append(artist)
# get table data
num_row = len(active_artists)
num_column = len(self.look_keys)
headers = self.look_keys
# make table
self.myWidget.studio_editor_table.setColumnCount(num_column)
self.myWidget.studio_editor_table.setRowCount(num_row)
self.myWidget.studio_editor_table.setHorizontalHeaderLabels(headers)
# fill table
for i, artist in enumerate(active_artists):
for j,key in enumerate(headers):
if not (key in self.look_keys):
continue
newItem = QtGui.QTableWidgetItem()
newItem.setText(artist[key])
if key == 'nik_name':
color = self.artist_color
brush = QtGui.QBrush(color)
newItem.setBackground(brush)
self.myWidget.studio_editor_table.setItem(i, j, newItem)
print('fill active artist table')
评论列表
文章目录