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

This commit is contained in:
Jaime van Kessel 2018-12-13 16:33:46 +01:00
commit bd565bf4cf
5 changed files with 57 additions and 65 deletions

View File

@ -24,10 +24,6 @@ class CuraStage(Stage):
def mainComponent(self) -> QUrl: def mainComponent(self) -> QUrl:
return self.getDisplayComponent("main") return self.getDisplayComponent("main")
@pyqtProperty(QUrl, constant = True)
def sidebarComponent(self) -> QUrl:
return self.getDisplayComponent("sidebar")
@pyqtProperty(QUrl, constant = True) @pyqtProperty(QUrl, constant = True)
def stageMenuComponent(self) -> QUrl: def stageMenuComponent(self) -> QUrl:
return self.getDisplayComponent("menu") return self.getDisplayComponent("menu")

View File

@ -1,4 +1,4 @@
# Copyright (c) 2017 Ultimaker B.V. # Copyright (c) 2018 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher. # Cura is released under the terms of the LGPLv3 or higher.
import os.path import os.path
from UM.Application import Application from UM.Application import Application
@ -15,9 +15,5 @@ class PrepareStage(CuraStage):
Application.getInstance().engineCreatedSignal.connect(self._engineCreated) Application.getInstance().engineCreatedSignal.connect(self._engineCreated)
def _engineCreated(self): def _engineCreated(self):
sidebar_component_path = os.path.join(Resources.getPath(Application.getInstance().ResourceTypes.QmlFiles),
"PrepareSidebar.qml")
menu_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("PrepareStage"), "PrepareMenu.qml") menu_component_path = os.path.join(PluginRegistry.getInstance().getPluginPath("PrepareStage"), "PrepareMenu.qml")
self.addDisplayComponent("menu", menu_component_path) self.addDisplayComponent("menu", menu_component_path)
self.addDisplayComponent("sidebar", sidebar_component_path)

View File

@ -20,67 +20,60 @@ Item
name: "cura" name: "cura"
} }
// Item to ensure that all of the buttons are nicely centered. Row
Item
{ {
anchors.horizontalCenter: parent.horizontalCenter id: stageMenuRow
width: stageMenuRow.width anchors.centerIn: parent
height: parent.height height: parent.height
width: childrenRect.width
RowLayout // We want this row to have a preferred with equals to the 85% of the parent
property int preferredWidth: Math.round(0.85 * previewMenu.width)
Cura.ViewsSelector
{ {
id: stageMenuRow id: viewsSelector
width: Math.round(0.85 * previewMenu.width)
height: parent.height height: parent.height
spacing: 0 width: UM.Theme.getSize("views_selector").width
headerCornerSide: Cura.RoundedRectangle.Direction.Left
}
Cura.ViewsSelector // Separator line
{ Rectangle
id: viewsSelector {
headerCornerSide: Cura.RoundedRectangle.Direction.Left height: parent.height
Layout.minimumWidth: UM.Theme.getSize("views_selector").width // If there is no viewPanel, we only need a single spacer, so hide this one.
Layout.maximumWidth: UM.Theme.getSize("views_selector").width visible: viewPanel.source != ""
Layout.fillWidth: true width: visible ? UM.Theme.getSize("default_lining").width : 0
Layout.fillHeight: true
}
// Separator line color: UM.Theme.getColor("lining")
Rectangle }
{
height: parent.height
// If there is no viewPanel, we only need a single spacer, so hide this one.
visible: viewPanel.source != ""
width: UM.Theme.getSize("default_lining").width
color: UM.Theme.getColor("lining") // This component will grow freely up to complete the preferredWidth of the row.
} Loader
{
id: viewPanel
height: parent.height
width: source != "" ? (stageMenuRow.preferredWidth - viewsSelector.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width) : 0
source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : ""
}
Loader // Separator line
{ Rectangle
id: viewPanel {
Layout.fillHeight: true height: parent.height
Layout.fillWidth: true width: UM.Theme.getSize("default_lining").width
Layout.preferredWidth: stageMenuRow.width - viewsSelector.width - printSetupSelectorItem.width - 2 * UM.Theme.getSize("default_lining").width color: UM.Theme.getColor("lining")
source: UM.Controller.activeView != null && UM.Controller.activeView.stageMenuComponent != null ? UM.Controller.activeView.stageMenuComponent : "" }
}
// Separator line Item
Rectangle {
{ id: printSetupSelectorItem
height: parent.height // This is a work around to prevent the printSetupSelector from having to be re-loaded every time
width: UM.Theme.getSize("default_lining").width // a stage switch is done.
color: UM.Theme.getColor("lining") children: [printSetupSelector]
} height: childrenRect.height
width: childrenRect.width
Item
{
id: printSetupSelectorItem
// This is a work around to prevent the printSetupSelector from having to be re-loaded every time
// a stage switch is done.
children: [printSetupSelector]
height: childrenRect.height
width: childrenRect.width
}
} }
} }
} }

View File

@ -12,6 +12,12 @@ Item
{ {
id: widget id: widget
function requestWriteToDevice()
{
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName,
{ "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats });
}
Cura.PrimaryButton Cura.PrimaryButton
{ {
id: saveToButton id: saveToButton
@ -32,9 +38,8 @@ Item
onClicked: onClicked:
{ {
forceActiveFocus(); forceActiveFocus()
UM.OutputDeviceManager.requestWriteToDevice(UM.OutputDeviceManager.activeDevice, PrintInformation.jobName, widget.requestWriteToDevice()
{ "filter_by_machine": true, "preferred_mimetypes": Cura.MachineManager.activeMachine.preferred_output_file_formats });
} }
} }
@ -81,6 +86,7 @@ Item
delegate: Cura.ActionButton delegate: Cura.ActionButton
{ {
text: model.description text: model.description
visible: model.id != UM.OutputDeviceManager.activeDevice // Don't show the active device in the list
color: "transparent" color: "transparent"
cornerRadius: 0 cornerRadius: 0
hoverColor: UM.Theme.getColor("primary") hoverColor: UM.Theme.getColor("primary")
@ -88,6 +94,7 @@ Item
onClicked: onClicked:
{ {
UM.OutputDeviceManager.setActiveDevice(model.id) UM.OutputDeviceManager.setActiveDevice(model.id)
widget.requestWriteToDevice()
popup.close() popup.close()
} }
} }

View File

@ -255,8 +255,8 @@
"message_button_text": [255, 255, 255, 255], "message_button_text": [255, 255, 255, 255],
"message_button_text_hover": [255, 255, 255, 255], "message_button_text_hover": [255, 255, 255, 255],
"message_button_text_active": [255, 255, 255, 255], "message_button_text_active": [255, 255, 255, 255],
"message_progressbar_background": [200, 200, 200, 255], "message_progressbar_background": [245, 245, 245, 255],
"message_progressbar_control": [77, 182, 226, 255], "message_progressbar_control": [50, 130, 255, 255],
"tool_panel_background": [255, 255, 255, 255], "tool_panel_background": [255, 255, 255, 255],