CURA-3221 Group items into categories for the profile change summary

This commit is contained in:
Lipu Fei 2017-03-08 15:08:45 +01:00
parent 3be6a0966b
commit 5724ee71d0

View file

@ -7,6 +7,7 @@ from UM.Settings.ContainerRegistry import ContainerRegistry
from UM.i18n import i18nCatalog
from UM.Settings.SettingFunction import SettingFunction
from collections import OrderedDict
import os
class UserChangesModel(ListModel):
@ -35,7 +36,8 @@ class UserChangesModel(ListModel):
self._update()
def _update(self):
items = []
item_dict = OrderedDict()
item_list = []
global_stack = Application.getInstance().getGlobalContainerStack()
if not global_stack:
return
@ -111,5 +113,9 @@ class UserChangesModel(ListModel):
if stack != global_stack:
item_to_add["extruder"] = stack.getName()
items.append(item_to_add)
self.setItems(items)
if category_label not in item_dict:
item_dict[category_label] = []
item_dict[category_label].append(item_to_add)
for each_item_list in item_dict.values():
item_list += each_item_list
self.setItems(item_list)