def __str__(self):
if len(self.data["templates"]) == 0:
return "There are no templates set"
table = prettytable.PrettyTable(["Index", "Path"])
list_to_highlight = []
for keys in self.data["templates"]:
if int(keys) == self.template:
list_to_highlight.append(keys)
table.add_row([keys] +[self.data["templates"][keys]])
table_string = table.get_string()
table_list = table_string.split("\n")
for keys in list_to_highlight:
table_list[int(keys) + 2] = color.BOLD + table_list[int(keys) + 2] + color.END
return "\n".join(table_list)
评论列表
文章目录