def set_info(self, data_to_write, x_hint_list, num_rows_to_add = 3):
#Takes in the file data, and updates the Grid to represent
#and indicate the files that are loaded with their metadata.
if len(data_to_write) != self.cols:
print('--Set info: Data mismatch error.')
popup = Popup(title='Grid Error 02',
content=Label(text = 'There was a problem in updating the grid.'),
size_hint = (0.3, 0.3))
popup.open()
else:
threshold = 3
#If < threshold available rows left, add more
if self._avail < threshold:
self.create_grid(x_hint_list, num_rows_to_add)
length = len(self.children)
next_row = self.find_next_row()
end = length - (next_row * self.cols)
start = end - self.cols
for i, widget in enumerate(reversed(self.children[start:end])):
#strip text primarily for title and artist, so shorten
#doesn't take into account the trailing whitespace
widget.text = data_to_write[i].strip()
self._avail -= 1
评论列表
文章目录