Merge remote-tracking branch 'origin/4.0' into CURA-6011_connection_types

This commit is contained in:
Lipu Fei 2018-12-14 11:11:40 +01:00
commit a1ad7851d9
8 changed files with 56 additions and 28 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

@ -3385,7 +3385,7 @@
"retraction_combing": "retraction_combing":
{ {
"label": "Combing Mode", "label": "Combing Mode",
"description": "Combing keeps the nozzle within already printed areas when traveling. This results in slightly longer travel moves but reduces the need for retractions. If combing is off, the material will retract and the nozzle moves in a straight line to the next point. It is also possible to avoid combing over top/bottom skin areas and also to only comb within the infill. Note that the 'Within Infill' option behaves exactly like the 'Not in Skin' option in earlier Cura releases.", "description": "Combing keeps the nozzle within already printed areas when traveling. This results in slightly longer travel moves but reduces the need for retractions. If combing is off, the material will retract and the nozzle moves in a straight line to the next point. It is also possible to avoid combing over top/bottom skin areas or to only comb within the infill.",
"type": "enum", "type": "enum",
"options": "options":
{ {

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

@ -278,6 +278,14 @@ UM.MainWindow
height: UM.Theme.getSize("stage_menu").height height: UM.Theme.getSize("stage_menu").height
source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : "" source: UM.Controller.activeStage != null ? UM.Controller.activeStage.stageMenuComponent : ""
// HACK: This is to ensure that the parent never gets set to null, as this wreaks havoc on the focus.
function onParentDestroyed()
{
printSetupSelector.parent = stageMenu
printSetupSelector.visible = false
}
property Item oldParent: null
// The printSetupSelector is defined here so that the setting list doesn't need to get re-instantiated // The printSetupSelector is defined here so that the setting list doesn't need to get re-instantiated
// Every time the stage is changed. // Every time the stage is changed.
property var printSetupSelector: Cura.PrintSetupSelector property var printSetupSelector: Cura.PrintSetupSelector
@ -285,9 +293,18 @@ UM.MainWindow
width: UM.Theme.getSize("print_setup_widget").width width: UM.Theme.getSize("print_setup_widget").width
height: UM.Theme.getSize("stage_menu").height height: UM.Theme.getSize("stage_menu").height
headerCornerSide: RoundedRectangle.Direction.Right headerCornerSide: RoundedRectangle.Direction.Right
onParentChanged:
{
if(stageMenu.oldParent !=null)
{
stageMenu.oldParent.Component.destruction.disconnect(stageMenu.onParentDestroyed)
}
stageMenu.oldParent = parent
visible = parent != stageMenu
parent.Component.destruction.connect(stageMenu.onParentDestroyed)
}
} }
} }
UM.MessageStack UM.MessageStack
{ {
anchors anchors

View File

@ -54,16 +54,23 @@ Item
{ {
text: model.name.toUpperCase() text: model.name.toUpperCase()
checkable: true checkable: true
checked: model.active checked: UM.Controller.activeStage != null ? model.id == UM.Controller.activeStage.stageId : false
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
exclusiveGroup: mainWindowHeaderMenuGroup exclusiveGroup: mainWindowHeaderMenuGroup
style: UM.Theme.styles.main_window_header_tab style: UM.Theme.styles.main_window_header_tab
height: UM.Theme.getSize("main_window_header_button").height height: UM.Theme.getSize("main_window_header_button").height
onClicked: UM.Controller.setActiveStage(model.id)
iconSource: model.stage.iconSource iconSource: model.stage.iconSource
property color overlayColor: "transparent" property color overlayColor: "transparent"
property string overlayIconSource: "" property string overlayIconSource: ""
// This is a trick to assure the activeStage is correctly changed. It doesn't work propertly if done in the onClicked (see CURA-6028)
MouseArea
{
anchors.fill: parent
onClicked: UM.Controller.setActiveStage(model.id)
}
} }
} }

View File

@ -39,6 +39,7 @@ Item
{ {
target: Cura.QualityProfilesDropDownMenuModel target: Cura.QualityProfilesDropDownMenuModel
onItemsChanged: qualityModel.update() onItemsChanged: qualityModel.update()
onDataChanged: qualityModel.update()
} }
Connections { Connections {

View File

@ -14,24 +14,28 @@ Cura.ExpandablePopup
contentPadding: UM.Theme.getSize("default_lining").width contentPadding: UM.Theme.getSize("default_lining").width
contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft contentAlignment: Cura.ExpandablePopup.ContentAlignment.AlignLeft
property var viewModel: UM.ViewModel { } property var viewModel: UM.ViewModel
{
onDataChanged: updateActiveView()
}
property var activeView: property var activeView: null
function updateActiveView()
{ {
for (var i = 0; i < viewModel.count; i++) for (var index in viewModel.items)
{ {
if (viewModel.items[i].active) if (viewModel.items[index].active)
{ {
return viewModel.items[i] activeView = viewModel.items[index]
return
} }
} }
return null activeView = null
} }
Component.onCompleted: Component.onCompleted:
{ {
// Nothing was active, so just return the first one (the list is sorted by priority, so the most
// important one should be returned)
if (activeView == null) if (activeView == null)
{ {
UM.Controller.setActiveView(viewModel.getItem(0).id) UM.Controller.setActiveView(viewModel.getItem(0).id)