Merge branch 'main' into CURA-10475_engineplugin

This commit is contained in:
Jelle Spijker 2023-09-05 07:05:57 +02:00
commit 43322ff249
No known key found for this signature in database
GPG key ID: 034D1C0527888B65
12 changed files with 117 additions and 95 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 381 KiB

After

Width:  |  Height:  |  Size: 417 KiB

Before After
Before After

View file

@ -40,7 +40,9 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
# Indicate that the 3mf mesh writer should not close the archive just yet (we still need to add stuff to it). # Indicate that the 3mf mesh writer should not close the archive just yet (we still need to add stuff to it).
mesh_writer.setStoreArchive(True) mesh_writer.setStoreArchive(True)
mesh_writer.write(stream, nodes, mode) if not mesh_writer.write(stream, nodes, mode):
self.setInformation(mesh_writer.getInformation())
return False
archive = mesh_writer.getArchive() archive = mesh_writer.getArchive()
if archive is None: # This happens if there was no mesh data to write. if archive is None: # This happens if there was no mesh data to write.
@ -98,7 +100,7 @@ class ThreeMFWorkspaceWriter(WorkspaceWriter):
Logger.error("No permission to write workspace to this stream.") Logger.error("No permission to write workspace to this stream.")
return False return False
except EnvironmentError as e: except EnvironmentError as e:
self.setInformation(catalog.i18nc("@error:zip", "The operating system does not allow saving a project file to this location or with this file name.")) self.setInformation(catalog.i18nc("@error:zip", str(e)))
Logger.error("EnvironmentError when writing workspace to this stream: {err}".format(err = str(e))) Logger.error("EnvironmentError when writing workspace to this stream: {err}".format(err = str(e)))
return False return False
mesh_writer.setStoreArchive(False) mesh_writer.setStoreArchive(False)

View file

@ -241,9 +241,9 @@ class ThreeMFWriter(MeshWriter):
archive.writestr(model_file, scene_string) archive.writestr(model_file, scene_string)
archive.writestr(content_types_file, b'<?xml version="1.0" encoding="UTF-8"?> \n' + ET.tostring(content_types)) archive.writestr(content_types_file, b'<?xml version="1.0" encoding="UTF-8"?> \n' + ET.tostring(content_types))
archive.writestr(relations_file, b'<?xml version="1.0" encoding="UTF-8"?> \n' + ET.tostring(relations_element)) archive.writestr(relations_file, b'<?xml version="1.0" encoding="UTF-8"?> \n' + ET.tostring(relations_element))
except Exception as e: except Exception as error:
Logger.logException("e", "Error writing zip file") Logger.logException("e", "Error writing zip file")
self.setInformation(catalog.i18nc("@error:zip", "Error writing 3mf file.")) self.setInformation(str(error))
return False return False
finally: finally:
if not self._store_archive: if not self._store_archive:

View file

@ -5514,7 +5514,9 @@
"unit": "mm", "unit": "mm",
"type": "float", "type": "float",
"default_value": 0.0, "default_value": 0.0,
"maximum_value": "extruderValue(support_extruder_nr, 'support_offset')", "maximum_value": "extruderValue(support_extruder_nr, 'support_offset') if support_structure == 'normal' else None",
"minimum_value_warning": "-1 * machine_nozzle_size",
"maximum_value_warning": "10 * machine_nozzle_size",
"limit_to_extruder": "support_interface_extruder_nr", "limit_to_extruder": "support_interface_extruder_nr",
"enabled": "support_interface_enable and (support_enable or support_meshes_present)", "enabled": "support_interface_enable and (support_enable or support_meshes_present)",
"settable_per_mesh": false, "settable_per_mesh": false,
@ -5529,7 +5531,9 @@
"type": "float", "type": "float",
"default_value": 0.0, "default_value": 0.0,
"value": "extruderValue(support_roof_extruder_nr, 'support_interface_offset')", "value": "extruderValue(support_roof_extruder_nr, 'support_interface_offset')",
"maximum_value": "extruderValue(support_extruder_nr, 'support_offset')", "maximum_value": "extruderValue(support_extruder_nr, 'support_offset') if support_structure == 'normal' else None",
"minimum_value_warning": "-1 * machine_nozzle_size",
"maximum_value_warning": "10 * machine_nozzle_size",
"limit_to_extruder": "support_roof_extruder_nr", "limit_to_extruder": "support_roof_extruder_nr",
"enabled": "support_roof_enable and (support_enable or support_meshes_present)", "enabled": "support_roof_enable and (support_enable or support_meshes_present)",
"settable_per_mesh": false, "settable_per_mesh": false,
@ -5543,7 +5547,9 @@
"type": "float", "type": "float",
"default_value": 0.0, "default_value": 0.0,
"value": "extruderValue(support_bottom_extruder_nr, 'support_interface_offset')", "value": "extruderValue(support_bottom_extruder_nr, 'support_interface_offset')",
"maximum_value": "extruderValue(support_extruder_nr, 'support_offset')", "maximum_value": "extruderValue(support_extruder_nr, 'support_offset') if support_structure == 'normal' else None",
"minimum_value_warning": "-1 * machine_nozzle_size",
"maximum_value_warning": "10 * machine_nozzle_size",
"limit_to_extruder": "support_bottom_extruder_nr", "limit_to_extruder": "support_bottom_extruder_nr",
"enabled": "support_bottom_enable and (support_enable or support_meshes_present)", "enabled": "support_bottom_enable and (support_enable or support_meshes_present)",
"settable_per_mesh": false, "settable_per_mesh": false,

View file

@ -822,12 +822,26 @@ UM.MainWindow
} }
} }
Cura.WizardDialog property var wizardDialog
Component
{ {
id: addMachineDialog id: addMachineDialogLoader
title: catalog.i18nc("@title:window", "Add Printer")
model: CuraApplication.getAddPrinterPagesModel() Cura.WizardDialog
progressBarVisible: false {
title: catalog.i18nc("@title:window", "Add Printer")
maximumWidth: Screen.width * 2
maximumHeight: Screen.height * 2
model: CuraApplication.getAddPrinterPagesModel()
progressBarVisible: false
onVisibleChanged:
{
if(!visible)
{
wizardDialog = null
}
}
}
} }
Cura.WizardDialog Cura.WizardDialog
@ -852,9 +866,8 @@ UM.MainWindow
target: Cura.Actions.addMachine target: Cura.Actions.addMachine
function onTriggered() function onTriggered()
{ {
// Make sure to show from the first page when the dialog shows up. wizardDialog = addMachineDialogLoader.createObject()
addMachineDialog.resetModelState() wizardDialog.show()
addMachineDialog.show()
} }
} }

View file

@ -55,6 +55,7 @@ UM.TooltipArea
} }
ScrollBar.vertical: UM.ScrollBar {} ScrollBar.vertical: UM.ScrollBar {}
clip: true
TextArea.flickable: TextArea TextArea.flickable: TextArea
{ {
@ -70,6 +71,7 @@ UM.TooltipArea
selectionColor: UM.Theme.getColor("text_selection") selectionColor: UM.Theme.getColor("text_selection")
selectedTextColor: UM.Theme.getColor("text") selectedTextColor: UM.Theme.getColor("text")
wrapMode: TextEdit.NoWrap wrapMode: TextEdit.NoWrap
padding: UM.Theme.getSize("narrow_margin").height + backgroundRectangle.border.width
onActiveFocusChanged: onActiveFocusChanged:
{ {
@ -81,8 +83,9 @@ UM.TooltipArea
background: Rectangle background: Rectangle
{ {
id: backgroundRectangle
anchors.fill: parent anchors.fill: parent
anchors.margins: -border.width //Wrap the border around the parent.
color: UM.Theme.getColor("detail_background") color: UM.Theme.getColor("detail_background")
border.color: border.color:

View file

@ -20,6 +20,7 @@ Item
width: childrenRect.width; width: childrenRect.width;
height: childrenRect.height; height: childrenRect.height;
id: checkboxTooltipArea id: checkboxTooltipArea
x: check.height
UM.CheckBox UM.CheckBox
{ {
id: check id: check
@ -40,7 +41,7 @@ Item
{ {
width: height width: height
height: check.height height: check.height
anchors.left: checkboxTooltipArea.right anchors.right: checkboxTooltipArea.left
anchors.leftMargin: 2 * screenScaleFactor anchors.leftMargin: 2 * screenScaleFactor
text: text:
@ -82,7 +83,7 @@ Item
source: UM.Theme.getIcon("Information") source: UM.Theme.getIcon("Information")
color: UM.Theme.getColor("primary_button_text") color: UM.Theme.getColor("small_button_text")
} }
visible: provider.properties.enabled == "False" visible: provider.properties.enabled == "False"

View file

@ -40,7 +40,7 @@ Item
Cura.TextField Cura.TextField
{ {
id: filter id: filter
height: parent.height implicitHeight: parent.height
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
topPadding: height / 4 topPadding: height / 4
@ -337,7 +337,7 @@ Item
} }
function onShowTooltip(text) { base.showTooltip(delegate, Qt.point(-settingsView.x - UM.Theme.getSize("default_margin").width, 0), text) } function onShowTooltip(text) { base.showTooltip(delegate, Qt.point(-settingsView.x - UM.Theme.getSize("default_margin").width, 0), text) }
function onHideTooltip() { base.hideTooltip() } function onHideTooltip() { base.hideTooltip() }
function onShowAllHiddenInheritedSettings() function onShowAllHiddenInheritedSettings(category_id)
{ {
var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(category_id) var children_with_override = Cura.SettingInheritanceManager.getChildrenKeysWithOverride(category_id)
for(var i = 0; i < children_with_override.length; i++) for(var i = 0; i < children_with_override.length; i++)

View file

@ -3,6 +3,7 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 2.3
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.1 as Cura import Cura 1.1 as Cura
@ -15,9 +16,7 @@ import Cura 1.1 as Cura
Item Item
{ {
id: base id: base
height: networkPrinterInfo.height + controlsRectangle.height
property alias maxItemCountAtOnce: networkPrinterListView.maxItemCountAtOnce
property var currentItem: (networkPrinterListView.currentIndex >= 0) property var currentItem: (networkPrinterListView.currentIndex >= 0)
? networkPrinterListView.model[networkPrinterListView.currentIndex] ? networkPrinterListView.model[networkPrinterListView.currentIndex]
: null : null
@ -29,35 +28,32 @@ Item
Item Item
{ {
id: networkPrinterInfo id: networkPrinterInfo
height: networkPrinterListView.visible ? networkPrinterListView.height : noPrinterLabel.height
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: separator.top
UM.Label UM.Label
{ {
id: noPrinterLabel id: noPrinterLabel
height: UM.Theme.getSize("setting_control").height + UM.Theme.getSize("default_margin").height height: UM.Theme.getSize("setting_control").height + UM.Theme.getSize("default_margin").height
anchors.left: parent.left anchors.fill: parent
anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.margins: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@label", "There is no printer found over your network.") text: catalog.i18nc("@label", "There is no printer found over your network.")
visible: networkPrinterListView.count == 0 // Do not show if there are discovered devices. visible: networkPrinterListView.count == 0 // Do not show if there are discovered devices.
verticalAlignment: Text.AlignTop
} }
ListView ListView
{ {
id: networkPrinterListView id: networkPrinterListView
anchors.top: parent.top anchors.fill: parent
anchors.left: parent.left
anchors.right: parent.right
height: Math.min(contentHeight, (maxItemCountAtOnce * UM.Theme.getSize("action_button").height) - UM.Theme.getSize("default_margin").height)
ScrollBar.vertical: UM.ScrollBar ScrollBar.vertical: UM.ScrollBar
{ {
id: networkPrinterScrollBar id: networkPrinterScrollBar
} }
clip: true clip: true
property int maxItemCountAtOnce: 8 // show at max 8 items at once, otherwise you need to scroll.
visible: networkPrinterListView.count > 0 visible: networkPrinterListView.count > 0
model: contentLoader.enabled ? CuraApplication.getDiscoveredPrintersModel().discoveredPrinters: undefined model: contentLoader.enabled ? CuraApplication.getDiscoveredPrintersModel().discoveredPrinters: undefined
@ -138,7 +134,7 @@ Item
{ {
id: separator id: separator
anchors.left: parent.left anchors.left: parent.left
anchors.top: networkPrinterInfo.bottom anchors.bottom: controlsRectangle.top
anchors.right: parent.right anchors.right: parent.right
height: UM.Theme.getSize("default_lining").height height: UM.Theme.getSize("default_lining").height
color: UM.Theme.getColor("lining") color: UM.Theme.getColor("lining")
@ -149,7 +145,7 @@ Item
id: controlsRectangle id: controlsRectangle
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.top: separator.bottom anchors.bottom: parent.bottom
height: UM.Theme.getSize("message_action_button").height + UM.Theme.getSize("default_margin").height height: UM.Theme.getSize("message_action_button").height + UM.Theme.getSize("default_margin").height

View file

@ -3,6 +3,7 @@
import QtQuick 2.10 import QtQuick 2.10
import QtQuick.Controls 2.3 import QtQuick.Controls 2.3
import QtQuick.Layouts 2.3
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.1 as Cura import Cura 1.1 as Cura
@ -17,79 +18,84 @@ Item
property var goToUltimakerPrinter property var goToUltimakerPrinter
DropDownWidget ColumnLayout
{ {
id: addNetworkPrinterDropDown
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: UM.Theme.getSize("wide_margin").height
anchors.bottom: backButton.top
anchors.bottomMargin: UM.Theme.getSize("default_margin").height
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
anchors.topMargin: UM.Theme.getSize("wide_margin").height
title: catalog.i18nc("@label", "Add a networked printer") spacing: UM.Theme.getSize("default_margin").height
contentShown: true // by default expand the network printer list
onClicked: DropDownWidget
{ {
addLocalPrinterDropDown.contentShown = !contentShown id: addNetworkPrinterDropDown
}
contentComponent: networkPrinterListComponent Layout.fillWidth: true
Component Layout.fillHeight: contentShown
{
id: networkPrinterListComponent title: catalog.i18nc("@label", "Add a networked printer")
AddNetworkPrinterScrollView contentShown: true // by default expand the network printer list
onClicked:
{ {
id: networkPrinterScrollView addLocalPrinterDropDown.contentShown = !contentShown
}
maxItemCountAtOnce: 9 // show at max 9 items at once, otherwise you need to scroll. contentComponent: networkPrinterListComponent
Component
onRefreshButtonClicked: {
id: networkPrinterListComponent
AddNetworkPrinterScrollView
{ {
UM.OutputDeviceManager.startDiscovery() id: networkPrinterScrollView
}
onAddByIpButtonClicked: onRefreshButtonClicked:
{
base.goToPage("add_printer_by_ip")
}
onAddCloudPrinterButtonClicked:
{
base.goToPage("add_cloud_printers")
if (!Cura.API.account.isLoggedIn)
{ {
Cura.API.account.login() UM.OutputDeviceManager.startDiscovery()
}
onAddByIpButtonClicked:
{
base.goToPage("add_printer_by_ip")
}
onAddCloudPrinterButtonClicked:
{
base.goToPage("add_cloud_printers")
if (!Cura.API.account.isLoggedIn)
{
Cura.API.account.login()
}
} }
} }
} }
} }
}
DropDownWidget DropDownWidget
{
id: addLocalPrinterDropDown
anchors.top: addNetworkPrinterDropDown.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.topMargin: UM.Theme.getSize("default_margin").height
title: catalog.i18nc("@label", "Add a non-networked printer")
onClicked:
{ {
addNetworkPrinterDropDown.contentShown = !contentShown id: addLocalPrinterDropDown
}
contentComponent: localPrinterListComponent Layout.fillWidth: true
Component Layout.fillHeight: contentShown
{
id: localPrinterListComponent title: catalog.i18nc("@label", "Add a non-networked printer")
AddLocalPrinterScrollView
onClicked:
{ {
id: localPrinterView addNetworkPrinterDropDown.contentShown = !contentShown
height: backButton.y - addLocalPrinterDropDown.y - UM.Theme.getSize("expandable_component_content_header").height - UM.Theme.getSize("default_margin").height }
contentComponent: localPrinterListComponent
Component
{
id: localPrinterListComponent
AddLocalPrinterScrollView
{
id: localPrinterView
}
} }
} }
} }

View file

@ -22,7 +22,7 @@ Item
id: base id: base
implicitWidth: 200 * screenScaleFactor implicitWidth: 200 * screenScaleFactor
height: header.contentShown ? (header.height + contentRectangle.height) : header.height implicitHeight: contentShown ? (header.height + contentRectangle.implicitHeight) : header.height
property var contentComponent: null property var contentComponent: null
property alias contentItem: contentLoader.item property alias contentItem: contentLoader.item
@ -56,12 +56,14 @@ Item
Cura.RoundedRectangle Cura.RoundedRectangle
{ {
id: contentRectangle id: contentRectangle
anchors.top: header.bottom
// Move up a bit (exactly the width of the border) to avoid double line // Move up a bit (exactly the width of the border) to avoid double line
y: header.height - UM.Theme.getSize("default_lining").width anchors.topMargin: -UM.Theme.getSize("default_lining").width
anchors.left: header.left anchors.left: header.left
anchors.right: header.right anchors.right: header.right
anchors.bottom: parent.bottom
// Add 2x lining, because it needs a bit of space on the top and the bottom. // Add 2x lining, because it needs a bit of space on the top and the bottom.
height: contentLoader.item ? contentLoader.item.height + 2 * UM.Theme.getSize("thick_lining").height : 0 anchors.bottomMargin: UM.Theme.getSize("thick_lining").height
border.width: UM.Theme.getSize("default_lining").width border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining") border.color: UM.Theme.getColor("lining")
@ -73,9 +75,7 @@ Item
Loader Loader
{ {
id: contentLoader id: contentLoader
anchors.top: parent.top anchors.fill: parent
anchors.left: parent.left
anchors.right: parent.right
// Keep a small margin with the Rectangle container so its content will not overlap with the Rectangle // Keep a small margin with the Rectangle container so its content will not overlap with the Rectangle
// border. // border.
anchors.margins: UM.Theme.getSize("default_lining").width anchors.margins: UM.Theme.getSize("default_lining").width

View file

@ -32,11 +32,6 @@ Window
property var model: null // Needs to be set by whoever is using this dialog. property var model: null // Needs to be set by whoever is using this dialog.
property alias progressBarVisible: wizardPanel.progressBarVisible property alias progressBarVisible: wizardPanel.progressBarVisible
function resetModelState()
{
model.resetState()
}
WizardPanel WizardPanel
{ {
id: wizardPanel id: wizardPanel