Merge branch '4.4' into CS-476_improve_packages_api_speed

This commit is contained in:
ChrisTerBeke 2019-11-07 10:31:37 +01:00
commit 7dc38cd55d
13 changed files with 99 additions and 88 deletions

View file

@ -2,8 +2,8 @@
#Cura is released under the terms of the LGPLv3 or higher.
from PyQt5.QtCore import Qt, QTimer
import collections
from typing import TYPE_CHECKING, Optional, Dict
from cura.Machines.Models.IntentTranslations import intent_translations
from cura.Machines.Models.IntentModel import IntentModel
from cura.Settings.IntentManager import IntentManager
@ -29,26 +29,6 @@ class IntentCategoryModel(ListModel):
modelUpdated = pyqtSignal()
# Translations to user-visible string. Ordered by weight.
# TODO: Create a solution for this name and weight to be used dynamically.
_translations = collections.OrderedDict() # type: "collections.OrderedDict[str,Dict[str,Optional[str]]]"
_translations["default"] = {
"name": catalog.i18nc("@label", "Default")
}
_translations["visual"] = {
"name": catalog.i18nc("@label", "Visual"),
"description": catalog.i18nc("@text", "Optimized for appearance")
}
_translations["engineering"] = {
"name": catalog.i18nc("@label", "Engineering"),
"description": catalog.i18nc("@text", "Optimized for higher accuracy")
}
_translations["quick"] = {
"name": catalog.i18nc("@label", "Draft"),
"description": catalog.i18nc("@text", "Optimized for fast results")
}
## Creates a new model for a certain intent category.
# \param The category to list the intent profiles for.
def __init__(self, intent_category: str) -> None:
@ -99,15 +79,15 @@ class IntentCategoryModel(ListModel):
"name": IntentCategoryModel.translation(category, "name", catalog.i18nc("@label", "Unknown")),
"description": IntentCategoryModel.translation(category, "description", None),
"intent_category": category,
"weight": list(self._translations.keys()).index(category),
"weight": list(intent_translations).index(category),
"qualities": qualities
})
result.sort(key = lambda k: k["weight"])
self.setItems(result)
## Get a display value for a category. See IntenCategoryModel._translations
## Get a display value for a category.
## for categories and keys
@staticmethod
def translation(category: str, key: str, default: Optional[str] = None):
display_strings = IntentCategoryModel._translations.get(category, {})
display_strings = intent_translations.get(category, {})
return display_strings.get(key, default)

View file

@ -0,0 +1,20 @@
import collections
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
intent_translations = collections.OrderedDict() # type: "collections.OrderedDict[str, Dict[str, Optional[str]]]"
intent_translations["default"] = {
"name": catalog.i18nc("@label", "Default")
}
intent_translations["visual"] = {
"name": catalog.i18nc("@label", "Visual"),
"description": catalog.i18nc("@text", "The visual profile is designed to print visual prototypes and models with the intent of high visual and surface quality.")
}
intent_translations["engineering"] = {
"name": catalog.i18nc("@label", "Engineering"),
"description": catalog.i18nc("@text", "The engineering profile is designed to print functional prototypes and end-use parts with the intent of better accuracy and for closer tolerances.")
}
intent_translations["quick"] = {
"name": catalog.i18nc("@label", "Draft"),
"description": catalog.i18nc("@text", "The draft profile is designed to print initial prototypes and concept validation with the intent of significant print time reduction.")
}

View file

@ -14,6 +14,7 @@ from cura.Machines.ContainerTree import ContainerTree
from cura.Settings.cura_empty_instance_containers import empty_quality_changes_container
from cura.Settings.IntentManager import IntentManager
from cura.Machines.Models.MachineModelUtils import fetchLayerHeight
from cura.Machines.Models.IntentTranslations import intent_translations
from UM.i18n import i18nCatalog
catalog = i18nCatalog("cura")
@ -336,10 +337,11 @@ class QualityManagementModel(ListModel):
"quality_type": quality_type,
"quality_changes_group": None,
"intent_category": intent_category,
"section_name": catalog.i18nc("@label", intent_category.capitalize()),
"section_name": catalog.i18nc("@label", intent_translations.get(intent_category, {}).get("name", catalog.i18nc("@label", "Unknown"))),
})
# Sort by quality_type for each intent category
result = sorted(result, key = lambda x: (x["intent_category"], x["quality_type"]))
result = sorted(result, key = lambda x: (list(intent_translations).index(x["intent_category"]), x["quality_type"]))
item_list += result
# Create quality_changes group items

View file

@ -85,10 +85,20 @@ class VariantNode(ContainerNode):
for base_material, material_node in self.materials.items():
if self.machine.preferred_material == base_material and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")):
return material_node
# First fallback: Choose any material with matching diameter.
# First fallback: Check if we should be checking for the 175 variant.
if approximate_diameter == 2:
preferred_material = self.machine.preferred_material + "_175"
for base_material, material_node in self.materials.items():
if preferred_material == base_material and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")):
return material_node
# Second fallback: Choose any material with matching diameter.
for material_node in self.materials.values():
if material_node.getMetaDataEntry("approximate_diameter") and approximate_diameter == int(material_node.getMetaDataEntry("approximate_diameter")):
Logger.log("w", "Could not find preferred material %s, falling back to whatever works", self.machine.preferred_material)
return material_node
fallback = next(iter(self.materials.values())) # Should only happen with empty material node.
Logger.log("w", "Could not find preferred material {preferred_material} with diameter {diameter} for variant {variant_id}, falling back to {fallback}.".format(
preferred_material = self.machine.preferred_material,

View file

@ -56,11 +56,11 @@ class CuraSplashScreen(QSplashScreen):
if buildtype:
version[0] += " (%s)" % buildtype
# draw version text
# Draw version text
font = QFont() # Using system-default font here
font.setPixelSize(37)
painter.setFont(font)
painter.drawText(215, 66, 330 * self._scale, 230 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[0])
painter.drawText(60, 66, 330 * self._scale, 230 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[0])
if len(version) > 1:
font.setPixelSize(16)
painter.setFont(font)
@ -68,14 +68,14 @@ class CuraSplashScreen(QSplashScreen):
painter.drawText(247, 105, 330 * self._scale, 255 * self._scale, Qt.AlignLeft | Qt.AlignTop, version[1])
painter.setPen(QColor(255, 255, 255, 255))
# draw the loading image
# Draw the loading image
pen = QPen()
pen.setWidth(6 * self._scale)
pen.setColor(QColor(32, 166, 219, 255))
painter.setPen(pen)
painter.drawArc(60, 150, 32 * self._scale, 32 * self._scale, self._loading_image_rotation_angle * 16, 300 * 16)
# draw message text
# Draw message text
if self._current_message:
font = QFont() # Using system-default font here
font.setPixelSize(13)

View file

@ -1,4 +1,4 @@
# Copyright (c) 2018 Ultimaker B.V.
# Copyright (c) 2019 Ultimaker B.V.
# Cura is released under the terms of the LGPLv3 or higher.
import numpy
@ -72,7 +72,7 @@ class GcodeStartEndFormatter(Formatter):
value = default_value_str
# "-1" is global stack, and if the setting value exists in the global stack, use it as the fallback value.
if key in kwargs["-1"]:
value = kwargs["-1"]
value = kwargs["-1"][key]
if str(extruder_nr) in kwargs and key in kwargs[str(extruder_nr)]:
value = kwargs[str(extruder_nr)][key]

View file

@ -66,6 +66,13 @@ class VersionUpgrade43to44(VersionUpgrade):
# Alternate skin rotation should be translated to top/bottom line directions.
if "skin_alternate_rotation" in parser["values"] and parseBool(parser["values"]["skin_alternate_rotation"]):
parser["values"]["skin_angles"] = "[45, 135, 0, 90]"
# Unit of adaptive layers topography size changed.
if "adaptive_layer_height_threshold" in parser["values"]:
val = parser["values"]["adaptive_layer_height_threshold"]
if val.startswith("="):
val = val[1:]
val = "=({val}) / 1000".format(val = val) # Convert microns to millimetres. Works even if the profile contained a formula.
parser["values"]["adaptive_layer_height_threshold"] = val
result = io.StringIO()
parser.write(result)

View file

@ -7074,11 +7074,12 @@
},
"adaptive_layer_height_threshold":
{
"label": "Adaptive Layers Threshold",
"description": "Threshold whether to use a smaller layer or not. This number is compared to the tan of the steepest slope in a layer.",
"label": "Adaptive Layers Topography Size",
"description": "Target horizontal distance between two adjacent layers. Reducing this setting causes thinner layers to be used to bring the edges of the layers closer together.",
"type": "float",
"enabled": "adaptive_layer_height_enabled",
"default_value": 200.0,
"default_value": 0.2,
"unit": "mm",
"settable_per_mesh": false,
"settable_per_extruder": false,
"settable_per_meshgroup": false

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Before After
Before After

View file

@ -41,6 +41,7 @@ UM.Dialog
source: UM.Theme.getImage("logo")
sourceSize.width: width
sourceSize.height: height
fillMode: Image.PreserveAspectFit
anchors.top: parent.top
anchors.topMargin: parent.topPadding

View file

@ -124,18 +124,6 @@ Item
elide: Text.ElideRight
}
NoIntentIcon
{
affected_extruders: Cura.MachineManager.extruderPositionsWithNonActiveIntent
intent_type: model.name
anchors.right: intentCategoryLabel.right
anchors.rightMargin: UM.Theme.getSize("narrow_margin").width
width: intentCategoryLabel.height * 0.75
anchors.verticalCenter: parent.verticalCenter
height: width
visible: Cura.MachineManager.activeIntentCategory == model.intent_category && affected_extruders.length
}
Cura.RadioCheckbar
{
anchors
@ -164,23 +152,44 @@ Item
isCheckedFunction: checkedFunction
}
MouseArea // tooltip hover area
MouseArea // Intent description tooltip hover area
{
id: intentDescriptionHoverArea
anchors.fill: parent
hoverEnabled: true
enabled: model.description !== undefined
acceptedButtons: Qt.NoButton // react to hover only, don't steal clicks
onEntered:
Timer
{
base.showTooltip(
id: intentTooltipTimer
interval: 500
running: false
repeat: false
onTriggered: base.showTooltip(
intentCategoryLabel,
Qt.point(-(intentCategoryLabel.x - qualityRow.x) - UM.Theme.getSize("thick_margin").width, 0),
model.description
)
}
onEntered: intentTooltipTimer.start()
onExited: base.hideTooltip()
}
NoIntentIcon // This icon has hover priority over intentDescriptionHoverArea, so draw it above it.
{
affected_extruders: Cura.MachineManager.extruderPositionsWithNonActiveIntent
intent_type: model.name
anchors.right: intentCategoryLabel.right
anchors.rightMargin: UM.Theme.getSize("narrow_margin").width
width: intentCategoryLabel.height * 0.75
anchors.verticalCenter: parent.verticalCenter
height: width
visible: Cura.MachineManager.activeIntentCategory == model.intent_category && affected_extruders.length
}
}
}

View file

@ -1,37 +1,18 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="82px"
height="18px"
viewBox="0 0 82 18"
version="1.1"
id="svg12"
sodipodi:docname="logo2.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
<polygon
fill="#20A6DB"
points="82 10.3797468 77.8757345 10.3797468 75.7721519 12.4764557 75.7721519 16.6075949 79.9067798 16.6075949 82 14.5108861"
id="polygon2" />
<path
fill="white"
d="M0,9.32538529 C0,14.168804 3.22511,17.6455696 8.53908129,17.6455696 L16.6075949,17.6455696 L16.6075949,13.294146 L8.53908129,13.294146 C5.8534025,13.2832128 4.53351762,11.4792306 4.53351762,9.32538529 C4.53351762,7.17153994 5.8534025,5.40035747 8.53908129,5.37849102 L16.6075949,5.37849102 L16.6075949,1.03800064 L8.53908129,1.03800064 C3.21363275,1.02706742 0,4.47103333 0,9.32538529 Z"
id="path4"/>
<path
fill="white"
d="M33.004725,9.78605176 C33.004725,12.2613239 31.20074,13.5835846 29.0468913,13.5835846 C26.8930426,13.5835846 25.1218573,12.2613239 25.1218573,9.78605176 L25.1218573,1.03797468 L20.7594937,1.03797468 L20.7594937,9.78605176 C20.7594937,14.6837056 24.203465,17.6455696 29.0468913,17.6455696 C33.8903176,17.6455696 37.3670886,14.6731275 37.3670886,9.78605176 L37.3670886,1.03797468 L33.004725,1.03797468 L33.004725,9.78605176 L33.004725,9.78605176 Z"
id="path6"/>
<path
fill="white"
d="M62.1251127,1.03797468 C57.0530042,1.03797468 53.9746835,4.47968021 53.9746835,9.31992005 C53.9746835,14.1601599 57.0530042,17.6346436 62.1251127,17.6346436 L63.9217127,17.6346436 L63.9217127,13.297002 L62.1251127,13.297002 C59.5616713,13.2860759 58.3018603,11.4832778 58.3018603,9.3308461 C58.3018603,7.17841439 59.5616713,5.4083944 62.1251127,5.38654231 L66.2112822,5.38654231 L66.2112822,11.0680879 L66.2112822,13.297002 L66.2112822,17.6455696 L70.5822785,17.6455696 L70.5822785,17.3942705 L70.5822785,13.297002 L70.5822785,5.38654231 L70.5822785,1.80279813 L70.5822785,1.03797468 L62.1251127,1.03797468 Z"
id="path8"/>
<path
fill="white"
d="M 41.518987,9.13915 V 17.646 h 4.36332 V 9.13915 c 0,-2.1053391 1.273557,-3.8366328 3.86497,-3.8580068 h 3.189432 V 1.038405 h -3.189432 c -5.127454,0 -8.22829,3.3664044 -8.22829,8.100745 z"
id="path10" />
<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="170.6px" height="23.7px" viewBox="0 0 170.6 23.7">
<g fill="white">
<!-- U --> <path d="M16.3,3.1v11.1c0,1.2-0.3,2.3-0.8,3.2s-1.3,1.7-2.3,2.3c-1,0.6-2.3,0.8-3.9,0.8c-2.2,0-3.9-0.6-5.1-1.7s-1.7-2.7-1.7-4.6v-11h3.1v10.7c0,1.4,0.3,2.4,0.9,3.1c0.6,0.6,1.6,1,2.9,1c1.3,0,2.3-0.3,2.9-1c0.6-0.7,0.9-1.7,0.9-3V3.1H16.3z" />
<!-- l --> <path d="M22.6,20.3h-3V2h3V20.3z" />
<!-- t --> <path d="M30.8,18.1c0.4,0,0.7,0,1.1-0.1c0.4-0.1,0.7-0.2,1-0.3V20c-0.3,0.2-0.7,0.3-1.2,0.4c-0.5,0.1-1,0.1-1.6,0.1c-0.8,0-1.4-0.1-2-0.4s-1.1-0.7-1.4-1.3c-0.4-0.6-0.5-1.5-0.5-2.6V9.5h-1.8V8.2l1.9-1.1l1-2.8h1.9v2.9h3.7v2.3h-3.7v6.7c0,0.6,0.2,1.1,0.5,1.4C29.9,17.9,30.3,18.1,30.8,18.1z" />
<!-- i --> <path d="M36.3,2.2c0.4,0,0.8,0.1,1.2,0.3C37.8,2.8,38,3.2,38,3.8c0,0.6-0.2,1-0.5,1.2c-0.3,0.2-0.7,0.4-1.2,0.4c-0.5,0-0.9-0.1-1.2-0.4c-0.3-0.2-0.5-0.7-0.5-1.2c0-0.6,0.2-1,0.5-1.2C35.5,2.3,35.8,2.2,36.3,2.2z M37.8,7.2v13h-3v-13H37.8z" />
<!-- m --> <path d="M55.9,7c1.5,0,2.6,0.4,3.3,1.1c0.7,0.8,1.1,2,1.1,3.6v8.5h-3v-7.9c0-1.9-0.7-2.9-2.2-2.9c-1.1,0-1.8,0.3-2.3,1c-0.4,0.7-0.7,1.7-0.7,3v6.8h-3v-7.9c0-1.9-0.7-2.9-2.2-2.9c-1.1,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c-3,0-4.5-1.6-4.5-4.7V7.5h1.4v8.3c0,1.2,0.3,2.1,0.8,2.7s1.4,0.9,2.4,0.9c2.8,0,4.2-1.6,4.2-4.9v-7H144.6z" />
<!-- r --> <path d="M154.1,7.3c0.7,0,1.2,0.1,1.7,0.2l-0.2,1.2c-0.3-0.1-0.5-0.1-0.8-0.1s-0.5,0-0.8,0c-1.2,0-2.1,0.4-2.8,1.3c-0.7,0.9-1,2-1,3.4v7h-1.4V7.5h1.2l0.1,2.4h0.1c0.3-0.7,0.8-1.3,1.5-1.8S153.1,7.3,154.1,7.3z" />
<!-- a --> <path d="M162.4,7.3c1.4,0,2.5,0.4,3.2,1.1s1.1,1.8,1.1,3.3v8.6h-1l-0.3-2.2h0c-0.4,0.7-1,1.3-1.7,1.7c-0.7,0.4-1.6,0.7-2.8,0.7c-1.2,0-2.2-0.3-2.9-0.9s-1.1-1.5-1.1-2.7c0-1.3,0.5-2.2,1.5-2.9c1-0.7,2.5-1,4.5-1.1l2.3-0.1v-0.9c0-1.3-0.3-2.2-0.8-2.7s-1.2-0.8-2.2-0.8c-0.7,0-1.3,0.1-1.9,0.3c-0.6,0.2-1.2,0.4-1.8,0.7l-0.4-1.1c0.6-0.3,1.2-0.6,2-0.7C160.8,7.4,161.6,7.3,162.4,7.3z M165.3,13.8l-2.2,0.1c-1.6,0.1-2.8,0.3-3.6,0.8c-0.8,0.5-1.2,1.2-1.2,2.2c0,0.8,0.2,1.4,0.7,1.8c0.5,0.4,1.2,0.6,2,0.6c1.3,0,2.4-0.4,3.1-1.1c0.7-0.8,1.1-1.8,1.1-3.2V13.8z" />
</g>
</svg>

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Before After
Before After

View file

@ -483,7 +483,7 @@
"default_lining": [0.08, 0.08],
"default_arrow": [0.8, 0.8],
"logo": [8, 1.75],
"logo": [16, 3.5],
"wide_margin": [2.0, 2.0],
"thick_margin": [1.71, 1.43],