mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-10 00:07:51 -06:00
Re-added material detail view
Contributes to CURA-5378
This commit is contained in:
parent
00eb8e6788
commit
6225fff1f8
8 changed files with 51 additions and 51 deletions
|
@ -34,7 +34,7 @@ class BaseMaterialsModel(ListModel):
|
||||||
|
|
||||||
self.addRoleName(self.RootMaterialIdRole, "root_material_id")
|
self.addRoleName(self.RootMaterialIdRole, "root_material_id")
|
||||||
self.addRoleName(self.IdRole, "id")
|
self.addRoleName(self.IdRole, "id")
|
||||||
self.addRoleName(self.GUIDRole, "guid")
|
self.addRoleName(self.GUIDRole, "GUID")
|
||||||
self.addRoleName(self.NameRole, "name")
|
self.addRoleName(self.NameRole, "name")
|
||||||
self.addRoleName(self.BrandRole, "brand")
|
self.addRoleName(self.BrandRole, "brand")
|
||||||
self.addRoleName(self.MaterialRole, "material")
|
self.addRoleName(self.MaterialRole, "material")
|
||||||
|
|
|
@ -127,24 +127,23 @@ class BrandMaterialsModel(ListModel):
|
||||||
|
|
||||||
# Now handle the individual materials
|
# Now handle the individual materials
|
||||||
item = {
|
item = {
|
||||||
"root_material_id": root_material_id,
|
"root_material_id": root_material_id,
|
||||||
# "root_material_id": container_node.metadata["base_file"] <- as written in material management model
|
"id": metadata["id"],
|
||||||
"id": metadata["id"],
|
"container_id": metadata["id"], # TODO: Remove duplicate in material manager qml
|
||||||
"container_id": metadata["id"], # TODO: Remove duplicate in material manager qml
|
"GUID": metadata["GUID"],
|
||||||
"guid": metadata["GUID"],
|
"name": metadata["name"],
|
||||||
"name": metadata["name"],
|
"brand": metadata["brand"],
|
||||||
"brand": metadata["brand"],
|
"description": metadata["description"],
|
||||||
"description": metadata["description"],
|
"material": metadata["material"],
|
||||||
"material": metadata["material"],
|
"color_name": metadata["color_name"],
|
||||||
"color_name": metadata["color_name"],
|
"color_code": metadata["color_code"],
|
||||||
"color_code": metadata["color_code"],
|
"density": metadata.get("properties", {}).get("density", ""),
|
||||||
"density": metadata.get("properties", {}).get("density", ""),
|
"diameter": metadata.get("properties", {}).get("diameter", ""),
|
||||||
"diameter": metadata.get("properties", {}).get("diameter", ""),
|
|
||||||
"approximate_diameter": metadata["approximate_diameter"],
|
"approximate_diameter": metadata["approximate_diameter"],
|
||||||
"adhesion_info": metadata["adhesion_info"],
|
"adhesion_info": metadata["adhesion_info"],
|
||||||
"is_read_only": self._container_registry.isReadOnly(metadata["id"]),
|
"is_read_only": self._container_registry.isReadOnly(metadata["id"]),
|
||||||
"container_node": container_node,
|
"container_node": container_node,
|
||||||
"is_favorite": root_material_id in favorites
|
"is_favorite": root_material_id in favorites
|
||||||
}
|
}
|
||||||
brand_group_dict[brand][material_type].append(item)
|
brand_group_dict[brand][material_type].append(item)
|
||||||
|
|
||||||
|
|
|
@ -56,6 +56,7 @@ class FavoriteMaterialsModel(BaseMaterialsModel):
|
||||||
item = {
|
item = {
|
||||||
"root_material_id": root_material_id,
|
"root_material_id": root_material_id,
|
||||||
"id": metadata["id"],
|
"id": metadata["id"],
|
||||||
|
"GUID": metadata["GUID"],
|
||||||
"name": metadata["name"],
|
"name": metadata["name"],
|
||||||
"brand": metadata["brand"],
|
"brand": metadata["brand"],
|
||||||
"material": metadata["material"],
|
"material": metadata["material"],
|
||||||
|
|
|
@ -55,6 +55,7 @@ class GenericMaterialsModel(BaseMaterialsModel):
|
||||||
item = {
|
item = {
|
||||||
"root_material_id": root_material_id,
|
"root_material_id": root_material_id,
|
||||||
"id": metadata["id"],
|
"id": metadata["id"],
|
||||||
|
"GUID": metadata["GUID"],
|
||||||
"name": metadata["name"],
|
"name": metadata["name"],
|
||||||
"brand": metadata["brand"],
|
"brand": metadata["brand"],
|
||||||
"material": metadata["material"],
|
"material": metadata["material"],
|
||||||
|
|
|
@ -21,7 +21,7 @@ Rectangle
|
||||||
width: parent.width
|
width: parent.width
|
||||||
color: base.currentItem == model ? UM.Theme.getColor("favorites_row_selected") : "transparent"
|
color: base.currentItem == model ? UM.Theme.getColor("favorites_row_selected") : "transparent"
|
||||||
|
|
||||||
Row
|
Item
|
||||||
{
|
{
|
||||||
height: parent.height
|
height: parent.height
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
|
@ -38,7 +38,7 @@ TabView
|
||||||
if (!base.containerId || !base.editingEnabled) {
|
if (!base.containerId || !base.editingEnabled) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
var linkedMaterials = Cura.ContainerManager.getLinkedMaterials(base.currentMaterialNode, true);
|
var linkedMaterials = Cura.ContainerManager.getLinkedMaterials(base.currentItem.container_node, true);
|
||||||
if (linkedMaterials.length == 0) {
|
if (linkedMaterials.length == 0) {
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,25 +13,24 @@ Item
|
||||||
{
|
{
|
||||||
id: detailsPanel
|
id: detailsPanel
|
||||||
|
|
||||||
|
property var currentItem: base.currentItem
|
||||||
|
|
||||||
|
onCurrentItemChanged: { updateMaterialPropertiesObject(currentItem) }
|
||||||
|
|
||||||
function updateMaterialPropertiesObject( currentItem )
|
function updateMaterialPropertiesObject( currentItem )
|
||||||
{
|
{
|
||||||
// var currentItem = materialsModel.getItem(materialListView.currentIndex);
|
materialProperties.name = currentItem.name || "Unknown"
|
||||||
|
materialProperties.guid = currentItem.GUID;
|
||||||
materialProperties.name = currentItem.name ? currentItem.name : "Unknown";
|
materialProperties.container_id = currentItem.id
|
||||||
materialProperties.guid = currentItem.guid;
|
materialProperties.brand = currentItem.brand || "Unknown"
|
||||||
materialProperties.container_id = currentItem.container_id;
|
materialProperties.material = currentItem.material || "Unknown"
|
||||||
|
materialProperties.color_name = currentItem.color_name || "Yellow"
|
||||||
materialProperties.brand = currentItem.brand ? currentItem.brand : "Unknown";
|
materialProperties.color_code = currentItem.color_code || "yellow"
|
||||||
materialProperties.material = currentItem.material ? currentItem.material : "Unknown";
|
materialProperties.description = currentItem.description || ""
|
||||||
materialProperties.color_name = currentItem.color_name ? currentItem.color_name : "Yellow";
|
materialProperties.adhesion_info = currentItem.adhesion_info || "";
|
||||||
materialProperties.color_code = currentItem.color_code ? currentItem.color_code : "yellow";
|
materialProperties.density = currentItem.density || 0.0
|
||||||
|
materialProperties.diameter = currentItem.diameter || 0.0
|
||||||
materialProperties.description = currentItem.description ? currentItem.description : "";
|
materialProperties.approximate_diameter = currentItem.approximate_diameter || "0"
|
||||||
materialProperties.adhesion_info = currentItem.adhesion_info ? currentItem.adhesion_info : "";
|
|
||||||
|
|
||||||
materialProperties.density = currentItem.density ? currentItem.density : 0.0;
|
|
||||||
materialProperties.diameter = currentItem.diameter ? currentItem.diameter : 0.0;
|
|
||||||
materialProperties.approximate_diameter = currentItem.approximate_diameter ? currentItem.approximate_diameter : "0";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
|
@ -66,7 +65,7 @@ Item
|
||||||
editingEnabled: base.currentItem != null && !base.currentItem.is_read_only
|
editingEnabled: base.currentItem != null && !base.currentItem.is_read_only
|
||||||
|
|
||||||
properties: materialProperties
|
properties: materialProperties
|
||||||
containerId: base.currentItem != null ? base.currentItem.container_id : ""
|
containerId: base.currentItem != null ? base.currentItem.id : ""
|
||||||
currentMaterialNode: base.currentItem.container_node
|
currentMaterialNode: base.currentItem.container_node
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ Item
|
||||||
// materialListView.currentIndex = itemIndex;
|
// materialListView.currentIndex = itemIndex;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// This connection makes sure that we will switch to the new
|
onCurrentItemChanged: { MaterialsDetailsPanel.currentItem = currentItem }
|
||||||
Connections
|
Connections
|
||||||
{
|
{
|
||||||
target: materialsModel
|
target: materialsModel
|
||||||
|
@ -284,17 +284,17 @@ Item
|
||||||
MaterialsList {}
|
MaterialsList {}
|
||||||
}
|
}
|
||||||
|
|
||||||
// MaterialsDetailsPanel
|
MaterialsDetailsPanel
|
||||||
// {
|
{
|
||||||
// anchors
|
anchors
|
||||||
// {
|
{
|
||||||
// left: materialScrollView.right
|
left: materialScrollView.right
|
||||||
// leftMargin: UM.Theme.getSize("default_margin").width
|
leftMargin: UM.Theme.getSize("default_margin").width
|
||||||
// top: parent.top
|
top: parent.top
|
||||||
// bottom: parent.bottom
|
bottom: parent.bottom
|
||||||
// right: parent.right
|
right: parent.right
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dialogs
|
// Dialogs
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue