Merge remote-tracking branch 'origin/CURA-6057_fix_onboarding' into CURA-6447_fix_start_onboarding

This commit is contained in:
Lipu Fei 2019-04-09 11:31:42 +02:00
commit 738886b4fb
14 changed files with 216 additions and 136 deletions

View file

@ -1630,6 +1630,7 @@ class MachineManager(QObject):
return abbr_machine
@pyqtSlot(str, result = str)
def getMachineTypeNameFromId(self, machine_type_id: str) -> str:
machine_type_name = ""
results = self._container_registry.findDefinitionContainersMetadata(id = machine_type_id)

View file

@ -20,12 +20,12 @@ Item
anchors.right: parent.right
anchors.top: parent.top
property int labelWidth: 180
property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4
property int labelWidth: 210 * screenScaleFactor
property int controlWidth: (UM.Theme.getSize("setting_control").width * 3 / 4) | 0
property var labelFont: UM.Theme.getFont("medium")
property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2
property int columnSpacing: 3
property int columnWidth: ((parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2) | 0
property int columnSpacing: 3 * screenScaleFactor
property int propertyStoreIndex: manager.storeContainerIndex // definition_changes
property string extruderStackId: ""

View file

@ -20,12 +20,12 @@ Item
anchors.right: parent.right
anchors.top: parent.top
property int labelWidth: 130
property int controlWidth: UM.Theme.getSize("setting_control").width * 3 / 4
property int labelWidth: 120 * screenScaleFactor
property int controlWidth: (UM.Theme.getSize("setting_control").width * 3 / 4) | 0
property var labelFont: UM.Theme.getFont("default")
property int columnWidth: (parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2
property int columnSpacing: 3
property int columnWidth: ((parent.width - 2 * UM.Theme.getSize("default_margin").width) / 2) | 0
property int columnSpacing: 3 * screenScaleFactor
property int propertyStoreIndex: manager.storeContainerIndex // definition_changes
property string machineStackId: Cura.MachineManager.activeMachineId

View file

@ -1,150 +1,154 @@
// Copyright (c) 2018 Ultimaker B.V.
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.7
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Window 2.2
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4
import UM 1.3 as UM
import Cura 1.0 as Cura
import Cura 1.1 as Cura
UM.Dialog
Window
{
UM.I18nCatalog { id: catalog; name: "cura" }
id: baseDialog
title: catalog.i18nc("@title:window", "More information on anonymous data collection")
visible: false
modality: Qt.ApplicationModal
minimumWidth: 500 * screenScaleFactor
minimumHeight: 400 * screenScaleFactor
width: minimumWidth
height: minimumHeight
property bool allowSendData: true // for saving the user's choice
color: UM.Theme.getColor("main_background")
onAccepted: manager.setSendSliceInfo(allowSendData)
property bool allowSendData: true // for saving the user's choice
onVisibilityChanged:
{
if (visible)
{
baseDialog.allowSendData = UM.Preferences.getValue("info/send_slice_info");
baseDialog.allowSendData = UM.Preferences.getValue("info/send_slice_info")
if (baseDialog.allowSendData)
{
allowSendButton.checked = true;
allowSendButton.checked = true
}
else
{
dontSendButton.checked = true;
dontSendButton.checked = true
}
}
}
// Main content area
Item
{
id: textRow
anchors
{
top: parent.top
bottom: radioButtonsRow.top
bottomMargin: UM.Theme.getSize("default_margin").height
left: parent.left
right: parent.right
}
anchors.fill: parent
anchors.margins: UM.Theme.getSize("default_margin").width
Label
Item // Text part
{
id: headerText
id: textRow
anchors
{
top: parent.top
left: parent.left
right: parent.right
}
text: catalog.i18nc("@text:window", "Cura sends anonymous data to Ultimaker in order to improve the print quality and user experience. Below is an example of all the data that is sent.")
wrapMode: Text.WordWrap
}
TextArea
{
id: exampleData
anchors
{
top: headerText.bottom
topMargin: UM.Theme.getSize("default_margin").height
bottom: parent.bottom
bottom: radioButtonsRow.top
bottomMargin: UM.Theme.getSize("default_margin").height
left: parent.left
right: parent.right
}
text: manager.getExampleData()
readOnly: true
textFormat: TextEdit.PlainText
}
}
Column
{
id: radioButtonsRow
width: parent.width
anchors.bottom: buttonRow.top
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
ExclusiveGroup { id: group }
RadioButton
{
id: dontSendButton
text: catalog.i18nc("@text:window", "I don't want to send this data")
exclusiveGroup: group
onClicked:
Label
{
baseDialog.allowSendData = !checked;
id: headerText
anchors
{
top: parent.top
left: parent.left
right: parent.right
}
text: catalog.i18nc("@text:window", "Cura sends anonymous data to Ultimaker in order to improve the print quality and user experience. Below is an example of all the data that is sent.")
wrapMode: Text.WordWrap
renderType: Text.NativeRendering
}
}
RadioButton
{
id: allowSendButton
text: catalog.i18nc("@text:window", "Allow sending this data to Ultimaker and help us improve Cura")
exclusiveGroup: group
onClicked:
Cura.ScrollableTextArea
{
baseDialog.allowSendData = checked;
}
}
}
anchors
{
top: headerText.bottom
topMargin: UM.Theme.getSize("default_margin").height
bottom: parent.bottom
bottomMargin: UM.Theme.getSize("default_margin").height
left: parent.left
right: parent.right
}
Item
{
id: buttonRow
anchors.bottom: parent.bottom
width: parent.width
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
UM.I18nCatalog { id: catalog; name: "cura" }
Button
{
anchors.right: parent.right
text: catalog.i18nc("@action:button", "OK")
onClicked:
{
baseDialog.accepted()
baseDialog.hide()
textArea.text: manager.getExampleData()
textArea.readOnly: true
}
}
Button
Column // Radio buttons for agree and disagree
{
id: radioButtonsRow
anchors.left: parent.left
text: catalog.i18nc("@action:button", "Cancel")
onClicked:
anchors.right: parent.right
anchors.bottom: buttonRow.top
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
Cura.RadioButton
{
baseDialog.rejected()
baseDialog.hide()
id: dontSendButton
text: catalog.i18nc("@text:window", "I don't want to send this data")
onClicked:
{
baseDialog.allowSendData = !checked
}
}
Cura.RadioButton
{
id: allowSendButton
text: catalog.i18nc("@text:window", "Allow sending this data to Ultimaker and help us improve Cura")
onClicked:
{
baseDialog.allowSendData = checked
}
}
}
Item // Bottom buttons
{
id: buttonRow
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
height: childrenRect.height
Cura.PrimaryButton
{
anchors.right: parent.right
text: catalog.i18nc("@action:button", "OK")
onClicked:
{
manager.setSendSliceInfo(allowSendData)
baseDialog.hide()
}
}
Cura.SecondaryButton
{
anchors.left: parent.left
text: catalog.i18nc("@action:button", "Cancel")
onClicked:
{
baseDialog.hide()
}
}
}
}

View file

@ -62,7 +62,7 @@ class SliceInfo(QObject, Extension):
def showMoreInfoDialog(self):
if self._more_info_dialog is None:
self._more_info_dialog = self._createDialog("MoreInfoWindow.qml")
self._more_info_dialog.open()
self._more_info_dialog.show()
def _createDialog(self, qml_name):
Logger.log("d", "Creating dialog [%s]", qml_name)

View file

@ -286,7 +286,7 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
self.refreshConnections()
def _checkManualDevice(self, address):
def _checkManualDevice(self, address: str) -> None:
# Check if a UM3 family device exists at this address.
# If a printer responds, it will replace the preliminary printer created above
# origin=manual is for tracking back the origin of the call
@ -307,7 +307,8 @@ class UM3OutputDevicePlugin(OutputDevicePlugin):
# - Something went wrong with checking the amount of printers the cluster has!
# - Couldn't find printer at the address when trying to add it manually.
if address in self._manual_instances:
self.removeManualDeviceSignal.emit(self.getPluginId(), "", address)
key = "manual:" + address
self.removeManualDevice(key, address)
return
if "system" in reply_url:

View file

@ -25,13 +25,17 @@ Button
property var outputDevice: null
property var printerTypesList: []
// Indicates if only to update the printer types list when this button is checked
property bool updatePrinterTypesOnlyWhenChecked: true
property var updatePrinterTypesFunction: updatePrinterTypesList
// This function converts the printer type string to another string.
property var printerTypeLabelConversionFunction: Cura.MachineManager.getAbbreviatedMachineName
function updatePrinterTypesList()
{
printerTypesList = (outputDevice != null) ? outputDevice.uniquePrinterTypes : []
var to_update = (updatePrinterTypesOnlyWhenChecked && checked) || !updatePrinterTypesOnlyWhenChecked
printerTypesList = (to_update && outputDevice != null) ? outputDevice.uniquePrinterTypes : []
}
contentItem: Item

View file

@ -97,6 +97,8 @@ Item
printerTypeLabelAutoFit: true
// update printer types for all items in the list
updatePrinterTypesOnlyWhenChecked: false
updatePrinterTypesFunction: updateMachineTypes
// show printer type as it is
printerTypeLabelConversionFunction: function(value) { return value }

View file

@ -69,16 +69,14 @@ Item
width: parent.width
anchors.top: explainLabel.bottom
TextField
Cura.TextField
{
id: hostnameField
width: (parent.width / 2) | 0
height: addPrinterButton.height
anchors.verticalCenter: addPrinterButton.verticalCenter
anchors.left: parent.left
height: addPrinterButton.height
anchors.right: addPrinterButton.left
anchors.margins: UM.Theme.getSize("default_margin").width
font: UM.Theme.getFont("default")
selectByMouse: true
validator: RegExpValidator
{
@ -89,11 +87,11 @@ Item
onAccepted: addPrinterButton.clicked()
}
Cura.PrimaryButton
Cura.SecondaryButton
{
id: addPrinterButton
anchors.top: parent.top
anchors.right: parent.right
anchors.left: hostnameField.right
anchors.margins: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@button", "Add")
@ -198,7 +196,10 @@ Item
{
if (UM.OutputDeviceManager.hasManualDevice)
{
typeText.text = UM.OutputDeviceManager.manualDeviceProperty("printer_type")
const type_id = UM.OutputDeviceManager.manualDeviceProperty("printer_type")
var readable_type = Cura.MachineManager.getMachineTypeNameFromId(type_id)
readable_type = (readable_type != "") ? readable_type : catalog.i18nc("@label", "Unknown")
typeText.text = readable_type
firmwareText.text = UM.OutputDeviceManager.manualDeviceProperty("firmware_version")
addressText.text = UM.OutputDeviceManager.manualDeviceProperty("address")
}
@ -240,7 +241,7 @@ Item
id: backButton
anchors.left: parent.left
anchors.bottom: parent.bottom
text: catalog.i18nc("@button", "Cancel")
text: catalog.i18nc("@button", "Back")
onClicked: base.showPreviousPage()
}

View file

@ -70,7 +70,6 @@ Item
onClicked:
{
CuraApplication.writeToLog("i", "User declined the User Agreement.")
base.endWizard()
CuraApplication.closeApplication() // NOTE: Hard exit, don't use if anything needs to be saved!
}
}

View file

@ -27,8 +27,10 @@ Item
renderType: Text.NativeRendering
}
Rectangle
Cura.ScrollableTextArea
{
id: whatsNewTextArea
anchors.top: titleLabel.bottom
anchors.bottom: getStartedButton.top
anchors.topMargin: UM.Theme.getSize("wide_margin").height
@ -36,27 +38,12 @@ Item
anchors.left: parent.left
anchors.right: parent.right
border.color: "#dfdfdf"
border.width: UM.Theme.getSize("default_lining").width
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollView
{
anchors.fill: parent
anchors.margins: UM.Theme.getSize("default_lining").width
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
TextArea
{
id: whatsNewTextArea
text: CuraApplication.getTextManager().getChangeLogText()
textFormat: Text.RichText
wrapMode: Text.WordWrap
readOnly: true
font: UM.Theme.getFont("default")
renderType: Text.NativeRendering
}
}
textArea.text: CuraApplication.getTextManager().getChangeLogText()
textArea.textFormat: Text.RichText
textArea.wrapMode: Text.WordWrap
textArea.readOnly: true
}
Cura.PrimaryButton

View file

@ -0,0 +1,32 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import UM 1.3 as UM
import Cura 1.1 as Cura
//
// Cura-style TextArea with scrolls
//
ScrollView
{
property alias textArea: _textArea
TextArea
{
id: _textArea
font: UM.Theme.getFont("default")
textFormat: TextEdit.PlainText
renderType: Text.NativeRendering
selectByMouse: true
background: Rectangle // Border
{
border.color: UM.Theme.getColor("lining")
border.width: UM.Theme.getSize("default_lining").width
}
}
}

View file

@ -0,0 +1,47 @@
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.10
import QtQuick.Controls 2.3
import UM 1.3 as UM
import Cura 1.1 as Cura
//
// Cura-style TextField
//
TextField
{
id: textField
UM.I18nCatalog { id: catalog; name: "cura" }
property int controlWidth: UM.Theme.getSize("setting_control").width
property int controlHeight: UM.Theme.getSize("setting_control").height
hoverEnabled: true
selectByMouse: true
font: UM.Theme.getFont("default")
renderType: Text.NativeRendering
background: Rectangle
{
anchors.fill: parent
anchors.margins: Math.round(UM.Theme.getSize("default_lining").width)
radius: UM.Theme.getSize("setting_control_radius").width
border.color:
{
if (!textField.enabled)
{
return UM.Theme.getColor("setting_control_disabled_border")
}
if (textField.hovered || textField.activeFocus)
{
return UM.Theme.getColor("setting_control_border_highlight")
}
return UM.Theme.getColor("setting_control_border")
}
}
}

View file

@ -25,7 +25,9 @@ CheckBox 1.0 CheckBox.qml
ComboBox 1.0 ComboBox.qml
NotificationIcon 1.0 NotificationIcon.qml
RadioButton 1.0 RadioButton.qml
Scrollable 1.0 Scrollable.qml
TabButton 1.0 TabButton.qml
TextField 1.0 TextField.qml
# Cura/MachineSettings