mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-08 22:35:03 -06:00
Merge pull request #846 from Ultimaker/feature_material_editing
Material Editing Support
This commit is contained in:
commit
90af9e3986
32 changed files with 1737 additions and 639 deletions
|
@ -39,6 +39,8 @@ Item
|
|||
property alias resetProfile: resetProfileAction;
|
||||
property alias manageProfiles: manageProfilesAction;
|
||||
|
||||
property alias manageMaterials: manageMaterialsAction;
|
||||
|
||||
property alias preferences: preferencesAction;
|
||||
|
||||
property alias showEngineLog: showEngineLogAction;
|
||||
|
@ -90,7 +92,7 @@ Item
|
|||
Action
|
||||
{
|
||||
id: preferencesAction;
|
||||
text: catalog.i18nc("@action:inmenu menubar:settings","&Preferences...");
|
||||
text: catalog.i18nc("@action:inmenu","Configure Cura...");
|
||||
iconName: "configure";
|
||||
}
|
||||
|
||||
|
@ -107,6 +109,13 @@ Item
|
|||
iconName: "configure";
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: manageMaterialsAction
|
||||
text: catalog.i18nc("@action:inmenu", "Manage Materials...")
|
||||
iconName: "configure"
|
||||
}
|
||||
|
||||
Action
|
||||
{
|
||||
id: updateProfileAction;
|
||||
|
@ -273,5 +282,6 @@ Item
|
|||
{
|
||||
id: configureSettingVisibilityAction
|
||||
text: catalog.i18nc("@action:menu", "Configure setting visiblity...");
|
||||
iconName: "configure"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,8 @@ import QtQuick.Dialogs 1.1
|
|||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
import "Menus"
|
||||
|
||||
UM.MainWindow
|
||||
{
|
||||
id: base
|
||||
|
@ -55,41 +57,13 @@ UM.MainWindow
|
|||
Menu
|
||||
{
|
||||
id: fileMenu
|
||||
//: File menu
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel","&File");
|
||||
|
||||
MenuItem {
|
||||
action: Cura.Actions.open;
|
||||
}
|
||||
|
||||
Menu
|
||||
{
|
||||
id: recentFilesMenu;
|
||||
title: catalog.i18nc("@title:menu menubar:file", "Open &Recent")
|
||||
iconName: "document-open-recent";
|
||||
|
||||
enabled: Printer.recentFiles.length > 0;
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: Printer.recentFiles
|
||||
MenuItem
|
||||
{
|
||||
text:
|
||||
{
|
||||
var path = modelData.toString()
|
||||
return (index + 1) + ". " + path.slice(path.lastIndexOf("/") + 1);
|
||||
}
|
||||
onTriggered: {
|
||||
UM.MeshFileHandler.readLocalFile(modelData);
|
||||
var meshName = backgroundItem.getMeshName(modelData.toString())
|
||||
backgroundItem.hasMesh(decodeURIComponent(meshName))
|
||||
}
|
||||
}
|
||||
onObjectAdded: recentFilesMenu.insertItem(index, object)
|
||||
onObjectRemoved: recentFilesMenu.removeItem(object)
|
||||
}
|
||||
}
|
||||
RecentFilesMenu { }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
|
@ -130,7 +104,6 @@ UM.MainWindow
|
|||
|
||||
Menu
|
||||
{
|
||||
//: Edit menu
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel","&Edit");
|
||||
|
||||
MenuItem { action: Cura.Actions.undo; }
|
||||
|
@ -146,173 +119,45 @@ UM.MainWindow
|
|||
MenuItem { action: Cura.Actions.unGroupObjects;}
|
||||
}
|
||||
|
||||
ViewMenu { title: catalog.i18nc("@title:menu", "&View") }
|
||||
|
||||
Menu
|
||||
{
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel","&View");
|
||||
id: top_view_menu
|
||||
Instantiator
|
||||
{
|
||||
model: UM.ViewModel { }
|
||||
MenuItem
|
||||
{
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.active;
|
||||
exclusiveGroup: view_menu_top_group;
|
||||
onTriggered: UM.Controller.setActiveView(model.id);
|
||||
}
|
||||
onObjectAdded: top_view_menu.insertItem(index, object)
|
||||
onObjectRemoved: top_view_menu.removeItem(object)
|
||||
}
|
||||
ExclusiveGroup { id: view_menu_top_group; }
|
||||
}
|
||||
Menu
|
||||
{
|
||||
id: machineMenu;
|
||||
//: Machine menu
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel","&Printer");
|
||||
id: settingsMenu
|
||||
title: catalog.i18nc("@title:menu", "&Settings")
|
||||
|
||||
PrinterMenu { title: catalog.i18nc("@title:menu menubar:toplevel", "&Printer") }
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: UM.ContainerStacksModel
|
||||
{
|
||||
filter: {"type": "machine"}
|
||||
model: Cura.ExtrudersModel { }
|
||||
Menu {
|
||||
title: model.name
|
||||
|
||||
NozzleMenu { title: catalog.i18nc("@title:menu", "&Nozzle"); visible: Cura.MachineManager.hasVariants }
|
||||
MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: Cura.MachineManager.hasMaterials }
|
||||
ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
MenuItem { text: "Set as Active Extruder" }
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: Cura.MachineManager.activeMachineId == model.id
|
||||
exclusiveGroup: machineMenuGroup;
|
||||
onTriggered: Cura.MachineManager.setActiveMachine(model.id);
|
||||
}
|
||||
onObjectAdded: machineMenu.insertItem(index, object)
|
||||
onObjectRemoved: machineMenu.removeItem(object)
|
||||
onObjectAdded: settingsMenu.insertItem(index, object)
|
||||
onObjectRemoved: settingsMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: machineMenuGroup; }
|
||||
NozzleMenu { title: catalog.i18nc("@title:menu", "&Nozzle"); visible: machineExtruderCount.properties.value <= 1 && Cura.MachineManager.hasVariants }
|
||||
MaterialMenu { title: catalog.i18nc("@title:menu", "&Material"); visible: machineExtruderCount.properties.value <= 1 && Cura.MachineManager.hasMaterials }
|
||||
ProfileMenu { title: catalog.i18nc("@title:menu", "&Profile"); visible: machineExtruderCount.properties.value <= 1 }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
filter:
|
||||
{
|
||||
"type": "variant",
|
||||
"definition": Cura.MachineManager.activeDefinitionId //Only show variants of this machine
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.id == Cura.MachineManager.activeVariantId;
|
||||
exclusiveGroup: machineVariantsGroup;
|
||||
onTriggered: Cura.MachineManager.setActiveVariant(model.id)
|
||||
}
|
||||
onObjectAdded: machineMenu.insertItem(index, object)
|
||||
onObjectRemoved: machineMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: machineVariantsGroup; }
|
||||
|
||||
MenuSeparator { visible: Cura.MachineManager.hasVariants; }
|
||||
|
||||
MenuItem { action: Cura.Actions.addMachine; }
|
||||
MenuItem { action: Cura.Actions.configureMachines; }
|
||||
}
|
||||
|
||||
Menu
|
||||
{
|
||||
id: profileMenu
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel", "P&rofile")
|
||||
|
||||
Instantiator
|
||||
{
|
||||
id: profileMenuInstantiator
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
filter:
|
||||
{
|
||||
var result = { "type": "quality" };
|
||||
if(Cura.MachineManager.filterQualityByMachine)
|
||||
{
|
||||
result.definition = Cura.MachineManager.activeDefinitionId;
|
||||
if(Cura.MachineManager.hasMaterials)
|
||||
{
|
||||
result.material = Cura.MachineManager.activeMaterialId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.definition = "fdmprinter"
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
property int separatorIndex: -1
|
||||
|
||||
Loader {
|
||||
property QtObject model_data: model
|
||||
property int model_index: index
|
||||
sourceComponent: profileMenuItemDelegate
|
||||
}
|
||||
|
||||
onObjectAdded:
|
||||
{
|
||||
//Insert a separator between readonly and custom profiles
|
||||
if(separatorIndex < 0 && index > 0) {
|
||||
if(model.getItem(index-1).readOnly != model.getItem(index).readOnly) {
|
||||
profileMenu.insertSeparator(index);
|
||||
separatorIndex = index;
|
||||
}
|
||||
}
|
||||
//Because of the separator, custom profiles move one index lower
|
||||
profileMenu.insertItem((model.getItem(index).readOnly) ? index : index + 1, object.item);
|
||||
}
|
||||
onObjectRemoved:
|
||||
{
|
||||
//When adding a profile, the menu is rebuild by removing all items.
|
||||
//If a separator was added, we need to remove that too.
|
||||
if(separatorIndex >= 0)
|
||||
{
|
||||
profileMenu.removeItem(profileMenu.items[separatorIndex])
|
||||
separatorIndex = -1;
|
||||
}
|
||||
profileMenu.removeItem(object.item);
|
||||
}
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: profileMenuGroup; }
|
||||
|
||||
Component
|
||||
{
|
||||
id: profileMenuItemDelegate
|
||||
MenuItem
|
||||
{
|
||||
id: item
|
||||
text: model_data ? model_data.name : ""
|
||||
checkable: true
|
||||
checked: model_data != null ? Cura.MachineManager.activeQualityId == model_data.id : false
|
||||
exclusiveGroup: profileMenuGroup
|
||||
onTriggered: Cura.MachineManager.setActiveQuality(model_data.id)
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator { id: profileMenuSeparator }
|
||||
|
||||
MenuItem { action: Cura.Actions.addProfile }
|
||||
MenuItem { action: Cura.Actions.updateProfile }
|
||||
MenuItem { action: Cura.Actions.resetProfile }
|
||||
MenuSeparator { }
|
||||
MenuItem { action: Cura.Actions.manageProfiles }
|
||||
MenuItem { action: Cura.Actions.configureSettingVisibility }
|
||||
}
|
||||
|
||||
Menu
|
||||
{
|
||||
id: extension_menu
|
||||
//: Extensions menu
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel","E&xtensions");
|
||||
|
||||
Instantiator
|
||||
|
@ -346,8 +191,7 @@ UM.MainWindow
|
|||
|
||||
Menu
|
||||
{
|
||||
//: Settings menu
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel","&Settings");
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel","P&references");
|
||||
|
||||
MenuItem { action: Cura.Actions.preferences; }
|
||||
}
|
||||
|
@ -365,6 +209,16 @@ UM.MainWindow
|
|||
}
|
||||
}
|
||||
|
||||
UM.SettingPropertyProvider
|
||||
{
|
||||
id: machineExtruderCount
|
||||
|
||||
containerStackId: Cura.MachineManager.activeMachineId
|
||||
key: "machine_extruder_count"
|
||||
watchedProperties: [ "value" ]
|
||||
storeIndex: 0
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
id: contentItem;
|
||||
|
@ -411,14 +265,9 @@ UM.MainWindow
|
|||
{
|
||||
id: view_panel
|
||||
|
||||
//anchors.left: parent.left;
|
||||
//anchors.right: parent.right;
|
||||
//anchors.bottom: parent.bottom
|
||||
anchors.top: viewModeButton.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height;
|
||||
anchors.left: viewModeButton.left;
|
||||
//anchors.bottom: buttons.top;
|
||||
//anchors.bottomMargin: UM.Theme.getSize("default_margin").height;
|
||||
|
||||
height: childrenRect.height;
|
||||
|
||||
|
@ -428,7 +277,6 @@ UM.MainWindow
|
|||
Button
|
||||
{
|
||||
id: openFileButton;
|
||||
//style: UM.Backend.progress < 0 ? UM.Theme.styles.open_file_button : UM.Theme.styles.tool_button;
|
||||
text: catalog.i18nc("@action:button","Open File");
|
||||
iconSource: UM.Theme.getIcon("load")
|
||||
style: UM.Theme.styles.tool_button
|
||||
|
@ -436,9 +284,7 @@ UM.MainWindow
|
|||
anchors
|
||||
{
|
||||
top: parent.top;
|
||||
//topMargin: UM.Theme.getSize("loadfile_margin").height
|
||||
left: parent.left;
|
||||
//leftMargin: UM.Theme.getSize("loadfile_margin").width
|
||||
}
|
||||
action: Cura.Actions.open;
|
||||
}
|
||||
|
@ -478,27 +324,7 @@ UM.MainWindow
|
|||
|
||||
style: UM.Theme.styles.tool_button;
|
||||
tooltip: '';
|
||||
menu: Menu
|
||||
{
|
||||
id: viewMenu;
|
||||
Instantiator
|
||||
{
|
||||
id: viewMenuInstantiator
|
||||
model: UM.ViewModel { }
|
||||
MenuItem
|
||||
{
|
||||
text: model.name
|
||||
checkable: true;
|
||||
checked: model.active
|
||||
exclusiveGroup: viewMenuGroup;
|
||||
onTriggered: UM.Controller.setActiveView(model.id);
|
||||
}
|
||||
onObjectAdded: viewMenu.insertItem(index, object)
|
||||
onObjectRemoved: viewMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: viewMenuGroup; }
|
||||
}
|
||||
menu: ViewMenu { }
|
||||
}
|
||||
|
||||
Toolbar
|
||||
|
@ -650,6 +476,16 @@ UM.MainWindow
|
|||
}
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: Cura.Actions.manageMaterials
|
||||
onTriggered:
|
||||
{
|
||||
preferences.visible = true;
|
||||
preferences.setPage(3)
|
||||
}
|
||||
}
|
||||
|
||||
Connections
|
||||
{
|
||||
target: Cura.Actions.configureSettingVisibility
|
||||
|
|
72
resources/qml/Menus/MaterialMenu.qml
Normal file
72
resources/qml/Menus/MaterialMenu.qml
Normal file
|
@ -0,0 +1,72 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Menu
|
||||
{
|
||||
id: menu
|
||||
title: "Material"
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
filter:
|
||||
{
|
||||
var result = { "type": "material" }
|
||||
if(Cura.MachineManager.filterMaterialsByMachine)
|
||||
{
|
||||
result.definition = Cura.MachineManager.activeDefinitionId
|
||||
if(Cura.MachineManager.hasVariants)
|
||||
{
|
||||
result.variant = Cura.MachineManager.activeVariantId
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.definition = "fdmprinter"
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
text:
|
||||
{
|
||||
var result = model.name
|
||||
|
||||
if(model.metadata.brand != undefined && model.metadata.brand != "Generic")
|
||||
{
|
||||
result = model.metadata.brand + " " + result
|
||||
}
|
||||
|
||||
if(model.metadata.color_name != undefined && model.metadata.color_name != "Generic")
|
||||
{
|
||||
result = result + " (%1)".arg(model.metadata.color_name)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
checkable: true;
|
||||
checked: model.id == Cura.MachineManager.activeMaterialId;
|
||||
exclusiveGroup: group;
|
||||
onTriggered:
|
||||
{
|
||||
Cura.MachineManager.setActiveMaterial(model.id);
|
||||
}
|
||||
}
|
||||
onObjectAdded: menu.insertItem(index, object)
|
||||
onObjectRemoved: menu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: group }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
MenuItem { action: Cura.Actions.manageMaterials }
|
||||
}
|
37
resources/qml/Menus/NozzleMenu.qml
Normal file
37
resources/qml/Menus/NozzleMenu.qml
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Menu
|
||||
{
|
||||
id: menu
|
||||
title: "Nozzle"
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
filter:
|
||||
{
|
||||
"type": "variant",
|
||||
"definition": Cura.MachineManager.activeDefinitionId //Only show variants of this machine
|
||||
}
|
||||
}
|
||||
MenuItem {
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.id == Cura.MachineManager.activeVariantId;
|
||||
exclusiveGroup: group
|
||||
onTriggered: Cura.MachineManager.setActiveVariant(model.id)
|
||||
}
|
||||
onObjectAdded: menu.insertItem(index, object)
|
||||
onObjectRemoved: menu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: group }
|
||||
}
|
38
resources/qml/Menus/PrinterMenu.qml
Normal file
38
resources/qml/Menus/PrinterMenu.qml
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Menu
|
||||
{
|
||||
id: menu;
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: UM.ContainerStacksModel
|
||||
{
|
||||
filter: {"type": "machine"}
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: Cura.MachineManager.activeMachineId == model.id
|
||||
exclusiveGroup: group;
|
||||
onTriggered: Cura.MachineManager.setActiveMachine(model.id);
|
||||
}
|
||||
onObjectAdded: menu.insertItem(index, object)
|
||||
onObjectRemoved: menu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: group; }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
MenuItem { action: Cura.Actions.addMachine; }
|
||||
MenuItem { action: Cura.Actions.configureMachines; }
|
||||
}
|
86
resources/qml/Menus/ProfileMenu.qml
Normal file
86
resources/qml/Menus/ProfileMenu.qml
Normal file
|
@ -0,0 +1,86 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Menu
|
||||
{
|
||||
id: menu
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: UM.InstanceContainersModel { filter: menu.getFilter({ "read_only": true }); }
|
||||
|
||||
MenuItem
|
||||
{
|
||||
text: model.name
|
||||
checkable: true
|
||||
checked: Cura.MachineManager.activeQualityId == model.id
|
||||
exclusiveGroup: group
|
||||
onTriggered: Cura.MachineManager.setActiveQuality(model.id)
|
||||
}
|
||||
|
||||
onObjectAdded: menu.insertItem(index, object);
|
||||
onObjectRemoved: menu.removeItem(object);
|
||||
}
|
||||
|
||||
MenuSeparator { id: customSeparator }
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
id: customProfilesModel;
|
||||
filter: menu.getFilter({ "read_only": false });
|
||||
onRowsInserted: customSeparator.visible = rowCount() > 1
|
||||
onRowsRemoved: customSeparator.visible = rowCount() > 1
|
||||
onModelReset: customSeparator.visible = rowCount() > 1
|
||||
}
|
||||
|
||||
MenuItem
|
||||
{
|
||||
text: model.name
|
||||
checkable: true
|
||||
checked: Cura.MachineManager.activeQualityId == model.id
|
||||
exclusiveGroup: group
|
||||
onTriggered: Cura.MachineManager.setActiveQuality(model.id)
|
||||
}
|
||||
|
||||
onObjectAdded: menu.insertItem(index, object);
|
||||
onObjectRemoved: menu.removeItem(object);
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: group; }
|
||||
|
||||
MenuSeparator { id: profileMenuSeparator }
|
||||
|
||||
MenuItem { action: Cura.Actions.addProfile }
|
||||
MenuItem { action: Cura.Actions.updateProfile }
|
||||
MenuItem { action: Cura.Actions.resetProfile }
|
||||
MenuSeparator { }
|
||||
MenuItem { action: Cura.Actions.manageProfiles }
|
||||
|
||||
function getFilter(initial_conditions)
|
||||
{
|
||||
var result = initial_conditions;
|
||||
result.type = "quality"
|
||||
|
||||
if(Cura.MachineManager.filterQualityByMachine)
|
||||
{
|
||||
result.definition = Cura.MachineManager.activeDefinitionId;
|
||||
if(Cura.MachineManager.hasMaterials)
|
||||
{
|
||||
result.material = Cura.MachineManager.activeMaterialId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.definition = "fdmprinter"
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
37
resources/qml/Menus/RecentFilesMenu.qml
Normal file
37
resources/qml/Menus/RecentFilesMenu.qml
Normal file
|
@ -0,0 +1,37 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Menu
|
||||
{
|
||||
id: menu
|
||||
title: catalog.i18nc("@title:menu menubar:file", "Open &Recent")
|
||||
iconName: "document-open-recent";
|
||||
|
||||
enabled: Printer.recentFiles.length > 0;
|
||||
|
||||
Instantiator
|
||||
{
|
||||
model: Printer.recentFiles
|
||||
MenuItem
|
||||
{
|
||||
text:
|
||||
{
|
||||
var path = modelData.toString()
|
||||
return (index + 1) + ". " + path.slice(path.lastIndexOf("/") + 1);
|
||||
}
|
||||
onTriggered: {
|
||||
UM.MeshFileHandler.readLocalFile(modelData);
|
||||
var meshName = backgroundItem.getMeshName(modelData.toString())
|
||||
backgroundItem.hasMesh(decodeURIComponent(meshName))
|
||||
}
|
||||
}
|
||||
onObjectAdded: menu.insertItem(index, object)
|
||||
onObjectRemoved: menu.removeItem(object)
|
||||
}
|
||||
}
|
29
resources/qml/Menus/ViewMenu.qml
Normal file
29
resources/qml/Menus/ViewMenu.qml
Normal file
|
@ -0,0 +1,29 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Cura is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.2
|
||||
import QtQuick.Controls 1.1
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
Menu
|
||||
{
|
||||
title: catalog.i18nc("@title:menu menubar:toplevel", "&View");
|
||||
id: menu
|
||||
Instantiator
|
||||
{
|
||||
model: UM.ViewModel { }
|
||||
MenuItem
|
||||
{
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.active;
|
||||
exclusiveGroup: group;
|
||||
onTriggered: UM.Controller.setActiveView(model.id);
|
||||
}
|
||||
onObjectAdded: menu.insertItem(index, object)
|
||||
onObjectRemoved: menu.removeItem(object)
|
||||
}
|
||||
ExclusiveGroup { id: group; }
|
||||
}
|
|
@ -27,14 +27,35 @@ UM.ManagementPage
|
|||
return -1;
|
||||
}
|
||||
|
||||
onAddObject: Printer.requestAddPrinter()
|
||||
onRemoveObject: confirmDialog.open();
|
||||
onRenameObject: renameDialog.open();
|
||||
onActivateObject: Cura.MachineManager.setActiveMachine(base.currentItem.id)
|
||||
|
||||
removeEnabled: base.currentItem != null && model.rowCount() > 1
|
||||
renameEnabled: base.currentItem != null
|
||||
activateEnabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMachineId
|
||||
buttons: [
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Activate");
|
||||
iconName: "list-activate";
|
||||
enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId
|
||||
onClicked: Cura.MachineManager.setActiveMachine(base.currentItem.id)
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Add");
|
||||
iconName: "list-add";
|
||||
onClicked: Printer.requestAddPrinter()
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Remove");
|
||||
iconName: "list-remove";
|
||||
enabled: base.currentItem != null && model.rowCount() > 1
|
||||
onClicked: confirmDialog.open();
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Rename");
|
||||
iconName: "edit-rename";
|
||||
enabled: base.currentItem != null
|
||||
onClicked: renameDialog.open();
|
||||
}
|
||||
]
|
||||
|
||||
Item
|
||||
{
|
||||
|
|
252
resources/qml/Preferences/MaterialView.qml
Normal file
252
resources/qml/Preferences/MaterialView.qml
Normal file
|
@ -0,0 +1,252 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.3
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
TabView
|
||||
{
|
||||
id: base
|
||||
|
||||
property QtObject properties;
|
||||
|
||||
property bool editingEnabled: false;
|
||||
property string currency: UM.Preferences.getValue("general/currency") ? UM.Preferences.getValue("general/currency") : "€"
|
||||
property real firstColumnWidth: width * 0.45
|
||||
property real secondColumnWidth: width * 0.45
|
||||
property string containerId: ""
|
||||
|
||||
Tab
|
||||
{
|
||||
title: "Information"
|
||||
anchors
|
||||
{
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
bottomMargin: UM.Theme.getSize("default_margin").height
|
||||
rightMargin: 0
|
||||
}
|
||||
|
||||
ScrollView
|
||||
{
|
||||
anchors.fill: parent
|
||||
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
|
||||
|
||||
Flow
|
||||
{
|
||||
id: containerGrid
|
||||
|
||||
width: base.width;
|
||||
|
||||
property real rowHeight: textField.height;
|
||||
|
||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Brand") }
|
||||
ReadOnlyTextField
|
||||
{
|
||||
id: textField;
|
||||
width: base.secondColumnWidth;
|
||||
text: properties.supplier;
|
||||
readOnly: !base.editingEnabled;
|
||||
onEditingFinished: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "brand", text)
|
||||
}
|
||||
|
||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Material Type") }
|
||||
ReadOnlyTextField
|
||||
{
|
||||
width: base.secondColumnWidth;
|
||||
text: properties.material_type;
|
||||
readOnly: !base.editingEnabled;
|
||||
onEditingFinished: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "material", text)
|
||||
}
|
||||
|
||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Color") }
|
||||
|
||||
Row
|
||||
{
|
||||
width: base.secondColumnWidth;
|
||||
height: parent.rowHeight;
|
||||
spacing: UM.Theme.getSize("default_margin").width/2
|
||||
|
||||
Rectangle
|
||||
{
|
||||
id: colorSelector
|
||||
color: properties.color_code
|
||||
onColorChanged: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "color_code", color)
|
||||
|
||||
width: colorLabel.height * 0.75
|
||||
height: colorLabel.height * 0.75
|
||||
border.width: UM.Theme.getSize("default_lining").height
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
MouseArea { anchors.fill: parent; onClicked: colorDialog.open(); enabled: base.editingEnabled }
|
||||
}
|
||||
ReadOnlyTextField
|
||||
{
|
||||
id: colorLabel;
|
||||
text: properties.color_name;
|
||||
readOnly: !base.editingEnabled
|
||||
onEditingFinished: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "color_name", text)
|
||||
}
|
||||
|
||||
ColorDialog { id: colorDialog; color: properties.color_code; onAccepted: colorSelector.color = color }
|
||||
}
|
||||
|
||||
Item { width: parent.width; height: UM.Theme.getSize("default_margin").height }
|
||||
|
||||
Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: "<b>" + catalog.i18nc("@label", "Properties") + "</b>" }
|
||||
|
||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Density") }
|
||||
ReadOnlySpinBox
|
||||
{
|
||||
width: base.secondColumnWidth;
|
||||
value: properties.density;
|
||||
decimals: 2
|
||||
suffix: "g/cm"
|
||||
stepSize: 0.01
|
||||
readOnly: !base.editingEnabled;
|
||||
|
||||
onEditingFinished: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "properties/density", value)
|
||||
}
|
||||
|
||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Diameter") }
|
||||
ReadOnlySpinBox
|
||||
{
|
||||
width: base.secondColumnWidth;
|
||||
value: properties.diameter;
|
||||
decimals: 2
|
||||
suffix: "mm³"
|
||||
stepSize: 0.01
|
||||
readOnly: !base.editingEnabled;
|
||||
|
||||
onEditingFinished: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "properties/diameter", value)
|
||||
}
|
||||
|
||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament Cost") }
|
||||
SpinBox
|
||||
{
|
||||
width: base.secondColumnWidth;
|
||||
value: properties.spool_cost;
|
||||
prefix: base.currency
|
||||
enabled: false
|
||||
}
|
||||
|
||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament weight") }
|
||||
SpinBox
|
||||
{
|
||||
width: base.secondColumnWidth;
|
||||
value: properties.spool_weight;
|
||||
suffix: "g";
|
||||
stepSize: 10
|
||||
enabled: false
|
||||
}
|
||||
|
||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Filament length") }
|
||||
SpinBox
|
||||
{
|
||||
width: base.secondColumnWidth;
|
||||
value: parseFloat(properties.spool_length);
|
||||
suffix: "m";
|
||||
enabled: false
|
||||
}
|
||||
|
||||
Label { width: base.firstColumnWidth; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Cost per Meter (Approx.)") }
|
||||
SpinBox
|
||||
{
|
||||
width: base.secondColumnWidth;
|
||||
value: parseFloat(properties.cost_per_meter);
|
||||
suffix: catalog.i18nc("@label", "%1/m".arg(base.currency));
|
||||
enabled: false
|
||||
}
|
||||
|
||||
Item { width: parent.width; height: UM.Theme.getSize("default_margin").height }
|
||||
|
||||
Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Description") }
|
||||
|
||||
ReadOnlyTextArea
|
||||
{
|
||||
text: properties.description;
|
||||
width: base.firstColumnWidth + base.secondColumnWidth
|
||||
wrapMode: Text.WordWrap
|
||||
|
||||
readOnly: !base.editingEnabled;
|
||||
|
||||
onEditingFinished: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "description", text)
|
||||
}
|
||||
|
||||
Label { width: parent.width; height: parent.rowHeight; verticalAlignment: Qt.AlignVCenter; text: catalog.i18nc("@label", "Adhesion Information") }
|
||||
|
||||
ReadOnlyTextArea
|
||||
{
|
||||
text: properties.adhesion_info;
|
||||
width: base.firstColumnWidth + base.secondColumnWidth
|
||||
wrapMode: Text.WordWrap
|
||||
|
||||
readOnly: !base.editingEnabled;
|
||||
|
||||
onEditingFinished: Cura.ContainerManager.setContainerMetaDataEntry(base.containerId, "adhesion_info", text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Tab
|
||||
{
|
||||
title: catalog.i18nc("@label", "Print settings")
|
||||
anchors
|
||||
{
|
||||
leftMargin: UM.Theme.getSize("default_margin").width
|
||||
topMargin: UM.Theme.getSize("default_margin").height
|
||||
bottomMargin: UM.Theme.getSize("default_margin").height
|
||||
rightMargin: 0
|
||||
}
|
||||
|
||||
ScrollView
|
||||
{
|
||||
anchors.fill: parent;
|
||||
|
||||
ListView
|
||||
{
|
||||
model: UM.SettingDefinitionsModel
|
||||
{
|
||||
containerId: Cura.MachineManager.activeDefinitionId
|
||||
visibilityHandler: Cura.MaterialSettingsVisibilityHandler { }
|
||||
expanded: ["*"]
|
||||
}
|
||||
|
||||
delegate: UM.TooltipArea
|
||||
{
|
||||
width: childrenRect.width
|
||||
height: childrenRect.height
|
||||
text: model.description
|
||||
Label
|
||||
{
|
||||
id: label
|
||||
width: base.firstColumnWidth;
|
||||
height: spinBox.height
|
||||
text: model.label
|
||||
}
|
||||
ReadOnlySpinBox
|
||||
{
|
||||
id: spinBox
|
||||
anchors.left: label.right
|
||||
value: parseFloat(provider.properties.value);
|
||||
width: base.secondColumnWidth;
|
||||
readOnly: !base.editingEnabled
|
||||
suffix: model.unit
|
||||
maximumValue: 99999
|
||||
decimals: model.unit == "mm" ? 2 : 0
|
||||
|
||||
onEditingFinished: provider.setPropertyValue("value", value)
|
||||
}
|
||||
|
||||
UM.ContainerPropertyProvider { id: provider; containerId: base.containerId; watchedProperties: [ "value" ]; key: model.key }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -33,6 +33,8 @@ UM.ManagementPage
|
|||
}
|
||||
return result
|
||||
}
|
||||
|
||||
sectionProperty: "brand"
|
||||
}
|
||||
|
||||
activeId: Cura.MachineManager.activeMaterialId
|
||||
|
@ -45,14 +47,64 @@ UM.ManagementPage
|
|||
return -1;
|
||||
}
|
||||
|
||||
addEnabled: false
|
||||
removeEnabled: false
|
||||
renameEnabled: false
|
||||
|
||||
scrollviewCaption: " "
|
||||
scrollviewCaption: "Printer: %1, Nozzle: %2".arg(Cura.MachineManager.activeMachineName).arg(Cura.MachineManager.activeVariantName)
|
||||
detailsVisible: true
|
||||
|
||||
property string currency: UM.Preferences.getValue("general/currency")
|
||||
section.property: "section"
|
||||
section.delegate: Label { text: section }
|
||||
|
||||
buttons: [
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Activate");
|
||||
iconName: "list-activate";
|
||||
enabled: base.currentItem != null && base.currentItem.id != Cura.MachineManager.activeMaterialId
|
||||
onClicked: Cura.MachineManager.setActiveMaterial(base.currentItem.id)
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Duplicate");
|
||||
iconName: "list-add";
|
||||
enabled: base.currentItem != null
|
||||
onClicked:
|
||||
{
|
||||
var material_id = Cura.ContainerManager.duplicateContainer(base.currentItem.id)
|
||||
if(material_id == "")
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
if(Cura.MachineManager.filterQualityByMachine)
|
||||
{
|
||||
var quality_id = Cura.ContainerManager.duplicateContainer(Cura.MachineManager.activeQualityId)
|
||||
Cura.ContainerManager.setContainerMetaDataEntry(quality_id, "material", material_id)
|
||||
Cura.MachineManager.setActiveQuality(quality_id)
|
||||
}
|
||||
|
||||
Cura.MachineManager.setActiveMaterial(material_id)
|
||||
}
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Remove");
|
||||
iconName: "list-remove";
|
||||
enabled: base.currentItem != null && !base.currentItem.readOnly
|
||||
onClicked: confirmDialog.open()
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Import");
|
||||
iconName: "document-import";
|
||||
onClicked: importDialog.open();
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Export")
|
||||
iconName: "document-export"
|
||||
onClicked: exportDialog.open()
|
||||
enabled: currentItem != null
|
||||
}
|
||||
]
|
||||
|
||||
Item {
|
||||
UM.I18nCatalog { id: catalog; name: "cura"; }
|
||||
|
@ -60,126 +112,42 @@ UM.ManagementPage
|
|||
visible: base.currentItem != null
|
||||
anchors.fill: parent
|
||||
|
||||
Label { id: profileName; text: materialProperties.name; font: UM.Theme.getFont("large"); width: parent.width; }
|
||||
Item
|
||||
{
|
||||
id: profileName
|
||||
|
||||
TabView {
|
||||
id: scrollView
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
anchors.top: profileName.bottom
|
||||
anchors.topMargin: UM.Theme.getSize("default_margin").height
|
||||
anchors.bottom: parent.bottom
|
||||
width: parent.width;
|
||||
height: childrenRect.height
|
||||
|
||||
Tab {
|
||||
title: "Information"
|
||||
anchors.margins: UM.Theme.getSize("default_margin").height
|
||||
Label { text: materialProperties.name; font: UM.Theme.getFont("large"); }
|
||||
Button
|
||||
{
|
||||
id: editButton
|
||||
anchors.right: parent.right;
|
||||
text: catalog.i18nc("@action:button", "Edit");
|
||||
iconName: "document-edit";
|
||||
|
||||
Flow {
|
||||
id: containerGrid
|
||||
enabled: base.currentItem != null && !base.currentItem.readOnly
|
||||
|
||||
width: scrollView.width;
|
||||
property real columnWidth: width / 2
|
||||
|
||||
Label { width: parent.columnWidth; text: catalog.i18nc("@label", "Profile Type") }
|
||||
Label { width: parent.columnWidth; text: materialProperties.profile_type }
|
||||
|
||||
Label { width: parent.columnWidth; text: catalog.i18nc("@label", "Supplier") }
|
||||
Label { width: parent.columnWidth; text: materialProperties.supplier }
|
||||
|
||||
Label { width: parent.columnWidth; text: catalog.i18nc("@label", "Material Type") }
|
||||
Label { width: parent.columnWidth; text: materialProperties.material_type }
|
||||
|
||||
Label { width: parent.columnWidth; text: catalog.i18nc("@label", "Color") }
|
||||
|
||||
Row {
|
||||
width: parent.columnWidth;
|
||||
spacing: UM.Theme.getSize("default_margin").width/2
|
||||
Rectangle {
|
||||
color: materialProperties.color_code
|
||||
width: colorLabel.height
|
||||
height: colorLabel.height
|
||||
border.width: UM.Theme.getSize("default_lining").height
|
||||
}
|
||||
Label { id: colorLabel; text: materialProperties.color_name }
|
||||
}
|
||||
|
||||
Item { width: parent.width; height: UM.Theme.getSize("default_margin").height }
|
||||
|
||||
Label { width: parent.width; text: "<b>" + catalog.i18nc("@label", "Properties") + "</b>" }
|
||||
|
||||
Label { width: parent.columnWidth; text: catalog.i18nc("@label", "Density") }
|
||||
Label { width: parent.columnWidth; text: materialProperties.density }
|
||||
|
||||
Label { width: parent.columnWidth; text: catalog.i18nc("@label", "Diameter") }
|
||||
Label { width: parent.columnWidth; text: materialProperties.diameter }
|
||||
|
||||
Label {
|
||||
text: catalog.i18nc("@label", "Filament cost")
|
||||
width: parent.columnWidth;
|
||||
height: spoolCostInput.height
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
Row {
|
||||
width: parent.columnWidth;
|
||||
Label {
|
||||
text: base.currency ? base.currency + " " : " "
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
}
|
||||
TextField {
|
||||
id: spoolCostInput
|
||||
text: materialProperties.spool_cost
|
||||
}
|
||||
}
|
||||
|
||||
Label { width: parent.columnWidth; text: catalog.i18nc("@label", "Filament weight") }
|
||||
Label { width: parent.columnWidth; text: materialProperties.spool_weight + " " + "g" }
|
||||
|
||||
Label { width: parent.columnWidth; text: catalog.i18nc("@label", "Filament length") }
|
||||
Label { width: parent.columnWidth; text: materialProperties.spool_length + " " + "m" }
|
||||
|
||||
Label { width: parent.columnWidth; text: catalog.i18nc("@label", "Cost per meter") }
|
||||
Label { width: parent.columnWidth; text: catalog.i18nc("@label", "approx. %1 %2/m").arg(materialProperties.cost_per_meter).arg(base.currency); }
|
||||
|
||||
Item { width: parent.width; height: UM.Theme.getSize("default_margin").height }
|
||||
|
||||
Label {
|
||||
text: materialProperties.description ? "<b>" + catalog.i18nc("@label", "Information") + "</b><br>" + materialProperties.description : "";
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
Label {
|
||||
text: materialProperties.adhesion_info ? "<b>" + catalog.i18nc("@label", "Adhesion") + "</b><br>" + materialProperties.adhesion_info : "";
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
}
|
||||
checkable: true
|
||||
}
|
||||
Tab {
|
||||
title: catalog.i18nc("@label", "Print settings")
|
||||
anchors.margins: UM.Theme.getSize("default_margin").height
|
||||
}
|
||||
|
||||
Grid {
|
||||
columns: 2
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
|
||||
Column {
|
||||
Repeater {
|
||||
model: base.currentItem ? base.currentItem.settings : null
|
||||
Label {
|
||||
text: modelData.name.toString();
|
||||
elide: Text.ElideMiddle;
|
||||
}
|
||||
}
|
||||
}
|
||||
Column {
|
||||
Repeater {
|
||||
model: base.currentItem ? base.currentItem.settings : null
|
||||
Label { text: modelData.value.toString() + " " + modelData.unit.toString(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
MaterialView
|
||||
{
|
||||
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.readOnly && editButton.checked;
|
||||
|
||||
properties: materialProperties
|
||||
containerId: base.currentItem.id
|
||||
}
|
||||
|
||||
QtObject
|
||||
|
@ -194,17 +162,100 @@ UM.ManagementPage
|
|||
property string color_name: "Yellow";
|
||||
property color color_code: "yellow";
|
||||
|
||||
property string density: "Unknown";
|
||||
property string diameter: "Unknown";
|
||||
property real density: 0.0;
|
||||
property real diameter: 0.0;
|
||||
|
||||
property string spool_cost: "Unknown";
|
||||
property string spool_weight: "Unknown";
|
||||
property string spool_length: "Unknown";
|
||||
property string cost_per_meter: "Unknown";
|
||||
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: "";
|
||||
}
|
||||
|
||||
UM.ConfirmRemoveDialog
|
||||
{
|
||||
id: confirmDialog
|
||||
object: base.currentItem != null ? base.currentItem.name : ""
|
||||
onYes:
|
||||
{
|
||||
var containers = Cura.ContainerManager.findInstanceContainers({"GUID": base.currentItem.metadata.GUID})
|
||||
for(var i in containers)
|
||||
{
|
||||
Cura.ContainerManager.removeContainer(containers[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: importDialog;
|
||||
title: catalog.i18nc("@title:window", "Import Material");
|
||||
selectExisting: true;
|
||||
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
|
||||
folder: CuraApplication.getDefaultPath()
|
||||
onAccepted:
|
||||
{
|
||||
var result = Cura.ContainerManager.importContainer(fileUrl)
|
||||
|
||||
messageDialog.title = catalog.i18nc("@title:window", "Import Material")
|
||||
messageDialog.text = catalog.i18nc("@info:status", "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", "Successfully imported material <filename>%1</filename>").arg(fileUrl)
|
||||
}
|
||||
else if(result.status == "duplicate")
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Warning
|
||||
}
|
||||
else
|
||||
{
|
||||
messageDialog.icon = StandardIcon.Critical
|
||||
}
|
||||
messageDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
FileDialog
|
||||
{
|
||||
id: exportDialog;
|
||||
title: catalog.i18nc("@title:window", "Export Material");
|
||||
selectExisting: false;
|
||||
nameFilters: Cura.ContainerManager.getContainerNameFilters("material")
|
||||
folder: CuraApplication.getDefaultPath()
|
||||
onAccepted:
|
||||
{
|
||||
if(base.currentItem.metadata.base_file)
|
||||
{
|
||||
var result = Cura.ContainerManager.exportContainer(base.currentItem.metadata.base_file, selectedNameFilter, fileUrl)
|
||||
}
|
||||
else
|
||||
{
|
||||
var result = Cura.ContainerManager.exportContainer(base.currentItem.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", "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", "Successfully exported material to <filename>%1</filename>").arg(fileUrl)
|
||||
messageDialog.open()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MessageDialog
|
||||
{
|
||||
id: messageDialog
|
||||
}
|
||||
}
|
||||
|
||||
onCurrentItemChanged:
|
||||
|
@ -228,13 +279,13 @@ UM.ManagementPage
|
|||
|
||||
if(currentItem.metadata.properties != undefined && currentItem.metadata.properties != null)
|
||||
{
|
||||
materialProperties.density = currentItem.metadata.properties.density ? currentItem.metadata.properties.density : "Unknown";
|
||||
materialProperties.diameter = currentItem.metadata.properties.diameter ? currentItem.metadata.properties.diameter : "Unknown";
|
||||
materialProperties.density = currentItem.metadata.properties.density ? currentItem.metadata.properties.density : 0.0;
|
||||
materialProperties.diameter = currentItem.metadata.properties.diameter ? currentItem.metadata.properties.diameter : 0.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
materialProperties.density = "Unknown";
|
||||
materialProperties.diameter = "Unknown";
|
||||
materialProperties.density = 0.0;
|
||||
materialProperties.diameter = 0.0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ UM.ManagementPage
|
|||
id: base;
|
||||
|
||||
title: catalog.i18nc("@title:tab", "Profiles");
|
||||
addText: base.currentItem && (base.currentItem.id == Cura.MachineManager.activeQualityId) ? catalog.i18nc("@label", "Create") : catalog.i18nc("@label", "Duplicate")
|
||||
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
|
@ -60,27 +59,62 @@ UM.ManagementPage
|
|||
return -1;
|
||||
}
|
||||
|
||||
onActivateObject: Cura.MachineManager.setActiveQuality(currentItem.id)
|
||||
onAddObject: {
|
||||
var selectedContainer;
|
||||
if (objectList.currentItem.id == Cura.MachineManager.activeQualityId) {
|
||||
selectedContainer = Cura.MachineManager.newQualityContainerFromQualityAndUser();
|
||||
} else {
|
||||
selectedContainer = Cura.MachineManager.duplicateContainer(base.currentItem.id);
|
||||
buttons: [
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Activate");
|
||||
iconName: "list-activate";
|
||||
enabled: base.currentItem != null ? base.currentItem.id != Cura.MachineManager.activeQualityId : false;
|
||||
onClicked: Cura.MachineManager.setActiveQuality(base.currentItem.id)
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: base.currentItem && (base.currentItem.id == Cura.MachineManager.activeQualityId) ? catalog.i18nc("@label", "Create") : catalog.i18nc("@label", "Duplicate")
|
||||
iconName: "list-add";
|
||||
|
||||
onClicked:
|
||||
{
|
||||
var selectedContainer;
|
||||
if (objectList.currentItem.id == Cura.MachineManager.activeQualityId) {
|
||||
selectedContainer = Cura.MachineManager.newQualityContainerFromQualityAndUser();
|
||||
} else {
|
||||
selectedContainer = Cura.MachineManager.duplicateContainer(base.currentItem.id);
|
||||
}
|
||||
base.selectContainer(selectedContainer);
|
||||
|
||||
renameDialog.removeWhenRejected = true;
|
||||
renameDialog.open();
|
||||
renameDialog.selectText();
|
||||
}
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Remove");
|
||||
iconName: "list-remove";
|
||||
enabled: base.currentItem != null ? !base.currentItem.readOnly : false;
|
||||
onClicked: confirmDialog.open();
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Rename");
|
||||
iconName: "edit-rename";
|
||||
enabled: base.currentItem != null ? !base.currentItem.readOnly : false;
|
||||
onClicked: { renameDialog.removeWhenRejected = false; renameDialog.open(); renameDialog.selectText(); }
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Import");
|
||||
iconName: "document-import";
|
||||
onClicked: importDialog.open();
|
||||
},
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Export")
|
||||
iconName: "document-export"
|
||||
onClicked: exportDialog.open()
|
||||
enabled: currentItem != null
|
||||
}
|
||||
base.selectContainer(selectedContainer);
|
||||
|
||||
renameDialog.removeWhenRejected = true;
|
||||
renameDialog.open();
|
||||
renameDialog.selectText();
|
||||
}
|
||||
onRemoveObject: confirmDialog.open();
|
||||
onRenameObject: { renameDialog.removeWhenRejected = false; renameDialog.open(); renameDialog.selectText(); }
|
||||
|
||||
activateEnabled: currentItem != null ? currentItem.id != Cura.MachineManager.activeQualityId : false;
|
||||
addEnabled: currentItem != null;
|
||||
removeEnabled: currentItem != null ? !currentItem.readOnly : false;
|
||||
renameEnabled: currentItem != null ? !currentItem.readOnly : false;
|
||||
]
|
||||
|
||||
scrollviewCaption: catalog.i18nc("@label %1 is printer name","Printer: %1").arg(Cura.MachineManager.activeMachineName)
|
||||
|
||||
|
@ -211,24 +245,6 @@ UM.ManagementPage
|
|||
}
|
||||
}
|
||||
|
||||
buttons: Row {
|
||||
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Import");
|
||||
iconName: "document-import";
|
||||
onClicked: importDialog.open();
|
||||
}
|
||||
|
||||
Button
|
||||
{
|
||||
text: catalog.i18nc("@action:button", "Export")
|
||||
iconName: "document-export"
|
||||
onClicked: exportDialog.open()
|
||||
enabled: currentItem != null
|
||||
}
|
||||
}
|
||||
|
||||
Item
|
||||
{
|
||||
UM.I18nCatalog { id: catalog; name: "uranium"; }
|
||||
|
|
52
resources/qml/Preferences/ReadOnlySpinBox.qml
Normal file
52
resources/qml/Preferences/ReadOnlySpinBox.qml
Normal file
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
Item
|
||||
{
|
||||
id: base
|
||||
|
||||
property alias value: spinBox.value
|
||||
property alias minimumValue: spinBox.minimumValue
|
||||
property alias maximumValue: spinBox.maximumValue
|
||||
property alias stepSize: spinBox.stepSize
|
||||
property alias prefix: spinBox.prefix
|
||||
property alias suffix: spinBox.suffix
|
||||
property alias decimals: spinBox.decimals
|
||||
|
||||
signal editingFinished();
|
||||
|
||||
property bool readOnly: false
|
||||
|
||||
width: spinBox.width
|
||||
height: spinBox.height
|
||||
|
||||
SpinBox
|
||||
{
|
||||
id: spinBox
|
||||
|
||||
enabled: !base.readOnly
|
||||
opacity: base.readOnly ? 0.5 : 1.0
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
onEditingFinished: base.editingFinished()
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
visible: base.readOnly
|
||||
text: base.prefix + base.value.toFixed(spinBox.decimals) + base.suffix
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: spinBox.__style ? spinBox.__style.padding.left : 0
|
||||
|
||||
color: palette.buttonText
|
||||
}
|
||||
|
||||
SystemPalette { id: palette }
|
||||
}
|
46
resources/qml/Preferences/ReadOnlyTextArea.qml
Normal file
46
resources/qml/Preferences/ReadOnlyTextArea.qml
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
Item
|
||||
{
|
||||
id: base
|
||||
|
||||
property alias text: textArea.text
|
||||
property alias wrapMode: textArea.wrapMode
|
||||
|
||||
signal editingFinished();
|
||||
|
||||
property bool readOnly: false
|
||||
|
||||
width: textArea.width
|
||||
height: textArea.height
|
||||
|
||||
TextArea
|
||||
{
|
||||
id: textArea
|
||||
|
||||
enabled: !base.readOnly
|
||||
opacity: base.readOnly ? 0.5 : 1.0
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
onEditingFinished: base.editingFinished()
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
visible: base.readOnly
|
||||
text: textArea.text
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.margins: textArea.__style ? textArea.__style.textMargin : 4
|
||||
|
||||
color: palette.buttonText
|
||||
}
|
||||
|
||||
SystemPalette { id: palette }
|
||||
}
|
46
resources/qml/Preferences/ReadOnlyTextField.qml
Normal file
46
resources/qml/Preferences/ReadOnlyTextField.qml
Normal file
|
@ -0,0 +1,46 @@
|
|||
// Copyright (c) 2016 Ultimaker B.V.
|
||||
// Uranium is released under the terms of the AGPLv3 or higher.
|
||||
|
||||
import QtQuick 2.1
|
||||
import QtQuick.Controls 1.1
|
||||
import QtQuick.Dialogs 1.2
|
||||
|
||||
Item
|
||||
{
|
||||
id: base
|
||||
|
||||
property alias text: textField.text
|
||||
|
||||
signal editingFinished();
|
||||
|
||||
property bool readOnly: false
|
||||
|
||||
width: textField.width
|
||||
height: textField.height
|
||||
|
||||
TextField
|
||||
{
|
||||
id: textField
|
||||
|
||||
enabled: !base.readOnly
|
||||
opacity: base.readOnly ? 0.5 : 1.0
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
onEditingFinished: base.editingFinished()
|
||||
}
|
||||
|
||||
Label
|
||||
{
|
||||
visible: base.readOnly
|
||||
text: textField.text
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: textField.__panel ? textField.__panel.leftMargin : 0
|
||||
|
||||
color: palette.buttonText
|
||||
}
|
||||
|
||||
SystemPalette { id: palette }
|
||||
}
|
|
@ -8,6 +8,8 @@ import QtQuick.Controls.Styles 1.1
|
|||
import UM 1.2 as UM
|
||||
import Cura 1.0 as Cura
|
||||
|
||||
import "Menus"
|
||||
|
||||
Column
|
||||
{
|
||||
id: base;
|
||||
|
@ -56,34 +58,7 @@ Column
|
|||
|
||||
width: parent.width * 0.55 + UM.Theme.getSize("default_margin").width
|
||||
|
||||
menu: Menu
|
||||
{
|
||||
id: machineSelectionMenu
|
||||
Instantiator
|
||||
{
|
||||
model: UM.ContainerStacksModel
|
||||
{
|
||||
filter: {"type": "machine"}
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: Cura.MachineManager.activeMachineId == model.id
|
||||
exclusiveGroup: machineSelectionMenuGroup;
|
||||
onTriggered: Cura.MachineManager.setActiveMachine(model.id);
|
||||
}
|
||||
onObjectAdded: machineSelectionMenu.insertItem(index, object)
|
||||
onObjectRemoved: machineSelectionMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: machineSelectionMenuGroup; }
|
||||
|
||||
MenuSeparator { }
|
||||
|
||||
MenuItem { action: Cura.Actions.addMachine; }
|
||||
MenuItem { action: Cura.Actions.configureMachines; }
|
||||
}
|
||||
menu: PrinterMenu { }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -236,37 +211,7 @@ Column
|
|||
anchors.left: parent.left
|
||||
style: UM.Theme.styles.sidebar_header_button
|
||||
|
||||
menu: Menu
|
||||
{
|
||||
id: variantsSelectionMenu
|
||||
Instantiator
|
||||
{
|
||||
id: variantSelectionInstantiator
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
filter:
|
||||
{
|
||||
"type": "variant",
|
||||
"definition": Cura.MachineManager.activeDefinitionId //Only show variants of this machine
|
||||
}
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.id == Cura.MachineManager.activeVariantId;
|
||||
exclusiveGroup: variantSelectionMenuGroup;
|
||||
onTriggered:
|
||||
{
|
||||
Cura.MachineManager.setActiveVariant(model.id);
|
||||
}
|
||||
}
|
||||
onObjectAdded: variantsSelectionMenu.insertItem(index, object)
|
||||
onObjectRemoved: variantsSelectionMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: variantSelectionMenuGroup; }
|
||||
}
|
||||
menu: NozzleMenu { }
|
||||
}
|
||||
|
||||
ToolButton {
|
||||
|
@ -281,49 +226,7 @@ Column
|
|||
anchors.right: parent.right
|
||||
style: UM.Theme.styles.sidebar_header_button
|
||||
|
||||
menu: Menu
|
||||
{
|
||||
id: materialSelectionMenu
|
||||
Instantiator
|
||||
{
|
||||
id: materialSelectionInstantiator
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
filter:
|
||||
{
|
||||
var result = { "type": "material" }
|
||||
if(Cura.MachineManager.filterMaterialsByMachine)
|
||||
{
|
||||
result.definition = Cura.MachineManager.activeDefinitionId
|
||||
if(Cura.MachineManager.hasVariants)
|
||||
{
|
||||
result.variant = Cura.MachineManager.activeVariantId
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.definition = "fdmprinter"
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
MenuItem
|
||||
{
|
||||
text: model.name;
|
||||
checkable: true;
|
||||
checked: model.id == Cura.MachineManager.activeMaterialId;
|
||||
exclusiveGroup: materialSelectionMenuGroup;
|
||||
onTriggered:
|
||||
{
|
||||
Cura.MachineManager.setActiveMaterial(model.id);
|
||||
}
|
||||
}
|
||||
onObjectAdded: materialSelectionMenu.insertItem(index, object)
|
||||
onObjectRemoved: materialSelectionMenu.removeItem(object)
|
||||
}
|
||||
|
||||
ExclusiveGroup { id: materialSelectionMenuGroup; }
|
||||
}
|
||||
menu: MaterialMenu { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -360,88 +263,7 @@ Column
|
|||
tooltip: Cura.MachineManager.activeQualityName
|
||||
style: UM.Theme.styles.sidebar_header_button
|
||||
|
||||
menu: Menu
|
||||
{
|
||||
id: profileSelectionMenu
|
||||
Instantiator
|
||||
{
|
||||
id: profileSelectionInstantiator
|
||||
model: UM.InstanceContainersModel
|
||||
{
|
||||
filter:
|
||||
{
|
||||
var result = { "type": "quality" };
|
||||
if(Cura.MachineManager.filterQualityByMachine)
|
||||
{
|
||||
result.definition = Cura.MachineManager.activeDefinitionId;
|
||||
if(Cura.MachineManager.hasMaterials)
|
||||
{
|
||||
result.material = Cura.MachineManager.activeMaterialId;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result.definition = "fdmprinter"
|
||||
}
|
||||
return result
|
||||
}
|
||||
}
|
||||
property int separatorIndex: -1
|
||||
|
||||
Loader {
|
||||
property QtObject model_data: model
|
||||
property int model_index: index
|
||||
sourceComponent: menuItemDelegate
|
||||
}
|
||||
onObjectAdded:
|
||||
{
|
||||
//Insert a separator between readonly and custom profiles
|
||||
if(separatorIndex < 0 && index > 0)
|
||||
{
|
||||
if(model.getItem(index-1).readOnly != model.getItem(index).readOnly)
|
||||
{
|
||||
profileSelectionMenu.insertSeparator(index);
|
||||
separatorIndex = index;
|
||||
}
|
||||
}
|
||||
//Because of the separator, custom profiles move one index lower
|
||||
profileSelectionMenu.insertItem((model.getItem(index).readOnly) ? index : index + 1, object.item);
|
||||
}
|
||||
onObjectRemoved:
|
||||
{
|
||||
//When adding a profile, the menu is rebuilt by removing all items.
|
||||
//If a separator was added, we need to remove that too.
|
||||
if(separatorIndex >= 0)
|
||||
{
|
||||
profileSelectionMenu.removeItem(profileSelectionMenu.items[separatorIndex])
|
||||
separatorIndex = -1;
|
||||
}
|
||||
profileSelectionMenu.removeItem(object.item);
|
||||
}
|
||||
}
|
||||
ExclusiveGroup { id: profileSelectionMenuGroup; }
|
||||
|
||||
Component
|
||||
{
|
||||
id: menuItemDelegate
|
||||
MenuItem
|
||||
{
|
||||
id: item
|
||||
text: model_data ? model_data.name : ""
|
||||
checkable: true
|
||||
checked: model_data != null ? Cura.MachineManager.activeQualityId == model_data.id : false
|
||||
exclusiveGroup: profileSelectionMenuGroup;
|
||||
onTriggered: Cura.MachineManager.setActiveQuality(model_data.id)
|
||||
}
|
||||
}
|
||||
|
||||
MenuSeparator { }
|
||||
MenuItem { action: Cura.Actions.addProfile }
|
||||
MenuItem { action: Cura.Actions.updateProfile }
|
||||
MenuItem { action: Cura.Actions.resetProfile }
|
||||
MenuSeparator { }
|
||||
MenuItem { action: Cura.Actions.manageProfiles }
|
||||
}
|
||||
menu: ProfileMenu { }
|
||||
|
||||
UM.SimpleButton
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue