mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-11-02 20:52:20 -07:00
Merge branch 'master' into full_screen_test
This commit is contained in:
commit
c2f0a33b42
226 changed files with 85323 additions and 17316 deletions
|
|
@ -76,7 +76,7 @@ Item
|
|||
{
|
||||
id:toggleFullScreenAction
|
||||
shortcut: StandardKey.FullScreen;
|
||||
text: catalog.i18nc("@action:inmenu","Toggle Fu&ll Screen");
|
||||
text: catalog.i18nc("@action:inmenu","Toggle Full Screen");
|
||||
iconName: "view-fullscreen";
|
||||
}
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ Item
|
|||
Action
|
||||
{
|
||||
id: aboutAction;
|
||||
text: catalog.i18nc("@action:inmenu menubar:help","&About...");
|
||||
text: catalog.i18nc("@action:inmenu menubar:help","About...");
|
||||
iconName: "help-about";
|
||||
}
|
||||
|
||||
|
|
@ -237,16 +237,6 @@ Item
|
|||
onTriggered: CuraActions.deleteSelection();
|
||||
}
|
||||
|
||||
Action //Also add backspace as the same function as delete because on Macintosh keyboards the button called "delete" is actually a backspace, and the user expects it to function as a delete.
|
||||
{
|
||||
id: backspaceSelectionAction
|
||||
text: catalog.i18ncp("@action:inmenu menubar:edit", "Delete Selected Model", "Delete Selected Models", UM.Selection.selectionCount)
|
||||
enabled: UM.Controller.toolsEnabled && UM.Selection.hasSelection
|
||||
iconName: "edit-delete"
|
||||
shortcut: StandardKey.Backspace
|
||||
onTriggered: CuraActions.deleteSelection()
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: centerSelectionAction;
|
||||
|
|
@ -339,7 +329,7 @@ Item
|
|||
Action
|
||||
{
|
||||
id: deleteAllAction;
|
||||
text: catalog.i18nc("@action:inmenu menubar:edit","&Clear Build Plate");
|
||||
text: catalog.i18nc("@action:inmenu menubar:edit","Clear Build Plate");
|
||||
enabled: UM.Controller.toolsEnabled;
|
||||
iconName: "edit-delete";
|
||||
shortcut: "Ctrl+D";
|
||||
|
|
@ -349,7 +339,7 @@ Item
|
|||
Action
|
||||
{
|
||||
id: reloadAllAction;
|
||||
text: catalog.i18nc("@action:inmenu menubar:file","Re&load All Models");
|
||||
text: catalog.i18nc("@action:inmenu menubar:file","Reload All Models");
|
||||
iconName: "document-revert";
|
||||
shortcut: "F5"
|
||||
onTriggered: CuraApplication.reloadAll();
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ UM.Dialog
|
|||
section.property: "section"
|
||||
section.delegate: Button
|
||||
{
|
||||
id: machineSectionButton
|
||||
text: section
|
||||
width: machineList.width
|
||||
style: ButtonStyle
|
||||
|
|
@ -214,6 +215,7 @@ UM.Dialog
|
|||
|
||||
Button
|
||||
{
|
||||
id: addPrinterButton
|
||||
text: catalog.i18nc("@action:button", "Add Printer")
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
|
|
|
|||
|
|
@ -104,11 +104,13 @@ UM.MainWindow
|
|||
title: catalog.i18nc("@title:menu menubar:toplevel","&File");
|
||||
MenuItem
|
||||
{
|
||||
id: newProjectMenu
|
||||
action: Cura.Actions.newProject;
|
||||
}
|
||||
|
||||
MenuItem
|
||||
{
|
||||
id: openMenu
|
||||
action: Cura.Actions.open;
|
||||
}
|
||||
|
||||
|
|
@ -117,7 +119,7 @@ UM.MainWindow
|
|||
MenuItem
|
||||
{
|
||||
id: saveWorkspaceMenu
|
||||
text: catalog.i18nc("@title:menu menubar:file","Save...")
|
||||
text: catalog.i18nc("@title:menu menubar:file","&Save...")
|
||||
onTriggered:
|
||||
{
|
||||
var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" };
|
||||
|
|
@ -148,6 +150,7 @@ UM.MainWindow
|
|||
|
||||
MenuItem
|
||||
{
|
||||
id: exportSelectionMenu
|
||||
text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...");
|
||||
enabled: UM.Selection.hasSelection;
|
||||
iconName: "document-save-as";
|
||||
|
|
@ -156,7 +159,11 @@ UM.MainWindow
|
|||
|
||||
MenuSeparator { }
|
||||
|
||||
MenuItem { action: Cura.Actions.reloadAll; }
|
||||
MenuItem
|
||||
{
|
||||
id: reloadAllMenu
|
||||
action: Cura.Actions.reloadAll;
|
||||
}
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
|
|
@ -189,7 +196,7 @@ UM.MainWindow
|
|||
id: settingsMenu
|
||||
title: catalog.i18nc("@title:menu", "&Settings")
|
||||
|
||||
PrinterMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&Printer") }
|
||||
PrinterMenu { title: catalog.i18nc("@title:menu menubar:settings", "&Printer") }
|
||||
|
||||
Instantiator
|
||||
{
|
||||
|
|
@ -233,7 +240,7 @@ UM.MainWindow
|
|||
|
||||
// TODO Only show in dev mode. Remove check when feature ready
|
||||
BuildplateMenu { title: catalog.i18nc("@title:menu", "&Build plate"); visible: CuraSDKVersion == "dev" ? Cura.MachineManager.hasVariantBuildplates : false }
|
||||
ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); }
|
||||
ProfileMenu { title: catalog.i18nc("@title:settings", "&Profile"); }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
|
|
@ -284,6 +291,7 @@ UM.MainWindow
|
|||
|
||||
Menu
|
||||
{
|
||||
id: preferencesMenu
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel","P&references");
|
||||
|
||||
MenuItem { action: Cura.Actions.preferences; }
|
||||
|
|
@ -291,7 +299,7 @@ UM.MainWindow
|
|||
|
||||
Menu
|
||||
{
|
||||
//: Help menu
|
||||
id: helpMenu
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel","&Help");
|
||||
|
||||
MenuItem { action: Cura.Actions.showProfileFolder; }
|
||||
|
|
@ -306,7 +314,7 @@ UM.MainWindow
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
@ -1054,7 +1062,7 @@ UM.MainWindow
|
|||
{
|
||||
restart();
|
||||
}
|
||||
else if(Cura.MachineManager.activeMachineId == null || Cura.MachineManager.activeMachineId == "")
|
||||
else if(Cura.MachineManager.activeMachine == null)
|
||||
{
|
||||
addMachineDialog.open();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ Menu
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ Menu
|
|||
onTriggered:
|
||||
{
|
||||
settingVisibilityPresetsModel.setActivePreset(model.id);
|
||||
showSettingVisibilityProfile();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Copyright (c) 2017 Ultimaker B.V.
|
||||
// Cura is released under the terms of the LGPLv3 or higher.
|
||||
//Copyright (c) 2018 Ultimaker B.V.
|
||||
//Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
|
@ -281,16 +281,16 @@ Item
|
|||
text: {
|
||||
if (!printerConnected || activePrintJob == null)
|
||||
{
|
||||
return catalog.i18nc("@label:", "Pause");
|
||||
return catalog.i18nc("@label", "Pause");
|
||||
}
|
||||
|
||||
if (activePrintJob.state == "paused")
|
||||
{
|
||||
return catalog.i18nc("@label:", "Resume");
|
||||
return catalog.i18nc("@label", "Resume");
|
||||
}
|
||||
else
|
||||
{
|
||||
return catalog.i18nc("@label:", "Pause");
|
||||
return catalog.i18nc("@label", "Pause");
|
||||
}
|
||||
}
|
||||
onClicked:
|
||||
|
|
@ -322,7 +322,7 @@ Item
|
|||
|
||||
height: UM.Theme.getSize("save_button_save_to_button").height
|
||||
|
||||
text: catalog.i18nc("@label:", "Abort Print")
|
||||
text: catalog.i18nc("@label", "Abort Print")
|
||||
onClicked: confirmationDialog.visible = true
|
||||
|
||||
style: UM.Theme.styles.sidebar_action_button
|
||||
|
|
|
|||
|
|
@ -181,7 +181,7 @@ Rectangle
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
@ -191,7 +191,7 @@ Rectangle
|
|||
{
|
||||
id: machineHeatedBed
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_heated_bed"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ UM.PreferencesPage
|
|||
{
|
||||
//: General configuration page title
|
||||
title: catalog.i18nc("@title:tab","General")
|
||||
id: generalPreferencesPage
|
||||
|
||||
function setDefaultLanguage(languageCode)
|
||||
{
|
||||
|
|
@ -283,9 +284,6 @@ UM.PreferencesPage
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Label
|
||||
{
|
||||
id: languageCaption
|
||||
|
|
@ -308,7 +306,7 @@ UM.PreferencesPage
|
|||
width: childrenRect.width;
|
||||
height: childrenRect.height;
|
||||
|
||||
text: catalog.i18nc("@info:tooltip","Slice automatically when changing settings.")
|
||||
text: catalog.i18nc("@info:tooltip", "Slice automatically when changing settings.")
|
||||
|
||||
CheckBox
|
||||
{
|
||||
|
|
@ -316,7 +314,7 @@ UM.PreferencesPage
|
|||
checked: boolCheck(UM.Preferences.getValue("general/auto_slice"))
|
||||
onClicked: UM.Preferences.setValue("general/auto_slice", checked)
|
||||
|
||||
text: catalog.i18nc("@option:check","Slice automatically");
|
||||
text: catalog.i18nc("@option:check", "Slice automatically");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -330,7 +328,7 @@ UM.PreferencesPage
|
|||
Label
|
||||
{
|
||||
font.bold: true
|
||||
text: catalog.i18nc("@label","Viewport behavior")
|
||||
text: catalog.i18nc("@label", "Viewport behavior")
|
||||
}
|
||||
|
||||
UM.TooltipArea
|
||||
|
|
@ -338,7 +336,7 @@ UM.PreferencesPage
|
|||
width: childrenRect.width;
|
||||
height: childrenRect.height;
|
||||
|
||||
text: catalog.i18nc("@info:tooltip","Highlight unsupported areas of the model in red. Without support these areas will not print properly.")
|
||||
text: catalog.i18nc("@info:tooltip", "Highlight unsupported areas of the model in red. Without support these areas will not print properly.")
|
||||
|
||||
CheckBox
|
||||
{
|
||||
|
|
@ -347,14 +345,14 @@ UM.PreferencesPage
|
|||
checked: boolCheck(UM.Preferences.getValue("view/show_overhang"))
|
||||
onClicked: UM.Preferences.setValue("view/show_overhang", checked)
|
||||
|
||||
text: catalog.i18nc("@option:check","Display overhang");
|
||||
text: catalog.i18nc("@option:check", "Display overhang");
|
||||
}
|
||||
}
|
||||
|
||||
UM.TooltipArea {
|
||||
width: childrenRect.width;
|
||||
height: childrenRect.height;
|
||||
text: catalog.i18nc("@info:tooltip","Moves the camera so the model is in the center of the view when a model is selected")
|
||||
text: catalog.i18nc("@info:tooltip", "Moves the camera so the model is in the center of the view when a model is selected")
|
||||
|
||||
CheckBox
|
||||
{
|
||||
|
|
@ -368,12 +366,12 @@ UM.PreferencesPage
|
|||
UM.TooltipArea {
|
||||
width: childrenRect.width;
|
||||
height: childrenRect.height;
|
||||
text: catalog.i18nc("@info:tooltip","Should the default zoom behavior of cura be inverted?")
|
||||
text: catalog.i18nc("@info:tooltip", "Should the default zoom behavior of cura be inverted?")
|
||||
|
||||
CheckBox
|
||||
{
|
||||
id: invertZoomCheckbox
|
||||
text: catalog.i18nc("@action:button","Invert the direction of camera zoom.");
|
||||
text: catalog.i18nc("@action:button", "Invert the direction of camera zoom.");
|
||||
checked: boolCheck(UM.Preferences.getValue("view/invert_zoom"))
|
||||
onClicked: UM.Preferences.setValue("view/invert_zoom", checked)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,14 +13,28 @@ import Cura 1.0 as Cura
|
|||
Rectangle
|
||||
{
|
||||
id: brand_section
|
||||
property var expanded: base.collapsed_brands.indexOf(model.name) > -1
|
||||
property var types_model: model.material_types
|
||||
|
||||
property var sectionName: ""
|
||||
property var elementsModel // This can be a MaterialTypesModel or GenericMaterialsModel or FavoriteMaterialsModel
|
||||
property var hasMaterialTypes: true // It indicates wheather it has material types or not
|
||||
property var expanded: materialList.expandedBrands.indexOf(sectionName) > -1
|
||||
|
||||
height: childrenRect.height
|
||||
width: parent.width
|
||||
Rectangle
|
||||
{
|
||||
id: brand_header_background
|
||||
color: UM.Theme.getColor("favorites_header_bar")
|
||||
color:
|
||||
{
|
||||
if(!expanded && sectionName == materialList.currentBrand)
|
||||
{
|
||||
return UM.Theme.getColor("favorites_row_selected")
|
||||
}
|
||||
else
|
||||
{
|
||||
return UM.Theme.getColor("favorites_header_bar")
|
||||
}
|
||||
}
|
||||
anchors.fill: brand_header
|
||||
}
|
||||
Row
|
||||
|
|
@ -30,11 +44,11 @@ Rectangle
|
|||
Label
|
||||
{
|
||||
id: brand_name
|
||||
text: model.name
|
||||
text: sectionName
|
||||
height: UM.Theme.getSize("favorites_row").height
|
||||
width: parent.width - UM.Theme.getSize("favorites_button").width
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
leftPadding: 4
|
||||
leftPadding: (UM.Theme.getSize("default_margin").width / 2) | 0
|
||||
}
|
||||
Button
|
||||
{
|
||||
|
|
@ -69,32 +83,68 @@ Rectangle
|
|||
anchors.fill: brand_header
|
||||
onPressed:
|
||||
{
|
||||
const i = base.collapsed_brands.indexOf(model.name)
|
||||
const i = materialList.expandedBrands.indexOf(sectionName)
|
||||
if (i > -1)
|
||||
{
|
||||
// Remove it
|
||||
base.collapsed_brands.splice(i, 1)
|
||||
materialList.expandedBrands.splice(i, 1)
|
||||
brand_section.expanded = false
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add it
|
||||
base.collapsed_brands.push(model.name)
|
||||
materialList.expandedBrands.push(sectionName)
|
||||
brand_section.expanded = true
|
||||
}
|
||||
UM.Preferences.setValue("cura/expanded_brands", materialList.expandedBrands.join(";"));
|
||||
}
|
||||
}
|
||||
Column
|
||||
{
|
||||
id: brandMaterialList
|
||||
anchors.top: brand_header.bottom
|
||||
width: parent.width
|
||||
anchors.left: parent.left
|
||||
height: brand_section.expanded ? childrenRect.height : 0
|
||||
visible: brand_section.expanded
|
||||
|
||||
Repeater
|
||||
{
|
||||
model: types_model
|
||||
delegate: MaterialsTypeSection {}
|
||||
model: elementsModel
|
||||
delegate: Loader
|
||||
{
|
||||
id: loader
|
||||
width: parent.width
|
||||
property var element: model
|
||||
sourceComponent: hasMaterialTypes ? materialsTypeSection : materialSlot
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: materialsTypeSection
|
||||
MaterialsTypeSection
|
||||
{
|
||||
materialType: element
|
||||
}
|
||||
}
|
||||
|
||||
Component
|
||||
{
|
||||
id: materialSlot
|
||||
MaterialsSlot
|
||||
{
|
||||
material: element
|
||||
}
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: UM.Preferences
|
||||
onPreferenceChanged:
|
||||
{
|
||||
expanded = materialList.expandedBrands.indexOf(sectionName) > -1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,21 +13,40 @@ Item
|
|||
{
|
||||
id: detailsPanel
|
||||
|
||||
property var currentItem: base.currentItem
|
||||
property var currentItem: null
|
||||
|
||||
onCurrentItemChanged: { updateMaterialPropertiesObject(currentItem) }
|
||||
|
||||
function updateMaterialPropertiesObject( currentItem )
|
||||
onCurrentItemChanged:
|
||||
{
|
||||
materialProperties.name = currentItem.name || "Unknown"
|
||||
materialProperties.guid = currentItem.GUID;
|
||||
// When the current item changes, the detail view needs to be updated
|
||||
if (currentItem != null)
|
||||
{
|
||||
updateMaterialPropertiesObject()
|
||||
materialDetailsView.currentMaterialNode = currentItem.container_node
|
||||
}
|
||||
}
|
||||
|
||||
function updateMaterialPropertiesObject()
|
||||
{
|
||||
// DRAGON WARNING!!! DO NOT TOUCH THIS IF YOU DON'T KNOW.
|
||||
// TL;DR: Always update "container_id" first!
|
||||
//
|
||||
// Other widgets such as MaterialsView have bindings towards "materialProperties" and its properties. Here the
|
||||
// properties are updated one by one, and each change can trigger a reaction on those widgets that have
|
||||
// connections to the property gets changed, and some reactions will use functions such as
|
||||
// ContainerManager.getContainerMetaDataEntry() to fetch data using the "container_id" as the reference.
|
||||
// We need to change "container_id" first so any underlying triggers will use the correct "container_id" to
|
||||
// fetch data. Or, for example, if we change GUID first, which triggered the weight widget to fetch weight
|
||||
// before we can update "container_id", so it will fetch weight with the wrong (old) "container_id".
|
||||
materialProperties.container_id = currentItem.id
|
||||
|
||||
materialProperties.name = currentItem.name || "Unknown"
|
||||
materialProperties.guid = currentItem.GUID
|
||||
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.adhesion_info = currentItem.adhesion_info || ""
|
||||
materialProperties.density = currentItem.density || 0.0
|
||||
materialProperties.diameter = currentItem.diameter || 0.0
|
||||
materialProperties.approximate_diameter = currentItem.approximate_diameter || "0"
|
||||
|
|
@ -62,13 +81,11 @@ Item
|
|||
bottom: parent.bottom
|
||||
}
|
||||
|
||||
editingEnabled: base.currentItem != null && !base.currentItem.is_read_only
|
||||
editingEnabled: currentItem != null && !currentItem.is_read_only
|
||||
|
||||
properties: materialProperties
|
||||
containerId: base.currentItem != null ? base.currentItem.id : ""
|
||||
currentMaterialNode: base.currentItem.container_node
|
||||
|
||||
|
||||
containerId: currentItem != null ? currentItem.id : ""
|
||||
currentMaterialNode: currentItem.container_node
|
||||
}
|
||||
|
||||
QtObject
|
||||
|
|
|
|||
|
|
@ -13,187 +13,156 @@ import Cura 1.0 as Cura
|
|||
Item
|
||||
{
|
||||
id: materialList
|
||||
width: materialScrollView.width - 17
|
||||
height: childrenRect.height
|
||||
|
||||
// Children
|
||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
||||
Cura.MaterialBrandsModel { id: materialsModel }
|
||||
Cura.FavoriteMaterialsModel { id: favoriteMaterialsModel }
|
||||
Cura.GenericMaterialsModel { id: genericMaterialsModel }
|
||||
Cura.MaterialBrandsModel
|
||||
{
|
||||
id: materialsModel
|
||||
extruderPosition: Cura.ExtruderManager.activeExtruderIndex
|
||||
}
|
||||
|
||||
Cura.FavoriteMaterialsModel
|
||||
{
|
||||
id: favoriteMaterialsModel
|
||||
extruderPosition: Cura.ExtruderManager.activeExtruderIndex
|
||||
}
|
||||
|
||||
Cura.GenericMaterialsModel
|
||||
{
|
||||
id: genericMaterialsModel
|
||||
extruderPosition: Cura.ExtruderManager.activeExtruderIndex
|
||||
}
|
||||
|
||||
property var currentType: null
|
||||
property var currentBrand: null
|
||||
property var expandedBrands: UM.Preferences.getValue("cura/expanded_brands").split(";")
|
||||
property var expandedTypes: UM.Preferences.getValue("cura/expanded_types").split(";")
|
||||
|
||||
// Store information about which parts of the tree are expanded
|
||||
function persistExpandedCategories()
|
||||
{
|
||||
UM.Preferences.setValue("cura/expanded_brands", materialList.expandedBrands.join(";"))
|
||||
UM.Preferences.setValue("cura/expanded_types", materialList.expandedTypes.join(";"))
|
||||
}
|
||||
|
||||
// Expand the list of materials in order to select the current material
|
||||
function expandActiveMaterial(search_root_id)
|
||||
{
|
||||
if (search_root_id == "")
|
||||
{
|
||||
// When this happens it means that the information of one of the materials has changed, so the model
|
||||
// was updated and the list has to highlight the current item.
|
||||
var currentItemId = base.currentItem == null ? "" : base.currentItem.root_material_id
|
||||
search_root_id = currentItemId
|
||||
}
|
||||
for (var material_idx = 0; material_idx < genericMaterialsModel.rowCount(); material_idx++)
|
||||
{
|
||||
var material = genericMaterialsModel.getItem(material_idx)
|
||||
if (material.root_material_id == search_root_id)
|
||||
{
|
||||
if (materialList.expandedBrands.indexOf("Generic") == -1)
|
||||
{
|
||||
materialList.expandedBrands.push("Generic")
|
||||
}
|
||||
materialList.currentBrand = "Generic"
|
||||
base.currentItem = material
|
||||
persistExpandedCategories()
|
||||
return true
|
||||
}
|
||||
}
|
||||
for (var brand_idx = 0; brand_idx < materialsModel.rowCount(); brand_idx++)
|
||||
{
|
||||
var brand = materialsModel.getItem(brand_idx)
|
||||
var types_model = brand.material_types
|
||||
for (var type_idx = 0; type_idx < types_model.rowCount(); type_idx++)
|
||||
{
|
||||
var type = types_model.getItem(type_idx)
|
||||
var colors_model = type.colors
|
||||
for (var material_idx = 0; material_idx < colors_model.rowCount(); material_idx++)
|
||||
{
|
||||
var material = colors_model.getItem(material_idx)
|
||||
if (material.root_material_id == search_root_id)
|
||||
{
|
||||
if (materialList.expandedBrands.indexOf(brand.name) == -1)
|
||||
{
|
||||
materialList.expandedBrands.push(brand.name)
|
||||
}
|
||||
materialList.currentBrand = brand.name
|
||||
if (materialList.expandedTypes.indexOf(brand.name + "_" + type.name) == -1)
|
||||
{
|
||||
materialList.expandedTypes.push(brand.name + "_" + type.name)
|
||||
}
|
||||
materialList.currentType = brand.name + "_" + type.name
|
||||
base.currentItem = material
|
||||
persistExpandedCategories()
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function updateAfterModelChanges()
|
||||
{
|
||||
var correctlyExpanded = materialList.expandActiveMaterial(base.newRootMaterialIdToSwitchTo)
|
||||
if (correctlyExpanded)
|
||||
{
|
||||
if (base.toActivateNewMaterial)
|
||||
{
|
||||
var position = Cura.ExtruderManager.activeExtruderIndex
|
||||
Cura.MachineManager.setMaterial(position, base.currentItem.container_node)
|
||||
}
|
||||
base.newRootMaterialIdToSwitchTo = ""
|
||||
base.toActivateNewMaterial = false
|
||||
}
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: materialsModel
|
||||
onItemsChanged: updateAfterModelChanges()
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: genericMaterialsModel
|
||||
onItemsChanged: updateAfterModelChanges()
|
||||
}
|
||||
|
||||
Column
|
||||
{
|
||||
Rectangle
|
||||
{
|
||||
property var expanded: true
|
||||
width: materialList.width
|
||||
height: childrenRect.height
|
||||
|
||||
id: favorites_section
|
||||
height: childrenRect.height
|
||||
width: materialList.width
|
||||
Rectangle
|
||||
{
|
||||
id: favorites_header_background
|
||||
color: UM.Theme.getColor("favorites_header_bar")
|
||||
anchors.fill: favorites_header
|
||||
}
|
||||
Row
|
||||
{
|
||||
id: favorites_header
|
||||
Label
|
||||
{
|
||||
id: favorites_name
|
||||
text: "Favorites"
|
||||
height: UM.Theme.getSize("favorites_row").height
|
||||
width: materialList.width - UM.Theme.getSize("favorites_button").width
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
leftPadding: 4
|
||||
}
|
||||
Button
|
||||
{
|
||||
text: ""
|
||||
implicitWidth: UM.Theme.getSize("favorites_button").width
|
||||
implicitHeight: UM.Theme.getSize("favorites_button").height
|
||||
UM.RecolorImage {
|
||||
anchors
|
||||
{
|
||||
verticalCenter: parent.verticalCenter
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
width: UM.Theme.getSize("standard_arrow").width
|
||||
height: UM.Theme.getSize("standard_arrow").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color: "black"
|
||||
source: favorites_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||
}
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: favorites_header
|
||||
onPressed:
|
||||
{
|
||||
favorites_section.expanded = !favorites_section.expanded
|
||||
}
|
||||
}
|
||||
Column
|
||||
{
|
||||
anchors.top: favorites_header.bottom
|
||||
anchors.left: parent.left
|
||||
width: materialList.width
|
||||
height: favorites_section.expanded ? childrenRect.height : 0
|
||||
visible: favorites_section.expanded
|
||||
Repeater
|
||||
{
|
||||
model: favoriteMaterialsModel
|
||||
delegate: MaterialsSlot {
|
||||
material: model
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle
|
||||
MaterialsBrandSection
|
||||
{
|
||||
property var expanded: base.collapsed_brands.indexOf("Generic") > -1
|
||||
|
||||
id: generic_section
|
||||
height: childrenRect.height
|
||||
width: materialList.width
|
||||
Rectangle
|
||||
{
|
||||
id: generic_header_background
|
||||
color: UM.Theme.getColor("favorites_header_bar")
|
||||
anchors.fill: generic_header
|
||||
}
|
||||
Row
|
||||
{
|
||||
id: generic_header
|
||||
Label
|
||||
{
|
||||
id: generic_name
|
||||
text: "Generic"
|
||||
height: UM.Theme.getSize("favorites_row").height
|
||||
width: materialList.width - UM.Theme.getSize("favorites_button").width
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
leftPadding: 4
|
||||
}
|
||||
Button
|
||||
{
|
||||
text: ""
|
||||
implicitWidth: UM.Theme.getSize("favorites_button").width
|
||||
implicitHeight: UM.Theme.getSize("favorites_button").height
|
||||
UM.RecolorImage {
|
||||
anchors
|
||||
{
|
||||
verticalCenter: parent.verticalCenter
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
width: UM.Theme.getSize("standard_arrow").width
|
||||
height: UM.Theme.getSize("standard_arrow").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color: "black"
|
||||
source: generic_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
|
||||
}
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: generic_header
|
||||
onPressed:
|
||||
{
|
||||
const i = base.collapsed_brands.indexOf("Generic")
|
||||
if (i > -1)
|
||||
{
|
||||
// Remove it
|
||||
base.collapsed_brands.splice(i, 1)
|
||||
generic_section.expanded = false
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add it
|
||||
base.collapsed_brands.push("Generic")
|
||||
generic_section.expanded = true
|
||||
}
|
||||
}
|
||||
}
|
||||
Column
|
||||
{
|
||||
anchors.top: generic_header.bottom
|
||||
width: materialList.width
|
||||
anchors.left: parent.left
|
||||
height: generic_section.expanded ? childrenRect.height : 0
|
||||
visible: generic_section.expanded
|
||||
Repeater
|
||||
{
|
||||
model: genericMaterialsModel
|
||||
delegate: MaterialsSlot {
|
||||
material: model
|
||||
}
|
||||
}
|
||||
}
|
||||
id: favoriteSection
|
||||
sectionName: "Favorites"
|
||||
elementsModel: favoriteMaterialsModel
|
||||
hasMaterialTypes: false
|
||||
}
|
||||
|
||||
MaterialsBrandSection
|
||||
{
|
||||
id: genericSection
|
||||
sectionName: "Generic"
|
||||
elementsModel: genericMaterialsModel
|
||||
hasMaterialTypes: false
|
||||
}
|
||||
|
||||
Repeater
|
||||
{
|
||||
id: brand_list
|
||||
model: materialsModel
|
||||
delegate: MaterialsBrandSection {}
|
||||
delegate: MaterialsBrandSection
|
||||
{
|
||||
id: brandSection
|
||||
sectionName: model.name
|
||||
elementsModel: model.material_types
|
||||
hasMaterialTypes: true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -17,96 +17,38 @@ Item
|
|||
// Keep PreferencesDialog happy
|
||||
property var resetEnabled: false
|
||||
property var currentItem: null
|
||||
|
||||
property var hasCurrentItem: base.currentItem != null
|
||||
property var isCurrentItemActivated:
|
||||
{
|
||||
const extruder_position = Cura.ExtruderManager.activeExtruderIndex;
|
||||
const root_material_id = Cura.MachineManager.currentRootMaterialId[extruder_position];
|
||||
return base.currentItem.root_material_id == root_material_id;
|
||||
if (!hasCurrentItem)
|
||||
{
|
||||
return false
|
||||
}
|
||||
const extruder_position = Cura.ExtruderManager.activeExtruderIndex
|
||||
const root_material_id = Cura.MachineManager.currentRootMaterialId[extruder_position]
|
||||
return base.currentItem.root_material_id == root_material_id
|
||||
}
|
||||
property string newRootMaterialIdToSwitchTo: ""
|
||||
property bool toActivateNewMaterial: false
|
||||
|
||||
// TODO: Save these to preferences
|
||||
property var collapsed_brands: []
|
||||
property var collapsed_types: []
|
||||
property var extruder_position: Cura.ExtruderManager.activeExtruderIndex
|
||||
property var active_root_material_id: Cura.MachineManager.currentRootMaterialId[extruder_position]
|
||||
|
||||
UM.I18nCatalog
|
||||
{
|
||||
id: catalog
|
||||
name: "cura"
|
||||
}
|
||||
Cura.MaterialBrandsModel { id: materialsModel }
|
||||
|
||||
function findModelByRootId( search_root_id )
|
||||
// When loaded, try to select the active material in the tree
|
||||
Component.onCompleted: materialListView.expandActiveMaterial(active_root_material_id)
|
||||
|
||||
// Every time the selected item has changed, notify to the details panel
|
||||
onCurrentItemChanged:
|
||||
{
|
||||
for (var i = 0; i < materialsModel.rowCount(); i++)
|
||||
{
|
||||
var types_model = materialsModel.getItem(i).material_types;
|
||||
for (var j = 0; j < types_model.rowCount(); j++)
|
||||
{
|
||||
var colors_model = types_model.getItem(j).colors;
|
||||
for (var k = 0; k < colors_model.rowCount(); k++)
|
||||
{
|
||||
var material = colors_model.getItem(k);
|
||||
if (material.root_material_id == search_root_id)
|
||||
{
|
||||
return material
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted:
|
||||
{
|
||||
// Select the activated material when this page shows up
|
||||
const extruder_position = Cura.ExtruderManager.activeExtruderIndex;
|
||||
const active_root_material_id = Cura.MachineManager.currentRootMaterialId[extruder_position];
|
||||
console.log("goign to search for", active_root_material_id)
|
||||
base.currentItem = findModelByRootId(active_root_material_id)
|
||||
}
|
||||
|
||||
onCurrentItemChanged: { MaterialsDetailsPanel.currentItem = currentItem }
|
||||
Connections
|
||||
{
|
||||
target: materialsModel
|
||||
onItemsChanged:
|
||||
{
|
||||
var currentItemId = base.currentItem == null ? "" : base.currentItem.root_material_id;
|
||||
var position = Cura.ExtruderManager.activeExtruderIndex;
|
||||
|
||||
// try to pick the currently selected item; it may have been moved
|
||||
if (base.newRootMaterialIdToSwitchTo == "")
|
||||
{
|
||||
base.newRootMaterialIdToSwitchTo = currentItemId;
|
||||
}
|
||||
|
||||
for (var idx = 0; idx < materialsModel.rowCount(); ++idx)
|
||||
{
|
||||
var item = materialsModel.getItem(idx);
|
||||
if (item.root_material_id == base.newRootMaterialIdToSwitchTo)
|
||||
{
|
||||
// Switch to the newly created profile if needed
|
||||
materialListView.currentIndex = idx;
|
||||
materialListView.activateDetailsWithIndex(materialListView.currentIndex);
|
||||
if (base.toActivateNewMaterial)
|
||||
{
|
||||
Cura.MachineManager.setMaterial(position, item.container_node);
|
||||
}
|
||||
base.newRootMaterialIdToSwitchTo = "";
|
||||
base.toActivateNewMaterial = false;
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
materialListView.currentIndex = 0;
|
||||
materialListView.activateDetailsWithIndex(materialListView.currentIndex);
|
||||
if (base.toActivateNewMaterial)
|
||||
{
|
||||
Cura.MachineManager.setMaterial(position, materialsModel.getItem(0).container_node);
|
||||
}
|
||||
base.newRootMaterialIdToSwitchTo = "";
|
||||
base.toActivateNewMaterial = false;
|
||||
}
|
||||
forceActiveFocus()
|
||||
materialDetailsPanel.currentItem = currentItem
|
||||
}
|
||||
|
||||
// Main layout
|
||||
|
|
@ -146,8 +88,10 @@ Item
|
|||
{
|
||||
forceActiveFocus()
|
||||
|
||||
const extruder_position = Cura.ExtruderManager.activeExtruderIndex;
|
||||
Cura.MachineManager.setMaterial(extruder_position, base.currentItem.container_node);
|
||||
// Set the current material as the one to be activated (needed to force the UI update)
|
||||
base.newRootMaterialIdToSwitchTo = base.currentItem.root_material_id
|
||||
const extruder_position = Cura.ExtruderManager.activeExtruderIndex
|
||||
Cura.MachineManager.setMaterial(extruder_position, base.currentItem.container_node)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -214,7 +158,7 @@ Item
|
|||
forceActiveFocus();
|
||||
exportMaterialDialog.open();
|
||||
}
|
||||
enabled: currentItem != null
|
||||
enabled: base.hasCurrentItem
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -285,15 +229,20 @@ Item
|
|||
color: palette.light
|
||||
}
|
||||
|
||||
width: true ? (parent.width * 0.4) | 0 : parent.width
|
||||
width: (parent.width * 0.4) | 0
|
||||
frameVisible: true
|
||||
verticalScrollBarPolicy: Qt.ScrollBarAlwaysOn
|
||||
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
|
||||
|
||||
MaterialsList {}
|
||||
MaterialsList
|
||||
{
|
||||
id: materialListView
|
||||
width: materialScrollView.viewport.width
|
||||
}
|
||||
}
|
||||
|
||||
MaterialsDetailsPanel
|
||||
{
|
||||
id: materialDetailsPanel
|
||||
anchors
|
||||
{
|
||||
left: materialScrollView.right
|
||||
|
|
@ -316,6 +265,8 @@ Item
|
|||
modality: Qt.ApplicationModal
|
||||
onYes:
|
||||
{
|
||||
// Set the active material as the fallback. It will be selected when the current material is deleted
|
||||
base.newRootMaterialIdToSwitchTo = base.active_root_material_id
|
||||
base.materialManager.removeMaterial(base.currentItem.container_node);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,109 +12,109 @@ import Cura 1.0 as Cura
|
|||
|
||||
Rectangle
|
||||
{
|
||||
id: material_slot
|
||||
property var material
|
||||
id: materialSlot
|
||||
property var material: null
|
||||
property var hovered: false
|
||||
property var is_favorite: material.is_favorite
|
||||
property var is_favorite: material != null ? material.is_favorite : false
|
||||
|
||||
height: UM.Theme.getSize("favorites_row").height
|
||||
width: parent.width
|
||||
color: base.currentItem == model ? UM.Theme.getColor("favorites_row_selected") : "transparent"
|
||||
|
||||
Item
|
||||
color: material != null ? (base.currentItem.root_material_id == material.root_material_id ? UM.Theme.getColor("favorites_row_selected") : "transparent") : "transparent"
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: swatch
|
||||
color: material != null ? material.color_code : "transparent"
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: "black"
|
||||
width: UM.Theme.getSize("favorites_button_icon").width
|
||||
height: UM.Theme.getSize("favorites_button_icon").height
|
||||
anchors.verticalCenter: materialSlot.verticalCenter
|
||||
anchors.left: materialSlot.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: material != null ? material.brand + " " + material.name : ""
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
height: parent.height
|
||||
width: parent.width
|
||||
Rectangle
|
||||
anchors.left: swatch.right
|
||||
anchors.verticalCenter: materialSlot.verticalCenter
|
||||
anchors.leftMargin: UM.Theme.getSize("narrow_margin").width
|
||||
}
|
||||
MouseArea
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked:
|
||||
{
|
||||
id: swatch
|
||||
color: material.color_code
|
||||
border.width: UM.Theme.getSize("default_lining").width
|
||||
border.color: "black"
|
||||
width: UM.Theme.getSize("favorites_button_icon").width
|
||||
height: UM.Theme.getSize("favorites_button_icon").height
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: UM.Theme.getSize("default_margin").width
|
||||
materialList.currentBrand = material.brand
|
||||
materialList.currentType = material.brand + "_" + material.material
|
||||
base.currentItem = material
|
||||
}
|
||||
Label
|
||||
hoverEnabled: true
|
||||
onEntered: { materialSlot.hovered = true }
|
||||
onExited: { materialSlot.hovered = false }
|
||||
}
|
||||
Button
|
||||
{
|
||||
id: favorite_button
|
||||
text: ""
|
||||
implicitWidth: UM.Theme.getSize("favorites_button").width
|
||||
implicitHeight: UM.Theme.getSize("favorites_button").height
|
||||
visible: materialSlot.hovered || materialSlot.is_favorite || favorite_button.hovered
|
||||
anchors
|
||||
{
|
||||
text: material.brand + " " + material.name
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
height: parent.height
|
||||
anchors.left: swatch.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.leftMargin: UM.Theme.getSize("narrow_margin").width
|
||||
right: materialSlot.right
|
||||
verticalCenter: materialSlot.verticalCenter
|
||||
}
|
||||
MouseArea
|
||||
onClicked:
|
||||
{
|
||||
anchors.fill: parent
|
||||
onClicked: { base.currentItem = material }
|
||||
hoverEnabled: true
|
||||
onEntered: { material_slot.hovered = true }
|
||||
onExited: { material_slot.hovered = false }
|
||||
}
|
||||
Button
|
||||
{
|
||||
id: favorite_button
|
||||
text: ""
|
||||
implicitWidth: UM.Theme.getSize("favorites_button").width
|
||||
implicitHeight: UM.Theme.getSize("favorites_button").height
|
||||
visible: material_slot.hovered || material_slot.is_favorite || favorite_button.hovered
|
||||
anchors
|
||||
{
|
||||
right: parent.right
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
onClicked:
|
||||
{
|
||||
if (material_slot.is_favorite) {
|
||||
base.materialManager.removeFavorite(material.root_material_id)
|
||||
material_slot.is_favorite = false
|
||||
return
|
||||
}
|
||||
base.materialManager.addFavorite(material.root_material_id)
|
||||
material_slot.is_favorite = true
|
||||
if (materialSlot.is_favorite) {
|
||||
base.materialManager.removeFavorite(material.root_material_id)
|
||||
materialSlot.is_favorite = false
|
||||
return
|
||||
}
|
||||
style: ButtonStyle
|
||||
base.materialManager.addFavorite(material.root_material_id)
|
||||
materialSlot.is_favorite = true
|
||||
return
|
||||
}
|
||||
style: ButtonStyle
|
||||
{
|
||||
background: Rectangle
|
||||
{
|
||||
background: Rectangle
|
||||
{
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
}
|
||||
anchors.fill: parent
|
||||
color: "transparent"
|
||||
}
|
||||
UM.RecolorImage {
|
||||
anchors
|
||||
}
|
||||
UM.RecolorImage {
|
||||
anchors
|
||||
{
|
||||
verticalCenter: favorite_button.verticalCenter
|
||||
horizontalCenter: favorite_button.horizontalCenter
|
||||
}
|
||||
width: UM.Theme.getSize("favorites_button_icon").width
|
||||
height: UM.Theme.getSize("favorites_button_icon").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color:
|
||||
{
|
||||
if (favorite_button.hovered)
|
||||
{
|
||||
verticalCenter: parent.verticalCenter
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
return UM.Theme.getColor("primary_hover")
|
||||
}
|
||||
width: UM.Theme.getSize("favorites_button_icon").width
|
||||
height: UM.Theme.getSize("favorites_button_icon").height
|
||||
sourceSize.width: width
|
||||
sourceSize.height: height
|
||||
color:
|
||||
else
|
||||
{
|
||||
if (favorite_button.hovered)
|
||||
if (materialSlot.is_favorite)
|
||||
{
|
||||
return UM.Theme.getColor("primary_hover")
|
||||
return UM.Theme.getColor("primary")
|
||||
}
|
||||
else
|
||||
{
|
||||
if (material_slot.is_favorite)
|
||||
{
|
||||
return UM.Theme.getColor("primary")
|
||||
}
|
||||
else
|
||||
{
|
||||
UM.Theme.getColor("text_inactive")
|
||||
}
|
||||
UM.Theme.getColor("text_inactive")
|
||||
}
|
||||
}
|
||||
source: material_slot.is_favorite ? UM.Theme.getIcon("favorites_star_full") : UM.Theme.getIcon("favorites_star_empty")
|
||||
}
|
||||
source: materialSlot.is_favorite ? UM.Theme.getIcon("favorites_star_full") : UM.Theme.getIcon("favorites_star_empty")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -13,14 +13,32 @@ import Cura 1.0 as Cura
|
|||
Rectangle
|
||||
{
|
||||
id: material_type_section
|
||||
property var expanded: base.collapsed_types.indexOf(model.brand + "_" + model.name) > -1
|
||||
property var colors_model: model.colors
|
||||
property var materialType
|
||||
property var expanded: materialList.expandedTypes.indexOf(materialType.brand + "_" + materialType.name) > -1
|
||||
property var colorsModel: materialType.colors
|
||||
height: childrenRect.height
|
||||
width: parent.width
|
||||
Rectangle
|
||||
{
|
||||
id: material_type_header_background
|
||||
color: UM.Theme.getColor("lining")
|
||||
color:
|
||||
{
|
||||
if(!expanded && materialType.brand + "_" + materialType.name == materialList.currentType)
|
||||
{
|
||||
return UM.Theme.getColor("favorites_row_selected")
|
||||
}
|
||||
else
|
||||
{
|
||||
return "transparent"
|
||||
}
|
||||
}
|
||||
width: parent.width
|
||||
height: material_type_header.height
|
||||
}
|
||||
Rectangle
|
||||
{
|
||||
id: material_type_header_border
|
||||
color: UM.Theme.getColor("favorites_header_bar")
|
||||
anchors.bottom: material_type_header.bottom
|
||||
anchors.left: material_type_header.left
|
||||
height: UM.Theme.getSize("default_lining").height
|
||||
|
|
@ -29,17 +47,17 @@ Rectangle
|
|||
Row
|
||||
{
|
||||
id: material_type_header
|
||||
width: parent.width - 8
|
||||
width: parent.width
|
||||
leftPadding: UM.Theme.getSize("default_margin").width
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
leftMargin: 8
|
||||
}
|
||||
Label
|
||||
{
|
||||
text: model.name
|
||||
text: materialType.name
|
||||
height: UM.Theme.getSize("favorites_row").height
|
||||
width: parent.width - UM.Theme.getSize("favorites_button").width
|
||||
width: parent.width - parent.leftPadding - UM.Theme.getSize("favorites_button").width
|
||||
id: material_type_name
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
|
@ -76,19 +94,21 @@ Rectangle
|
|||
anchors.fill: material_type_header
|
||||
onPressed:
|
||||
{
|
||||
const i = base.collapsed_types.indexOf(model.brand + "_" + model.name)
|
||||
const identifier = materialType.brand + "_" + materialType.name;
|
||||
const i = materialList.expandedTypes.indexOf(identifier)
|
||||
if (i > -1)
|
||||
{
|
||||
// Remove it
|
||||
base.collapsed_types.splice(i, 1)
|
||||
materialList.expandedTypes.splice(i, 1)
|
||||
material_type_section.expanded = false
|
||||
}
|
||||
else
|
||||
{
|
||||
// Add it
|
||||
base.collapsed_types.push(model.brand + "_" + model.name)
|
||||
materialList.expandedTypes.push(identifier)
|
||||
material_type_section.expanded = true
|
||||
}
|
||||
UM.Preferences.setValue("cura/expanded_types", materialList.expandedTypes.join(";"));
|
||||
}
|
||||
}
|
||||
Column
|
||||
|
|
@ -97,13 +117,22 @@ Rectangle
|
|||
visible: material_type_section.expanded
|
||||
width: parent.width
|
||||
anchors.top: material_type_header.bottom
|
||||
anchors.left: parent.left
|
||||
Repeater
|
||||
{
|
||||
model: colors_model
|
||||
delegate: MaterialsSlot {
|
||||
model: colorsModel
|
||||
delegate: MaterialsSlot
|
||||
{
|
||||
material: model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: UM.Preferences
|
||||
onPreferenceChanged:
|
||||
{
|
||||
expanded = materialList.expandedTypes.indexOf(materialType.brand + "_" + materialType.name) > -1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -40,7 +40,7 @@ TabView
|
|||
{
|
||||
return ""
|
||||
}
|
||||
var linkedMaterials = Cura.ContainerManager.getLinkedMaterials(base.currentItem.container_node, true);
|
||||
var linkedMaterials = Cura.ContainerManager.getLinkedMaterials(base.currentMaterialNode, true);
|
||||
if (linkedMaterials.length == 0)
|
||||
{
|
||||
return ""
|
||||
|
|
@ -191,6 +191,7 @@ TabView
|
|||
ReadOnlyTextField
|
||||
{
|
||||
id: colorLabel;
|
||||
width: parent.width - colorSelector.width - parent.spacing
|
||||
text: properties.color_name;
|
||||
readOnly: !base.editingEnabled
|
||||
onEditingFinished: base.setMetaDataEntry("color_name", properties.color_name, text)
|
||||
|
|
@ -567,25 +568,25 @@ TabView
|
|||
// don't change when new name is the same
|
||||
if (old_name == new_name)
|
||||
{
|
||||
return;
|
||||
return
|
||||
}
|
||||
|
||||
// update the values
|
||||
base.materialManager.setMaterialName(base.currentMaterialNode, new_name);
|
||||
materialProperties.name = new_name;
|
||||
base.materialManager.setMaterialName(base.currentMaterialNode, new_name)
|
||||
properties.name = new_name
|
||||
}
|
||||
|
||||
// update the type of the material
|
||||
function updateMaterialType (old_type, new_type)
|
||||
function updateMaterialType(old_type, new_type)
|
||||
{
|
||||
base.setMetaDataEntry("material", old_type, new_type);
|
||||
materialProperties.material= new_type;
|
||||
base.setMetaDataEntry("material", old_type, new_type)
|
||||
properties.material = new_type
|
||||
}
|
||||
|
||||
// update the brand of the material
|
||||
function updateMaterialBrand (old_brand, new_brand)
|
||||
function updateMaterialBrand(old_brand, new_brand)
|
||||
{
|
||||
base.setMetaDataEntry("brand", old_brand, new_brand);
|
||||
materialProperties.brand = new_brand;
|
||||
base.setMetaDataEntry("brand", old_brand, new_brand)
|
||||
properties.brand = new_brand
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -595,7 +595,7 @@ Rectangle
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
@ -605,7 +605,7 @@ Rectangle
|
|||
{
|
||||
id: machineHeatedBed
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_heated_bed"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
|
|||
|
|
@ -78,18 +78,18 @@ Column
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: bedTemperature
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "material_bed_temperature"
|
||||
watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
|
||||
storeIndex: 0
|
||||
|
||||
property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None"
|
||||
property var resolve: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine ? properties.resolve : "None"
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: machineExtruderCount
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: ["value"]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ Item
|
|||
watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"]
|
||||
storeIndex: 0
|
||||
|
||||
property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None"
|
||||
property var resolve: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine ? properties.resolve : "None"
|
||||
}
|
||||
|
||||
Rectangle
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ Button
|
|||
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
|
||||
background: Rectangle
|
||||
{
|
||||
id: backgroundRectangle
|
||||
implicitHeight: UM.Theme.getSize("section").height
|
||||
color: {
|
||||
if (base.color) {
|
||||
|
|
@ -35,6 +36,7 @@ Button
|
|||
Behavior on color { ColorAnimation { duration: 50; } }
|
||||
Rectangle
|
||||
{
|
||||
id: backgroundLiningRectangle
|
||||
height: UM.Theme.getSize("default_lining").height
|
||||
width: parent.width
|
||||
anchors.bottom: parent.bottom
|
||||
|
|
@ -68,6 +70,7 @@ Button
|
|||
anchors.left: parent.left
|
||||
|
||||
Label {
|
||||
id: settingNameLabel
|
||||
anchors
|
||||
{
|
||||
left: parent.left
|
||||
|
|
@ -76,6 +79,7 @@ Button
|
|||
verticalCenter: parent.verticalCenter;
|
||||
}
|
||||
text: definition.label
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("setting_category")
|
||||
color:
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ SettingItem
|
|||
anchors.right: downArrow.left
|
||||
|
||||
text: control.currentText
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("default")
|
||||
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
|
||||
|
|
@ -115,6 +116,7 @@ SettingItem
|
|||
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
|
||||
|
||||
text: modelData.value
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
color: control.contentItem.color
|
||||
font: UM.Theme.getFont("default")
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ SettingItem
|
|||
rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width
|
||||
|
||||
text: control.currentText
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("default")
|
||||
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
||||
|
|
|
|||
|
|
@ -115,6 +115,7 @@ Item {
|
|||
text: definition.label
|
||||
elide: Text.ElideMiddle;
|
||||
renderType: Text.NativeRendering
|
||||
textFormat: Text.PlainText
|
||||
|
||||
color: UM.Theme.getColor("setting_control_text");
|
||||
opacity: (definition.visible) ? 1 : 0.5
|
||||
|
|
@ -139,7 +140,7 @@ Item {
|
|||
{
|
||||
id: linkedSettingIcon;
|
||||
|
||||
visible: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon
|
||||
visible: Cura.MachineManager.activeStack != Cura.MachineManager.activeMachine && (!definition.settable_per_extruder || String(globalPropertyProvider.properties.limit_to_extruder) != "-1") && base.showLinkedSettingIcon
|
||||
|
||||
height: parent.height;
|
||||
width: height;
|
||||
|
|
@ -260,12 +261,6 @@ Item {
|
|||
// entry (user container) are set, we can simply remove the container.
|
||||
propertyProvider.removeFromContainer(0)
|
||||
}
|
||||
else if(last_entry - 1 == base.stackLevel)
|
||||
{
|
||||
// Another special case. The setting that is overriden is only 1 instance container deeper,
|
||||
// so we can remove it.
|
||||
propertyProvider.removeFromContainer(last_entry - 1)
|
||||
}
|
||||
else
|
||||
{
|
||||
// Put that entry into the "top" instance container.
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ SettingItem
|
|||
rightPadding: swatch.width + UM.Theme.getSize("setting_unit_margin").width
|
||||
|
||||
text: control.currentText
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
font: UM.Theme.getFont("default")
|
||||
color: enabled ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text")
|
||||
|
|
@ -199,6 +200,7 @@ SettingItem
|
|||
anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width
|
||||
|
||||
text: model.name
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
color:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@ SettingItem
|
|||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
text: definition.unit
|
||||
textFormat: Text.PlainText
|
||||
renderType: Text.NativeRendering
|
||||
color: UM.Theme.getColor("setting_unit")
|
||||
font: UM.Theme.getFont("default")
|
||||
|
|
|
|||
|
|
@ -39,10 +39,11 @@ Item
|
|||
Label
|
||||
{
|
||||
id: globalProfileLabel
|
||||
text: catalog.i18nc("@label","Profile:");
|
||||
text: catalog.i18nc("@label","Profile:")
|
||||
textFormat: Text.PlainText
|
||||
width: Math.round(parent.width * 0.45 - UM.Theme.getSize("sidebar_margin").width - 2)
|
||||
font: UM.Theme.getFont("default");
|
||||
color: UM.Theme.getColor("text");
|
||||
font: UM.Theme.getFont("default")
|
||||
color: UM.Theme.getColor("text")
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.top: parent.top
|
||||
anchors.bottom: parent.bottom
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ Column
|
|||
elide: Text.ElideRight
|
||||
}
|
||||
|
||||
// Everthing for the extruder icon
|
||||
// Everything for the extruder icon
|
||||
Item
|
||||
{
|
||||
id: extruderIconItem
|
||||
|
|
@ -607,7 +607,7 @@ Column
|
|||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ Item
|
|||
property variant minimumPrintTime: PrintInformation.minimumPrintTime;
|
||||
property variant maximumPrintTime: PrintInformation.maximumPrintTime;
|
||||
property bool settingsEnabled: Cura.ExtruderManager.activeExtruderStackId || extrudersEnabledCount.properties.value == 1
|
||||
|
||||
Component.onCompleted: PrintInformation.enabled = true
|
||||
Component.onDestruction: PrintInformation.enabled = false
|
||||
UM.I18nCatalog { id: catalog; name: "cura" }
|
||||
|
|
@ -1116,7 +1115,7 @@ Item
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: platformAdhesionType
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "adhesion_type"
|
||||
watchedProperties: [ "value", "enabled" ]
|
||||
storeIndex: 0
|
||||
|
|
@ -1125,7 +1124,7 @@ Item
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: supportEnabled
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "support_enable"
|
||||
watchedProperties: [ "value", "enabled", "description" ]
|
||||
storeIndex: 0
|
||||
|
|
@ -1134,7 +1133,7 @@ Item
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: extrudersEnabledCount
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "extruders_enabled_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
@ -1143,7 +1142,7 @@ Item
|
|||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: supportExtruderNr
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
containerStack: Cura.MachineManager.activeMachine
|
||||
key: "support_extruder_nr"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue