- for description in self.descriptions:
- self.remove_widget(description)
- self.descriptions = []
- for icon, description in actionlist:
- description_label = ActionListDescription(text=description)
- self.add_widget(description_label)
- self.descriptions.append(description_label)
+ descriptions_length = len(self.descriptions)
+ index = -1
+ for index, [icon, description] in enumerate(actionlist):
+ if index >= descriptions_length:
+ description_label = ActionListDescription(text=description)
+ self.add_widget(description_label)
+ self.descriptions.append(description_label)
+ else:
+ self.descriptions[index].text = description
+
+ if index+1 < descriptions_length:
+ self.clear_widgets(
+ children=self.descriptions[index+1:descriptions_length])
+ del(self.descriptions[index+1:descriptions_length])