diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 10ae8bb87a..4059283a32 100755 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -28,7 +28,7 @@ import copy from typing import List, Optional -# Setting for clearance around the prime +# Radius of disallowed area in mm around prime. I.e. how much distance to keep from prime position. PRIME_CLEARANCE = 6.5 diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index a410d10cc1..0737210871 100755 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -5,6 +5,7 @@ from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant # For comm from UM.FlameProfiler import pyqtSlot import cura.CuraApplication # To get the global container stack to find the current machine. +from cura.Settings.GlobalStack import GlobalStack from UM.Logger import Logger from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.SceneNode import SceneNode @@ -15,12 +16,10 @@ from UM.Settings.SettingFunction import SettingFunction from UM.Settings.ContainerStack import ContainerStack from UM.Settings.PropertyEvaluationContext import PropertyEvaluationContext -from typing import Optional, TYPE_CHECKING, Dict, List, Any, Union +from typing import Any, cast, Dict, List, Optional, TYPE_CHECKING, Union if TYPE_CHECKING: from cura.Settings.ExtruderStack import ExtruderStack - from cura.Settings.GlobalStack import GlobalStack - from UM.Scene.SceneNode import SceneNode ## Manages all existing extruder stacks. @@ -380,7 +379,7 @@ class ExtruderManager(QObject): # If no extruder has the value, the list will contain the global value. @staticmethod def getExtruderValues(key: str) -> List[Any]: - global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() + global_stack = cast(GlobalStack, cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()) #We know that there must be a global stack by the time you're requesting setting values. result = [] for extruder in ExtruderManager.getInstance().getActiveExtruderStacks(): @@ -415,7 +414,7 @@ class ExtruderManager(QObject): # If no extruder has the value, the list will contain the global value. @staticmethod def getDefaultExtruderValues(key: str) -> List[Any]: - global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() + global_stack = cast(GlobalStack, cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()) #We know that there must be a global stack by the time you're requesting setting values. context = PropertyEvaluationContext(global_stack) context.context["evaluate_from_container_index"] = 1 # skip the user settings container context.context["override_operators"] = { @@ -482,7 +481,7 @@ class ExtruderManager(QObject): value = value(extruder) else: # Just a value from global. - value = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack().getProperty(key, "value") + value = cast(GlobalStack, cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()).getProperty(key, "value") return value @@ -511,7 +510,7 @@ class ExtruderManager(QObject): if isinstance(value, SettingFunction): value = value(extruder, context = context) else: # Just a value from global. - value = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack().getProperty(key, "value", context = context) + value = cast(GlobalStack, cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()).getProperty(key, "value", context = context) return value @@ -524,7 +523,7 @@ class ExtruderManager(QObject): # \return The effective value @staticmethod def getResolveOrValue(key: str) -> Any: - global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() + global_stack = cast(GlobalStack, cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()) resolved_value = global_stack.getProperty(key, "value") return resolved_value @@ -538,7 +537,7 @@ class ExtruderManager(QObject): # \return The effective value @staticmethod def getDefaultResolveOrValue(key: str) -> Any: - global_stack = cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack() + global_stack = cast(GlobalStack, cura.CuraApplication.CuraApplication.getInstance().getGlobalContainerStack()) context = PropertyEvaluationContext(global_stack) context.context["evaluate_from_container_index"] = 1 # skip the user settings container context.context["override_operators"] = { diff --git a/plugins/SimulationView/SimulationView.qml b/plugins/SimulationView/SimulationView.qml index 8d671dcb56..b4ca9584c7 100644 --- a/plugins/SimulationView/SimulationView.qml +++ b/plugins/SimulationView/SimulationView.qml @@ -670,7 +670,6 @@ Item onCurrentLayerChanged: { playButton.pauseSimulation() - pathSlider.setHandleValue(0) // After updating the layer set Path slider to 0 layerSlider.setUpperValue(UM.SimulationView.currentLayer) } } diff --git a/plugins/Toolbox/src/Toolbox.py b/plugins/Toolbox/src/Toolbox.py index 9488b50e4e..9e9fdd6f29 100644 --- a/plugins/Toolbox/src/Toolbox.py +++ b/plugins/Toolbox/src/Toolbox.py @@ -488,7 +488,17 @@ class Toolbox(QObject, Extension): local_version = Version(local_package["package_version"]) remote_version = Version(remote_package["package_version"]) - return remote_version > local_version + + can_upgrade = False + if remote_version > local_version: + can_upgrade = True + # A package with the same version can be built to have different SDK versions. So, for a package with the same + # version, we also need to check if the current one has a lower SDK version. If so, this package should also + # be upgradable. + elif remote_version == local_version and local_package.get("sdk_version", 0) < int(self._getSDKVersion()): + can_upgrade = True + + return can_upgrade @pyqtSlot(str, result = bool) def canDowngrade(self, package_id: str) -> bool: diff --git a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py index 54b561c847..2430b35ea0 100644 --- a/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py +++ b/plugins/VersionUpgrade/VersionUpgrade25to26/VersionUpgrade25to26.py @@ -1,4 +1,4 @@ -# Copyright (c) 2017 Ultimaker B.V. +# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import configparser #To parse the files we need to upgrade and write the new files. @@ -9,8 +9,6 @@ from urllib.parse import quote_plus from UM.Resources import Resources from UM.VersionUpgrade import VersionUpgrade -from cura.CuraApplication import CuraApplication - _removed_settings = { #Settings that were removed in 2.5. "start_layers_at_same_position", "sub_div_rad_mult" @@ -152,7 +150,7 @@ class VersionUpgrade25to26(VersionUpgrade): ## Acquires the next unique extruder stack index number for the Custom FDM Printer. def _acquireNextUniqueCustomFdmPrinterExtruderStackIdIndex(self): - extruder_stack_dir = Resources.getPath(CuraApplication.ResourceTypes.ExtruderStack) + extruder_stack_dir = os.path.join(Resources.getDataStoragePath(), "extruders") file_name_list = os.listdir(extruder_stack_dir) file_name_list = [os.path.basename(file_name) for file_name in file_name_list] while True: @@ -173,7 +171,7 @@ class VersionUpgrade25to26(VersionUpgrade): def _checkCustomFdmPrinterHasExtruderStack(self, machine_id): # go through all extruders and make sure that this custom FDM printer has extruder stacks. - extruder_stack_dir = Resources.getPath(CuraApplication.ResourceTypes.ExtruderStack) + extruder_stack_dir = os.path.join(Resources.getDataStoragePath(), "extruders") has_extruders = False for item in os.listdir(extruder_stack_dir): file_path = os.path.join(extruder_stack_dir, item) @@ -245,9 +243,9 @@ class VersionUpgrade25to26(VersionUpgrade): parser.write(extruder_output) extruder_filename = quote_plus(stack_id) + ".extruder.cfg" - extruder_stack_dir = Resources.getPath(CuraApplication.ResourceTypes.ExtruderStack) - definition_changes_dir = Resources.getPath(CuraApplication.ResourceTypes.DefinitionChangesContainer) - user_settings_dir = Resources.getPath(CuraApplication.ResourceTypes.UserInstanceContainer) + extruder_stack_dir = os.path.join(Resources.getDataStoragePath(), "extruders") + definition_changes_dir = os.path.join(Resources.getDataStoragePath(), "definition_changes") + user_settings_dir = os.path.join(Resources.getDataStoragePath(), "user") with open(os.path.join(definition_changes_dir, definition_changes_filename), "w", encoding = "utf-8") as f: f.write(definition_changes_output.getvalue()) diff --git a/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py b/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py index 2037a0211d..dfa436e5bd 100644 --- a/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py +++ b/plugins/VersionUpgrade/VersionUpgrade26to27/VersionUpgrade26to27.py @@ -1,11 +1,10 @@ -# Copyright (c) 2017 Ultimaker B.V. +# Copyright (c) 2018 Ultimaker B.V. # Cura is released under the terms of the LGPLv3 or higher. import configparser #To parse the files we need to upgrade and write the new files. import io #To serialise configparser output to a string. from UM.VersionUpgrade import VersionUpgrade -from cura.CuraApplication import CuraApplication # a dict of renamed quality profiles: : _renamed_quality_profiles = { diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index ec5a2e937b..53f6a4f63b 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -77,6 +77,20 @@ "type": "str", "enabled": false }, + "material_diameter": + { + "label": "Diameter", + "description": "Adjusts the diameter of the filament used. Match this value with the diameter of the used filament.", + "unit": "mm", + "type": "float", + "default_value": 2.85, + "minimum_value": "0.0001", + "minimum_value_warning": "0.4", + "maximum_value_warning": "3.5", + "enabled": "machine_gcode_flavor != \"UltiGCode\"", + "settable_per_mesh": false, + "settable_per_extruder": true + }, "material_bed_temp_wait": { "label": "Wait for Build Plate Heatup", diff --git a/tests/conftest.py b/tests/conftest.py index 77d215815a..ad0bc609ee 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -6,6 +6,8 @@ import unittest.mock import pytest +import Arcus #Prevents error: "PyCapsule_GetPointer called with incorrect name" with conflicting SIP configurations between Arcus and PyQt: Import Arcus and Savitar first! +import Savitar from UM.Qt.QtApplication import QtApplication #QtApplication import is required, even though it isn't used. from cura.CuraApplication import CuraApplication from cura.MachineActionManager import MachineActionManager