mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-17 11:47:50 -06:00
CURA-3221 Group items into categories for the profile change summary
This commit is contained in:
parent
3be6a0966b
commit
5724ee71d0
1 changed files with 9 additions and 3 deletions
|
@ -7,6 +7,7 @@ from UM.Settings.ContainerRegistry import ContainerRegistry
|
||||||
from UM.i18n import i18nCatalog
|
from UM.i18n import i18nCatalog
|
||||||
from UM.Settings.SettingFunction import SettingFunction
|
from UM.Settings.SettingFunction import SettingFunction
|
||||||
|
|
||||||
|
from collections import OrderedDict
|
||||||
import os
|
import os
|
||||||
|
|
||||||
class UserChangesModel(ListModel):
|
class UserChangesModel(ListModel):
|
||||||
|
@ -35,7 +36,8 @@ class UserChangesModel(ListModel):
|
||||||
self._update()
|
self._update()
|
||||||
|
|
||||||
def _update(self):
|
def _update(self):
|
||||||
items = []
|
item_dict = OrderedDict()
|
||||||
|
item_list = []
|
||||||
global_stack = Application.getInstance().getGlobalContainerStack()
|
global_stack = Application.getInstance().getGlobalContainerStack()
|
||||||
if not global_stack:
|
if not global_stack:
|
||||||
return
|
return
|
||||||
|
@ -111,5 +113,9 @@ class UserChangesModel(ListModel):
|
||||||
if stack != global_stack:
|
if stack != global_stack:
|
||||||
item_to_add["extruder"] = stack.getName()
|
item_to_add["extruder"] = stack.getName()
|
||||||
|
|
||||||
items.append(item_to_add)
|
if category_label not in item_dict:
|
||||||
self.setItems(items)
|
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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue