Merge branch 'master' of github.com:Ultimaker/Cura into network_rewrite

This commit is contained in:
Jaime van Kessel 2017-12-14 13:03:02 +01:00
commit 24bd32477a
127 changed files with 1078 additions and 824 deletions

View file

@ -18,6 +18,7 @@ Item
property alias redo: redoAction;
property alias homeCamera: homeCameraAction;
property alias expandSidebar: expandSidebarAction;
property alias deleteSelection: deleteSelectionAction;
property alias centerSelection: centerSelectionAction;
@ -389,4 +390,11 @@ Item
text: catalog.i18nc("@action:menu", "Installed plugins...");
iconName: "plugins_configure"
}
Action
{
id: expandSidebarAction;
text: catalog.i18nc("@action:inmenu menubar:view","Expand/Collapse Sidebar");
shortcut: "Ctrl+E";
}
}

View file

@ -24,7 +24,7 @@ UM.MainWindow
// It should be phased out in newer plugin versions.
Connections
{
target: Printer
target: CuraApplication
onShowPrintMonitor: {
if (show) {
UM.Controller.setActiveStage("MonitorStage")
@ -34,6 +34,24 @@ UM.MainWindow
}
}
onWidthChanged:
{
// If slidebar is collapsed then it should be invisible
// otherwise after the main_window resize the sidebar will be fully re-drawn
if (sidebar.collapsed){
if (sidebar.visible == true){
sidebar.visible = false
sidebar.initialWidth = 0
}
}
else{
if (sidebar.visible == false){
sidebar.visible = true
sidebar.initialWidth = UM.Theme.getSize("sidebar").width
}
}
}
Component.onCompleted:
{
CuraApplication.setMinimumWindowSize(UM.Theme.getSize("window_minimum_size"))
@ -369,17 +387,59 @@ UM.MainWindow
{
id: sidebar
anchors
{
top: topbar.bottom
bottom: parent.bottom
right: parent.right
property bool collapsed: false;
property var initialWidth: UM.Theme.getSize("sidebar").width;
function callExpandOrCollapse() {
if (collapsed) {
sidebar.visible = true;
sidebar.initialWidth = UM.Theme.getSize("sidebar").width;
viewportRect = Qt.rect(0, 0, (base.width - sidebar.width) / base.width, 1.0);
expandSidebarAnimation.start();
} else {
viewportRect = Qt.rect(0, 0, 1, 1.0);
collapseSidebarAnimation.start();
}
collapsed = !collapsed;
UM.Preferences.setValue("cura/sidebar_collapse", collapsed);
}
width: UM.Theme.getSize("sidebar").width
z: 1
anchors
{
top: topbar.top
bottom: parent.bottom
}
width: initialWidth
x: base.width - sidebar.width
source: UM.Controller.activeStage.sidebarComponent
NumberAnimation {
id: collapseSidebarAnimation
target: sidebar
properties: "x"
to: base.width
duration: 100
}
NumberAnimation {
id: expandSidebarAnimation
target: sidebar
properties: "x"
to: base.width - sidebar.width
duration: 100
}
Component.onCompleted:
{
var sidebarCollapsed = UM.Preferences.getValue("cura/sidebar_collapse");
if (sidebarCollapsed) {
sidebar.collapsed = true;
viewportRect = Qt.rect(0, 0, 1, 1.0)
collapseSidebarAnimation.start();
}
}
}
Loader
@ -418,6 +478,13 @@ UM.MainWindow
}
}
// Expand or collapse sidebar
Connections
{
target: Cura.Actions.expandSidebar
onTriggered: sidebar.callExpandOrCollapse()
}
UM.PreferencesDialog
{
id: preferences
@ -819,7 +886,7 @@ UM.MainWindow
Connections
{
target: Printer
target: CuraApplication
onShowMessageBox:
{
messageDialog.title = title
@ -865,7 +932,7 @@ UM.MainWindow
Connections
{
target: Printer
target: CuraApplication
onRequestAddPrinter:
{
addMachineDialog.visible = true

View file

@ -1,4 +1,4 @@
// Copyright (c) 2016 Ultimaker B.V.
// Copyright (c) 2017 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.2
@ -157,7 +157,7 @@ Menu
}
//: Model used to populate the brandModel
UM.InstanceContainersModel
Cura.MaterialsModel
{
id: materialsModel
filter: materialFilter()

View file

@ -32,4 +32,5 @@ Menu
MenuSeparator {}
MenuItem { action: Cura.Actions.homeCamera; }
MenuItem { action: Cura.Actions.expandSidebar; }
}

View file

@ -222,14 +222,19 @@ UM.ManagementPage
}
}
Component.onCompleted: {
addAdditionalComponents("machinesDetailPane")
}
Connections {
target: Printer
onAdditionalComponentsChanged:
{
if(areaId == "machinesDetailPane") {
for (var component in CuraApplication.additionalComponents["machinesDetailPane"]) {
CuraApplication.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
}
target: CuraApplication
onAdditionalComponentsChanged: addAdditionalComponents
}
function addAdditionalComponents (areaId) {
if(areaId == "machinesDetailPane") {
for (var component in CuraApplication.additionalComponents["machinesDetailPane"]) {
CuraApplication.additionalComponents["machinesDetailPane"][component].parent = additionalComponentsColumn
}
}
}

View file

@ -41,7 +41,7 @@ TabView
Tab
{
title: catalog.i18nc("@title","Information")
title: catalog.i18nc("@title", "Information")
anchors.margins: UM.Theme.getSize("default_margin").width

View file

@ -182,6 +182,7 @@ UM.ManagementPage
{
Cura.MachineManager.setActiveMaterial(material_id)
}
// TODO: this doesn't work because the source is a bit delayed
base.objectList.currentIndex = base.getIndexById(material_id);
}
},
@ -292,10 +293,16 @@ UM.ManagementPage
base_file = base.currentItem.id
}
var guid = Cura.ContainerManager.getContainerMetaDataEntry(base.currentItem.id, "GUID")
// remove base container first, it otherwise triggers loading the base file while removing other containers
var base_containers = Cura.ContainerManager.findInstanceContainers({"GUID": guid, "id": base_file, "base_file": base_file, "type": "material"})
for(var i in base_containers)
{
Cura.ContainerManager.removeContainer(base_containers[i]);
}
var containers = Cura.ContainerManager.findInstanceContainers({"GUID": guid, "base_file": base_file, "type": "material"})
for(var i in containers)
{
Cura.ContainerManager.removeContainer(containers[i])
Cura.ContainerManager.removeContainer(containers[i]);
}
if(base.objectList.currentIndex > 0)
{

View file

@ -12,11 +12,10 @@ Item {
id: base;
UM.I18nCatalog { id: catalog; name:"cura"}
property real progress: UM.Backend.progress;
property int backendState: UM.Backend.state;
property var backend: CuraApplication.getBackend();
property bool activity: CuraApplication.platformActivity;
property real progress: UM.Backend.progress
property int backendState: UM.Backend.state
property var backend: CuraApplication.getBackend()
property bool activity: CuraApplication.platformActivity
property alias buttonRowWidth: saveRow.width
@ -28,6 +27,10 @@ Item {
return catalog.i18nc("@label:PrintjobStatus", "Please load a 3D model");
}
if (base.backendState == "undefined") {
return ""
}
switch(base.backendState)
{
case 1:
@ -46,10 +49,12 @@ Item {
}
function sliceOrStopSlicing() {
if (backend != "undefined" && [1, 5].indexOf(UM.Backend.state) != -1) {
backend.forceSlice();
} else {
backend.stopSlicing();
if (base.backendState != "undefined" && backend !== "undefined") {
if ([1, 5].indexOf(base.backendState) != -1) {
backend.forceSlice();
} else {
backend.stopSlicing();
}
}
}
@ -81,7 +86,7 @@ Item {
height: parent.height
color: UM.Theme.getColor("progressbar_control")
radius: UM.Theme.getSize("progressbar_radius").width
visible: base.backendState == 2 ? true : false
visible: (base.backendState != "undefined" && base.backendState == 2) ? true : false
}
}
@ -131,14 +136,19 @@ Item {
spacing: UM.Theme.getSize("default_margin").width
}
Component.onCompleted: {
addAdditionalComponents("saveButton")
}
Connections {
target: Printer
onAdditionalComponentsChanged:
{
if(areaId == "saveButton") {
for (var component in CuraApplication.additionalComponents["saveButton"]) {
CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
}
target: CuraApplication
onAdditionalComponentsChanged: addAdditionalComponents
}
function addAdditionalComponents (areaId) {
if(areaId == "saveButton") {
for (var component in CuraApplication.additionalComponents["saveButton"]) {
CuraApplication.additionalComponents["saveButton"][component].parent = additionalComponentsRow
}
}
}
@ -157,12 +167,10 @@ Item {
Button {
id: prepareButton
tooltip: [1, 5].indexOf(UM.Backend.state) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process")
tooltip: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process")
// 1 = not started, 2 = Processing
enabled: (base.backendState == 1 || base.backendState == 2) && base.activity == true
visible: {
return !autoSlice && (base.backendState == 1 || base.backendState == 2) && base.activity == true;
}
enabled: base.backendState != "undefined" && (base.backendState == 1 || base.backendState == 2) && base.activity == true
visible: base.backendState != "undefined" && !autoSlice && (base.backendState == 1 || base.backendState == 2) && base.activity == true
property bool autoSlice
height: UM.Theme.getSize("save_button_save_to_button").height
@ -171,7 +179,7 @@ Item {
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
// 1 = not started, 5 = disabled
text: [1, 5].indexOf(UM.Backend.state) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel")
text: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel")
onClicked:
{
sliceOrStopSlicing();
@ -235,10 +243,8 @@ Item {
tooltip: UM.OutputDeviceManager.activeDeviceDescription;
// 3 = done, 5 = disabled
enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true
visible: {
return autoSlice || ((base.backendState == 3 || base.backendState == 5) && base.activity == true);
}
enabled: base.backendState != "undefined" && (base.backendState == 3 || base.backendState == 5) && base.activity == true
visible: base.backendState != "undefined" && autoSlice || ((base.backendState == 3 || base.backendState == 5) && base.activity == true)
property bool autoSlice
height: UM.Theme.getSize("save_button_save_to_button").height
@ -315,8 +321,8 @@ Item {
width: UM.Theme.getSize("save_button_save_to_button").height
height: UM.Theme.getSize("save_button_save_to_button").height
// 3 = Done, 5 = Disabled
enabled: (base.backendState == 3 || base.backendState == 5) && base.activity == true
visible: (devicesModel.deviceCount > 1) && (base.backendState == 3 || base.backendState == 5) && base.activity == true
enabled: base.backendState != "undefined" && (base.backendState == 3 || base.backendState == 5) && base.activity == true
visible: base.backendState != "undefined" && (devicesModel.deviceCount > 1) && (base.backendState == 3 || base.backendState == 5) && base.activity == true
style: ButtonStyle {

View file

@ -87,10 +87,77 @@ Rectangle
}
}
ToolButton
{
id: machineSelection
text: Cura.MachineManager.activeMachineName
width: base.width
height: UM.Theme.getSize("sidebar_header").height
tooltip: Cura.MachineManager.activeMachineName
anchors.top: base.top
//anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
style: ButtonStyle
{
background: Rectangle
{
color:
{
if(control.pressed)
{
return UM.Theme.getColor("sidebar_header_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("sidebar_header_hover");
}
else
{
return UM.Theme.getColor("sidebar_header_bar");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
UM.RecolorImage
{
id: downArrow
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width
sourceSize.height: width
color: UM.Theme.getColor("text_emphasis")
source: UM.Theme.getIcon("arrow_bottom")
}
Label
{
id: sidebarComboBoxLabel
color: UM.Theme.getColor("sidebar_header_text_active")
text: control.text;
elide: Text.ElideRight;
anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2
anchors.right: downArrow.left;
anchors.rightMargin: control.rightMargin;
anchors.verticalCenter: parent.verticalCenter;
font: UM.Theme.getFont("large")
}
}
label: Label {}
}
menu: PrinterMenu { }
}
SidebarHeader {
id: header
width: parent.width
visible: machineExtruderCount.properties.value > 1 || Cura.MachineManager.hasMaterials || Cura.MachineManager.hasVariants
anchors.top: machineSelection.bottom
onShowTooltip: base.showTooltip(item, location, text)
onHideTooltip: base.hideTooltip()
@ -549,7 +616,6 @@ Rectangle
visible: monitoringPrint
}
SidebarTooltip
{
id: tooltip;

View file

@ -21,6 +21,22 @@ Rectangle
property bool printerConnected: Cura.MachineManager.printerOutputDevices.length != 0
property bool printerAcceptsCommands: printerConnected && Cura.MachineManager.printerOutputDevices[0].acceptsCommands
property int rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width;
property int allItemsWidth: 0;
function updateMarginsAndSizes() {
if (UM.Preferences.getValue("cura/sidebar_collapse")) {
rightMargin = UM.Theme.getSize("default_margin").width;
} else {
rightMargin = UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width;
}
allItemsWidth = (
logo.width + UM.Theme.getSize("topbar_logo_right_margin").width +
UM.Theme.getSize("topbar_logo_right_margin").width + stagesMenuContainer.width +
UM.Theme.getSize("default_margin").width + viewModeButton.width +
rightMargin);
}
UM.I18nCatalog
{
id: catalog
@ -44,10 +60,9 @@ Rectangle
Row
{
id: stagesMenuContainer
anchors.left: logo.right
anchors.leftMargin: UM.Theme.getSize("topbar_logo_right_margin").width
anchors.right: machineSelection.left
anchors.rightMargin: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("default_margin").width
// The topbar is dynamically filled with all available stages
@ -76,71 +91,6 @@ Rectangle
ExclusiveGroup { id: topbarMenuGroup }
}
ToolButton
{
id: machineSelection
text: Cura.MachineManager.activeMachineName
width: UM.Theme.getSize("sidebar").width
height: UM.Theme.getSize("sidebar_header").height
tooltip: Cura.MachineManager.activeMachineName
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
style: ButtonStyle
{
background: Rectangle
{
color:
{
if(control.pressed)
{
return UM.Theme.getColor("sidebar_header_active");
}
else if(control.hovered)
{
return UM.Theme.getColor("sidebar_header_hover");
}
else
{
return UM.Theme.getColor("sidebar_header_bar");
}
}
Behavior on color { ColorAnimation { duration: 50; } }
UM.RecolorImage
{
id: downArrow
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width
width: UM.Theme.getSize("standard_arrow").width
height: UM.Theme.getSize("standard_arrow").height
sourceSize.width: width
sourceSize.height: width
color: UM.Theme.getColor("text_emphasis")
source: UM.Theme.getIcon("arrow_bottom")
}
Label
{
id: sidebarComboBoxLabel
color: UM.Theme.getColor("sidebar_header_text_active")
text: control.text;
elide: Text.ElideRight;
anchors.left: parent.left;
anchors.leftMargin: UM.Theme.getSize("default_margin").width * 2
anchors.right: downArrow.left;
anchors.rightMargin: control.rightMargin;
anchors.verticalCenter: parent.verticalCenter;
font: UM.Theme.getFont("large")
}
}
label: Label {}
}
menu: PrinterMenu { }
}
// View orientation Item
Row
{
@ -153,8 +103,8 @@ Rectangle
anchors
{
verticalCenter: base.verticalCenter
right: viewModeButton.right
rightMargin: UM.Theme.getSize("default_margin").width + viewModeButton.width
right: viewModeButton.left
rightMargin: UM.Theme.getSize("default_margin").width
}
// #1 3d view
@ -166,7 +116,7 @@ Rectangle
onClicked:{
UM.Controller.rotateView("3d", 0);
}
visible: base.width > 1100
visible: base.width - allItemsWidth - 4 * this.width > 0;
}
// #2 Front view
@ -178,7 +128,7 @@ Rectangle
onClicked:{
UM.Controller.rotateView("home", 0);
}
visible: base.width > 1130
visible: base.width - allItemsWidth - 3 * this.width > 0;
}
// #3 Top view
@ -190,7 +140,7 @@ Rectangle
onClicked:{
UM.Controller.rotateView("y", 90);
}
visible: base.width > 1160
visible: base.width - allItemsWidth - 2 * this.width > 0;
}
// #4 Left view
@ -202,7 +152,7 @@ Rectangle
onClicked:{
UM.Controller.rotateView("x", 90);
}
visible: base.width > 1190
visible: base.width - allItemsWidth - 1 * this.width > 0;
}
// #5 Left view
@ -214,7 +164,7 @@ Rectangle
onClicked:{
UM.Controller.rotateView("x", -90);
}
visible: base.width > 1210
visible: base.width - allItemsWidth > 0;
}
}
@ -225,7 +175,7 @@ Rectangle
anchors {
verticalCenter: parent.verticalCenter
right: parent.right
rightMargin: UM.Theme.getSize("sidebar").width + UM.Theme.getSize("default_margin").width
rightMargin: rightMargin
}
style: UM.Theme.styles.combobox
@ -285,4 +235,16 @@ Rectangle
source: UM.ActiveView.valid ? UM.ActiveView.activeViewPanel : "";
}
// Expand or collapse sidebar
Connections
{
target: Cura.Actions.expandSidebar
onTriggered: updateMarginsAndSizes()
}
Component.onCompleted:
{
updateMarginsAndSizes();
}
}