Merge branch 'master' of github.com:Ultimaker/Cura

This commit is contained in:
Jaime van Kessel 2018-09-14 15:42:11 +02:00
commit 2590b03540
8 changed files with 43 additions and 22 deletions

View File

@ -28,7 +28,7 @@ import copy
from typing import List, Optional 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 PRIME_CLEARANCE = 6.5

View File

@ -5,6 +5,7 @@ from PyQt5.QtCore import pyqtSignal, pyqtProperty, QObject, QVariant # For comm
from UM.FlameProfiler import pyqtSlot from UM.FlameProfiler import pyqtSlot
import cura.CuraApplication # To get the global container stack to find the current machine. 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.Logger import Logger
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
from UM.Scene.SceneNode import SceneNode 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.ContainerStack import ContainerStack
from UM.Settings.PropertyEvaluationContext import PropertyEvaluationContext 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: if TYPE_CHECKING:
from cura.Settings.ExtruderStack import ExtruderStack from cura.Settings.ExtruderStack import ExtruderStack
from cura.Settings.GlobalStack import GlobalStack
from UM.Scene.SceneNode import SceneNode
## Manages all existing extruder stacks. ## 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. # If no extruder has the value, the list will contain the global value.
@staticmethod @staticmethod
def getExtruderValues(key: str) -> List[Any]: 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 = [] result = []
for extruder in ExtruderManager.getInstance().getActiveExtruderStacks(): 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. # If no extruder has the value, the list will contain the global value.
@staticmethod @staticmethod
def getDefaultExtruderValues(key: str) -> List[Any]: 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 = PropertyEvaluationContext(global_stack)
context.context["evaluate_from_container_index"] = 1 # skip the user settings container context.context["evaluate_from_container_index"] = 1 # skip the user settings container
context.context["override_operators"] = { context.context["override_operators"] = {
@ -482,7 +481,7 @@ class ExtruderManager(QObject):
value = value(extruder) value = value(extruder)
else: else:
# Just a value from global. # 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 return value
@ -511,7 +510,7 @@ class ExtruderManager(QObject):
if isinstance(value, SettingFunction): if isinstance(value, SettingFunction):
value = value(extruder, context = context) value = value(extruder, context = context)
else: # Just a value from global. 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 return value
@ -524,7 +523,7 @@ class ExtruderManager(QObject):
# \return The effective value # \return The effective value
@staticmethod @staticmethod
def getResolveOrValue(key: str) -> Any: 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") resolved_value = global_stack.getProperty(key, "value")
return resolved_value return resolved_value
@ -538,7 +537,7 @@ class ExtruderManager(QObject):
# \return The effective value # \return The effective value
@staticmethod @staticmethod
def getDefaultResolveOrValue(key: str) -> Any: 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 = PropertyEvaluationContext(global_stack)
context.context["evaluate_from_container_index"] = 1 # skip the user settings container context.context["evaluate_from_container_index"] = 1 # skip the user settings container
context.context["override_operators"] = { context.context["override_operators"] = {

View File

@ -670,7 +670,6 @@ Item
onCurrentLayerChanged: onCurrentLayerChanged:
{ {
playButton.pauseSimulation() playButton.pauseSimulation()
pathSlider.setHandleValue(0) // After updating the layer set Path slider to 0
layerSlider.setUpperValue(UM.SimulationView.currentLayer) layerSlider.setUpperValue(UM.SimulationView.currentLayer)
} }
} }

View File

@ -488,7 +488,17 @@ class Toolbox(QObject, Extension):
local_version = Version(local_package["package_version"]) local_version = Version(local_package["package_version"])
remote_version = Version(remote_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) @pyqtSlot(str, result = bool)
def canDowngrade(self, package_id: str) -> bool: def canDowngrade(self, package_id: str) -> bool:

View File

@ -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. # 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 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.Resources import Resources
from UM.VersionUpgrade import VersionUpgrade from UM.VersionUpgrade import VersionUpgrade
from cura.CuraApplication import CuraApplication
_removed_settings = { #Settings that were removed in 2.5. _removed_settings = { #Settings that were removed in 2.5.
"start_layers_at_same_position", "start_layers_at_same_position",
"sub_div_rad_mult" "sub_div_rad_mult"
@ -152,7 +150,7 @@ class VersionUpgrade25to26(VersionUpgrade):
## Acquires the next unique extruder stack index number for the Custom FDM Printer. ## Acquires the next unique extruder stack index number for the Custom FDM Printer.
def _acquireNextUniqueCustomFdmPrinterExtruderStackIdIndex(self): 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.listdir(extruder_stack_dir)
file_name_list = [os.path.basename(file_name) for file_name in file_name_list] file_name_list = [os.path.basename(file_name) for file_name in file_name_list]
while True: while True:
@ -173,7 +171,7 @@ class VersionUpgrade25to26(VersionUpgrade):
def _checkCustomFdmPrinterHasExtruderStack(self, machine_id): def _checkCustomFdmPrinterHasExtruderStack(self, machine_id):
# go through all extruders and make sure that this custom FDM printer has extruder stacks. # 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 has_extruders = False
for item in os.listdir(extruder_stack_dir): for item in os.listdir(extruder_stack_dir):
file_path = os.path.join(extruder_stack_dir, item) file_path = os.path.join(extruder_stack_dir, item)
@ -245,9 +243,9 @@ class VersionUpgrade25to26(VersionUpgrade):
parser.write(extruder_output) parser.write(extruder_output)
extruder_filename = quote_plus(stack_id) + ".extruder.cfg" extruder_filename = quote_plus(stack_id) + ".extruder.cfg"
extruder_stack_dir = Resources.getPath(CuraApplication.ResourceTypes.ExtruderStack) extruder_stack_dir = os.path.join(Resources.getDataStoragePath(), "extruders")
definition_changes_dir = Resources.getPath(CuraApplication.ResourceTypes.DefinitionChangesContainer) definition_changes_dir = os.path.join(Resources.getDataStoragePath(), "definition_changes")
user_settings_dir = Resources.getPath(CuraApplication.ResourceTypes.UserInstanceContainer) 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: with open(os.path.join(definition_changes_dir, definition_changes_filename), "w", encoding = "utf-8") as f:
f.write(definition_changes_output.getvalue()) f.write(definition_changes_output.getvalue())

View File

@ -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. # 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 configparser #To parse the files we need to upgrade and write the new files.
import io #To serialise configparser output to a string. import io #To serialise configparser output to a string.
from UM.VersionUpgrade import VersionUpgrade from UM.VersionUpgrade import VersionUpgrade
from cura.CuraApplication import CuraApplication
# a dict of renamed quality profiles: <old_id> : <new_id> # a dict of renamed quality profiles: <old_id> : <new_id>
_renamed_quality_profiles = { _renamed_quality_profiles = {

View File

@ -77,6 +77,20 @@
"type": "str", "type": "str",
"enabled": false "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": "material_bed_temp_wait":
{ {
"label": "Wait for Build Plate Heatup", "label": "Wait for Build Plate Heatup",

View File

@ -6,6 +6,8 @@
import unittest.mock import unittest.mock
import pytest 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 UM.Qt.QtApplication import QtApplication #QtApplication import is required, even though it isn't used.
from cura.CuraApplication import CuraApplication from cura.CuraApplication import CuraApplication
from cura.MachineActionManager import MachineActionManager from cura.MachineActionManager import MachineActionManager