mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-15 02:37:49 -06:00
Merge branch '3.5'
This commit is contained in:
commit
3b36223681
4 changed files with 16 additions and 18 deletions
|
@ -15,12 +15,11 @@ 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 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"] = {
|
||||||
|
|
|
@ -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())
|
||||||
|
|
|
@ -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 = {
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue