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

This commit is contained in:
Jaime van Kessel 2018-12-13 19:40:51 +01:00
commit 9d929b90c3
13 changed files with 126 additions and 179 deletions

View File

@ -44,7 +44,7 @@ class Account(QObject):
OAUTH_SERVER_URL= self._oauth_root, OAUTH_SERVER_URL= self._oauth_root,
CALLBACK_PORT=self._callback_port, CALLBACK_PORT=self._callback_port,
CALLBACK_URL="http://localhost:{}/callback".format(self._callback_port), CALLBACK_URL="http://localhost:{}/callback".format(self._callback_port),
CLIENT_ID="um---------------ultimaker_cura_drive_plugin", CLIENT_ID="um----------------------------ultimaker_cura",
CLIENT_SCOPES="account.user.read drive.backup.read drive.backup.write packages.download packages.rating.read packages.rating.write", CLIENT_SCOPES="account.user.read drive.backup.read drive.backup.write packages.download packages.rating.read packages.rating.write",
AUTH_DATA_PREFERENCE_KEY="general/ultimaker_auth_data", AUTH_DATA_PREFERENCE_KEY="general/ultimaker_auth_data",
AUTH_SUCCESS_REDIRECT="{}/app/auth-success".format(self._oauth_root), AUTH_SUCCESS_REDIRECT="{}/app/auth-success".format(self._oauth_root),

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

@ -2,21 +2,23 @@
// Toolbox is released under the terms of the LGPLv3 or higher. // Toolbox is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 1.4 import QtQuick.Controls 2.3
import QtQuick.Controls.Styles 1.4
import UM 1.1 as UM import UM 1.1 as UM
import Cura 1.0 as Cura
Item Item
{ {
id: footer id: footer
width: parent.width width: parent.width
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
height: visible ? Math.floor(UM.Theme.getSize("toolbox_footer").height) : 0 height: visible ? UM.Theme.getSize("toolbox_footer").height : 0
Label Label
{ {
text: catalog.i18nc("@info", "You will need to restart Cura before changes in packages have effect.") text: catalog.i18nc("@info", "You will need to restart Cura before changes in packages have effect.")
color: UM.Theme.getColor("text") color: UM.Theme.getColor("text")
height: Math.floor(UM.Theme.getSize("toolbox_footer_button").height) height: UM.Theme.getSize("toolbox_footer_button").height
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
anchors anchors
{ {
@ -28,10 +30,10 @@ Item
} }
renderType: Text.NativeRendering renderType: Text.NativeRendering
} }
Button
Cura.PrimaryButton
{ {
id: restartButton id: restartButton
text: catalog.i18nc("@info:button", "Quit Cura")
anchors anchors
{ {
top: parent.top top: parent.top
@ -39,27 +41,11 @@ Item
right: parent.right right: parent.right
rightMargin: UM.Theme.getSize("wide_margin").width rightMargin: UM.Theme.getSize("wide_margin").width
} }
iconName: "dialog-restart" height: UM.Theme.getSize("toolbox_footer_button").height
text: catalog.i18nc("@info:button", "Quit Cura")
onClicked: toolbox.restart() onClicked: toolbox.restart()
style: ButtonStyle
{
background: Rectangle
{
implicitWidth: UM.Theme.getSize("toolbox_footer_button").width
implicitHeight: Math.floor(UM.Theme.getSize("toolbox_footer_button").height)
color: control.hovered ? UM.Theme.getColor("primary_hover") : UM.Theme.getColor("primary")
}
label: Label
{
color: UM.Theme.getColor("button_text")
font: UM.Theme.getFont("default_bold")
text: control.text
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
renderType: Text.NativeRendering
}
}
} }
ToolboxShadow ToolboxShadow
{ {
visible: footer.visible visible: footer.visible

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
}
// 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,6 +293,11 @@ 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:
{
visible = parent != stageMenu
parent.Component.destruction.connect(stageMenu.onParentDestroyed)
}
} }
} }

View File

@ -54,16 +54,23 @@ Item
{ {
text: model.name.toUpperCase() text: model.name.toUpperCase()
checkable: true checkable: true
checked: model.active checked: model.id == UM.Controller.activeStage.stageId
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
property var activeView:
{ {
for (var i = 0; i < viewModel.count; i++) onDataChanged: updateActiveView()
}
property var activeView: null
function updateActiveView()
{
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)

View File

@ -177,8 +177,8 @@ QtObject
{ {
background: Item background: Item
{ {
implicitWidth: Theme.getSize("button").width; implicitWidth: Theme.getSize("button").width
implicitHeight: Theme.getSize("button").height; implicitHeight: Theme.getSize("button").height
UM.PointingRectangle UM.PointingRectangle
{ {
@ -205,20 +205,20 @@ QtObject
id: button_tip id: button_tip
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter; anchors.verticalCenter: parent.verticalCenter
text: control.text; text: control.text;
font: Theme.getFont("button_tooltip"); font: Theme.getFont("button_tooltip")
color: Theme.getColor("tooltip_text"); color: Theme.getColor("tooltip_text")
} }
} }
Rectangle Rectangle
{ {
id: buttonFace; id: buttonFace
anchors.fill: parent; anchors.fill: parent
property bool down: control.pressed || (control.checkable && control.checked); property bool down: control.pressed || (control.checkable && control.checked)
color: color:
{ {
@ -228,58 +228,22 @@ QtObject
} }
else if(control.checkable && control.checked && control.hovered) else if(control.checkable && control.checked && control.hovered)
{ {
return Theme.getColor("button_active_hover"); return Theme.getColor("toolbar_button_active_hover")
} }
else if(control.pressed || (control.checkable && control.checked)) else if(control.pressed || (control.checkable && control.checked))
{ {
return Theme.getColor("button_active"); return Theme.getColor("toolbar_button_active")
} }
else if(control.hovered) else if(control.hovered)
{ {
return Theme.getColor("button_hover"); return Theme.getColor("toolbar_button_hover")
}
else
{
return Theme.getColor("button");
} }
return Theme.getColor("toolbar_background")
} }
Behavior on color { ColorAnimation { duration: 50; } } Behavior on color { ColorAnimation { duration: 50; } }
border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? 2 * screenScaleFactor : 0 border.width: (control.hasOwnProperty("needBorder") && control.needBorder) ? Theme.getSize("default_lining").width : 0
border.color: Theme.getColor("tool_button_border") border.color: Theme.getColor("lining")
UM.RecolorImage
{
id: tool_button_arrow
anchors.right: parent.right;
anchors.rightMargin: Theme.getSize("button").width - Math.round(Theme.getSize("button_icon").width / 4)
anchors.bottom: parent.bottom;
anchors.bottomMargin: Theme.getSize("button").height - Math.round(Theme.getSize("button_icon").height / 4)
width: Theme.getSize("standard_arrow").width
height: Theme.getSize("standard_arrow").height
sourceSize.height: width
visible: control.menu != null;
color:
{
if(control.checkable && control.checked && control.hovered)
{
return Theme.getColor("button_text_active_hover");
}
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("button_text_active");
}
else if(control.hovered)
{
return Theme.getColor("button_text_hover");
}
else
{
return Theme.getColor("button_text");
}
}
source: Theme.getIcon("arrow_bottom")
}
} }
} }
@ -287,30 +251,12 @@ QtObject
{ {
UM.RecolorImage UM.RecolorImage
{ {
anchors.centerIn: parent; anchors.centerIn: parent
opacity: !control.enabled ? 0.2 : 1.0 opacity: control.enabled ? 1.0 : 0.2
source: control.iconSource; source: control.iconSource
width: Theme.getSize("button_icon").width; width: Theme.getSize("button_icon").width
height: Theme.getSize("button_icon").height; height: Theme.getSize("button_icon").height
color: color: Theme.getColor("toolbar_button_text")
{
if(control.checkable && control.checked && control.hovered)
{
return Theme.getColor("button_text_active_hover");
}
else if(control.pressed || (control.checkable && control.checked))
{
return Theme.getColor("button_text_active");
}
else if(control.hovered)
{
return Theme.getColor("button_text_hover");
}
else
{
return Theme.getColor("button_text");
}
}
sourceSize: Theme.getSize("button_icon") sourceSize: Theme.getSize("button_icon")
} }

View File

@ -243,8 +243,6 @@
"tooltip": [68, 192, 255, 255], "tooltip": [68, 192, 255, 255],
"tooltip_text": [255, 255, 255, 255], "tooltip_text": [255, 255, 255, 255],
"tool_button_border": [255, 255, 255, 0],
"message_background": [255, 255, 255, 255], "message_background": [255, 255, 255, 255],
"message_shadow": [0, 0, 0, 120], "message_shadow": [0, 0, 0, 120],
"message_border": [192, 193, 194, 255], "message_border": [192, 193, 194, 255],
@ -257,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],