Merge branch 'main' into master

This commit is contained in:
ThatGuyZim 2023-07-19 17:23:48 +08:00 committed by GitHub
commit 0036ffb3ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 67 additions and 165 deletions

View File

@ -28,6 +28,6 @@ This fixes... OR This improves... -->
<!-- Check if relevant -->
- [ ] My code follows the style guidelines of this project as described in [UltiMaker Meta](https://github.com/Ultimaker/Meta) and [Cura QML best practices](https://github.com/Ultimaker/Cura/wiki/QML-Best-Practices)
- [ ] I have read the [Contribution guide](https://github.com/Ultimaker/Cura/blob/main/contributing.md)
- [ ] I have read the [Contribution guide](https://github.com/Ultimaker/Cura/blob/main/CONTRIBUTING.md)
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have uploaded any files required to test this change
- [ ] I have uploaded any files required to test this change

View File

@ -22,7 +22,7 @@ except ImportError:
from PyQt6.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QUrl
from PyQt6.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit, QGroupBox, QCheckBox, QPushButton
from PyQt6.QtGui import QDesktopServices
from PyQt6.QtGui import QDesktopServices, QTextCursor
from UM.Application import Application
from UM.Logger import Logger
@ -309,7 +309,7 @@ class CrashHandler:
trace = "".join(trace_list)
text_area.setText(trace)
text_area.setReadOnly(True)
text_area.moveCursor(QTextCursor.MoveOperation.End) # Move cursor to end, so we see last bit of the exception
layout.addWidget(text_area)
group.setLayout(layout)
@ -400,7 +400,7 @@ class CrashHandler:
text_area.setText(logdata)
text_area.setReadOnly(True)
text_area.moveCursor(QTextCursor.MoveOperation.End) # Move cursor to end, so we see last bit of the log
layout.addWidget(text_area)
group.setLayout(layout)

View File

@ -5,6 +5,7 @@ import os
import sys
import tempfile
import time
import platform
from typing import cast, TYPE_CHECKING, Optional, Callable, List, Any, Dict
import numpy
@ -828,6 +829,8 @@ class CuraApplication(QtApplication):
def run(self):
super().run()
self._log_hardware_info()
if len(ApplicationMetadata.DEPENDENCY_INFO) > 0:
Logger.debug("Using Conan managed dependencies: " + ", ".join(
[dep["recipe"]["id"] for dep in ApplicationMetadata.DEPENDENCY_INFO["installed"] if dep["recipe"]["version"] != "latest"]))
@ -901,6 +904,14 @@ class CuraApplication(QtApplication):
self.exec()
def _log_hardware_info(self):
hardware_info = platform.uname()
Logger.info(f"System: {hardware_info.system}")
Logger.info(f"Release: {hardware_info.release}")
Logger.info(f"Version: {hardware_info.version}")
Logger.info(f"Processor name: {hardware_info.processor}")
Logger.info(f"CPU Cores: {os.cpu_count()}")
def __setUpSingleInstanceServer(self):
if self._use_single_instance:
self._single_instance.startServer()

View File

@ -21,7 +21,7 @@ class AutoDetectBaudJob(Job):
self._all_baud_rates = [115200, 250000, 500000, 230400, 76800, 57600, 38400, 19200, 9600]
def run(self) -> None:
Logger.log("d", "Auto detect baud rate started.")
Logger.debug(f"Auto detect baud rate started for {self._serial_port}")
wait_response_timeouts = [3, 15, 30]
wait_bootloader_times = [1.5, 5, 15]
write_timeout = 3
@ -46,8 +46,7 @@ class AutoDetectBaudJob(Job):
wait_bootloader = wait_bootloader_times[retry]
else:
wait_bootloader = wait_bootloader_times[-1]
Logger.log("d", "Checking {serial} if baud rate {baud_rate} works. Retry nr: {retry}. Wait timeout: {timeout}".format(
serial = self._serial_port, baud_rate = baud_rate, retry = retry, timeout = wait_response_timeout))
Logger.debug(f"Checking {self._serial_port} if baud rate {baud_rate} works. Retry nr: {retry}. Wait timeout: {wait_response_timeout}")
if serial is None:
try:
@ -61,7 +60,9 @@ class AutoDetectBaudJob(Job):
serial.baudrate = baud_rate
except ValueError:
continue
sleep(wait_bootloader) # Ensure that we are not talking to the boot loader. 1.5 seconds seems to be the magic number
# Ensure that we are not talking to the boot loader. 1.5 seconds seems to be the magic number
sleep(wait_bootloader)
serial.write(b"\n") # Ensure we clear out previous responses
serial.write(b"M105\n")
@ -83,4 +84,5 @@ class AutoDetectBaudJob(Job):
serial.write(b"M105\n")
sleep(15) # Give the printer some time to init and try again.
Logger.debug(f"Unable to find a working baudrate for {serial}")
self.setResult(None) # Unable to detect the correct baudrate.

View File

@ -1,152 +0,0 @@
// Copyright (c) 2022 UltiMaker
// Cura is released under the terms of the LGPLv3 or higher.
import QtQuick 2.15
import QtQuick.Controls 2.2
import QtQuick.Window 2.1
import QtQuick.Layouts 1.1
import UM 1.7 as UM
import Cura 1.7 as Cura
/*
* A dialog that provides the option to pick a color. Currently it only asks for a hex code and shows the color
* in a color swath
*/
UM.Dialog
{
id: base
property variant catalog: UM.I18nCatalog { name: "cura" }
margin: UM.Theme.getSize("default_margin").width
property alias swatchGridColumns: colorSwatchGrid.columns
// In this case we would like to let the content of the dialog determine the size of the dialog
// however with the current implementation of the dialog this is not possible, so instead we calculate
// the size of the dialog ourselves.
// Ugly workaround for windows having overlapping elements due to incorrect dialog width
minimumWidth: content.width + (Qt.platform.os === "windows" ? 4 * margin : 2 * margin)
minimumHeight: {
const footerHeight = Math.max(okButton.height, cancelButton.height);
return content.height + footerHeight + (Qt.platform.os === "windows" ? 5 * margin : 3 * margin);
}
property alias color: colorInput.text
property var swatchColors: [
"#2161AF", "#57AFB2", "#F7B32D", "#E33D4A", "#C088AD",
"#5D88BE", "#5ABD0E", "#E17239", "#F74E46", "#874AF9",
"#50C2EC", "#8DC15A", "#C3977A", "#CD7776", "#9086BA",
"#FFFFFF", "#D3D3D3", "#9E9E9E", "#5A5A5A", "#000000",
]
Component.onCompleted: updateSwatches()
onSwatchColorsChanged: updateSwatches()
function updateSwatches()
{
swatchColorsModel.clear();
for (const swatchColor of base.swatchColors)
{
swatchColorsModel.append({ swatchColor });
}
}
Column
{
id: content
width: childrenRect.width
height: childrenRect.height
spacing: UM.Theme.getSize("wide_margin").height
GridLayout {
id: colorSwatchGrid
columns: 5
width: childrenRect.width
height: childrenRect.height
columnSpacing: UM.Theme.getSize("thick_margin").width
rowSpacing: UM.Theme.getSize("thick_margin").height
Repeater
{
model: ListModel
{
id: swatchColorsModel
}
delegate: Rectangle
{
color: swatchColor
implicitWidth: UM.Theme.getSize("medium_button_icon").width
implicitHeight: UM.Theme.getSize("medium_button_icon").height
radius: width / 2
UM.ColorImage
{
anchors.fill: parent
visible: swatchColor == base.color
source: UM.Theme.getIcon("Check", "low")
color: UM.Theme.getColor("checkbox")
}
MouseArea
{
anchors.fill: parent
onClicked: base.color = swatchColor
}
}
}
}
RowLayout
{
width: parent.width
spacing: UM.Theme.getSize("default_margin").width
UM.Label
{
text: catalog.i18nc("@label", "Hex")
}
Cura.TextField
{
id: colorInput
Layout.fillWidth: true
text: "#FFFFFF"
selectByMouse: true
onTextChanged: {
if (!text.startsWith("#"))
{
text = `#${text}`;
}
}
validator: UM.HexColorValidator {}
}
Rectangle
{
color: base.color
Layout.preferredHeight: parent.height
Layout.preferredWidth: height
}
}
}
buttonSpacing: UM.Theme.getSize("thin_margin").width
rightButtons:
[
Cura.TertiaryButton {
id: cancelButton
text: catalog.i18nc("@action:button", "Cancel")
onClicked: base.close()
},
Cura.PrimaryButton {
id: okButton
text: catalog.i18nc("@action:button", "OK")
onClicked: base.accept()
}
]
}

View File

@ -430,11 +430,51 @@ UM.Window
{
id: refreshListButton
Layout.alignment: Qt.AlignVCenter
readonly property int _AccountSyncState_SYNCING: 0
visible: Cura.API.account.syncState != _AccountSyncState_SYNCING
enabled: visible
text: catalog.i18nc("@button", "Refresh List")
iconSource: UM.Theme.getIcon("ArrowDoubleCircleRight")
onClicked: Cura.API.account.sync(true)
}
Item
{
width: childrenRect.width
Layout.alignment: Qt.AlignVCenter
height: refreshListButton.height
visible: !refreshListButton.visible
UM.ColorImage
{
id: refreshingIcon
height: UM.Theme.getSize("action_button_icon").height
width: height
anchors.verticalCenter: refreshingLabel.verticalCenter
source: UM.Theme.getIcon("ArrowDoubleCircleRight")
color: UM.Theme.getColor("primary")
RotationAnimator
{
target: refreshingIcon
from: 0
to: 360
duration: 1000
loops: Animation.Infinite
running: true
}
}
UM.Label
{
id: refreshingLabel
anchors.left: refreshingIcon.right
anchors.leftMargin: UM.Theme.getSize("narrow_margin").width
text: catalog.i18nc("@button", "Refreshing...")
color: UM.Theme.getColor("primary")
font: UM.Theme.getFont("medium")
}
}
Cura.TertiaryButton
{
id: printerListTroubleshooting

View File

@ -256,12 +256,12 @@ Item
// popup dialog to select a new color
// if successful it sets the properties.color_code value to the new color
Cura.ColorDialog
ColorDialog
{
id: colorDialog
title: catalog.i18nc("@title", "Material color picker")
color: properties.color_code
onAccepted: base.setMetaDataEntry("color_code", properties.color_code, color)
selectedColor: properties.color_code
onAccepted: base.setMetaDataEntry("color_code", properties.color_code, selectedColor)
}
}
}

View File

@ -17,7 +17,7 @@ RecommendedSettingSection
enableSectionSwitchVisible: platformAdhesionType.properties.enabled === "True"
enableSectionSwitchChecked: platformAdhesionType.properties.value !== "skirt" && platformAdhesionType.properties.value !== "none"
enableSectionSwitchEnabled: recommendedPrintSetup.settingsEnabled
tooltipText: catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards.")
tooltipText: catalog.i18nc("@label", "Enable printing a brim or raft. This will add a flat area around or under your object which is easy to cut off afterwards. Disabling it results in a skirt around object by default.")
property var curaRecommendedMode: Cura.RecommendedMode {}

View File

@ -45,6 +45,7 @@ support_extruder_nr
support_type
support_angle
support_offset
support_structure
[platform_adhesion]
prime_blob_enable