Merge branch 'master' into feature_firmware_updater

This commit is contained in:
fieldOfView 2018-09-28 11:32:28 +02:00
commit 7c23a4e187
337 changed files with 88130 additions and 18157 deletions

View file

@ -75,7 +75,8 @@ Item
Action
{
id:toggleFullScreenAction
text: catalog.i18nc("@action:inmenu","Toggle Fu&ll Screen");
shortcut: StandardKey.FullScreen;
text: catalog.i18nc("@action:inmenu","Toggle Full Screen");
iconName: "view-fullscreen";
}
@ -110,35 +111,35 @@ Item
Action
{
id: view3DCameraAction;
text: catalog.i18nc("@action:inmenu menubar:view","&3D View");
text: catalog.i18nc("@action:inmenu menubar:view","3D View");
onTriggered: UM.Controller.rotateView("3d", 0);
}
Action
{
id: viewFrontCameraAction;
text: catalog.i18nc("@action:inmenu menubar:view","&Front View");
text: catalog.i18nc("@action:inmenu menubar:view","Front View");
onTriggered: UM.Controller.rotateView("home", 0);
}
Action
{
id: viewTopCameraAction;
text: catalog.i18nc("@action:inmenu menubar:view","&Top View");
text: catalog.i18nc("@action:inmenu menubar:view","Top View");
onTriggered: UM.Controller.rotateView("y", 90);
}
Action
{
id: viewLeftSideCameraAction;
text: catalog.i18nc("@action:inmenu menubar:view","&Left Side View");
text: catalog.i18nc("@action:inmenu menubar:view","Left Side View");
onTriggered: UM.Controller.rotateView("x", 90);
}
Action
{
id: viewRightSideCameraAction;
text: catalog.i18nc("@action:inmenu menubar:view","&Right Side View");
text: catalog.i18nc("@action:inmenu menubar:view","Right Side View");
onTriggered: UM.Controller.rotateView("x", -90);
}
@ -222,30 +223,20 @@ Item
Action
{
id: aboutAction;
text: catalog.i18nc("@action:inmenu menubar:help","&About...");
text: catalog.i18nc("@action:inmenu menubar:help","About...");
iconName: "help-about";
}
Action
{
id: deleteSelectionAction;
text: catalog.i18ncp("@action:inmenu menubar:edit", "Delete &Selected Model", "Delete &Selected Models", UM.Selection.selectionCount);
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.Delete;
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;
@ -328,7 +319,7 @@ Item
Action
{
id: selectAllAction;
text: catalog.i18nc("@action:inmenu menubar:edit","&Select All Models");
text: catalog.i18nc("@action:inmenu menubar:edit","Select All Models");
enabled: UM.Controller.toolsEnabled;
iconName: "edit-select-all";
shortcut: "Ctrl+A";
@ -338,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";
@ -348,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();
@ -386,7 +377,7 @@ Item
Action
{
id: resetAllAction;
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model &Transformations");
text: catalog.i18nc("@action:inmenu menubar:edit","Reset All Model Transformations");
onTriggered: CuraApplication.resetAll();
}

View file

@ -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

View file

@ -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;
}
@ -120,7 +122,7 @@ UM.MainWindow
text: catalog.i18nc("@title:menu menubar:file","&Save...")
onTriggered:
{
var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetype": "application/x-curaproject+xml" };
var args = { "filter_by_machine": false, "file_type": "workspace", "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml" };
if(UM.Preferences.getValue("cura/dialog_on_project_save"))
{
saveWorkspaceDialog.args = args;
@ -142,21 +144,26 @@ UM.MainWindow
onTriggered:
{
var localDeviceId = "local_file";
UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetype": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"});
UM.OutputDeviceManager.requestWriteToDevice(localDeviceId, PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"});
}
}
MenuItem
{
id: exportSelectionMenu
text: catalog.i18nc("@action:inmenu menubar:file", "Export Selection...");
enabled: UM.Selection.hasSelection;
iconName: "document-save-as";
onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetype": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"});
onTriggered: UM.OutputDeviceManager.requestWriteSelectionToDevice("local_file", PrintInformation.jobName, { "filter_by_machine": false, "preferred_mimetypes": "application/vnd.ms-package.3dmanufacturing-3dmodel+xml"});
}
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
@ -541,7 +549,7 @@ UM.MainWindow
insertPage(2, catalog.i18nc("@title:tab", "Printers"), Qt.resolvedUrl("Preferences/MachinesPage.qml"));
insertPage(3, catalog.i18nc("@title:tab", "Materials"), Qt.resolvedUrl("Preferences/MaterialsPage.qml"));
insertPage(3, catalog.i18nc("@title:tab", "Materials"), Qt.resolvedUrl("Preferences/Materials/MaterialsPage.qml"));
insertPage(4, catalog.i18nc("@title:tab", "Profiles"), Qt.resolvedUrl("Preferences/ProfilesPage.qml"));
@ -1054,7 +1062,7 @@ UM.MainWindow
{
restart();
}
else if(Cura.MachineManager.activeMachineId == null || Cura.MachineManager.activeMachineId == "")
else if(Cura.MachineManager.activeMachine == null)
{
addMachineDialog.open();
}

View file

@ -81,7 +81,7 @@ Item {
text: PrintInformation.jobName
horizontalAlignment: TextInput.AlignRight
onEditingFinished: {
var new_name = text == "" ? catalog.i18nc("@text Print job name", "unnamed") : text;
var new_name = text == "" ? catalog.i18nc("@text Print job name", "Untitled") : text;
PrintInformation.setJobName(new_name, true);
printJobTextfield.focus = false;
}

View file

@ -103,7 +103,7 @@ Menu
{
id: machineExtruderCount
containerStackId: Cura.MachineManager.activeMachineId
containerStack: Cura.MachineManager.activeMachine
key: "machine_extruder_count"
watchedProperties: [ "value" ]
}

View file

@ -10,28 +10,74 @@ import Cura 1.0 as Cura
Menu
{
id: menu
title: "Material"
title: catalog.i18nc("@label:category menu label", "Material")
property int extruderIndex: 0
Cura.FavoriteMaterialsModel
{
id: favoriteMaterialsModel
extruderPosition: menu.extruderIndex
}
Cura.GenericMaterialsModel
{
id: genericMaterialsModel
extruderPosition: menu.extruderIndex
}
Cura.MaterialBrandsModel
{
id: brandModel
extruderPosition: menu.extruderIndex
}
MenuItem
{
text: catalog.i18nc("@label:category menu label", "Favorites")
enabled: false
visible: favoriteMaterialsModel.items.length > 0
}
Instantiator
{
model: genericMaterialsModel
MenuItem
model: favoriteMaterialsModel
delegate: MenuItem
{
text: model.name
text: model.brand + " " + model.name
checkable: true
checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex]
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
exclusiveGroup: group
onTriggered:
{
Cura.MachineManager.setMaterial(extruderIndex, model.container_node);
}
}
onObjectAdded: menu.insertItem(index, object)
onObjectRemoved: menu.removeItem(object)
onObjectRemoved: menu.removeItem(object) // TODO: This ain't gonna work, removeItem() takes an index, not object
}
MenuSeparator { }
MenuSeparator {}
Menu
{
id: genericMenu
title: catalog.i18nc("@label:category menu label", "Generic")
Instantiator
{
model: genericMaterialsModel
delegate: MenuItem
{
text: model.name
checkable: true
checked: model.root_material_id == Cura.MachineManager.currentRootMaterialId[extruderIndex]
exclusiveGroup: group
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
}
onObjectAdded: genericMenu.insertItem(index, object)
onObjectRemoved: genericMenu.removeItem(object) // TODO: This ain't gonna work, removeItem() takes an index, not object
}
}
MenuSeparator {}
Instantiator
{
model: brandModel
@ -40,12 +86,12 @@ Menu
id: brandMenu
title: brandName
property string brandName: model.name
property var brandMaterials: model.materials
property var brandMaterials: model.material_types
Instantiator
{
model: brandMaterials
Menu
delegate: Menu
{
id: brandMaterialsMenu
title: materialName
@ -55,16 +101,13 @@ Menu
Instantiator
{
model: brandMaterialColors
MenuItem
delegate: MenuItem
{
text: model.name
checkable: true
checked: model.id == Cura.MachineManager.allActiveMaterialIds[Cura.ExtruderManager.extruderIds[extruderIndex]]
exclusiveGroup: group
onTriggered:
{
Cura.MachineManager.setMaterial(extruderIndex, model.container_node);
}
onTriggered: Cura.MachineManager.setMaterial(extruderIndex, model.container_node)
}
onObjectAdded: brandMaterialsMenu.insertItem(index, object)
onObjectRemoved: brandMaterialsMenu.removeItem(object)
@ -78,21 +121,14 @@ Menu
onObjectRemoved: menu.removeItem(object)
}
Cura.GenericMaterialsModel
{
id: genericMaterialsModel
extruderPosition: menu.extruderIndex
ExclusiveGroup {
id: group
}
Cura.BrandMaterialsModel
MenuSeparator {}
MenuItem
{
id: brandModel
extruderPosition: menu.extruderIndex
action: Cura.Actions.manageMaterials
}
ExclusiveGroup { id: group }
MenuSeparator { }
MenuItem { action: Cura.Actions.manageMaterials }
}

View file

@ -29,7 +29,6 @@ Menu
onTriggered:
{
settingVisibilityPresetsModel.setActivePreset(model.id);
showSettingVisibilityProfile();
}
}

View file

@ -73,4 +73,7 @@ Menu
MenuSeparator {}
MenuItem { action: Cura.Actions.expandSidebar; }
MenuSeparator {}
MenuItem { action: Cura.Actions.toggleFullScreen; }
}

View file

@ -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

View file

@ -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

View file

@ -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)
}

View file

@ -0,0 +1,150 @@
// Copyright (c) 2018 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import Cura 1.0 as Cura
Rectangle
{
id: brand_section
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:
{
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
{
id: brand_header
width: parent.width
Label
{
id: brand_name
text: sectionName
height: UM.Theme.getSize("favorites_row").height
width: parent.width - UM.Theme.getSize("favorites_button").width
verticalAlignment: Text.AlignVCenter
leftPadding: (UM.Theme.getSize("default_margin").width / 2) | 0
}
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: brand_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
}
style: ButtonStyle
{
background: Rectangle
{
anchors.fill: parent
color: "transparent"
}
}
}
}
MouseArea
{
anchors.fill: brand_header
onPressed:
{
const i = materialList.expandedBrands.indexOf(sectionName)
if (i > -1)
{
// Remove it
materialList.expandedBrands.splice(i, 1)
brand_section.expanded = false
}
else
{
// Add it
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: 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
}
}
}

View file

@ -0,0 +1,119 @@
// Copyright (c) 2018 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import Cura 1.0 as Cura
Item
{
id: detailsPanel
property var currentItem: null
onCurrentItemChanged:
{
// 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.density = currentItem.density || 0.0
materialProperties.diameter = currentItem.diameter || 0.0
materialProperties.approximate_diameter = currentItem.approximate_diameter || "0"
}
Item
{
anchors.fill: parent
Item // Material title Label
{
id: profileName
width: parent.width
height: childrenRect.height
Label {
text: materialProperties.name
font: UM.Theme.getFont("large")
}
}
MaterialsView // Material detailed information view below the title Label
{
id: materialDetailsView
anchors
{
left: parent.left
right: parent.right
top: profileName.bottom
topMargin: UM.Theme.getSize("default_margin").height
bottom: parent.bottom
}
editingEnabled: currentItem != null && !currentItem.is_read_only
properties: materialProperties
containerId: currentItem != null ? currentItem.id : ""
currentMaterialNode: currentItem.container_node
}
QtObject
{
id: materialProperties
property string guid: "00000000-0000-0000-0000-000000000000"
property string container_id: "Unknown";
property string name: "Unknown";
property string profile_type: "Unknown";
property string brand: "Unknown";
property string material: "Unknown"; // This needs to be named as "material" to be consistent with
// the material container's metadata entry
property string color_name: "Yellow";
property color color_code: "yellow";
property real density: 0.0;
property real diameter: 0.0;
property string approximate_diameter: "0";
property real spool_cost: 0.0;
property real spool_weight: 0.0;
property real spool_length: 0.0;
property real cost_per_meter: 0.0;
property string description: "";
property string adhesion_info: "";
}
}
}

View file

@ -0,0 +1,168 @@
// Copyright (c) 2018 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import Cura 1.0 as Cura
Item
{
id: materialList
height: childrenRect.height
// Children
UM.I18nCatalog { id: catalog; name: "cura"; }
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
{
width: materialList.width
height: childrenRect.height
MaterialsBrandSection
{
id: favoriteSection
sectionName: "Favorites"
elementsModel: favoriteMaterialsModel
hasMaterialTypes: false
}
MaterialsBrandSection
{
id: genericSection
sectionName: "Generic"
elementsModel: genericMaterialsModel
hasMaterialTypes: false
}
Repeater
{
model: materialsModel
delegate: MaterialsBrandSection
{
id: brandSection
sectionName: model.name
elementsModel: model.material_types
hasMaterialTypes: true
}
}
}
}

View file

@ -0,0 +1,337 @@
// Copyright (c) 2018 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import Cura 1.0 as Cura
Item
{
id: base
property QtObject materialManager: CuraApplication.getMaterialManager()
// Keep PreferencesDialog happy
property var resetEnabled: false
property var currentItem: null
property var hasCurrentItem: base.currentItem != null
property var isCurrentItemActivated:
{
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
property var extruder_position: Cura.ExtruderManager.activeExtruderIndex
property var active_root_material_id: Cura.MachineManager.currentRootMaterialId[extruder_position]
UM.I18nCatalog
{
id: catalog
name: "cura"
}
// 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:
{
forceActiveFocus()
materialDetailsPanel.currentItem = currentItem
}
// Main layout
Label
{
id: titleLabel
anchors
{
top: parent.top
left: parent.left
right: parent.right
margins: 5 * screenScaleFactor
}
font.pointSize: 18
text: catalog.i18nc("@title:tab", "Materials")
}
// Button Row
Row
{
id: buttonRow
anchors
{
left: parent.left
right: parent.right
top: titleLabel.bottom
}
height: childrenRect.height
// Activate button
Button
{
text: catalog.i18nc("@action:button", "Activate")
iconName: "list-activate"
enabled: !isCurrentItemActivated
onClicked:
{
forceActiveFocus()
// 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)
}
}
// Create button
Button
{
text: catalog.i18nc("@action:button", "Create")
iconName: "list-add"
onClicked:
{
forceActiveFocus();
base.newRootMaterialIdToSwitchTo = base.materialManager.createMaterial();
base.toActivateNewMaterial = true;
}
}
// Duplicate button
Button
{
text: catalog.i18nc("@action:button", "Duplicate");
iconName: "list-add"
enabled: base.hasCurrentItem
onClicked:
{
forceActiveFocus();
base.newRootMaterialIdToSwitchTo = base.materialManager.duplicateMaterial(base.currentItem.container_node);
base.toActivateNewMaterial = true;
}
}
// Remove button
Button
{
text: catalog.i18nc("@action:button", "Remove")
iconName: "list-remove"
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated
onClicked:
{
forceActiveFocus();
confirmRemoveMaterialDialog.open();
}
}
// Import button
Button
{
text: catalog.i18nc("@action:button", "Import")
iconName: "document-import"
onClicked:
{
forceActiveFocus();
importMaterialDialog.open();
}
visible: true
}
// Export button
Button
{
text: catalog.i18nc("@action:button", "Export")
iconName: "document-export"
onClicked:
{
forceActiveFocus();
exportMaterialDialog.open();
}
enabled: base.hasCurrentItem
}
}
Item {
id: contentsItem
anchors
{
top: titleLabel.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
margins: 5 * screenScaleFactor
bottomMargin: 0
}
clip: true
}
Item
{
anchors
{
top: buttonRow.bottom
topMargin: UM.Theme.getSize("default_margin").height
left: parent.left
right: parent.right
bottom: parent.bottom
}
SystemPalette { id: palette }
Label
{
id: captionLabel
anchors
{
top: parent.top
left: parent.left
}
visible: text != ""
text:
{
var caption = catalog.i18nc("@action:label", "Printer") + ": " + Cura.MachineManager.activeMachineName;
if (Cura.MachineManager.hasVariants)
{
caption += ", " + Cura.MachineManager.activeDefinitionVariantsName + ": " + Cura.MachineManager.activeVariantName;
}
return caption;
}
width: materialScrollView.width
elide: Text.ElideRight
}
ScrollView
{
id: materialScrollView
anchors
{
top: captionLabel.visible ? captionLabel.bottom : parent.top
topMargin: captionLabel.visible ? UM.Theme.getSize("default_margin").height : 0
bottom: parent.bottom
left: parent.left
}
Rectangle
{
parent: viewport
anchors.fill: parent
color: palette.light
}
width: (parent.width * 0.4) | 0
frameVisible: true
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
MaterialsList
{
id: materialListView
width: materialScrollView.viewport.width
}
}
MaterialsDetailsPanel
{
id: materialDetailsPanel
anchors
{
left: materialScrollView.right
leftMargin: UM.Theme.getSize("default_margin").width
top: parent.top
bottom: parent.bottom
right: parent.right
}
}
}
// Dialogs
MessageDialog
{
id: confirmRemoveMaterialDialog
icon: StandardIcon.Question;
title: catalog.i18nc("@title:window", "Confirm Remove")
text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItem.name)
standardButtons: StandardButton.Yes | StandardButton.No
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);
}
}
FileDialog
{
id: importMaterialDialog
title: catalog.i18nc("@title:window", "Import Material")
selectExisting: true
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
folder: CuraApplication.getDefaultPath("dialog_material_path")
onAccepted:
{
var result = Cura.ContainerManager.importMaterialContainer(fileUrl);
messageDialog.title = catalog.i18nc("@title:window", "Import Material");
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "Could not import material <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
if (result.status == "success")
{
messageDialog.icon = StandardIcon.Information;
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully imported material <filename>%1</filename>").arg(fileUrl);
}
else if (result.status == "duplicate")
{
messageDialog.icon = StandardIcon.Warning;
}
else
{
messageDialog.icon = StandardIcon.Critical;
}
messageDialog.open();
CuraApplication.setDefaultPath("dialog_material_path", folder);
}
}
FileDialog
{
id: exportMaterialDialog
title: catalog.i18nc("@title:window", "Export Material")
selectExisting: false
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
folder: CuraApplication.getDefaultPath("dialog_material_path")
onAccepted:
{
var result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, fileUrl);
messageDialog.title = catalog.i18nc("@title:window", "Export Material");
if (result.status == "error")
{
messageDialog.icon = StandardIcon.Critical;
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> and <message>!", "Failed to export material to <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
messageDialog.open();
}
else if (result.status == "success")
{
messageDialog.icon = StandardIcon.Information;
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully exported material to <filename>%1</filename>").arg(result.path);
messageDialog.open();
}
CuraApplication.setDefaultPath("dialog_material_path", folder);
}
}
MessageDialog
{
id: messageDialog
}
}

View file

@ -0,0 +1,120 @@
// Copyright (c) 2018 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import Cura 1.0 as Cura
Rectangle
{
id: materialSlot
property var material: null
property var hovered: false
property var is_favorite: material != null ? material.is_favorite : false
height: UM.Theme.getSize("favorites_row").height
width: parent.width
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
anchors.left: swatch.right
anchors.verticalCenter: materialSlot.verticalCenter
anchors.leftMargin: UM.Theme.getSize("narrow_margin").width
}
MouseArea
{
anchors.fill: parent
onClicked:
{
materialList.currentBrand = material.brand
materialList.currentType = material.brand + "_" + material.material
base.currentItem = material
}
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
{
right: materialSlot.right
verticalCenter: materialSlot.verticalCenter
}
onClicked:
{
if (materialSlot.is_favorite) {
base.materialManager.removeFavorite(material.root_material_id)
materialSlot.is_favorite = false
return
}
base.materialManager.addFavorite(material.root_material_id)
materialSlot.is_favorite = true
return
}
style: ButtonStyle
{
background: Rectangle
{
anchors.fill: parent
color: "transparent"
}
}
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)
{
return UM.Theme.getColor("primary_hover")
}
else
{
if (materialSlot.is_favorite)
{
return UM.Theme.getColor("primary")
}
else
{
UM.Theme.getColor("text_inactive")
}
}
}
source: materialSlot.is_favorite ? UM.Theme.getIcon("favorites_star_full") : UM.Theme.getIcon("favorites_star_empty")
}
}
}

View file

@ -0,0 +1,138 @@
// Copyright (c) 2018 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import Cura 1.0 as Cura
Rectangle
{
id: material_type_section
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:
{
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
width: material_type_header.width
}
Row
{
id: material_type_header
width: parent.width
leftPadding: UM.Theme.getSize("default_margin").width
anchors
{
left: parent.left
}
Label
{
text: materialType.name
height: UM.Theme.getSize("favorites_row").height
width: parent.width - parent.leftPadding - UM.Theme.getSize("favorites_button").width
id: material_type_name
verticalAlignment: Text.AlignVCenter
}
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: material_type_section.expanded ? UM.Theme.getIcon("arrow_bottom") : UM.Theme.getIcon("arrow_left")
}
style: ButtonStyle
{
background: Rectangle
{
anchors.fill: parent
color: "transparent"
}
}
}
}
MouseArea
{
anchors.fill: material_type_header
onPressed:
{
const identifier = materialType.brand + "_" + materialType.name;
const i = materialList.expandedTypes.indexOf(identifier)
if (i > -1)
{
// Remove it
materialList.expandedTypes.splice(i, 1)
material_type_section.expanded = false
}
else
{
// Add it
materialList.expandedTypes.push(identifier)
material_type_section.expanded = true
}
UM.Preferences.setValue("cura/expanded_types", materialList.expandedTypes.join(";"));
}
}
Column
{
height: material_type_section.expanded ? childrenRect.height : 0
visible: material_type_section.expanded
width: parent.width
anchors.top: material_type_header.bottom
Repeater
{
model: colorsModel
delegate: MaterialsSlot
{
material: model
}
}
}
Connections
{
target: UM.Preferences
onPreferenceChanged:
{
expanded = materialList.expandedTypes.indexOf(materialType.brand + "_" + materialType.name) > -1
}
}
}

View file

@ -8,6 +8,8 @@ import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import Cura 1.0 as Cura
import ".." // Access to ReadOnlyTextArea.qml
TabView
{
id: base
@ -189,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)
@ -565,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
}
}

View file

@ -1,572 +0,0 @@
// Copyright (c) 2018 Ultimaker B.V.
// Uranium is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3
import QtQuick.Dialogs 1.2
import UM 1.2 as UM
import Cura 1.0 as Cura
Item
{
id: base
property QtObject materialManager: CuraApplication.getMaterialManager()
property var resetEnabled: false // Keep PreferencesDialog happy
UM.I18nCatalog { id: catalog; name: "cura"; }
Cura.MaterialManagementModel
{
id: materialsModel
}
Label
{
id: titleLabel
anchors
{
top: parent.top
left: parent.left
right: parent.right
margins: 5 * screenScaleFactor
}
font.pointSize: 18
text: catalog.i18nc("@title:tab", "Materials")
}
property var hasCurrentItem: materialListView.currentItem != null
property var currentItem:
{ // is soon to be overwritten
var current_index = materialListView.currentIndex;
return materialsModel.getItem(current_index);
}
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;
}
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];
var itemIndex = -1;
for (var i = 0; i < materialsModel.rowCount(); ++i)
{
var item = materialsModel.getItem(i);
if (item.root_material_id == active_root_material_id)
{
itemIndex = i;
break;
}
}
materialListView.currentIndex = itemIndex;
}
Row // Button Row
{
id: buttonRow
anchors
{
left: parent.left
right: parent.right
top: titleLabel.bottom
}
height: childrenRect.height
// Activate button
Button
{
text: catalog.i18nc("@action:button", "Activate")
iconName: "list-activate"
enabled: !isCurrentItemActivated
onClicked:
{
forceActiveFocus()
const extruder_position = Cura.ExtruderManager.activeExtruderIndex;
Cura.MachineManager.setMaterial(extruder_position, base.currentItem.container_node);
}
}
// Create button
Button
{
text: catalog.i18nc("@action:button", "Create")
iconName: "list-add"
onClicked:
{
forceActiveFocus();
base.newRootMaterialIdToSwitchTo = base.materialManager.createMaterial();
base.toActivateNewMaterial = true;
}
}
// Duplicate button
Button
{
text: catalog.i18nc("@action:button", "Duplicate");
iconName: "list-add"
enabled: base.hasCurrentItem
onClicked:
{
forceActiveFocus();
base.newRootMaterialIdToSwitchTo = base.materialManager.duplicateMaterial(base.currentItem.container_node);
base.toActivateNewMaterial = true;
}
}
// Remove button
Button
{
text: catalog.i18nc("@action:button", "Remove")
iconName: "list-remove"
enabled: base.hasCurrentItem && !base.currentItem.is_read_only && !base.isCurrentItemActivated
onClicked:
{
forceActiveFocus();
confirmRemoveMaterialDialog.open();
}
}
// Import button
Button
{
text: catalog.i18nc("@action:button", "Import")
iconName: "document-import"
onClicked:
{
forceActiveFocus();
importMaterialDialog.open();
}
visible: true
}
// Export button
Button
{
text: catalog.i18nc("@action:button", "Export")
iconName: "document-export"
onClicked:
{
forceActiveFocus();
exportMaterialDialog.open();
}
enabled: currentItem != null
}
}
property string newRootMaterialIdToSwitchTo: ""
property bool toActivateNewMaterial: false
// This connection makes sure that we will switch to the new
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;
}
}
MessageDialog
{
id: confirmRemoveMaterialDialog
icon: StandardIcon.Question;
title: catalog.i18nc("@title:window", "Confirm Remove")
text: catalog.i18nc("@label (%1 is object name)", "Are you sure you wish to remove %1? This cannot be undone!").arg(base.currentItem.name)
standardButtons: StandardButton.Yes | StandardButton.No
modality: Qt.ApplicationModal
onYes:
{
base.materialManager.removeMaterial(base.currentItem.container_node);
}
}
FileDialog
{
id: importMaterialDialog
title: catalog.i18nc("@title:window", "Import Material")
selectExisting: true
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
folder: CuraApplication.getDefaultPath("dialog_material_path")
onAccepted:
{
var result = Cura.ContainerManager.importMaterialContainer(fileUrl);
messageDialog.title = catalog.i18nc("@title:window", "Import Material");
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> or <message>!", "Could not import material <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
if (result.status == "success")
{
messageDialog.icon = StandardIcon.Information;
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully imported material <filename>%1</filename>").arg(fileUrl);
}
else if (result.status == "duplicate")
{
messageDialog.icon = StandardIcon.Warning;
}
else
{
messageDialog.icon = StandardIcon.Critical;
}
messageDialog.open();
CuraApplication.setDefaultPath("dialog_material_path", folder);
}
}
FileDialog
{
id: exportMaterialDialog
title: catalog.i18nc("@title:window", "Export Material")
selectExisting: false
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
folder: CuraApplication.getDefaultPath("dialog_material_path")
onAccepted:
{
var result = Cura.ContainerManager.exportContainer(base.currentItem.root_material_id, selectedNameFilter, fileUrl);
messageDialog.title = catalog.i18nc("@title:window", "Export Material");
if (result.status == "error")
{
messageDialog.icon = StandardIcon.Critical;
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tags <filename> and <message>!", "Failed to export material to <filename>%1</filename>: <message>%2</message>").arg(fileUrl).arg(result.message);
messageDialog.open();
}
else if (result.status == "success")
{
messageDialog.icon = StandardIcon.Information;
messageDialog.text = catalog.i18nc("@info:status Don't translate the XML tag <filename>!", "Successfully exported material to <filename>%1</filename>").arg(result.path);
messageDialog.open();
}
CuraApplication.setDefaultPath("dialog_material_path", folder);
}
}
MessageDialog
{
id: messageDialog
}
Item {
id: contentsItem
anchors
{
top: titleLabel.bottom
left: parent.left
right: parent.right
bottom: parent.bottom
margins: 5 * screenScaleFactor
bottomMargin: 0
}
clip: true
}
Item
{
anchors
{
top: buttonRow.bottom
topMargin: UM.Theme.getSize("default_margin").height
left: parent.left
right: parent.right
bottom: parent.bottom
}
SystemPalette { id: palette }
Label
{
id: captionLabel
anchors
{
top: parent.top
left: parent.left
}
visible: text != ""
text:
{
var caption = catalog.i18nc("@action:label", "Printer") + ": " + Cura.MachineManager.activeMachineName;
if (Cura.MachineManager.hasVariants)
{
caption += ", " + Cura.MachineManager.activeDefinitionVariantsName + ": " + Cura.MachineManager.activeVariantName;
}
return caption;
}
width: materialScrollView.width
elide: Text.ElideRight
}
ScrollView
{
id: materialScrollView
anchors
{
top: captionLabel.visible ? captionLabel.bottom : parent.top
topMargin: captionLabel.visible ? UM.Theme.getSize("default_margin").height : 0
bottom: parent.bottom
left: parent.left
}
Rectangle
{
parent: viewport
anchors.fill: parent
color: palette.light
}
width: true ? (parent.width * 0.4) | 0 : parent.width
frameVisible: true
ListView
{
id: materialListView
model: materialsModel
section.property: "brand"
section.criteria: ViewSection.FullString
section.delegate: Rectangle
{
width: materialScrollView.width
height: childrenRect.height
color: palette.light
Label
{
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_lining").width
text: section
font.bold: true
color: palette.text
}
}
delegate: Rectangle
{
width: materialScrollView.width
height: childrenRect.height
color: ListView.isCurrentItem ? palette.highlight : (model.index % 2) ? palette.base : palette.alternateBase
Row
{
id: materialRow
spacing: (UM.Theme.getSize("default_margin").width / 2) | 0
anchors.left: parent.left
anchors.leftMargin: UM.Theme.getSize("default_margin").width
anchors.right: parent.right
property bool isCurrentItem: parent.ListView.isCurrentItem
property bool isItemActivated:
{
const extruder_position = Cura.ExtruderManager.activeExtruderIndex;
const root_material_id = Cura.MachineManager.currentRootMaterialId[extruder_position];
return model.root_material_id == root_material_id;
}
Rectangle
{
width: Math.floor(parent.height * 0.8)
height: Math.floor(parent.height * 0.8)
color: model.color_code
border.color: materialRow.isCurrentItem ? palette.highlightedText : palette.text;
anchors.verticalCenter: parent.verticalCenter
}
Label
{
width: Math.floor((parent.width * 0.3))
text: model.material
elide: Text.ElideRight
font.italic: materialRow.isItemActivated
color: materialRow.isCurrentItem ? palette.highlightedText : palette.text;
}
Label
{
text: (model.name != model.material) ? model.name : ""
elide: Text.ElideRight
font.italic: materialRow.isItemActivated
color: materialRow.isCurrentItem ? palette.highlightedText : palette.text;
}
}
MouseArea
{
anchors.fill: parent
onClicked:
{
parent.ListView.view.currentIndex = model.index;
}
}
}
function activateDetailsWithIndex(index)
{
var model = materialsModel.getItem(index);
base.currentItem = model;
materialDetailsView.containerId = model.container_id;
materialDetailsView.currentMaterialNode = model.container_node;
detailsPanel.updateMaterialPropertiesObject();
}
onCurrentIndexChanged:
{
forceActiveFocus(); // causes the changed fields to be saved
activateDetailsWithIndex(currentIndex);
}
}
}
Item
{
id: detailsPanel
anchors
{
left: materialScrollView.right
leftMargin: UM.Theme.getSize("default_margin").width
top: parent.top
bottom: parent.bottom
right: parent.right
}
function updateMaterialPropertiesObject()
{
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";
}
Item
{
anchors.fill: parent
Item // Material title Label
{
id: profileName
width: parent.width
height: childrenRect.height
Label {
text: materialProperties.name
font: UM.Theme.getFont("large")
}
}
MaterialView // Material detailed information view below the title Label
{
id: materialDetailsView
anchors
{
left: parent.left
right: parent.right
top: profileName.bottom
topMargin: UM.Theme.getSize("default_margin").height
bottom: parent.bottom
}
editingEnabled: base.currentItem != null && !base.currentItem.is_read_only
properties: materialProperties
containerId: base.currentItem != null ? base.currentItem.container_id : ""
currentMaterialNode: base.currentItem.container_node
property alias pane: base
}
QtObject
{
id: materialProperties
property string guid: "00000000-0000-0000-0000-000000000000"
property string container_id: "Unknown";
property string name: "Unknown";
property string profile_type: "Unknown";
property string brand: "Unknown";
property string material: "Unknown"; // This needs to be named as "material" to be consistent with
// the material container's metadata entry
property string color_name: "Yellow";
property color color_code: "yellow";
property real density: 0.0;
property real diameter: 0.0;
property string approximate_diameter: "0";
property real spool_cost: 0.0;
property real spool_weight: 0.0;
property real spool_length: 0.0;
property real cost_per_meter: 0.0;
property string description: "";
property string adhesion_info: "";
}
}
}
}
}

View file

@ -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

View file

@ -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"]
}

View file

@ -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

View file

@ -7,6 +7,7 @@ import QtQuick.Controls.Styles 1.1
import QtQuick.Layouts 1.1
import UM 1.1 as UM
import Cura 1.0 as Cura
Item {
id: base;
@ -257,7 +258,8 @@ Item {
onClicked:
{
forceActiveFocus();
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName, { "filter_by_machine": true, "preferred_mimetype":Printer.preferredOutputMimetype });
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName,
{ "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats });
}
style: ButtonStyle {

View file

@ -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:

View file

@ -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")

View file

@ -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")

View file

@ -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.

View file

@ -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:
{

View file

@ -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")

View file

@ -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

View file

@ -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

View file

@ -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