Merge branch 'master' into CURA-9005_restyle_print_setting_category

This commit is contained in:
Casper Lamboo 2022-03-11 13:43:33 +01:00 committed by GitHub
commit 60f7b2dccb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 92 additions and 46 deletions

View file

@ -1,4 +1,4 @@
# Copyright (c) 2021 Ultimaker B.V. # Copyright (c) 2022 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 math import math
@ -31,6 +31,8 @@ Position = NamedTuple("Position", [("x", float), ("y", float), ("z", float), ("f
class FlavorParser: class FlavorParser:
"""This parser is intended to interpret the common firmware codes among all the different flavors""" """This parser is intended to interpret the common firmware codes among all the different flavors"""
MAX_EXTRUDER_COUNT = 16
def __init__(self) -> None: def __init__(self) -> None:
CuraApplication.getInstance().hideMessageSignal.connect(self._onHideMessage) CuraApplication.getInstance().hideMessageSignal.connect(self._onHideMessage)
self._cancelled = False self._cancelled = False
@ -53,7 +55,7 @@ class FlavorParser:
def _clearValues(self) -> None: def _clearValues(self) -> None:
self._extruder_number = 0 self._extruder_number = 0
self._extrusion_length_offset = [0] * 8 # type: List[float] self._extrusion_length_offset = [0] * self.MAX_EXTRUDER_COUNT # type: List[float]
self._layer_type = LayerPolygon.Inset0Type self._layer_type = LayerPolygon.Inset0Type
self._layer_number = 0 self._layer_number = 0
self._previous_z = 0 # type: float self._previous_z = 0 # type: float
@ -355,7 +357,7 @@ class FlavorParser:
Logger.log("d", "Parsing g-code...") Logger.log("d", "Parsing g-code...")
current_position = Position(0, 0, 0, 0, [0] * 8) current_position = Position(0, 0, 0, 0, [0] * self.MAX_EXTRUDER_COUNT)
current_path = [] #type: List[List[float]] current_path = [] #type: List[List[float]]
min_layer_number = 0 min_layer_number = 0
negative_layers = 0 negative_layers = 0

View file

@ -31,8 +31,11 @@ class Marketplace(Extension, QObject):
# Not entirely the cleanest code, since the localPackage list also checks the server if there are updates # Not entirely the cleanest code, since the localPackage list also checks the server if there are updates
# Since that in turn will trigger notifications to be shown, we do need to construct it here and make sure # Since that in turn will trigger notifications to be shown, we do need to construct it here and make sure
# that it checks for updates... # that it checks for updates...
preferences = CuraApplication.getInstance().getPreferences()
preferences.addPreference("info/automatic_plugin_update_check", True)
self._local_package_list = LocalPackageList(self) self._local_package_list = LocalPackageList(self)
self._local_package_list.checkForUpdates(self._package_manager.local_packages) if preferences.getValue("info/automatic_plugin_update_check"):
self._local_package_list.checkForUpdates(self._package_manager.local_packages)
self._package_manager.installedPackagesChanged.connect(self.checkIfRestartNeeded) self._package_manager.installedPackagesChanged.connect(self.checkIfRestartNeeded)

View file

@ -24,7 +24,7 @@ Item
height: UM.Theme.getSize("card").height height: UM.Theme.getSize("card").height
// card icon // card icon
Image Item
{ {
id: packageItem id: packageItem
anchors anchors
@ -35,19 +35,36 @@ Item
} }
width: UM.Theme.getSize("card_icon").width width: UM.Theme.getSize("card_icon").width
height: width height: width
sourceSize.height: height
sourceSize.width: width property bool packageHasIcon: packageData.iconUrl != ""
source:
Image
{ {
if (packageData.iconUrl != "") visible: parent.packageHasIcon
anchors.fill: parent
source: packageData.iconUrl
sourceSize.height: height
sourceSize.width: width
}
UM.RecolorImage
{
visible: !parent.packageHasIcon
anchors.fill: parent
sourceSize.height: height
sourceSize.width: width
color: UM.Theme.getColor("text")
source:
{ {
return packageData.iconUrl switch (packageData.packageType)
} {
switch (packageData.packageType) case "plugin":
{ return "../images/Plugin.svg";
case "plugin": return "../images/Plugin.svg"; case "material":
case "material": return "../images/Spool.svg"; return "../images/Spool.svg";
default: return "../images/placeholder.svg"; default:
return "../images/placeholder.svg";
}
} }
} }
} }

View file

@ -5,6 +5,7 @@ import QtQuick 2.3
import QtQuick.Controls 2.4 import QtQuick.Controls 2.4
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import UM 1.5 as UM import UM 1.5 as UM
import Cura 1.5 as Cura
UM.Dialog UM.Dialog
{ {
@ -17,12 +18,21 @@ UM.Dialog
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
title: catalog.i18nc("@title:window", "Configuration Changes") title: catalog.i18nc("@title:window", "Configuration Changes")
buttonSpacing: UM.Theme.getSize("narrow_margin").width
rightButtons: rightButtons:
[ [
Button Cura.TertiaryButton
{
id: cancelButton
text: catalog.i18nc("@action:button", "Cancel")
onClicked:
{
overrideConfirmationDialog.reject()
}
},
Cura.PrimaryButton
{ {
id: overrideButton id: overrideButton
anchors.margins: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@action:button", "Override") text: catalog.i18nc("@action:button", "Override")
onClicked: onClicked:
{ {
@ -49,16 +59,6 @@ UM.Dialog
} }
return true return true
} }
},
Button
{
id: cancelButton
anchors.margins: UM.Theme.getSize("default_margin").width
text: catalog.i18nc("@action:button", "Cancel")
onClicked:
{
overrideConfirmationDialog.reject()
}
} }
] ]

View file

@ -79,7 +79,7 @@ Item
{ {
id: showTroubleShootingAction id: showTroubleShootingAction
onTriggered: Qt.openUrlExternally("https://ultimaker.com/en/troubleshooting?utm_source=cura&utm_medium=software&utm_campaign=dropdown-troubleshooting") onTriggered: Qt.openUrlExternally("https://ultimaker.com/en/troubleshooting?utm_source=cura&utm_medium=software&utm_campaign=dropdown-troubleshooting")
text: catalog.i18nc("@action:inmenu", "Show Online Troubleshooting Guide") text: catalog.i18nc("@action:inmenu", "Show Online Troubleshooting")
} }
Action Action

View file

@ -20,7 +20,7 @@ UM.Dialog
minimumHeight: UM.Theme.getSize("popup_dialog").height minimumHeight: UM.Theme.getSize("popup_dialog").height
width: minimumWidth width: minimumWidth
height: minimumHeight height: minimumHeight
backgroundColor: UM.Theme.getColor("background_1")
margin: UM.Theme.getSize("thick_margin").width margin: UM.Theme.getSize("thick_margin").width
property var changesModel: Cura.UserChangesModel { id: userChangesModel } property var changesModel: Cura.UserChangesModel { id: userChangesModel }

View file

@ -58,16 +58,24 @@ Item
} }
} }
TextField Cura.TextField
{ {
id: printJobTextfield id: printJobTextfield
anchors.left: printJobPencilIcon.right anchors.left: printJobPencilIcon.right
anchors.leftMargin: UM.Theme.getSize("narrow_margin").width anchors.leftMargin: UM.Theme.getSize("narrow_margin").width
height: UM.Theme.getSize("jobspecs_line").height height: UM.Theme.getSize("jobspecs_line").height
width: Math.max(contentWidth + UM.Theme.getSize("default_margin").width, 50) width: Math.max(contentWidth + UM.Theme.getSize("default_margin").width + 2, 50) // add two pixels to width to prevent inner text from shifting
maximumLength: 120 maximumLength: 120
text: PrintInformation === null ? "" : PrintInformation.jobName text: PrintInformation === null ? "" : PrintInformation.jobName
horizontalAlignment: TextInput.AlignLeft horizontalAlignment: TextInput.AlignLeft
onTextChanged:
{
if (!activeFocus)
{
// Text is changed from outside, reset the cursor position.
cursorPosition = 0
}
}
property string textBeforeEdit: "" property string textBeforeEdit: ""
@ -86,12 +94,12 @@ Item
PrintInformation.setJobName(new_name, true) PrintInformation.setJobName(new_name, true)
} }
printJobTextfield.focus = false printJobTextfield.focus = false
cursorPosition = 0
} }
validator: RegExpValidator { validator: RegExpValidator {
regExp: /^[^\\\/\*\?\|\[\]]*$/ regExp: /^[^\\\/\*\?\|\[\]]*$/
} }
font: UM.Theme.getFont("default")
color: UM.Theme.getColor("text_scene") color: UM.Theme.getColor("text_scene")
background: Item {} background: Item {}
selectByMouse: true selectByMouse: true

View file

@ -34,14 +34,16 @@ Item
{ {
text: menuBarItem.text.replace(new RegExp("&([A-Za-z])"), function (match, character) text: menuBarItem.text.replace(new RegExp("&([A-Za-z])"), function (match, character)
{ {
return `<u>${character}</u>`; return `<u>${character}</u>`
}) })
horizontalAlignment: Text.AlignLeft horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
} }
leftPadding: UM.Theme.getSize("default_margin").width
rightPadding: UM.Theme.getSize("default_margin").width
background: Rectangle background: Rectangle
{ {
color: menuBarItem.highlighted ? UM.Theme.getColor("background_2") : "transparent" color: menuBarItem.highlighted ? UM.Theme.getColor("background_2") : "transparent"
} }
} }

View file

@ -285,10 +285,11 @@ Item
Cura.MaterialMenu Cura.MaterialMenu
{ {
id: materialsMenu id: materialsMenu
width: materialSelection.width
extruderIndex: Cura.ExtruderManager.activeExtruderIndex extruderIndex: Cura.ExtruderManager.activeExtruderIndex
updateModels: materialSelection.visible updateModels: materialSelection.visible
} }
onClicked: materialsMenu.popup() onClicked: materialsMenu.popup(0, height - UM.Theme.getSize("default_lining").height)
} }
Item Item
@ -341,8 +342,9 @@ Item
{ {
id: nozzlesMenu id: nozzlesMenu
extruderIndex: Cura.ExtruderManager.activeExtruderIndex extruderIndex: Cura.ExtruderManager.activeExtruderIndex
width: variantSelection.width
} }
onClicked: nozzlesMenu.popup() onClicked: nozzlesMenu.popup(0, height - UM.Theme.getSize("default_lining").height)
} }
} }

View file

@ -21,6 +21,7 @@ UM.ManagementPage
activeId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id: "" activeId: Cura.MachineManager.activeMachine !== null ? Cura.MachineManager.activeMachine.id: ""
activeIndex: activeMachineIndex() activeIndex: activeMachineIndex()
onHamburgeButtonClicked: menu.popup(content_item, content_item.width - menu.width, hamburger_button.height) onHamburgeButtonClicked: menu.popup(content_item, content_item.width - menu.width, hamburger_button.height)
hamburgerButtonVisible: Cura.MachineManager.activeMachine !== null
function activeMachineIndex() function activeMachineIndex()
{ {

View file

@ -76,10 +76,10 @@ UM.ManagementPage
enabled: !Cura.MachineManager.stacksHaveErrors enabled: !Cura.MachineManager.stacksHaveErrors
visible: base.canCreateProfile visible: base.canCreateProfile
tooltip: catalog.i18nc("@action:tooltip", "Create new profile from current settings/overrides")
onClicked: onClicked:
{ {
createQualityDialog.object = Cura.ContainerManager.makeUniqueName(base.currentItem.name) createQualityDialog.object = Cura.ContainerManager.makeUniqueName("<new name>")
createQualityDialog.open() createQualityDialog.open()
createQualityDialog.selectText() createQualityDialog.selectText()
} }
@ -315,6 +315,13 @@ UM.ManagementPage
font: UM.Theme.getFont("large_bold") font: UM.Theme.getFont("large_bold")
elide: Text.ElideRight elide: Text.ElideRight
} }
UM.Label
{
anchors.left: parent.left
anchors.right: parent.right
text: catalog.i18nc("@action:label", "Some settings from current profile were overwritten.")
visible: currentSettingsActions.visible
}
Flow Flow
{ {
@ -322,12 +329,13 @@ UM.ManagementPage
width: parent.width width: parent.width
visible: base.hasCurrentItem && base.currentItem.name == Cura.MachineManager.activeQualityOrQualityChangesName && base.currentItem.intent_category == Cura.MachineManager.activeIntentCategory visible: base.hasCurrentItem && base.currentItem.name == Cura.MachineManager.activeQualityOrQualityChangesName && base.currentItem.intent_category == Cura.MachineManager.activeIntentCategory
spacing: UM.Theme.getSize("default_margin").width
Cura.SecondaryButton Cura.SecondaryButton
{ {
text: catalog.i18nc("@action:button", "Update profile with current settings/overrides") text: catalog.i18nc("@action:button", "Update profile.")
enabled: Cura.MachineManager.hasUserSettings && objectList.currentIndex && !objectList.currentIndex.is_read_only enabled: Cura.MachineManager.hasUserSettings && objectList.currentIndex && !objectList.currentIndex.is_read_only
onClicked: Cura.ContainerManager.updateQualityChanges() onClicked: Cura.ContainerManager.updateQualityChanges()
tooltip: catalog.i18nc("@action:tooltip", "Update profile with current settings/overrides")
} }
Cura.SecondaryButton Cura.SecondaryButton

View file

@ -12,7 +12,8 @@ Cura.ActionButton
color: UM.Theme.getColor("secondary_button") color: UM.Theme.getColor("secondary_button")
textColor: UM.Theme.getColor("secondary_button_text") textColor: UM.Theme.getColor("secondary_button_text")
outlineColor: UM.Theme.getColor("border_accent_1") outlineColor: UM.Theme.getColor("border_accent_1")
disabledColor: UM.Theme.getColor("action_button_disabled") disabledColor: UM.Theme.getColor("secondary_button")
textDisabledColor: UM.Theme.getColor("action_button_disabled_text") textDisabledColor: UM.Theme.getColor("action_button_disabled_text")
hoverColor: UM.Theme.getColor("secondary_button_hover") hoverColor: UM.Theme.getColor("secondary_button_hover")
outlineDisabledColor: UM.Theme.getColor("action_button_disabled_text")
} }

View file

@ -180,6 +180,7 @@ Item
ListView ListView
{ {
id: contents id: contents
maximumFlickVelocity: 1000
anchors anchors
{ {
top: filterContainer.bottom top: filterContainer.bottom

View file

@ -57,9 +57,7 @@ ComboBox
contentItem: UM.Label contentItem: UM.Label
{ {
id: contentLabel id: contentLabel
anchors.left: parent.left leftPadding: UM.Theme.getSize("setting_unit_margin").width + UM.Theme.getSize("default_margin").width
anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width
anchors.verticalCenter: parent.verticalCenter
anchors.right: downArrow.left anchors.right: downArrow.left
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
text: text:

View file

@ -18,4 +18,5 @@ MenuSeparator
implicitHeight: UM.Theme.getSize("default_lining").height implicitHeight: UM.Theme.getSize("default_lining").height
color: UM.Theme.getColor("setting_control_border") color: UM.Theme.getColor("setting_control_border")
} }
height: visible ? implicitHeight: 0
} }

View file

@ -639,6 +639,8 @@
"banner_icon_size": [2.0, 2.0], "banner_icon_size": [2.0, 2.0],
"marketplace_large_icon": [4.0, 4.0] "marketplace_large_icon": [4.0, 4.0],
"preferences_page_list_item": [8.0, 2.0]
} }
} }