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