From 14afd9eab7687a26a49d730c0aef1883b51eb570 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 21 Nov 2016 21:36:08 +0100 Subject: [PATCH 001/197] Heaps to changes to get the Cura code through the type checker (with minimal checking). CURA-2917 --- CMakeLists.txt | 2 +- cura/CuraApplication.py | 58 +++++---- cura/PrintInformation.py | 4 +- cura/Settings/ContainerManager.py | 44 +++---- cura/Settings/ExtruderManager.py | 114 +++++++++--------- cura/Settings/ExtrudersModel.py | 4 +- cura/Settings/MachineManager.py | 113 ++++++++--------- .../MaterialSettingsVisibilityHandler.py | 4 +- cura/Settings/QualitySettingsModel.py | 23 ++-- cura/Settings/__init__.py | 11 -- cura_app.py | 3 - .../CuraEngineBackend/CuraEngineBackend.py | 4 +- .../MachineSettingsAction.py | 18 +-- .../PerObjectSettingVisibilityHandler.py | 4 +- plugins/SolidView/SolidView.py | 3 +- .../VersionUpgrade21to22/Profile.py | 2 +- .../XmlMaterialProfile/XmlMaterialProfile.py | 34 +++--- 17 files changed, 228 insertions(+), 217 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 40fac2ca2f..9c6c64fce1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -61,7 +61,7 @@ if(NOT ${URANIUM_SCRIPTS_DIR} STREQUAL "") endif() endif() -find_package(PythonInterp 3.4.0 REQUIRED) +find_package(PythonInterp 3.5.0 REQUIRED) install(DIRECTORY resources DESTINATION ${CMAKE_INSTALL_DATADIR}/cura) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 80bd4eb9a9..c9c72ceed7 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -42,7 +42,14 @@ from . import CuraSplashScreen from . import CameraImageProvider from . import MachineActionManager -import cura.Settings +from cura.Settings.MachineManager import MachineManager +from cura.Settings.ExtruderManager import ExtruderManager +from cura.Settings.CuraContainerRegistry import CuraContainerRegistry +from cura.Settings.ExtrudersModel import ExtrudersModel +from cura.Settings.ContainerSettingsModel import ContainerSettingsModel +from cura.Settings.MaterialSettingsVisibilityHandler import MaterialSettingsVisibilityHandler +from cura.Settings.QualitySettingsModel import QualitySettingsModel +from cura.Settings.ContainerManager import ContainerManager from PyQt5.QtCore import pyqtSlot, QUrl, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS from PyQt5.QtGui import QColor, QIcon @@ -57,11 +64,13 @@ import urllib numpy.seterr(all="ignore") -try: - from cura.CuraVersion import CuraVersion, CuraBuildType -except ImportError: - CuraVersion = "master" # [CodeStyle: Reflecting imported value] - CuraBuildType = "" +MYPY = False +if not MYPY: + try: + from cura.CuraVersion import CuraVersion, CuraBuildType + except ImportError: + CuraVersion = "master" # [CodeStyle: Reflecting imported value] + CuraBuildType = "" class CuraApplication(QtApplication): class ResourceTypes: @@ -77,6 +86,8 @@ class CuraApplication(QtApplication): Q_ENUMS(ResourceTypes) def __init__(self): + super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType) + Resources.addSearchPath(os.path.join(QtApplication.getInstallPrefix(), "share", "cura", "resources")) if not hasattr(sys, "frozen"): Resources.addSearchPath(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..", "resources")) @@ -92,8 +103,8 @@ class CuraApplication(QtApplication): SettingDefinition.addSupportedProperty("resolve", DefinitionPropertyType.Function, default = None) SettingDefinition.addSettingType("extruder", None, str, Validator) - SettingFunction.registerOperator("extruderValues", cura.Settings.ExtruderManager.getExtruderValues) - SettingFunction.registerOperator("extruderValue", cura.Settings.ExtruderManager.getExtruderValue) + SettingFunction.registerOperator("extruderValues", ExtruderManager.getExtruderValues) + SettingFunction.registerOperator("extruderValue", ExtruderManager.getExtruderValue) ## Add the 4 types of profiles to storage. Resources.addStorageType(self.ResourceTypes.QualityInstanceContainer, "quality") @@ -112,11 +123,12 @@ class CuraApplication(QtApplication): ## Initialise the version upgrade manager with Cura's storage paths. import UM.VersionUpgradeManager #Needs to be here to prevent circular dependencies. - self._version_upgrade_manager = UM.VersionUpgradeManager.VersionUpgradeManager( + + UM.VersionUpgradeManager.VersionUpgradeManager.getInstance().setCurrentVersions( { - ("quality", UM.Settings.InstanceContainer.Version): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"), - ("machine_stack", UM.Settings.ContainerStack.Version): (self.ResourceTypes.MachineStack, "application/x-uranium-containerstack"), - ("preferences", UM.Preferences.Version): (Resources.Preferences, "application/x-uranium-preferences") + ("quality", UM.Settings.InstanceContainer.InstanceContainer.Version): (self.ResourceTypes.QualityInstanceContainer, "application/x-uranium-instancecontainer"), + ("machine_stack", UM.Settings.ContainerStack.ContainerStack.Version): (self.ResourceTypes.MachineStack, "application/x-uranium-containerstack"), + ("preferences", Preferences.Version): (Resources.Preferences, "application/x-uranium-preferences") } ) @@ -125,7 +137,6 @@ class CuraApplication(QtApplication): self._additional_components = {} # Components to add to certain areas in the interface - super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType) self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png"))) @@ -267,6 +278,9 @@ class CuraApplication(QtApplication): self._recent_files.append(QUrl.fromLocalFile(f)) + def getContainerRegistry(self): + return CuraContainerRegistry.getInstance() + def _onEngineCreated(self): self._engine.addImageProvider("camera", CameraImageProvider.CameraImageProvider()) @@ -418,8 +432,8 @@ class CuraApplication(QtApplication): self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Loading interface...")) # Initialise extruder so as to listen to global container stack changes before the first global container stack is set. - cura.Settings.ExtruderManager.getInstance() - qmlRegisterSingletonType(cura.Settings.MachineManager, "Cura", 1, 0, "MachineManager", self.getMachineManager) + ExtruderManager.getInstance() + qmlRegisterSingletonType(MachineManager, "Cura", 1, 0, "MachineManager", self.getMachineManager) qmlRegisterSingletonType(MachineActionManager.MachineActionManager, "Cura", 1, 0, "MachineActionManager", self.getMachineActionManager) self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) @@ -440,7 +454,7 @@ class CuraApplication(QtApplication): def getMachineManager(self, *args): if self._machine_manager is None: - self._machine_manager = cura.Settings.MachineManager.createMachineManager() + self._machine_manager = MachineManager.createMachineManager() return self._machine_manager ## Get the machine action manager @@ -476,17 +490,17 @@ class CuraApplication(QtApplication): qmlRegisterUncreatableType(CuraApplication, "Cura", 1, 0, "ResourceTypes", "Just an Enum type") - qmlRegisterType(cura.Settings.ExtrudersModel, "Cura", 1, 0, "ExtrudersModel") + qmlRegisterType(ExtrudersModel, "Cura", 1, 0, "ExtrudersModel") - qmlRegisterType(cura.Settings.ContainerSettingsModel, "Cura", 1, 0, "ContainerSettingsModel") - qmlRegisterType(cura.Settings.MaterialSettingsVisibilityHandler, "Cura", 1, 0, "MaterialSettingsVisibilityHandler") - qmlRegisterType(cura.Settings.QualitySettingsModel, "Cura", 1, 0, "QualitySettingsModel") + qmlRegisterType(ContainerSettingsModel, "Cura", 1, 0, "ContainerSettingsModel") + qmlRegisterType(MaterialSettingsVisibilityHandler, "Cura", 1, 0, "MaterialSettingsVisibilityHandler") + qmlRegisterType(QualitySettingsModel, "Cura", 1, 0, "QualitySettingsModel") - qmlRegisterSingletonType(cura.Settings.ContainerManager, "Cura", 1, 0, "ContainerManager", cura.Settings.ContainerManager.createContainerManager) + qmlRegisterSingletonType(ContainerManager, "Cura", 1, 0, "ContainerManager", ContainerManager.createContainerManager) qmlRegisterSingletonType(QUrl.fromLocalFile(Resources.getPath(CuraApplication.ResourceTypes.QmlFiles, "Actions.qml")), "Cura", 1, 0, "Actions") - engine.rootContext().setContextProperty("ExtruderManager", cura.Settings.ExtruderManager.getInstance()) + engine.rootContext().setContextProperty("ExtruderManager", ExtruderManager.getInstance()) for path in Resources.getAllResourcesOfType(CuraApplication.ResourceTypes.QmlFiles): type_name = os.path.splitext(os.path.basename(path))[0] diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 096170ba22..b4be3aa924 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -7,7 +7,7 @@ from UM.Application import Application from UM.Qt.Duration import Duration from UM.Preferences import Preferences -import cura.Settings.ExtruderManager +from cura.Settings.ExtruderManager import ExtruderManager import math import os.path @@ -85,7 +85,7 @@ class PrintInformation(QObject): r = Application.getInstance().getGlobalContainerStack().getProperty("material_diameter", "value") / 2 self._material_lengths = [] self._material_weights = [] - extruder_stacks = list(cura.Settings.ExtruderManager.getInstance().getMachineExtruders(Application.getInstance().getGlobalContainerStack().getId())) + extruder_stacks = list(ExtruderManager.getInstance().getMachineExtruders(Application.getInstance().getGlobalContainerStack().getId())) for index, amount in enumerate(material_amounts): ## Find the right extruder stack. As the list isn't sorted because it's a annoying generator, we do some # list comprehension filtering to solve this for us. diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index 8957f386fc..c25a881b57 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -8,17 +8,19 @@ from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal, QUrl from PyQt5.QtWidgets import QMessageBox import UM.PluginRegistry -import UM.Settings import UM.SaveFile import UM.Platform import UM.MimeTypeDatabase import UM.Logger -import cura.Settings - +from UM.Application import Application from UM.MimeTypeDatabase import MimeTypeNotFoundError +from UM.Settings.ContainerRegistry import ContainerRegistry from UM.i18n import i18nCatalog + +from cura.Settings.ExtruderManager import ExtruderManager + catalog = i18nCatalog("cura") ## Manager class that contains common actions to deal with containers in Cura. @@ -30,7 +32,7 @@ class ContainerManager(QObject): def __init__(self, parent = None): super().__init__(parent) - self._registry = UM.Settings.ContainerRegistry.getInstance() + self._registry = ContainerRegistry.getInstance() self._container_name_filters = {} ## Create a duplicate of the specified container @@ -246,7 +248,7 @@ class ContainerManager(QObject): @pyqtSlot(str, result = bool) def isContainerUsed(self, container_id): UM.Logger.log("d", "Checking if container %s is currently used in the active stacks", container_id) - for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): + for stack in ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): if container_id in [child.getId() for child in stack.getContainers()]: UM.Logger.log("d", "The container is in use by %s", stack.getId()) return True @@ -357,12 +359,12 @@ class ContainerManager(QObject): except MimeTypeNotFoundError: return { "status": "error", "message": "Could not determine mime type of file" } - container_type = UM.Settings.ContainerRegistry.getContainerForMimeType(mime_type) + container_type = ContainerRegistry.getContainerForMimeType(mime_type) if not container_type: return { "status": "error", "message": "Could not find a container to handle the specified file."} container_id = urllib.parse.unquote_plus(mime_type.stripExtension(os.path.basename(file_url))) - container_id = UM.Settings.ContainerRegistry.getInstance().uniqueName(container_id) + container_id = ContainerRegistry.getInstance().uniqueName(container_id) container = container_type(container_id) @@ -374,7 +376,7 @@ class ContainerManager(QObject): container.setName(container_id) - UM.Settings.ContainerRegistry.getInstance().addContainer(container) + ContainerRegistry.getInstance().addContainer(container) return { "status": "success", "message": "Successfully imported container {0}".format(container.getName()) } @@ -386,13 +388,13 @@ class ContainerManager(QObject): # \return \type{bool} True if successful, False if not. @pyqtSlot(result = bool) def updateQualityChanges(self): - global_stack = UM.Application.getInstance().getGlobalContainerStack() + global_stack = Application.getInstance().getGlobalContainerStack() if not global_stack: return False - UM.Application.getInstance().getMachineManager().blurSettings.emit() + Application.getInstance().getMachineManager().blurSettings.emit() - for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): + for stack in ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): # Find the quality_changes container for this stack and merge the contents of the top container into it. quality_changes = stack.findContainer(type = "quality_changes") if not quality_changes or quality_changes.isReadOnly(): @@ -401,17 +403,17 @@ class ContainerManager(QObject): self._performMerge(quality_changes, stack.getTop()) - UM.Application.getInstance().getMachineManager().activeQualityChanged.emit() + Application.getInstance().getMachineManager().activeQualityChanged.emit() return True ## Clear the top-most (user) containers of the active stacks. @pyqtSlot() def clearUserContainers(self): - UM.Application.getInstance().getMachineManager().blurSettings.emit() + Application.getInstance().getMachineManager().blurSettings.emit() # Go through global and extruder stacks and clear their topmost container (the user settings). - for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): + for stack in ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): stack.getTop().clear() ## Create quality changes containers from the user containers in the active stacks. @@ -423,7 +425,7 @@ class ContainerManager(QObject): # \return \type{bool} True if the operation was successfully, False if not. @pyqtSlot(result = bool) def createQualityChanges(self): - global_stack = UM.Application.getInstance().getGlobalContainerStack() + global_stack = Application.getInstance().getGlobalContainerStack() if not global_stack: return False @@ -432,12 +434,12 @@ class ContainerManager(QObject): UM.Logger.log("w", "No quality container found in stack %s, cannot create profile", global_stack.getId()) return False - UM.Application.getInstance().getMachineManager().blurSettings.emit() + Application.getInstance().getMachineManager().blurSettings.emit() - unique_name = UM.Settings.ContainerRegistry.getInstance().uniqueName(quality_container.getName()) + unique_name = ContainerRegistry.getInstance().uniqueName(quality_container.getName()) # Go through the active stacks and create quality_changes containers from the user containers. - for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): + for stack in ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): user_container = stack.getTop() quality_container = stack.findContainer(type = "quality") quality_changes_container = stack.findContainer(type = "quality_changes") @@ -541,7 +543,7 @@ class ContainerManager(QObject): container_type = containers[0].getMetaDataEntry("type") if container_type == "quality": for container in self._getFilteredContainers(name = quality_name, type = "quality"): - for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): + for stack in ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): new_changes = self._createQualityChanges(container, new_name, stack.getId()) UM.Settings.ContainerRegistry.getInstance().addContainer(new_changes) elif container_type == "quality_changes": @@ -620,7 +622,7 @@ class ContainerManager(QObject): # # \return A generator that iterates over the list of containers matching the search criteria. def _getFilteredContainers(self, **kwargs): - global_stack = UM.Application.getInstance().getGlobalContainerStack() + global_stack = Application.getInstance().getGlobalContainerStack() if not global_stack: return False @@ -635,7 +637,7 @@ class ContainerManager(QObject): material_ids = [] if filter_by_material: - for stack in cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): + for stack in ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks(): material_ids.append(stack.findContainer(type = "material").getId()) containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 1359ab77b6..adb0b38e8e 100644 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -3,11 +3,14 @@ from PyQt5.QtCore import pyqtSignal, pyqtProperty, pyqtSlot, QObject, QVariant #For communicating data and events to Qt. -import UM.Application #To get the global container stack to find the current machine. -import UM.Logger -import UM.Settings.ContainerRegistry #Finding containers by ID. -import UM.Settings.SettingFunction - +from UM.Application import Application #To get the global container stack to find the current machine. +from UM.Logger import Logger +from UM.Settings.ContainerRegistry import ContainerRegistry #Finding containers by ID. +from UM.Settings.InstanceContainer import InstanceContainer +from UM.Settings.SettingFunction import SettingFunction +from UM.Settings.ContainerStack import ContainerStack +from UM.Settings.DefinitionContainer import DefinitionContainer +from typing import Optional ## Manages all existing extruder stacks. # @@ -22,9 +25,12 @@ class ExtruderManager(QObject): ## Registers listeners and such to listen to changes to the extruders. def __init__(self, parent = None): super().__init__(parent) - self._extruder_trains = { } #Per machine, a dictionary of extruder container stack IDs. - self._active_extruder_index = 0 - UM.Application.getInstance().globalContainerStackChanged.connect(self.__globalContainerStackChanged) + + # Per machine, a dictionary of extruder container stack IDs. + self._extruder_trains = {} # type: Dict[str, Dict[str, ContainerStack]] + + self._active_extruder_index = 0 # type: int + Application.getInstance().globalContainerStackChanged.connect(self.__globalContainerStackChanged) self._addCurrentMachineExtruders() ## Gets the unique identifier of the currently active extruder stack. @@ -34,31 +40,31 @@ class ExtruderManager(QObject): # # \return The unique ID of the currently active extruder stack. @pyqtProperty(str, notify = activeExtruderChanged) - def activeExtruderStackId(self): - if not UM.Application.getInstance().getGlobalContainerStack(): + def activeExtruderStackId(self) -> Optional[str]: + if not Application.getInstance().getGlobalContainerStack(): return None # No active machine, so no active extruder. try: - return self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()][str(self._active_extruder_index)].getId() + return self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()][str(self._active_extruder_index)].getId() except KeyError: # Extruder index could be -1 if the global tab is selected, or the entry doesn't exist if the machine definition is wrong. return None @pyqtProperty(int, notify = extrudersChanged) - def extruderCount(self): - if not UM.Application.getInstance().getGlobalContainerStack(): + def extruderCount(self) -> int: + if not Application.getInstance().getGlobalContainerStack(): return 0 # No active machine, so no extruders. - return len(self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()]) + return len(self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()]) @pyqtProperty("QVariantMap", notify=extrudersChanged) def extruderIds(self): map = {} - for position in self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()]: - map[position] = self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()][position].getId() + for position in self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()]: + map[position] = self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()][position].getId() return map @pyqtSlot(str, result = str) - def getQualityChangesIdByExtruderStackId(self, id): - for position in self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()]: - extruder = self._extruder_trains[UM.Application.getInstance().getGlobalContainerStack().getId()][position] + def getQualityChangesIdByExtruderStackId(self, id: str) -> str: + for position in self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()]: + extruder = self._extruder_trains[Application.getInstance().getGlobalContainerStack().getId()][position] if extruder.getId() == id: return extruder.findContainer(type = "quality_changes").getId() @@ -75,7 +81,7 @@ class ExtruderManager(QObject): # # \return The extruder manager. @classmethod - def getInstance(cls): + def getInstance(cls) -> 'ExtruderManager': if not cls.__instance: cls.__instance = ExtruderManager() return cls.__instance @@ -84,16 +90,16 @@ class ExtruderManager(QObject): # # \param index The index of the new active extruder. @pyqtSlot(int) - def setActiveExtruderIndex(self, index): + def setActiveExtruderIndex(self, index: int) -> None: self._active_extruder_index = index self.activeExtruderChanged.emit() @pyqtProperty(int, notify = activeExtruderChanged) - def activeExtruderIndex(self): + def activeExtruderIndex(self) -> int: return self._active_extruder_index - def getActiveExtruderStack(self): - global_container_stack = UM.Application.getInstance().getGlobalContainerStack() + def getActiveExtruderStack(self) -> ContainerStack: + global_container_stack = Application.getInstance().getGlobalContainerStack() if global_container_stack: if global_container_stack.getId() in self._extruder_trains: if str(self._active_extruder_index) in self._extruder_trains[global_container_stack.getId()]: @@ -102,7 +108,7 @@ class ExtruderManager(QObject): ## Get an extruder stack by index def getExtruderStack(self, index): - global_container_stack = UM.Application.getInstance().getGlobalContainerStack() + global_container_stack = Application.getInstance().getGlobalContainerStack() if global_container_stack: if global_container_stack.getId() in self._extruder_trains: if str(index) in self._extruder_trains[global_container_stack.getId()]: @@ -114,19 +120,19 @@ class ExtruderManager(QObject): # # \param machine_definition The machine definition to add the extruders for. # \param machine_id The machine_id to add the extruders for. - def addMachineExtruders(self, machine_definition, machine_id): + def addMachineExtruders(self, machine_definition: DefinitionContainer, machine_id: str) -> None: changed = False machine_definition_id = machine_definition.getId() if machine_id not in self._extruder_trains: self._extruder_trains[machine_id] = { } changed = True - container_registry = UM.Settings.ContainerRegistry.getInstance() + container_registry = ContainerRegistry.getInstance() if container_registry: # Add the extruder trains that don't exist yet. for extruder_definition in container_registry.findDefinitionContainers(machine = machine_definition_id): position = extruder_definition.getMetaDataEntry("position", None) if not position: - UM.Logger.log("w", "Extruder definition %s specifies no position metadata entry.", extruder_definition.getId()) + Logger.log("w", "Extruder definition %s specifies no position metadata entry.", extruder_definition.getId()) if not container_registry.findContainerStacks(machine = machine_id, position = position): # Doesn't exist yet. self.createExtruderTrain(extruder_definition, machine_definition, position, machine_id) changed = True @@ -138,7 +144,7 @@ class ExtruderManager(QObject): # Make sure the next stack is a stack that contains only the machine definition if not extruder_train.getNextStack(): - shallow_stack = UM.Settings.ContainerStack(machine_id + "_shallow") + shallow_stack = ContainerStack(machine_id + "_shallow") shallow_stack.addContainer(machine_definition) extruder_train.setNextStack(shallow_stack) changed = True @@ -157,14 +163,15 @@ class ExtruderManager(QObject): # \param machine_definition The machine that the extruder train belongs to. # \param position The position of this extruder train in the extruder slots of the machine. # \param machine_id The id of the "global" stack this extruder is linked to. - def createExtruderTrain(self, extruder_definition, machine_definition, position, machine_id): + def createExtruderTrain(self, extruder_definition: DefinitionContainer, machine_definition: DefinitionContainer, + position, machine_id: str) -> None: # Cache some things. - container_registry = UM.Settings.ContainerRegistry.getInstance() + container_registry = ContainerRegistry.getInstance() machine_definition_id = machine_definition.getId() # Create a container stack for this extruder. extruder_stack_id = container_registry.uniqueName(extruder_definition.getId()) - container_stack = UM.Settings.ContainerStack(extruder_stack_id) + container_stack = ContainerStack(extruder_stack_id) container_stack.setName(extruder_definition.getName()) # Take over the display name to display the stack with. container_stack.addMetaDataEntry("type", "extruder_train") container_stack.addMetaDataEntry("machine", machine_id) @@ -184,7 +191,7 @@ class ExtruderManager(QObject): if len(preferred_variants) >= 1: variant = preferred_variants[0] else: - UM.Logger.log("w", "The preferred variant \"%s\" of machine %s doesn't exist or is not a variant profile.", preferred_variant_id, machine_id) + Logger.log("w", "The preferred variant \"%s\" of machine %s doesn't exist or is not a variant profile.", preferred_variant_id, machine_id) # And leave it at the default variant. container_stack.addContainer(variant) @@ -213,7 +220,7 @@ class ExtruderManager(QObject): if len(preferred_materials) >= 1: material = preferred_materials[0] else: - UM.Logger.log("w", "The preferred material \"%s\" of machine %s doesn't exist or is not a material profile.", preferred_material_id, machine_id) + Logger.log("w", "The preferred material \"%s\" of machine %s doesn't exist or is not a material profile.", preferred_material_id, machine_id) # And leave it at the default material. container_stack.addContainer(material) @@ -232,11 +239,11 @@ class ExtruderManager(QObject): if preferred_quality: search_criteria["id"] = preferred_quality - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) if not containers and preferred_quality: - UM.Logger.log("w", "The preferred quality \"%s\" of machine %s doesn't exist or is not a quality profile.", preferred_quality, machine_id) + Logger.log("w", "The preferred quality \"%s\" of machine %s doesn't exist or is not a quality profile.", preferred_quality, machine_id) search_criteria.pop("id", None) - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) if containers: quality = containers[0] @@ -249,7 +256,7 @@ class ExtruderManager(QObject): if user_profile: # There was already a user profile, loaded from settings. user_profile = user_profile[0] else: - user_profile = UM.Settings.InstanceContainer(extruder_stack_id + "_current_settings") # Add an empty user profile. + user_profile = InstanceContainer(extruder_stack_id + "_current_settings") # Add an empty user profile. user_profile.addMetaDataEntry("type", "user") user_profile.addMetaDataEntry("extruder", extruder_stack_id) user_profile.setDefinition(machine_definition) @@ -258,7 +265,7 @@ class ExtruderManager(QObject): # Make sure the next stack is a stack that contains only the machine definition if not container_stack.getNextStack(): - shallow_stack = UM.Settings.ContainerStack(machine_id + "_shallow") + shallow_stack = ContainerStack(machine_id + "_shallow") shallow_stack.addContainer(machine_definition) container_stack.setNextStack(shallow_stack) @@ -269,26 +276,25 @@ class ExtruderManager(QObject): # \param machine_id The machine to remove the extruders for. def removeMachineExtruders(self, machine_id): for extruder in self.getMachineExtruders(machine_id): - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "user", extruder = extruder.getId()) + containers = ContainerRegistry.getInstance().findInstanceContainers(type = "user", extruder = extruder.getId()) for container in containers: - UM.Settings.ContainerRegistry.getInstance().removeContainer(container.getId()) - UM.Settings.ContainerRegistry.getInstance().removeContainer(extruder.getId()) + ContainerRegistry.getInstance().removeContainer(container.getId()) + ContainerRegistry.getInstance().removeContainer(extruder.getId()) ## Returns extruders for a specific machine. # # \param machine_id The machine to get the extruders of. def getMachineExtruders(self, machine_id): if machine_id not in self._extruder_trains: - UM.Logger.log("w", "Tried to get the extruder trains for machine %s, which doesn't exist.", machine_id) - return - for name in self._extruder_trains[machine_id]: - yield self._extruder_trains[machine_id][name] + Logger.log("w", "Tried to get the extruder trains for machine %s, which doesn't exist.", machine_id) + return [] + return [self._extruder_trains[machine_id][name] for name in self._extruder_trains[machine_id]] ## Returns a generator that will iterate over the global stack and per-extruder stacks. # # The first generated element is the global container stack. After that any extruder stacks are generated. def getActiveGlobalAndExtruderStacks(self): - global_stack = UM.Application.getInstance().getGlobalContainerStack() + global_stack = Application.getInstance().getGlobalContainerStack() if not global_stack: return @@ -298,13 +304,13 @@ class ExtruderManager(QObject): for name in self._extruder_trains[global_id]: yield self._extruder_trains[global_id][name] - def __globalContainerStackChanged(self): + def __globalContainerStackChanged(self) -> None: self._addCurrentMachineExtruders() self.activeExtruderChanged.emit() ## Adds the extruders of the currently active machine. - def _addCurrentMachineExtruders(self): - global_stack = UM.Application.getInstance().getGlobalContainerStack() + def _addCurrentMachineExtruders(self) -> None: + global_stack = Application.getInstance().getGlobalContainerStack() if global_stack and global_stack.getBottom(): self.addMachineExtruders(global_stack.getBottom(), global_stack.getId()) @@ -318,7 +324,7 @@ class ExtruderManager(QObject): # If no extruder has the value, the list will contain the global value. @staticmethod def getExtruderValues(key): - global_stack = UM.Application.getInstance().getGlobalContainerStack() + global_stack = Application.getInstance().getGlobalContainerStack() result = [] for extruder in ExtruderManager.getInstance().getMachineExtruders(global_stack.getId()): @@ -327,7 +333,7 @@ class ExtruderManager(QObject): if not value: continue - if isinstance(value, UM.Settings.SettingFunction): + if isinstance(value, SettingFunction): value = value(extruder) result.append(value) @@ -363,9 +369,9 @@ class ExtruderManager(QObject): if extruder: value = extruder.getRawProperty(key, "value") - if isinstance(value, UM.Settings.SettingFunction): + if isinstance(value, SettingFunction): value = value(extruder) else: #Just a value from global. - value = UM.Application.getInstance().getGlobalContainerStack().getProperty(key, "value") + value = Application.getInstance().getGlobalContainerStack().getProperty(key, "value") return value diff --git a/cura/Settings/ExtrudersModel.py b/cura/Settings/ExtrudersModel.py index 155f1a0df1..4c5a755007 100644 --- a/cura/Settings/ExtrudersModel.py +++ b/cura/Settings/ExtrudersModel.py @@ -5,7 +5,7 @@ from PyQt5.QtCore import Qt, pyqtSignal, pyqtProperty import UM.Qt.ListModel -from . import ExtruderManager +from cura.Settings.ExtruderManager import ExtruderManager ## Model that holds extruders. # @@ -100,7 +100,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): self.clear() changed = True - global_container_stack = UM.Application.getInstance().getGlobalContainerStack() + global_container_stack = UM.Application.Application.getInstance().getGlobalContainerStack() if global_container_stack: if self._add_global: material = global_container_stack.findContainer({ "type": "material" }) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 823e59b4b8..9165d49e15 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1,5 +1,6 @@ # Copyright (c) 2016 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. +from typing import Union from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal from PyQt5.QtWidgets import QMessageBox @@ -7,13 +8,14 @@ from PyQt5.QtWidgets import QMessageBox from UM.Application import Application from UM.Preferences import Preferences from UM.Logger import Logger - +from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.Settings.InstanceContainer import InstanceContainer from UM.Settings.SettingRelation import RelationType - -import UM.Settings +from UM.Settings.ContainerStack import ContainerStack +from UM.Settings.Validator import ValidatorState from cura.PrinterOutputDevice import PrinterOutputDevice -from . import ExtruderManager +from cura.Settings.ExtruderManager import ExtruderManager from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") @@ -24,8 +26,8 @@ class MachineManager(QObject): def __init__(self, parent = None): super().__init__(parent) - self._active_container_stack = None - self._global_container_stack = None + self._active_container_stack = None # type: ContainerStack + self._global_container_stack = None # type: ContainerStack Application.getInstance().globalContainerStackChanged.connect(self._onGlobalContainerChanged) ## When the global container is changed, active material probably needs to be updated. @@ -47,10 +49,10 @@ class MachineManager(QObject): self.globalValueChanged.connect(self.activeStackChanged) ExtruderManager.getInstance().activeExtruderChanged.connect(self.activeStackChanged) - self._empty_variant_container = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = "empty_variant")[0] - self._empty_material_container = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = "empty_material")[0] - self._empty_quality_container = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = "empty_quality")[0] - self._empty_quality_changes_container = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = "empty_quality_changes")[0] + self._empty_variant_container = ContainerRegistry.getInstance().findInstanceContainers(id = "empty_variant")[0] + self._empty_material_container = ContainerRegistry.getInstance().findInstanceContainers(id = "empty_material")[0] + self._empty_quality_container = ContainerRegistry.getInstance().findInstanceContainers(id = "empty_quality")[0] + self._empty_quality_changes_container = ContainerRegistry.getInstance().findInstanceContainers(id = "empty_quality_changes")[0] Preferences.getInstance().addPreference("cura/active_machine", "") @@ -84,7 +86,7 @@ class MachineManager(QObject): outputDevicesChanged = pyqtSignal() - def _onOutputDevicesChanged(self): + def _onOutputDevicesChanged(self) -> None: for printer_output_device in self._printer_output_devices: printer_output_device.hotendIdChanged.disconnect(self._onHotendIdChanged) printer_output_device.materialIdChanged.disconnect(self._onMaterialIdChanged) @@ -103,14 +105,15 @@ class MachineManager(QObject): def printerOutputDevices(self): return self._printer_output_devices - def _onHotendIdChanged(self, index, hotend_id): + def _onHotendIdChanged(self, index: Union[str,int], hotend_id: str) -> None: if not self._global_container_stack: return - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type="variant", definition=self._global_container_stack.getBottom().getId(), name=hotend_id) + containers = ContainerRegistry.getInstance().findInstanceContainers(type="variant", definition=self._global_container_stack.getBottom().getId(), name=hotend_id) if containers: # New material ID is known extruder_manager = ExtruderManager.getInstance() - extruders = list(extruder_manager.getMachineExtruders(self.activeMachineId)) + machine_id = self.activeMachineId + extruders = extruder_manager.getMachineExtruders(machine_id) matching_extruder = None for extruder in extruders: if str(index) == extruder.getMetaDataEntry("position"): @@ -147,7 +150,7 @@ class MachineManager(QObject): if self._global_container_stack.getMetaDataEntry("has_machine_materials", False): definition_id = self._global_container_stack.getBottom().getId() extruder_manager = ExtruderManager.getInstance() - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "material", definition = definition_id, GUID = material_id) + containers = ContainerRegistry.getInstance().findInstanceContainers(type = "material", definition = definition_id, GUID = material_id) if containers: # New material ID is known extruders = list(extruder_manager.getMachineExtruders(self.activeMachineId)) matching_extruder = None @@ -262,7 +265,7 @@ class MachineManager(QObject): changed_validation_state = self._active_container_stack.getProperty(key, property_name) else: changed_validation_state = self._global_container_stack.getProperty(key, property_name) - if changed_validation_state in (UM.Settings.ValidatorState.Exception, UM.Settings.ValidatorState.MaximumError, UM.Settings.ValidatorState.MinimumError): + if changed_validation_state in (ValidatorState.Exception, ValidatorState.MaximumError, ValidatorState.MinimumError): self._active_stack_valid = False self.activeValidationChanged.emit() else: @@ -273,19 +276,19 @@ class MachineManager(QObject): self.activeStackChanged.emit() @pyqtSlot(str) - def setActiveMachine(self, stack_id): - containers = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = stack_id) + def setActiveMachine(self, stack_id: str) -> None: + containers = ContainerRegistry.getInstance().findContainerStacks(id = stack_id) if containers: Application.getInstance().setGlobalContainerStack(containers[0]) @pyqtSlot(str, str) - def addMachine(self, name, definition_id): - container_registry = UM.Settings.ContainerRegistry.getInstance() + def addMachine(self, name: str, definition_id: str) -> None: + container_registry = ContainerRegistry.getInstance() definitions = container_registry.findDefinitionContainers(id = definition_id) if definitions: definition = definitions[0] name = self._createUniqueName("machine", "", name, definition.getName()) - new_global_stack = UM.Settings.ContainerStack(name) + new_global_stack = ContainerStack(name) new_global_stack.addMetaDataEntry("type", "machine") container_registry.addContainer(new_global_stack) @@ -293,7 +296,7 @@ class MachineManager(QObject): material_instance_container = self._updateMaterialContainer(definition, variant_instance_container) quality_instance_container = self._updateQualityContainer(definition, variant_instance_container, material_instance_container) - current_settings_instance_container = UM.Settings.InstanceContainer(name + "_current_settings") + current_settings_instance_container = InstanceContainer(name + "_current_settings") current_settings_instance_container.addMetaDataEntry("machine", name) current_settings_instance_container.addMetaDataEntry("type", "user") current_settings_instance_container.setDefinition(definitions[0]) @@ -321,8 +324,9 @@ class MachineManager(QObject): # \param new_name \type{string} Base name, which may not be unique # \param fallback_name \type{string} Name to use when (stripped) new_name is empty # \return \type{string} Name that is unique for the specified type and name/id - def _createUniqueName(self, container_type, current_name, new_name, fallback_name): - return UM.Settings.ContainerRegistry.getInstance().createUniqueName(container_type, current_name, new_name, fallback_name) + def _createUniqueName(self, container_type: str, current_name: str, new_name: str, fallback_name: str) -> str: + Logger.log('d', str(ContainerRegistry.getInstance())) + return ContainerRegistry.getInstance().createUniqueName(container_type, current_name, new_name, fallback_name) ## Convenience function to check if a stack has errors. def _checkStackForErrors(self, stack): @@ -331,7 +335,7 @@ class MachineManager(QObject): for key in stack.getAllKeys(): validation_state = stack.getProperty(key, "validationState") - if validation_state in (UM.Settings.ValidatorState.Exception, UM.Settings.ValidatorState.MaximumError, UM.Settings.ValidatorState.MinimumError): + if validation_state in (ValidatorState.Exception, ValidatorState.MaximumError, ValidatorState.MinimumError): return True return False @@ -364,39 +368,39 @@ class MachineManager(QObject): # Note that the _active_stack_valid is cached due to performance issues # Calling _checkStackForErrors on every change is simply too expensive @pyqtProperty(bool, notify = activeValidationChanged) - def isActiveStackValid(self): + def isActiveStackValid(self) -> bool: return bool(self._active_stack_valid) @pyqtProperty(str, notify = activeStackChanged) - def activeUserProfileId(self): + def activeUserProfileId(self) -> str: if self._active_container_stack: return self._active_container_stack.getTop().getId() return "" @pyqtProperty(str, notify = globalContainerChanged) - def activeMachineName(self): + def activeMachineName(self) -> str: if self._global_container_stack: return self._global_container_stack.getName() return "" @pyqtProperty(str, notify = globalContainerChanged) - def activeMachineId(self): + def activeMachineId(self) -> str: if self._global_container_stack: return self._global_container_stack.getId() return "" @pyqtProperty(str, notify = activeStackChanged) - def activeStackId(self): + def activeStackId(self) -> str: if self._active_container_stack: return self._active_container_stack.getId() return "" @pyqtProperty(str, notify = activeMaterialChanged) - def activeMaterialName(self): + def activeMaterialName(self) -> str: if self._active_container_stack: material = self._active_container_stack.findContainer({"type":"material"}) if material: @@ -405,7 +409,7 @@ class MachineManager(QObject): return "" @pyqtProperty(str, notify=activeMaterialChanged) - def activeMaterialId(self): + def activeMaterialId(self) -> str: if self._active_container_stack: material = self._active_container_stack.findContainer({"type": "material"}) if material: @@ -430,7 +434,7 @@ class MachineManager(QObject): return result @pyqtProperty(str, notify=activeQualityChanged) - def activeQualityMaterialId(self): + def activeQualityMaterialId(self) -> str: if self._active_container_stack: quality = self._active_container_stack.findContainer({"type": "quality"}) if quality: @@ -478,8 +482,8 @@ class MachineManager(QObject): ## Check if a container is read_only @pyqtSlot(str, result = bool) - def isReadOnly(self, container_id): - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = container_id) + def isReadOnly(self, container_id) -> bool: + containers = ContainerRegistry.getInstance().findInstanceContainers(id = container_id) if not containers or not self._active_container_stack: return True return containers[0].isReadOnly() @@ -499,7 +503,7 @@ class MachineManager(QObject): @pyqtSlot(str) def setActiveMaterial(self, material_id): - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = material_id) + containers = ContainerRegistry.getInstance().findInstanceContainers(id = material_id) if not containers or not self._active_container_stack: return @@ -532,7 +536,7 @@ class MachineManager(QObject): @pyqtSlot(str) def setActiveVariant(self, variant_id): - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = variant_id) + containers = ContainerRegistry.getInstance().findInstanceContainers(id = variant_id) if not containers or not self._active_container_stack: return old_variant = self._active_container_stack.findContainer({"type": "variant"}) @@ -541,7 +545,6 @@ class MachineManager(QObject): variant_index = self._active_container_stack.getContainerIndex(old_variant) self._active_container_stack.replaceContainer(variant_index, containers[0]) - preferred_material = None if old_material: preferred_material_name = old_material.getName() self.setActiveMaterial(self._updateMaterialContainer(self._global_container_stack.getBottom(), containers[0], preferred_material_name).id) @@ -550,7 +553,7 @@ class MachineManager(QObject): @pyqtSlot(str) def setActiveQuality(self, quality_id): - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = quality_id) + containers = ContainerRegistry.getInstance().findInstanceContainers(id = quality_id) if not containers or not self._global_container_stack: return @@ -563,7 +566,7 @@ class MachineManager(QObject): quality_container = containers[0] elif container_type == "quality_changes": quality_changes_container = containers[0] - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers( + containers = ContainerRegistry.getInstance().findInstanceContainers( quality_type = quality_changes_container.getMetaDataEntry("quality")) if not containers: Logger.log("e", "Could not find quality %s for changes %s, not changing quality", quality_changes_container.getMetaDataEntry("quality"), quality_changes_container.getId()) @@ -591,10 +594,10 @@ class MachineManager(QObject): else: criteria["definition"] = "fdmprinter" - stack_quality = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) + stack_quality = ContainerRegistry.getInstance().findInstanceContainers(**criteria) if not stack_quality: criteria.pop("extruder") - stack_quality = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) + stack_quality = ContainerRegistry.getInstance().findInstanceContainers(**criteria) if not stack_quality: stack_quality = quality_container else: @@ -603,7 +606,7 @@ class MachineManager(QObject): stack_quality = stack_quality[0] if quality_changes_container != self._empty_quality_changes_container: - stack_quality_changes = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(name = quality_changes_container.getName(), extruder = extruder_id)[0] + stack_quality_changes = ContainerRegistry.getInstance().findInstanceContainers(name = quality_changes_container.getName(), extruder = extruder_id)[0] else: stack_quality_changes = self._empty_quality_changes_container @@ -683,7 +686,7 @@ class MachineManager(QObject): @pyqtSlot(str, str) def renameMachine(self, machine_id, new_name): - containers = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = machine_id) + containers = ContainerRegistry.getInstance().findContainerStacks(id = machine_id) if containers: new_name = self._createUniqueName("machine", containers[0].getName(), new_name, containers[0].getBottom().getName()) containers[0].setName(new_name) @@ -696,13 +699,13 @@ class MachineManager(QObject): ExtruderManager.getInstance().removeMachineExtruders(machine_id) - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "user", machine = machine_id) + containers = ContainerRegistry.getInstance().findInstanceContainers(type = "user", machine = machine_id) for container in containers: - UM.Settings.ContainerRegistry.getInstance().removeContainer(container.getId()) - UM.Settings.ContainerRegistry.getInstance().removeContainer(machine_id) + ContainerRegistry.getInstance().removeContainer(container.getId()) + ContainerRegistry.getInstance().removeContainer(machine_id) if activate_new_machine: - stacks = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(type = "machine") + stacks = ContainerRegistry.getInstance().findContainerStacks(type = "machine") if stacks: Application.getInstance().setGlobalContainerStack(stacks[0]) @@ -743,7 +746,7 @@ class MachineManager(QObject): # \returns DefinitionID (string) if found, None otherwise @pyqtSlot(str, result = str) def getDefinitionByMachineId(self, machine_id): - containers = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id=machine_id) + containers = ContainerRegistry.getInstance().findContainerStacks(id=machine_id) if containers: return containers[0].getBottom().getId() @@ -758,10 +761,10 @@ class MachineManager(QObject): containers = [] preferred_variant = definition.getMetaDataEntry("preferred_variant") if preferred_variant: - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "variant", definition = definition.id, id = preferred_variant) + containers = ContainerRegistry.getInstance().findInstanceContainers(type = "variant", definition = definition.id, id = preferred_variant) if not containers: - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "variant", definition = definition.id) + containers = ContainerRegistry.getInstance().findInstanceContainers(type = "variant", definition = definition.id) if containers: return containers[0] @@ -789,7 +792,7 @@ class MachineManager(QObject): if preferred_material: search_criteria["id"] = preferred_material - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) if containers: return containers[0] @@ -798,14 +801,14 @@ class MachineManager(QObject): search_criteria.pop("name", None) search_criteria.pop("id", None) - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) if containers: return containers[0] return self._empty_material_container def _updateQualityContainer(self, definition, variant_container, material_container = None, preferred_quality_name = None): - container_registry = UM.Settings.ContainerRegistry.getInstance() + container_registry = ContainerRegistry.getInstance() search_criteria = { "type": "quality" } if definition.getMetaDataEntry("has_machine_quality"): @@ -870,7 +873,7 @@ class MachineManager(QObject): # \param preferred_quality_changes_name The name of the quality-changes to # pick, if any such quality-changes profile is available. def _updateQualityChangesContainer(self, quality_type, preferred_quality_changes_name = None): - container_registry = UM.Settings.ContainerRegistry.getInstance() # Cache. + container_registry = ContainerRegistry.getInstance() # Cache. search_criteria = { "type": "quality_changes" } search_criteria["quality"] = quality_type diff --git a/cura/Settings/MaterialSettingsVisibilityHandler.py b/cura/Settings/MaterialSettingsVisibilityHandler.py index 7286f509bf..8a16832f5e 100644 --- a/cura/Settings/MaterialSettingsVisibilityHandler.py +++ b/cura/Settings/MaterialSettingsVisibilityHandler.py @@ -1,9 +1,9 @@ # Copyright (c) 2016 Ultimaker B.V. # Uranium is released under the terms of the AGPLv3 or higher. -import UM.Settings.Models +from UM.Settings.Models.SettingVisibilityHandler import SettingVisibilityHandler -class MaterialSettingsVisibilityHandler(UM.Settings.Models.SettingVisibilityHandler): +class MaterialSettingsVisibilityHandler(SettingVisibilityHandler): def __init__(self, parent = None, *args, **kwargs): super().__init__(parent = parent, *args, **kwargs) diff --git a/cura/Settings/QualitySettingsModel.py b/cura/Settings/QualitySettingsModel.py index 4362dd51d8..589b0da7cb 100644 --- a/cura/Settings/QualitySettingsModel.py +++ b/cura/Settings/QualitySettingsModel.py @@ -5,11 +5,10 @@ import collections from PyQt5.QtCore import pyqtProperty, pyqtSignal, Qt -import UM.Application import UM.Logger import UM.Qt -import UM.Settings - +from UM.Application import Application +from UM.Settings.ContainerRegistry import ContainerRegistry class QualitySettingsModel(UM.Qt.ListModel.ListModel): KeyRole = Qt.UserRole + 1 @@ -75,7 +74,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel): settings = collections.OrderedDict() definition_container = UM.Application.getInstance().getGlobalContainerStack().getBottom() - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = self._quality) + containers = ContainerRegistry.getInstance().findInstanceContainers(id = self._quality) if not containers: UM.Logger.log("w", "Could not find a quality container with id %s", self._quality) return @@ -97,7 +96,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel): if self._material: criteria["material"] = self._material - quality_container = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) + quality_container = ContainerRegistry.getInstance().findInstanceContainers(**criteria) if not quality_container: UM.Logger.log("w", "Could not find a quality container matching quality changes %s", quality_changes_container.getId()) return @@ -113,22 +112,22 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel): criteria["extruder"] = self._extruder_id - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**criteria) if not containers: # Try again, this time without extruder new_criteria = criteria.copy() new_criteria.pop("extruder") - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**new_criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**new_criteria) if not containers: # Try again, this time without material criteria.pop("material") - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**criteria) if not containers: # Try again, this time without material or extruder criteria.pop("extruder") # "material" has already been popped - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**criteria) if not containers: UM.Logger.log("Could not find any quality containers matching the search criteria %s" % str(criteria)) @@ -136,7 +135,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel): if quality_changes_container: criteria = {"type": "quality_changes", "quality": quality_type, "extruder": self._extruder_id, "definition": definition_id } - changes = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) + changes = ContainerRegistry.getInstance().findInstanceContainers(**criteria) if changes: containers.extend(changes) @@ -154,9 +153,9 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel): user_value = None if not self._extruder_id: - user_value = UM.Application.getInstance().getGlobalContainerStack().getTop().getProperty(definition.key, "value") + user_value = Application.getInstance().getGlobalContainerStack().getTop().getProperty(definition.key, "value") else: - extruder_stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = self._extruder_id) + extruder_stack = ContainerRegistry.getInstance().findContainerStacks(id = self._extruder_id) if extruder_stack: user_value = extruder_stack[0].getTop().getProperty(definition.key, "value") diff --git a/cura/Settings/__init__.py b/cura/Settings/__init__.py index 5daa00c84f..c00ee15ebf 100644 --- a/cura/Settings/__init__.py +++ b/cura/Settings/__init__.py @@ -1,13 +1,2 @@ # Copyright (c) 2016 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. - -from .MaterialSettingsVisibilityHandler import MaterialSettingsVisibilityHandler -from .ContainerManager import ContainerManager -from .ContainerSettingsModel import ContainerSettingsModel -from .CuraContainerRegistry import CuraContainerRegistry -from .ExtruderManager import ExtruderManager -from .ExtrudersModel import ExtrudersModel -from .MachineManager import MachineManager -from .MaterialSettingsVisibilityHandler import MaterialSettingsVisibilityHandler -from .SettingOverrideDecorator import SettingOverrideDecorator -from .QualitySettingsModel import QualitySettingsModel diff --git a/cura_app.py b/cura_app.py index 5c3ea811b5..6c75e49fb7 100755 --- a/cura_app.py +++ b/cura_app.py @@ -55,8 +55,5 @@ if Platform.isWindows() and hasattr(sys, "frozen"): sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w") sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w") -# Force an instance of CuraContainerRegistry to be created and reused later. -cura.Settings.CuraContainerRegistry.getInstance() - app = cura.CuraApplication.CuraApplication.getInstance() app.run() diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 9e6bec45e4..ff4a92a6e0 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -82,7 +82,7 @@ class CuraEngineBackend(Backend): self._onGlobalStackChanged() self._active_extruder_stack = None - cura.Settings.ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged) + cura.Settings.ExtruderManager.ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged) self._onActiveExtruderChanged() # When you update a setting and other settings get changed through inheritance, many propertyChanged signals are fired. @@ -449,7 +449,7 @@ class CuraEngineBackend(Backend): if self._active_extruder_stack: self._active_extruder_stack.containersChanged.disconnect(self._onChanged) - self._active_extruder_stack = cura.Settings.ExtruderManager.getInstance().getActiveExtruderStack() + self._active_extruder_stack = cura.Settings.ExtruderManager.ExtruderManager.getInstance().getActiveExtruderStack() if self._active_extruder_stack: self._active_extruder_stack.containersChanged.connect(self._onChanged) diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.py b/plugins/MachineSettingsAction/MachineSettingsAction.py index a37aa9c5cb..56206e010f 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.py +++ b/plugins/MachineSettingsAction/MachineSettingsAction.py @@ -9,7 +9,7 @@ import cura.Settings.CuraContainerRegistry import UM.Application import UM.Settings.InstanceContainer import UM.Settings.DefinitionContainer -import UM.Logger +from UM.Logger import Logger import UM.i18n catalog = UM.i18n.i18nCatalog("cura") @@ -19,10 +19,10 @@ class MachineSettingsAction(MachineAction): super().__init__("MachineSettingsAction", catalog.i18nc("@action", "Machine Settings")) self._qml_url = "MachineSettingsAction.qml" - cura.Settings.CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded) + cura.Settings.CuraContainerRegistry.CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded) def _reset(self): - global_container_stack = UM.Application.getInstance().getGlobalContainerStack() + global_container_stack = UM.Application.Application.getInstance().getGlobalContainerStack() if global_container_stack: variant = global_container_stack.findContainer({"type": "variant"}) if variant and variant.getId() == "empty_variant": @@ -39,28 +39,28 @@ class MachineSettingsAction(MachineAction): def _onContainerAdded(self, container): # Add this action as a supported action to all machine definitions - if isinstance(container, UM.Settings.DefinitionContainer) and container.getMetaDataEntry("type") == "machine": + if isinstance(container, UM.Settings.DefinitionContainer.DefinitionContainer) and container.getMetaDataEntry("type") == "machine": if container.getProperty("machine_extruder_count", "value") > 1: # Multiextruder printers are not currently supported - UM.Logger.log("d", "Not attaching MachineSettingsAction to %s; Multi-extrusion printers are not supported", container.getId()) + Logger.log("d", "Not attaching MachineSettingsAction to %s; Multi-extrusion printers are not supported", container.getId()) return if container.getMetaDataEntry("has_variants", False): # Machines that use variants are not currently supported - UM.Logger.log("d", "Not attaching MachineSettingsAction to %s; Machines that use variants are not supported", container.getId()) + Logger.log("d", "Not attaching MachineSettingsAction to %s; Machines that use variants are not supported", container.getId()) return - UM.Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey()) + UM.Application.Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey()) @pyqtSlot() def forceUpdate(self): # Force rebuilding the build volume by reloading the global container stack. # This is a bit of a hack, but it seems quick enough. - UM.Application.getInstance().globalContainerStackChanged.emit() + UM.Application.Application.getInstance().globalContainerStackChanged.emit() @pyqtSlot() def updateHasMaterialsMetadata(self): # Updates the has_materials metadata flag after switching gcode flavor - global_container_stack = UM.Application.getInstance().getGlobalContainerStack() + global_container_stack = UM.Application.Application.getInstance().getGlobalContainerStack() if global_container_stack: definition = global_container_stack.getBottom() if definition.getProperty("machine_gcode_flavor", "value") == "UltiGCode" and not definition.getMetaDataEntry("has_materials", False): diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingVisibilityHandler.py b/plugins/PerObjectSettingsTool/PerObjectSettingVisibilityHandler.py index b4086291ca..42b30969be 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingVisibilityHandler.py +++ b/plugins/PerObjectSettingsTool/PerObjectSettingVisibilityHandler.py @@ -6,14 +6,14 @@ from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal from UM.Application import Application from UM.Settings.SettingInstance import SettingInstance from UM.Logger import Logger -import UM.Settings.Models +import UM.Settings.Models.SettingVisibilityHandler from cura.Settings.ExtruderManager import ExtruderManager #To get global-inherits-stack setting values from different extruders. from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator ## The per object setting visibility handler ensures that only setting # definitions that have a matching instance Container are returned as visible. -class PerObjectSettingVisibilityHandler(UM.Settings.Models.SettingVisibilityHandler): +class PerObjectSettingVisibilityHandler(UM.Settings.Models.SettingVisibilityHandler.SettingVisibilityHandler): def __init__(self, parent = None, *args, **kwargs): super().__init__(parent = parent, *args, **kwargs) diff --git a/plugins/SolidView/SolidView.py b/plugins/SolidView/SolidView.py index 3e3501a83f..d5995a1390 100644 --- a/plugins/SolidView/SolidView.py +++ b/plugins/SolidView/SolidView.py @@ -13,6 +13,7 @@ from UM.Settings.Validator import ValidatorState from UM.View.GL.OpenGL import OpenGL import cura.Settings +import cura.Settings.ExtrudersModel import math @@ -26,7 +27,7 @@ class SolidView(View): self._enabled_shader = None self._disabled_shader = None - self._extruders_model = cura.Settings.ExtrudersModel() + self._extruders_model = cura.Settings.ExtrudersModel.ExtrudersModel() def beginRendering(self): scene = self.getController().getScene() diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py index 4ac86f9a1d..84cbc390a7 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py @@ -25,7 +25,7 @@ class Profile: # # \param serialised A string with the contents of a profile. # \param filename The supposed filename of the profile, without extension. - def __init__(self, serialised, filename): + def __init__(self, serialised: str, filename: str): self._filename = filename parser = configparser.ConfigParser(interpolation = None) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 77f775ee27..fabd84963a 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -11,11 +11,11 @@ from UM.Logger import Logger from UM.Util import parseBool import UM.Dictionary - -import UM.Settings +from UM.Settings.InstanceContainer import InstanceContainer +from UM.Settings.ContainerRegistry import ContainerRegistry ## Handles serializing and deserializing material containers from an XML file -class XmlMaterialProfile(UM.Settings.InstanceContainer): +class XmlMaterialProfile(InstanceContainer): def __init__(self, container_id, *args, **kwargs): super().__init__(container_id, *args, **kwargs) @@ -24,7 +24,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): base_file = self.getMetaDataEntry("base_file", None) if base_file != self.id: - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = base_file) + containers = ContainerRegistry.getInstance().findInstanceContainers(id = base_file) if containers: new_basefile = containers[0].duplicate(self.getMetaDataEntry("brand") + "_" + new_id, new_name) base_file = new_basefile.id @@ -33,14 +33,14 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): new_id = self.getMetaDataEntry("brand") + "_" + new_id + "_" + self.getDefinition().getId() variant = self.getMetaDataEntry("variant") if variant: - variant_containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = variant) + variant_containers = ContainerRegistry.getInstance().findInstanceContainers(id = variant) if variant_containers: new_id += "_" + variant_containers[0].getName().replace(" ", "_") has_base_file = True else: has_base_file = False - new_id = UM.Settings.ContainerRegistry.getInstance().createUniqueName("material", self._id, new_id, "") + new_id = ContainerRegistry.getInstance().createUniqueName("material", self._id, new_id, "") result = super().duplicate(new_id, new_name) if has_base_file: result.setMetaDataEntry("base_file", base_file) @@ -53,7 +53,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): super().setReadOnly(read_only) basefile = self.getMetaDataEntry("base_file", self._id) #if basefile is none, this is a basefile. - for container in UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): + for container in ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): container._read_only = read_only ## Overridden from InstanceContainer @@ -65,7 +65,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): basefile = self.getMetaDataEntry("base_file", self._id) #if basefile is none, this is a basefile. # Update all containers that share GUID and basefile - for container in UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): + for container in ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): container.setMetaData(copy.deepcopy(self._metadata)) ## Overridden from InstanceContainer, similar to setMetaDataEntry. @@ -84,7 +84,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): basefile = self.getMetaDataEntry("base_file", self._id) # if basefile is none, this is a basefile. # Update the basefile as well, this is actually what we're trying to do # Update all containers that share GUID and basefile - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile) + containers = ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile) for container in containers: container.setName(new_name) @@ -96,12 +96,12 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): super().setProperty(key, property_name, property_value) basefile = self.getMetaDataEntry("base_file", self._id) #if basefile is none, this is a basefile. - for container in UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): + for container in ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): container._dirty = True ## Overridden from InstanceContainer def serialize(self): - registry = UM.Settings.ContainerRegistry.getInstance() + registry = ContainerRegistry.getInstance() base_file = self.getMetaDataEntry("base_file", "") if base_file and self.id != base_file: @@ -296,7 +296,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): self.addMetaDataEntry("properties", property_values) - self.setDefinition(UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = "fdmprinter")[0]) + self.setDefinition(ContainerRegistry.getInstance().findDefinitionContainers(id = "fdmprinter")[0]) global_compatibility = True global_setting_values = {} @@ -336,7 +336,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): Logger.log("w", "Cannot create material for unknown machine %s", identifier.get("product")) continue - definitions = UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = machine_id) + definitions = ContainerRegistry.getInstance().findDefinitionContainers(id = machine_id) if not definitions: Logger.log("w", "No definition found for machine ID %s", machine_id) continue @@ -357,7 +357,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): new_material._dirty = False - UM.Settings.ContainerRegistry.getInstance().addContainer(new_material) + ContainerRegistry.getInstance().addContainer(new_material) hotends = machine.iterfind("./um:hotend", self.__namespaces) for hotend in hotends: @@ -365,10 +365,10 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): if hotend_id is None: continue - variant_containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = hotend_id) + variant_containers = ContainerRegistry.getInstance().findInstanceContainers(id = hotend_id) if not variant_containers: # It is not really properly defined what "ID" is so also search for variants by name. - variant_containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(definition = definition.id, name = hotend_id) + variant_containers = ContainerRegistry.getInstance().findInstanceContainers(definition = definition.id, name = hotend_id) if not variant_containers: Logger.log("d", "No variants found with ID or name %s for machine %s", hotend_id, definition.id) @@ -406,7 +406,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): new_hotend_material.setProperty(key, "value", value, definition) new_hotend_material._dirty = False - UM.Settings.ContainerRegistry.getInstance().addContainer(new_hotend_material) + ContainerRegistry.getInstance().addContainer(new_hotend_material) if not global_compatibility: # Change the type of this container so it is not shown as an option in menus. From 5884509af1f785d6c48b0af294ae9a989ecb2155 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 22 Nov 2016 11:51:18 +0100 Subject: [PATCH 002/197] More type checking fixes after the merge. CURA-2917 --- cura/QualityManager.py | 2 +- cura/Settings/ContainerManager.py | 2 +- cura/Settings/ProfilesModel.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/QualityManager.py b/cura/QualityManager.py index 0b4353442e..5b4d743ae9 100644 --- a/cura/QualityManager.py +++ b/cura/QualityManager.py @@ -18,7 +18,7 @@ class QualityManager: QualityManager.__instance = cls() return QualityManager.__instance - __instance = None + __instance = None # type: 'QualityManager' ## Find a quality by name for a specific machine definition and materials. # diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index 91db12926d..3262f7cbb6 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -694,7 +694,7 @@ class ContainerManager(QObject): ContainerManager.__instance = cls() return ContainerManager.__instance - __instance = None + __instance = None # type: 'ContainerManager' # Factory function, used by QML @staticmethod diff --git a/cura/Settings/ProfilesModel.py b/cura/Settings/ProfilesModel.py index c03e074053..d60a633549 100644 --- a/cura/Settings/ProfilesModel.py +++ b/cura/Settings/ProfilesModel.py @@ -38,7 +38,7 @@ class ProfilesModel(InstanceContainersModel): ProfilesModel.__instance = cls() return ProfilesModel.__instance - __instance = None + __instance = None # type: 'ProfilesModel' ## Fetch the list of containers to display. # From 74e5798509b274908fc98b704fdc7848c6ab4e27 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 12 Dec 2016 16:05:35 +0100 Subject: [PATCH 003/197] Lots of import fixes. Eliminated the import hacks such as those used inside UM/Settings/__init__.py. CURA-2917 --- cura/BuildVolume.py | 6 +- cura/ConvexHullDecorator.py | 12 +-- cura/CuraApplication.py | 2 +- cura/PrinterOutputDevice.py | 6 +- cura/QualityManager.py | 32 ++++---- cura/Settings/ContainerManager.py | 78 ++++++++++--------- cura/Settings/MachineNameValidator.py | 8 +- cura/Settings/QualitySettingsModel.py | 4 +- cura/Settings/SettingInheritanceManager.py | 22 +++--- cura/Settings/SettingOverrideDecorator.py | 8 +- cura_app.py | 3 + plugins/3MFReader/ThreeMFReader.py | 3 +- .../CuraEngineBackend/CuraEngineBackend.py | 8 +- plugins/CuraEngineBackend/StartSliceJob.py | 7 +- plugins/GCodeWriter/GCodeWriter.py | 7 +- .../MachineSettingsAction.py | 28 +++---- .../PerObjectSettingVisibilityHandler.py | 3 +- .../UMOUpgradeSelection.py | 8 +- .../UpgradeFirmwareMachineAction.py | 13 ++-- .../XmlMaterialProfile/XmlMaterialProfile.py | 4 +- 20 files changed, 134 insertions(+), 128 deletions(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 603cda14d1..5fb2a82d36 100644 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -2,6 +2,7 @@ # Cura is released under the terms of the AGPLv3 or higher. from cura.Settings.ExtruderManager import ExtruderManager +from UM.Settings.ContainerRegistry import ContainerRegistry from UM.i18n import i18nCatalog from UM.Scene.Platform import Platform from UM.Scene.Iterator.BreadthFirstIterator import BreadthFirstIterator @@ -23,9 +24,6 @@ catalog = i18nCatalog("cura") import numpy import copy -import UM.Settings.ContainerRegistry - - # Setting for clearance around the prime PRIME_CLEARANCE = 6.5 @@ -663,7 +661,7 @@ class BuildVolume(SceneNode): return self._global_container_stack.getProperty(setting_key, property) extruder_stack_id = ExtruderManager.getInstance().extruderIds[str(extruder_index)] - stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0] + stack = ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0] return stack.getProperty(setting_key, property) ## Convenience function to calculate the disallowed radius around the edge. diff --git a/cura/ConvexHullDecorator.py b/cura/ConvexHullDecorator.py index c4b2fe0337..65c799619a 100644 --- a/cura/ConvexHullDecorator.py +++ b/cura/ConvexHullDecorator.py @@ -1,13 +1,13 @@ # Copyright (c) 2016 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. -from UM.Scene.SceneNodeDecorator import SceneNodeDecorator from UM.Application import Application -from cura.Settings.ExtruderManager import ExtruderManager from UM.Math.Polygon import Polygon -from . import ConvexHullNode +from UM.Scene.SceneNodeDecorator import SceneNodeDecorator +from UM.Settings.ContainerRegistry import ContainerRegistry -import UM.Settings.ContainerRegistry +from cura.Settings.ExtruderManager import ExtruderManager +from . import ConvexHullNode import numpy @@ -308,11 +308,11 @@ class ConvexHullDecorator(SceneNodeDecorator): extruder_stack_id = self._node.callDecoration("getActiveExtruder") if not extruder_stack_id: #Decoration doesn't exist. extruder_stack_id = ExtruderManager.getInstance().extruderIds["0"] - extruder_stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0] + extruder_stack = ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0] return extruder_stack.getProperty(setting_key, property) else: #Limit_to_extruder is set. Use that one. extruder_stack_id = ExtruderManager.getInstance().extruderIds[str(extruder_index)] - stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0] + stack = ContainerRegistry.getInstance().findContainerStacks(id = extruder_stack_id)[0] return stack.getProperty(setting_key, property) ## Returns true if node is a descendant or the same as the root node. diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 0a121deeb4..5019519c53 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -124,7 +124,6 @@ class CuraApplication(QtApplication): Q_ENUMS(ResourceTypes) def __init__(self): - super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType) Resources.addSearchPath(os.path.join(QtApplication.getInstallPrefix(), "share", "cura", "resources")) if not hasattr(sys, "frozen"): @@ -187,6 +186,7 @@ class CuraApplication(QtApplication): self._additional_components = {} # Components to add to certain areas in the interface + super().__init__(name = "cura", version = CuraVersion, buildtype = CuraBuildType) self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png"))) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 6eae259e1e..fc27b0a471 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -2,11 +2,11 @@ from UM.i18n import i18nCatalog from UM.OutputDevice.OutputDevice import OutputDevice from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject from PyQt5.QtWidgets import QMessageBox -import UM.Settings.ContainerRegistry + +from UM.Settings.ContainerRegistry import ContainerRegistry from enum import IntEnum # For the connection state tracking. from UM.Logger import Logger -from UM.Application import Application from UM.Signal import signalemitter i18n_catalog = i18nCatalog("cura") @@ -25,7 +25,7 @@ class PrinterOutputDevice(QObject, OutputDevice): def __init__(self, device_id, parent = None): super().__init__(device_id = device_id, parent = parent) - self._container_registry = UM.Settings.ContainerRegistry.getInstance() + self._container_registry = ContainerRegistry.getInstance() self._target_bed_temperature = 0 self._bed_temperature = 0 self._num_extruders = 1 diff --git a/cura/QualityManager.py b/cura/QualityManager.py index 5b4d743ae9..dc23b2bafa 100644 --- a/cura/QualityManager.py +++ b/cura/QualityManager.py @@ -1,12 +1,16 @@ # Copyright (c) 2016 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. -import UM.Application -import cura.Settings.ExtruderManager -import UM.Settings.ContainerRegistry - # This collects a lot of quality and quality changes related code which was split between ContainerManager # and the MachineManager and really needs to usable from both. +from typing import List + +from UM.Application import Application +from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.Settings.DefinitionContainer import DefinitionContainer +from UM.Settings.InstanceContainer import InstanceContainer +from cura.Settings.ExtruderManager import ExtruderManager + class QualityManager: @@ -121,14 +125,14 @@ class QualityManager: # # \param machine_definition \type{DefinitionContainer} the machine definition. # \return \type{List[InstanceContainer]} the list of quality changes - def findAllQualityChangesForMachine(self, machine_definition): + def findAllQualityChangesForMachine(self, machine_definition: DefinitionContainer) -> List[InstanceContainer]: if machine_definition.getMetaDataEntry("has_machine_quality"): definition_id = machine_definition.getId() else: definition_id = "fdmprinter" filter_dict = { "type": "quality_changes", "extruder": None, "definition": definition_id } - quality_changes_list = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**filter_dict) + quality_changes_list = ContainerRegistry.getInstance().findInstanceContainers(**filter_dict) return quality_changes_list ## Find all usable qualities for a machine and extruders. @@ -177,7 +181,7 @@ class QualityManager: if base_material: # There is a basic material specified criteria = { "type": "material", "name": base_material, "definition": definition_id } - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**criteria) containers = [basic_material for basic_material in containers if basic_material.getMetaDataEntry("variant") == material_container.getMetaDataEntry( "variant")] @@ -191,13 +195,13 @@ class QualityManager: def _getFilteredContainersForStack(self, machine_definition=None, material_containers=None, **kwargs): # Fill in any default values. if machine_definition is None: - machine_definition = UM.Application.getInstance().getGlobalContainerStack().getBottom() + machine_definition = Application.getInstance().getGlobalContainerStack().getBottom() quality_definition_id = machine_definition.getMetaDataEntry("quality_definition") if quality_definition_id is not None: - machine_definition = UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id=quality_definition_id)[0] + machine_definition = ContainerRegistry.getInstance().findDefinitionContainers(id=quality_definition_id)[0] if material_containers is None: - active_stacks = cura.Settings.ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks() + active_stacks = ExtruderManager.getInstance().getActiveGlobalAndExtruderStacks() material_containers = [stack.findContainer(type="material") for stack in active_stacks] criteria = kwargs @@ -222,7 +226,7 @@ class QualityManager: if material_instance is not None: material_ids.add(material_instance.getId()) - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**criteria) result = [] for container in containers: @@ -238,8 +242,8 @@ class QualityManager: # an extruder definition. # \return \type{DefinitionContainer} the parent machine definition. If the given machine # definition doesn't have a parent then it is simply returned. - def getParentMachineDefinition(self, machine_definition): - container_registry = UM.Settings.ContainerRegistry.getInstance() + def getParentMachineDefinition(self, machine_definition: DefinitionContainer) -> DefinitionContainer: + container_registry = ContainerRegistry.getInstance() machine_entry = machine_definition.getMetaDataEntry("machine") if machine_entry is None: @@ -274,6 +278,6 @@ class QualityManager: # This already is a 'global' machine definition. return machine_definition else: - container_registry = UM.Settings.ContainerRegistry.getInstance() + container_registry = ContainerRegistry.getInstance() whole_machine = container_registry.findDefinitionContainers(id=machine_entry)[0] return whole_machine diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index 3262f7cbb6..eec4e2da1c 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -7,13 +7,15 @@ import urllib from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal, QUrl, QVariant from PyQt5.QtWidgets import QMessageBox -import UM.PluginRegistry +from UM.PluginRegistry import PluginRegistry import UM.SaveFile import UM.Platform import UM.MimeTypeDatabase -import UM.Logger +from UM.Logger import Logger from UM.Application import Application +from UM.Settings.ContainerStack import ContainerStack +from UM.Settings.DefinitionContainer import DefinitionContainer from UM.Settings.InstanceContainer import InstanceContainer from cura.QualityManager import QualityManager @@ -35,7 +37,7 @@ class ContainerManager(QObject): def __init__(self, parent = None): super().__init__(parent) - self._registry = ContainerRegistry.getInstance() + self._container_registry = ContainerRegistry.getInstance() self._machine_manager = Application.getInstance().getMachineManager() self._container_name_filters = {} @@ -51,7 +53,7 @@ class ContainerManager(QObject): def duplicateContainer(self, container_id): containers = self._container_registry.findContainers(None, id = container_id) if not containers: - UM.Logger.log("w", "Could duplicate container %s because it was not found.", container_id) + Logger.log("w", "Could duplicate container %s because it was not found.", container_id) return "" container = containers[0] @@ -83,7 +85,7 @@ class ContainerManager(QObject): def renameContainer(self, container_id, new_id, new_name): containers = self._container_registry.findContainers(None, id = container_id) if not containers: - UM.Logger.log("w", "Could rename container %s because it was not found.", container_id) + Logger.log("w", "Could rename container %s because it was not found.", container_id) return False container = containers[0] @@ -111,7 +113,7 @@ class ContainerManager(QObject): def removeContainer(self, container_id): containers = self._container_registry.findContainers(None, id = container_id) if not containers: - UM.Logger.log("w", "Could remove container %s because it was not found.", container_id) + Logger.log("w", "Could remove container %s because it was not found.", container_id) return False self._container_registry.removeContainer(containers[0].getId()) @@ -131,20 +133,20 @@ class ContainerManager(QObject): def mergeContainers(self, merge_into_id, merge_id): containers = self._container_registry.findContainers(None, id = merge_into_id) if not containers: - UM.Logger.log("w", "Could merge into container %s because it was not found.", merge_into_id) + Logger.log("w", "Could merge into container %s because it was not found.", merge_into_id) return False merge_into = containers[0] containers = self._container_registry.findContainers(None, id = merge_id) if not containers: - UM.Logger.log("w", "Could not merge container %s because it was not found", merge_id) + Logger.log("w", "Could not merge container %s because it was not found", merge_id) return False merge = containers[0] if not isinstance(merge, type(merge_into)): - UM.Logger.log("w", "Cannot merge two containers of different types") + Logger.log("w", "Cannot merge two containers of different types") return False self._performMerge(merge_into, merge) @@ -160,11 +162,11 @@ class ContainerManager(QObject): def clearContainer(self, container_id): containers = self._container_registry.findContainers(None, id = container_id) if not containers: - UM.Logger.log("w", "Could clear container %s because it was not found.", container_id) + Logger.log("w", "Could clear container %s because it was not found.", container_id) return False if containers[0].isReadOnly(): - UM.Logger.log("w", "Cannot clear read-only container %s", container_id) + Logger.log("w", "Cannot clear read-only container %s", container_id) return False containers[0].clear() @@ -175,7 +177,7 @@ class ContainerManager(QObject): def getContainerMetaDataEntry(self, container_id, entry_name): containers = self._container_registry.findContainers(None, id=container_id) if not containers: - UM.Logger.log("w", "Could not get metadata of container %s because it was not found.", container_id) + Logger.log("w", "Could not get metadata of container %s because it was not found.", container_id) return "" result = containers[0].getMetaDataEntry(entry_name) @@ -200,13 +202,13 @@ class ContainerManager(QObject): def setContainerMetaDataEntry(self, container_id, entry_name, entry_value): containers = self._container_registry.findContainers(None, id = container_id) if not containers: - UM.Logger.log("w", "Could not set metadata of container %s because it was not found.", container_id) + Logger.log("w", "Could not set metadata of container %s because it was not found.", container_id) return False container = containers[0] if container.isReadOnly(): - UM.Logger.log("w", "Cannot set metadata of read-only container %s.", container_id) + Logger.log("w", "Cannot set metadata of read-only container %s.", container_id) return False entries = entry_name.split("/") @@ -234,13 +236,13 @@ class ContainerManager(QObject): def setContainerName(self, container_id, new_name): containers = self._container_registry.findContainers(None, id = container_id) if not containers: - UM.Logger.log("w", "Could not set name of container %s because it was not found.", container_id) + Logger.log("w", "Could not set name of container %s because it was not found.", container_id) return False container = containers[0] if container.isReadOnly(): - UM.Logger.log("w", "Cannot set name of read-only container %s.", container_id) + Logger.log("w", "Cannot set name of read-only container %s.", container_id) return False container.setName(new_name) @@ -264,11 +266,11 @@ class ContainerManager(QObject): @pyqtSlot(str, result = bool) def isContainerUsed(self, container_id): - UM.Logger.log("d", "Checking if container %s is currently used", container_id) + Logger.log("d", "Checking if container %s is currently used", container_id) containers = self._container_registry.findContainerStacks() for stack in containers: if container_id in [child.getId() for child in stack.getContainers()]: - UM.Logger.log("d", "The container is in use by %s", stack.getId()) + Logger.log("d", "The container is in use by %s", stack.getId()) return True return False @@ -423,7 +425,7 @@ class ContainerManager(QObject): # Find the quality_changes container for this stack and merge the contents of the top container into it. quality_changes = stack.findContainer(type = "quality_changes") if not quality_changes or quality_changes.isReadOnly(): - UM.Logger.log("e", "Could not update quality of a nonexistant or read only quality profile in stack %s", stack.getId()) + Logger.log("e", "Could not update quality of a nonexistant or read only quality profile in stack %s", stack.getId()) continue self._performMerge(quality_changes, stack.getTop()) @@ -457,13 +459,13 @@ class ContainerManager(QObject): # \return \type{bool} True if the operation was successfully, False if not. @pyqtSlot(str, result = bool) def createQualityChanges(self, base_name): - global_stack = UM.Application.getInstance().getGlobalContainerStack() + global_stack = Application.getInstance().getGlobalContainerStack() if not global_stack: return False active_quality_name = self._machine_manager.activeQualityName if active_quality_name == "": - UM.Logger.log("w", "No quality container found in stack %s, cannot create profile", global_stack.getId()) + Logger.log("w", "No quality container found in stack %s, cannot create profile", global_stack.getId()) return False self._machine_manager.blurSettings.emit() @@ -477,12 +479,12 @@ class ContainerManager(QObject): quality_container = stack.findContainer(type = "quality") quality_changes_container = stack.findContainer(type = "quality_changes") if not quality_container or not quality_changes_container: - UM.Logger.log("w", "No quality or quality changes container found in stack %s, ignoring it", stack.getId()) + Logger.log("w", "No quality or quality changes container found in stack %s, ignoring it", stack.getId()) continue extruder_id = None if stack is global_stack else QualityManager.getInstance().getParentMachineDefinition(stack.getBottom()).getId() new_changes = self._createQualityChanges(quality_container, unique_name, - UM.Application.getInstance().getGlobalContainerStack().getBottom(), + Application.getInstance().getGlobalContainerStack().getBottom(), extruder_id) self._performMerge(new_changes, quality_changes_container, clear_settings = False) self._performMerge(new_changes, user_container) @@ -504,7 +506,7 @@ class ContainerManager(QObject): # \return \type{bool} True if successful, False if not. @pyqtSlot(str, result = bool) def removeQualityChanges(self, quality_name): - UM.Logger.log("d", "Attempting to remove the quality change containers with name %s", quality_name) + Logger.log("d", "Attempting to remove the quality change containers with name %s", quality_name) containers_found = False if not quality_name: @@ -514,7 +516,7 @@ class ContainerManager(QObject): activate_quality = quality_name == self._machine_manager.activeQualityName activate_quality_type = None - global_stack = UM.Application.getInstance().getGlobalContainerStack() + global_stack = Application.getInstance().getGlobalContainerStack() if not global_stack or not quality_name: return "" machine_definition = global_stack.getBottom() @@ -526,7 +528,7 @@ class ContainerManager(QObject): self._container_registry.removeContainer(container.getId()) if not containers_found: - UM.Logger.log("d", "Unable to remove quality containers, as we did not find any by the name of %s", quality_name) + Logger.log("d", "Unable to remove quality containers, as we did not find any by the name of %s", quality_name) elif activate_quality: definition_id = "fdmprinter" if not self._machine_manager.filterQualityByMachine else self._machine_manager.activeDefinitionId @@ -549,15 +551,15 @@ class ContainerManager(QObject): # \return True if successful, False if not. @pyqtSlot(str, str, result = bool) def renameQualityChanges(self, quality_name, new_name): - UM.Logger.log("d", "User requested QualityChanges container rename of %s to %s", quality_name, new_name) + Logger.log("d", "User requested QualityChanges container rename of %s to %s", quality_name, new_name) if not quality_name or not new_name: return False if quality_name == new_name: - UM.Logger.log("w", "Unable to rename %s to %s, because they are the same.", quality_name, new_name) + Logger.log("w", "Unable to rename %s to %s, because they are the same.", quality_name, new_name) return True - global_stack = UM.Application.getInstance().getGlobalContainerStack() + global_stack = Application.getInstance().getGlobalContainerStack() if not global_stack: return False @@ -574,7 +576,7 @@ class ContainerManager(QObject): container_registry.renameContainer(container.getId(), new_name, self._createUniqueId(stack_id, new_name)) if not containers_to_rename: - UM.Logger.log("e", "Unable to rename %s, because we could not find the profile", quality_name) + Logger.log("e", "Unable to rename %s, because we could not find the profile", quality_name) self._machine_manager.activeQualityChanged.emit() return True @@ -590,7 +592,7 @@ class ContainerManager(QObject): # \return A string containing the name of the duplicated containers, or an empty string if it failed. @pyqtSlot(str, str, result = str) def duplicateQualityOrQualityChanges(self, quality_name, base_name): - global_stack = UM.Application.getInstance().getGlobalContainerStack() + global_stack = Application.getInstance().getGlobalContainerStack() if not global_stack or not quality_name: return "" machine_definition = global_stack.getBottom() @@ -611,16 +613,16 @@ class ContainerManager(QObject): # \param material_instances \type{List[InstanceContainer]} # \return \type{str} the name of the newly created container. def _duplicateQualityOrQualityChangesForMachineType(self, quality_name, base_name, machine_definition, material_instances): - UM.Logger.log("d", "Attempting to duplicate the quality %s", quality_name) + Logger.log("d", "Attempting to duplicate the quality %s", quality_name) if base_name is None: base_name = quality_name # Try to find a Quality with the name. container = QualityManager.getInstance().findQualityByName(quality_name, machine_definition, material_instances) if container: - UM.Logger.log("d", "We found a quality to duplicate.") + Logger.log("d", "We found a quality to duplicate.") return self._duplicateQualityForMachineType(container, base_name, machine_definition) - UM.Logger.log("d", "We found a quality_changes to duplicate.") + Logger.log("d", "We found a quality_changes to duplicate.") # Assume it is a quality changes. return self._duplicateQualityChangesForMachineType(quality_name, base_name, machine_definition) @@ -667,11 +669,11 @@ class ContainerManager(QObject): def duplicateMaterial(self, material_id): containers = self._container_registry.findInstanceContainers(id=material_id) if not containers: - UM.Logger.log("d", "Unable to duplicate the material with id %s, because it doesn't exist.", material_id) + Logger.log("d", "Unable to duplicate the material with id %s, because it doesn't exist.", material_id) return "" # Ensure all settings are saved. - UM.Application.getInstance().saveSettings() + Application.getInstance().saveSettings() # Create a new ID & container to hold the data. new_id = self._container_registry.uniqueName(material_id) @@ -717,12 +719,12 @@ class ContainerManager(QObject): self._container_name_filters = {} for plugin_id, container_type in self._container_registry.getContainerTypes(): # Ignore default container types since those are not plugins - if container_type in (UM.Settings.InstanceContainer, UM.Settings.ContainerStack, UM.Settings.DefinitionContainer): + if container_type in (InstanceContainer, ContainerStack, DefinitionContainer): continue serialize_type = "" try: - plugin_metadata = UM.PluginRegistry.getInstance().getMetaData(plugin_id) + plugin_metadata = PluginRegistry.getInstance().getMetaData(plugin_id) if plugin_metadata: serialize_type = plugin_metadata["settings_container"]["type"] else: diff --git a/cura/Settings/MachineNameValidator.py b/cura/Settings/MachineNameValidator.py index 34b6351144..68782a2148 100644 --- a/cura/Settings/MachineNameValidator.py +++ b/cura/Settings/MachineNameValidator.py @@ -7,8 +7,8 @@ import os #For statvfs. import urllib #To escape machine names for how they're saved to file. import UM.Resources -import UM.Settings.ContainerRegistry -import UM.Settings.InstanceContainer +from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.Settings.InstanceContainer import InstanceContainer ## Are machine names valid? # @@ -22,7 +22,7 @@ class MachineNameValidator(QObject): filename_max_length = os.statvfs(UM.Resources.getDataStoragePath()).f_namemax except AttributeError: #Doesn't support statvfs. Probably because it's not a Unix system. filename_max_length = 255 #Assume it's Windows on NTFS. - machine_name_max_length = filename_max_length - len("_current_settings.") - len(UM.Settings.ContainerRegistry.getMimeTypeForContainer(UM.Settings.InstanceContainer).preferredSuffix) + machine_name_max_length = filename_max_length - len("_current_settings.") - len(ContainerRegistry.getMimeTypeForContainer(InstanceContainer).preferredSuffix) # Characters that urllib.parse.quote_plus escapes count for 12! So now # we must devise a regex that allows only 12 normal characters or 1 # special character, and that up to [machine_name_max_length / 12] times. @@ -45,7 +45,7 @@ class MachineNameValidator(QObject): except AttributeError: #Doesn't support statvfs. Probably because it's not a Unix system. filename_max_length = 255 #Assume it's Windows on NTFS. escaped_name = urllib.parse.quote_plus(name) - current_settings_filename = escaped_name + "_current_settings." + UM.Settings.ContainerRegistry.getMimeTypeForContainer(UM.Settings.InstanceContainer).preferredSuffix + current_settings_filename = escaped_name + "_current_settings." + ContainerRegistry.getMimeTypeForContainer(InstanceContainer).preferredSuffix if len(current_settings_filename) > filename_max_length: return QValidator.Invalid diff --git a/cura/Settings/QualitySettingsModel.py b/cura/Settings/QualitySettingsModel.py index a00b47c12b..085c0f054c 100644 --- a/cura/Settings/QualitySettingsModel.py +++ b/cura/Settings/QualitySettingsModel.py @@ -88,7 +88,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel): items = [] settings = collections.OrderedDict() - definition_container = UM.Application.getInstance().getGlobalContainerStack().getBottom() + definition_container = Application.getInstance().getGlobalContainerStack().getBottom() containers = self._container_registry.findInstanceContainers(id = self._quality_id) if not containers: @@ -116,7 +116,7 @@ class QualitySettingsModel(UM.Qt.ListModel.ListModel): quality_container = quality_container[0] quality_type = quality_container.getMetaDataEntry("quality_type") - definition_id = UM.Application.getInstance().getMachineManager().getQualityDefinitionId(quality_container.getDefinition()) + definition_id = Application.getInstance().getMachineManager().getQualityDefinitionId(quality_container.getDefinition()) criteria = {"type": "quality", "quality_type": quality_type, "definition": definition_id} diff --git a/cura/Settings/SettingInheritanceManager.py b/cura/Settings/SettingInheritanceManager.py index 4d1e60a739..49a465c37d 100644 --- a/cura/Settings/SettingInheritanceManager.py +++ b/cura/Settings/SettingInheritanceManager.py @@ -2,9 +2,7 @@ # Cura is released under the terms of the AGPLv3 or higher. from PyQt5.QtCore import QObject, pyqtSlot, pyqtProperty, pyqtSignal -import UM.Settings from UM.Application import Application -import cura.Settings from UM.Logger import Logger @@ -13,6 +11,12 @@ from UM.Logger import Logger # because some profiles tend to have 'hardcoded' values that break our inheritance. A good example of that are the # speed settings. If all the children of print_speed have a single value override, changing the speed won't # actually do anything, as only the 'leaf' settings are used by the engine. +from UM.Settings.ContainerStack import ContainerStack +from UM.Settings.SettingFunction import SettingFunction +from UM.Settings.SettingInstance import InstanceState + +from cura.Settings.ExtruderManager import ExtruderManager + class SettingInheritanceManager(QObject): def __init__(self, parent = None): super().__init__(parent) @@ -22,7 +26,7 @@ class SettingInheritanceManager(QObject): self._active_container_stack = None self._onGlobalContainerChanged() - cura.Settings.ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged) + ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged) self._onActiveExtruderChanged() settingsWithIntheritanceChanged = pyqtSignal() @@ -44,7 +48,7 @@ class SettingInheritanceManager(QObject): multi_extrusion = self._global_container_stack.getProperty("machine_extruder_count", "value") > 1 if not multi_extrusion: return self._settings_with_inheritance_warning - extruder = cura.Settings.ExtruderManager.getInstance().getExtruderStack(extruder_index) + extruder = ExtruderManager.getInstance().getExtruderStack(extruder_index) if not extruder: Logger.log("w", "Unable to find extruder for current machine with index %s", extruder_index) return [] @@ -70,7 +74,7 @@ class SettingInheritanceManager(QObject): self._update() def _onActiveExtruderChanged(self): - new_active_stack = cura.Settings.ExtruderManager.getInstance().getActiveExtruderStack() + new_active_stack = ExtruderManager.getInstance().getActiveExtruderStack() if not new_active_stack: new_active_stack = self._global_container_stack @@ -136,14 +140,14 @@ class SettingInheritanceManager(QObject): return self._settings_with_inheritance_warning ## Check if a setting has an inheritance function that is overwritten - def _settingIsOverwritingInheritance(self, key, stack = None): + def _settingIsOverwritingInheritance(self, key: str, stack: ContainerStack = None) -> bool: has_setting_function = False if not stack: stack = self._active_container_stack containers = [] ## Check if the setting has a user state. If not, it is never overwritten. - has_user_state = stack.getProperty(key, "state") == UM.Settings.InstanceState.User + has_user_state = stack.getProperty(key, "state") == InstanceState.User if not has_user_state: return False @@ -152,7 +156,7 @@ class SettingInheritanceManager(QObject): return False ## Also check if the top container is not a setting function (this happens if the inheritance is restored). - if isinstance(stack.getTop().getProperty(key, "value"), UM.Settings.SettingFunction): + if isinstance(stack.getTop().getProperty(key, "value"), SettingFunction): return False ## Mash all containers for all the stacks together. @@ -167,7 +171,7 @@ class SettingInheritanceManager(QObject): continue if value is not None: # If a setting doesn't use any keys, it won't change it's value, so treat it as if it's a fixed value - has_setting_function = isinstance(value, UM.Settings.SettingFunction) and len(value.getUsedSettingKeys()) > 0 + has_setting_function = isinstance(value, SettingFunction) and len(value.getUsedSettingKeys()) > 0 if has_setting_function is False: has_non_function_value = True continue diff --git a/cura/Settings/SettingOverrideDecorator.py b/cura/Settings/SettingOverrideDecorator.py index d38dac565b..d5f4ef7b14 100644 --- a/cura/Settings/SettingOverrideDecorator.py +++ b/cura/Settings/SettingOverrideDecorator.py @@ -10,10 +10,10 @@ from UM.Settings.InstanceContainer import InstanceContainer from UM.Settings.ContainerRegistry import ContainerRegistry import UM.Logger -import cura.Settings - from UM.Application import Application +from cura.Settings.ExtruderManager import ExtruderManager + ## A decorator that adds a container stack to a Node. This stack should be queried for all settings regarding # the linked node. The Stack in question will refer to the global stack (so that settings that are not defined by # this stack still resolve. @@ -29,8 +29,8 @@ class SettingOverrideDecorator(SceneNodeDecorator): self._instance = InstanceContainer(container_id = "SettingOverrideInstanceContainer") self._stack.addContainer(self._instance) - if cura.Settings.ExtruderManager.getInstance().extruderCount > 1: - self._extruder_stack = cura.Settings.ExtruderManager.getInstance().getExtruderStack(0).getId() + if ExtruderManager.getInstance().extruderCount > 1: + self._extruder_stack = ExtruderManager.getInstance().getExtruderStack(0).getId() else: self._extruder_stack = None diff --git a/cura_app.py b/cura_app.py index 6c75e49fb7..c6f7e27065 100755 --- a/cura_app.py +++ b/cura_app.py @@ -55,5 +55,8 @@ if Platform.isWindows() and hasattr(sys, "frozen"): sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w") sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w") +# Force an instance of CuraContainerRegistry to be created and reused later. +cura.Settings.CuraContainerRegistry.CuraContainerRegistry.getInstance() + app = cura.CuraApplication.CuraApplication.getInstance() app.run() diff --git a/plugins/3MFReader/ThreeMFReader.py b/plugins/3MFReader/ThreeMFReader.py index 2aa719018d..cd263b210f 100644 --- a/plugins/3MFReader/ThreeMFReader.py +++ b/plugins/3MFReader/ThreeMFReader.py @@ -8,7 +8,6 @@ from UM.Math.Matrix import Matrix from UM.Math.Vector import Vector from UM.Scene.SceneNode import SceneNode from UM.Scene.GroupDecorator import GroupDecorator -import UM.Application from UM.Job import Job from cura.Settings.SettingOverrideDecorator import SettingOverrideDecorator from UM.Application import Application @@ -188,7 +187,7 @@ class ThreeMFReader(MeshReader): transform = build_item.get("transform") if transform is not None: build_item_node.setTransformation(self._createMatrixFromTransformationString(transform)) - global_container_stack = UM.Application.getInstance().getGlobalContainerStack() + global_container_stack = Application.getInstance().getGlobalContainerStack() # Create a transformation Matrix to convert from 3mf worldspace into ours. # First step: flip the y and z axis. diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index d7e1bce52b..6bf05b363c 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -13,12 +13,8 @@ from UM.Resources import Resources from UM.Settings.Validator import ValidatorState #To find if a setting is in an error state. We can't slice then. from UM.Platform import Platform -import cura.Settings - -from cura.OneAtATimeIterator import OneAtATimeIterator from cura.Settings.ExtruderManager import ExtruderManager from . import ProcessSlicedLayersJob -from . import ProcessGCodeJob from . import StartSliceJob import os @@ -82,7 +78,7 @@ class CuraEngineBackend(Backend): self._onGlobalStackChanged() self._active_extruder_stack = None - cura.Settings.ExtruderManager.ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged) + ExtruderManager.getInstance().activeExtruderChanged.connect(self._onActiveExtruderChanged) self._onActiveExtruderChanged() # When you update a setting and other settings get changed through inheritance, many propertyChanged signals are fired. @@ -484,7 +480,7 @@ class CuraEngineBackend(Backend): if self._active_extruder_stack: self._active_extruder_stack.containersChanged.disconnect(self._onChanged) - self._active_extruder_stack = cura.Settings.ExtruderManager.ExtruderManager.getInstance().getActiveExtruderStack() + self._active_extruder_stack = ExtruderManager.getInstance().getActiveExtruderStack() if self._active_extruder_stack: self._active_extruder_stack.containersChanged.connect(self._onChanged) diff --git a/plugins/CuraEngineBackend/StartSliceJob.py b/plugins/CuraEngineBackend/StartSliceJob.py index 0319186518..8efa50105f 100644 --- a/plugins/CuraEngineBackend/StartSliceJob.py +++ b/plugins/CuraEngineBackend/StartSliceJob.py @@ -16,8 +16,7 @@ from UM.Settings.Validator import ValidatorState from UM.Settings.SettingRelation import RelationType from cura.OneAtATimeIterator import OneAtATimeIterator - -import cura.Settings +from cura.Settings.ExtruderManager import ExtruderManager class StartJobResult(IntEnum): Finished = 1 @@ -84,7 +83,7 @@ class StartSliceJob(Job): self.setResult(StartJobResult.BuildPlateError) return - for extruder_stack in cura.Settings.ExtruderManager.getInstance().getMachineExtruders(stack.getId()): + for extruder_stack in ExtruderManager.getInstance().getMachineExtruders(stack.getId()): material = extruder_stack.findContainer({"type": "material"}) if material: if material.getMetaDataEntry("compatible") == False: @@ -149,7 +148,7 @@ class StartSliceJob(Job): self._buildGlobalSettingsMessage(stack) self._buildGlobalInheritsStackMessage(stack) - for extruder_stack in cura.Settings.ExtruderManager.getInstance().getMachineExtruders(stack.getId()): + for extruder_stack in ExtruderManager.getInstance().getMachineExtruders(stack.getId()): self._buildExtruderMessage(extruder_stack) for group in object_groups: diff --git a/plugins/GCodeWriter/GCodeWriter.py b/plugins/GCodeWriter/GCodeWriter.py index d503f547b0..162738f073 100644 --- a/plugins/GCodeWriter/GCodeWriter.py +++ b/plugins/GCodeWriter/GCodeWriter.py @@ -4,13 +4,10 @@ from UM.Mesh.MeshWriter import MeshWriter from UM.Logger import Logger from UM.Application import Application -import UM.Settings.ContainerRegistry - -from cura.CuraApplication import CuraApplication -from cura.Settings.ExtruderManager import ExtruderManager - from UM.Settings.InstanceContainer import InstanceContainer +from cura.Settings.ExtruderManager import ExtruderManager + import re #For escaping characters in the settings. import json import copy diff --git a/plugins/MachineSettingsAction/MachineSettingsAction.py b/plugins/MachineSettingsAction/MachineSettingsAction.py index 56206e010f..13b00b2fd7 100644 --- a/plugins/MachineSettingsAction/MachineSettingsAction.py +++ b/plugins/MachineSettingsAction/MachineSettingsAction.py @@ -4,13 +4,15 @@ from PyQt5.QtCore import pyqtSlot from cura.MachineAction import MachineAction -import cura.Settings.CuraContainerRegistry -import UM.Application -import UM.Settings.InstanceContainer -import UM.Settings.DefinitionContainer +from UM.Application import Application +from UM.Settings.InstanceContainer import InstanceContainer +from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.Settings.DefinitionContainer import DefinitionContainer from UM.Logger import Logger +from cura.Settings.CuraContainerRegistry import CuraContainerRegistry + import UM.i18n catalog = UM.i18n.i18nCatalog("cura") @@ -19,10 +21,10 @@ class MachineSettingsAction(MachineAction): super().__init__("MachineSettingsAction", catalog.i18nc("@action", "Machine Settings")) self._qml_url = "MachineSettingsAction.qml" - cura.Settings.CuraContainerRegistry.CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded) + CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded) def _reset(self): - global_container_stack = UM.Application.Application.getInstance().getGlobalContainerStack() + global_container_stack = Application.Application.getInstance().getGlobalContainerStack() if global_container_stack: variant = global_container_stack.findContainer({"type": "variant"}) if variant and variant.getId() == "empty_variant": @@ -31,10 +33,10 @@ class MachineSettingsAction(MachineAction): def _createVariant(self, global_container_stack, variant_index): # Create and switch to a variant to store the settings in - new_variant = UM.Settings.InstanceContainer(global_container_stack.getName() + "_variant") + new_variant = InstanceContainer(global_container_stack.getName() + "_variant") new_variant.addMetaDataEntry("type", "variant") new_variant.setDefinition(global_container_stack.getBottom()) - UM.Settings.ContainerRegistry.getInstance().addContainer(new_variant) + ContainerRegistry.getInstance().addContainer(new_variant) global_container_stack.replaceContainer(variant_index, new_variant) def _onContainerAdded(self, container): @@ -49,13 +51,13 @@ class MachineSettingsAction(MachineAction): Logger.log("d", "Not attaching MachineSettingsAction to %s; Machines that use variants are not supported", container.getId()) return - UM.Application.Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey()) + Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey()) @pyqtSlot() def forceUpdate(self): # Force rebuilding the build volume by reloading the global container stack. # This is a bit of a hack, but it seems quick enough. - UM.Application.Application.getInstance().globalContainerStackChanged.emit() + Application.getInstance().globalContainerStackChanged.emit() @pyqtSlot() def updateHasMaterialsMetadata(self): @@ -78,7 +80,7 @@ class MachineSettingsAction(MachineAction): # Set the material container to a sane default if material_container.getId() == "empty_material": search_criteria = { "type": "material", "definition": "fdmprinter", "id": "*pla*" } - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) + containers = ContainerRegistry.getInstance().findInstanceContainers(**search_criteria) if containers: global_container_stack.replaceContainer(material_index, containers[0]) else: @@ -87,7 +89,7 @@ class MachineSettingsAction(MachineAction): if "has_materials" in global_container_stack.getMetaData(): global_container_stack.removeMetaDataEntry("has_materials") - empty_material = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = "empty_material")[0] + empty_material = ContainerRegistry.getInstance().findInstanceContainers(id = "empty_material")[0] global_container_stack.replaceContainer(material_index, empty_material) - UM.Application.getInstance().globalContainerStackChanged.emit() \ No newline at end of file + Application.getInstance().globalContainerStackChanged.emit() \ No newline at end of file diff --git a/plugins/PerObjectSettingsTool/PerObjectSettingVisibilityHandler.py b/plugins/PerObjectSettingsTool/PerObjectSettingVisibilityHandler.py index 08532ef61b..b283608cb0 100644 --- a/plugins/PerObjectSettingsTool/PerObjectSettingVisibilityHandler.py +++ b/plugins/PerObjectSettingsTool/PerObjectSettingVisibilityHandler.py @@ -4,6 +4,7 @@ from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal from UM.Application import Application +from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.SettingInstance import SettingInstance from UM.Logger import Logger import UM.Settings.Models.SettingVisibilityHandler @@ -72,7 +73,7 @@ class PerObjectSettingVisibilityHandler(UM.Settings.Models.SettingVisibilityHand # Use the found stack number to get the right stack to copy the value from. if stack_nr in ExtruderManager.getInstance().extruderIds: - stack = UM.Settings.ContainerRegistry.getInstance().findContainerStacks(id = ExtruderManager.getInstance().extruderIds[stack_nr])[0] + stack = ContainerRegistry.getInstance().findContainerStacks(id = ExtruderManager.getInstance().extruderIds[stack_nr])[0] # Use the raw property to set the value (so the inheritance doesn't break) if stack is not None: diff --git a/plugins/UltimakerMachineActions/UMOUpgradeSelection.py b/plugins/UltimakerMachineActions/UMOUpgradeSelection.py index b92dc30c68..87b2e42cd0 100644 --- a/plugins/UltimakerMachineActions/UMOUpgradeSelection.py +++ b/plugins/UltimakerMachineActions/UMOUpgradeSelection.py @@ -1,3 +1,5 @@ +from UM.Settings.ContainerRegistry import ContainerRegistry +from UM.Settings.InstanceContainer import InstanceContainer from cura.MachineAction import MachineAction from PyQt5.QtCore import pyqtSlot, pyqtSignal, pyqtProperty @@ -5,8 +7,6 @@ from UM.i18n import i18nCatalog from UM.Application import Application catalog = i18nCatalog("cura") -import UM.Settings.InstanceContainer - class UMOUpgradeSelection(MachineAction): def __init__(self): super().__init__("UMOUpgradeSelection", catalog.i18nc("@action", "Select upgrades")) @@ -37,9 +37,9 @@ class UMOUpgradeSelection(MachineAction): def _createVariant(self, global_container_stack, variant_index): # Create and switch to a variant to store the settings in - new_variant = UM.Settings.InstanceContainer(global_container_stack.getName() + "_variant") + new_variant = InstanceContainer(global_container_stack.getName() + "_variant") new_variant.addMetaDataEntry("type", "variant") new_variant.setDefinition(global_container_stack.getBottom()) - UM.Settings.ContainerRegistry.getInstance().addContainer(new_variant) + ContainerRegistry.getInstance().addContainer(new_variant) global_container_stack.replaceContainer(variant_index, new_variant) return new_variant \ No newline at end of file diff --git a/plugins/UltimakerMachineActions/UpgradeFirmwareMachineAction.py b/plugins/UltimakerMachineActions/UpgradeFirmwareMachineAction.py index 71d3f0b55b..838285969a 100644 --- a/plugins/UltimakerMachineActions/UpgradeFirmwareMachineAction.py +++ b/plugins/UltimakerMachineActions/UpgradeFirmwareMachineAction.py @@ -1,17 +1,18 @@ +from UM.Application import Application +from UM.Settings.DefinitionContainer import DefinitionContainer from cura.MachineAction import MachineAction from UM.i18n import i18nCatalog -import cura.Settings.CuraContainerRegistry -import UM.Settings.DefinitionContainer -catalog = i18nCatalog("cura") +from UM.Settings.ContainerRegistry import ContainerRegistry +catalog = i18nCatalog("cura") class UpgradeFirmwareMachineAction(MachineAction): def __init__(self): super().__init__("UpgradeFirmware", catalog.i18nc("@action", "Upgrade Firmware")) self._qml_url = "UpgradeFirmwareMachineAction.qml" - cura.Settings.CuraContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded) + ContainerRegistry.getInstance().containerAdded.connect(self._onContainerAdded) def _onContainerAdded(self, container): # Add this action as a supported action to all machine definitions - if isinstance(container, UM.Settings.DefinitionContainer) and container.getMetaDataEntry("type") == "machine" and container.getMetaDataEntry("supports_usb_connection"): - UM.Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey()) + if isinstance(container, DefinitionContainer) and container.getMetaDataEntry("type") == "machine" and container.getMetaDataEntry("supports_usb_connection"): + Application.getInstance().getMachineActionManager().addSupportedAction(container.getId(), self.getKey()) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index d3a2b8deea..2ab9a58336 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -28,7 +28,7 @@ class XmlMaterialProfile(InstanceContainer): super().setReadOnly(read_only) basefile = self.getMetaDataEntry("base_file", self._id) # if basefile is self.id, this is a basefile. - for container in UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): + for container in ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): container._read_only = read_only # prevent loop instead of calling setReadOnly ## Overridden from InstanceContainer @@ -44,7 +44,7 @@ class XmlMaterialProfile(InstanceContainer): basefile = self.getMetaDataEntry("base_file", self._id) #if basefile is self.id, this is a basefile. # Update all containers that share GUID and basefile - for container in UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): + for container in ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): container.setMetaDataEntry(key, value) ## Overridden from InstanceContainer, similar to setMetaDataEntry. From 95e507edd19e0ff5fb26deac6d628c112384ef57 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:45:33 +0100 Subject: [PATCH 004/197] Create cartesio --- resources/definitions/cartesio | 52 ++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 resources/definitions/cartesio diff --git a/resources/definitions/cartesio b/resources/definitions/cartesio new file mode 100644 index 0000000000..3c2f9be9c7 --- /dev/null +++ b/resources/definitions/cartesio @@ -0,0 +1,52 @@ +{ + "id": "cartesio", + "name": "Cartesio", + "version": 2, + "inherits": "fdmprinter", + "metadata": { + "visible": true, + "author": "Scheepers", + "manufacturer": "Cartesio bv", + "category": "Other", + "file_formats": "text/x-gcode", + "has_materials": true, + "has_machine_materials": true, + "has_variants": true, + "variants_name": "Nozzle size", + "machine_extruder_trains": + { + "0": "cartesio_extruder_0", + "1": "cartesio_extruder_1", + "2": "cartesio_extruder_2", + "3": "cartesio_extruder_3" + }, + "platform": "cartesio_platform.stl", + "platform_offset": [ -120, -1.5, 130], + "first_start_actions": ["MachineSettingsAction"], + "supported_actions": ["MachineSettingsAction"] + }, + + "overrides": { + "material_diameter": { "default_value": 1.75 }, + "machine_extruder_count": { "default_value": 4 }, + "machine_heated_bed": { "default_value": true }, + "machine_center_is_zero": { "default_value": false }, + "machine_height": { "default_value": 400 }, + "machine_gcode_flavor": { "default_value": "RepRap (Marlin/Sprinter)" }, + "machine_depth": { "default_value": 270 }, + "machine_width": { "default_value": 430 }, + "machine_name": { "default_value": "Cartesio" }, + "machine_start_gcode": { + "default_value": "M92 E162:162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S45\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-{retraction_amount} F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F9000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" + }, + "machine_end_gcode": { + "default_value": "; -- END GCODE --\nM106 S255\nM140 S5\nM104 S5 T0\nM104 S5 T1\nG1 X20.0 Y260.0 F6000\nG4 S7\nM84\nG4 S90\nM107\nM42 P12 S0\nM42 P13 S0\nM84\n; -- end of END GCODE --" + }, + "machine_nozzle_heat_up_speed": {"default_value": 20}, + "machine_nozzle_cool_down_speed": {"default_value": 20}, + "machine_min_cool_heat_time_window": {"default_value": 5}, + "retraction_prime_speed": {"value": "10"}, + "switch_extruder_prime_speed": {"value": "10"}, + "extruder_prime_pos_abs": { "default_value": true } + } +} From e0a6e6334d0823131186bc388f45134b4909d582 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:46:25 +0100 Subject: [PATCH 005/197] Create cartesio_extruder_0.def.json --- .../extruders/cartesio_extruder_0.def.json | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 resources/extruders/cartesio_extruder_0.def.json diff --git a/resources/extruders/cartesio_extruder_0.def.json b/resources/extruders/cartesio_extruder_0.def.json new file mode 100644 index 0000000000..f943bb7fed --- /dev/null +++ b/resources/extruders/cartesio_extruder_0.def.json @@ -0,0 +1,25 @@ +{ + "id": "cartesio_extruder_0", + "version": 2, + "name": "Extruder 0", + "inherits": "fdmextruder", + "metadata": { + "machine": "cartesio", + "position": "0" + }, + + "overrides": { + "extruder_nr": { + "default_value": 0, + "maximum_value": "3" + }, + "machine_nozzle_offset_x": { "default_value": 0.0 }, + "machine_nozzle_offset_y": { "default_value": 0.0 }, + "machine_extruder_start_code": { + "default_value": "\n;start extruder_0\nG1 X70 Y20 F9000\n" + }, + "machine_extruder_end_code": { + "default_value": "\nM104 T0 S120\n;end extruder_0\n" + } + } +} From 4a8bcc49bc4fde259db694b4be83d2d0aa2e0c8b Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:47:10 +0100 Subject: [PATCH 006/197] Delete cartesio --- resources/definitions/cartesio | 52 ---------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 resources/definitions/cartesio diff --git a/resources/definitions/cartesio b/resources/definitions/cartesio deleted file mode 100644 index 3c2f9be9c7..0000000000 --- a/resources/definitions/cartesio +++ /dev/null @@ -1,52 +0,0 @@ -{ - "id": "cartesio", - "name": "Cartesio", - "version": 2, - "inherits": "fdmprinter", - "metadata": { - "visible": true, - "author": "Scheepers", - "manufacturer": "Cartesio bv", - "category": "Other", - "file_formats": "text/x-gcode", - "has_materials": true, - "has_machine_materials": true, - "has_variants": true, - "variants_name": "Nozzle size", - "machine_extruder_trains": - { - "0": "cartesio_extruder_0", - "1": "cartesio_extruder_1", - "2": "cartesio_extruder_2", - "3": "cartesio_extruder_3" - }, - "platform": "cartesio_platform.stl", - "platform_offset": [ -120, -1.5, 130], - "first_start_actions": ["MachineSettingsAction"], - "supported_actions": ["MachineSettingsAction"] - }, - - "overrides": { - "material_diameter": { "default_value": 1.75 }, - "machine_extruder_count": { "default_value": 4 }, - "machine_heated_bed": { "default_value": true }, - "machine_center_is_zero": { "default_value": false }, - "machine_height": { "default_value": 400 }, - "machine_gcode_flavor": { "default_value": "RepRap (Marlin/Sprinter)" }, - "machine_depth": { "default_value": 270 }, - "machine_width": { "default_value": 430 }, - "machine_name": { "default_value": "Cartesio" }, - "machine_start_gcode": { - "default_value": "M92 E162:162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S45\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-{retraction_amount} F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F9000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" - }, - "machine_end_gcode": { - "default_value": "; -- END GCODE --\nM106 S255\nM140 S5\nM104 S5 T0\nM104 S5 T1\nG1 X20.0 Y260.0 F6000\nG4 S7\nM84\nG4 S90\nM107\nM42 P12 S0\nM42 P13 S0\nM84\n; -- end of END GCODE --" - }, - "machine_nozzle_heat_up_speed": {"default_value": 20}, - "machine_nozzle_cool_down_speed": {"default_value": 20}, - "machine_min_cool_heat_time_window": {"default_value": 5}, - "retraction_prime_speed": {"value": "10"}, - "switch_extruder_prime_speed": {"value": "10"}, - "extruder_prime_pos_abs": { "default_value": true } - } -} From a8a6ba836dc59ee8b97cc2285cc056a9fd4da6fc Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:47:38 +0100 Subject: [PATCH 007/197] Create cartesio.def.json --- resources/definitions/cartesio.def.json | 52 +++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 resources/definitions/cartesio.def.json diff --git a/resources/definitions/cartesio.def.json b/resources/definitions/cartesio.def.json new file mode 100644 index 0000000000..3c2f9be9c7 --- /dev/null +++ b/resources/definitions/cartesio.def.json @@ -0,0 +1,52 @@ +{ + "id": "cartesio", + "name": "Cartesio", + "version": 2, + "inherits": "fdmprinter", + "metadata": { + "visible": true, + "author": "Scheepers", + "manufacturer": "Cartesio bv", + "category": "Other", + "file_formats": "text/x-gcode", + "has_materials": true, + "has_machine_materials": true, + "has_variants": true, + "variants_name": "Nozzle size", + "machine_extruder_trains": + { + "0": "cartesio_extruder_0", + "1": "cartesio_extruder_1", + "2": "cartesio_extruder_2", + "3": "cartesio_extruder_3" + }, + "platform": "cartesio_platform.stl", + "platform_offset": [ -120, -1.5, 130], + "first_start_actions": ["MachineSettingsAction"], + "supported_actions": ["MachineSettingsAction"] + }, + + "overrides": { + "material_diameter": { "default_value": 1.75 }, + "machine_extruder_count": { "default_value": 4 }, + "machine_heated_bed": { "default_value": true }, + "machine_center_is_zero": { "default_value": false }, + "machine_height": { "default_value": 400 }, + "machine_gcode_flavor": { "default_value": "RepRap (Marlin/Sprinter)" }, + "machine_depth": { "default_value": 270 }, + "machine_width": { "default_value": 430 }, + "machine_name": { "default_value": "Cartesio" }, + "machine_start_gcode": { + "default_value": "M92 E162:162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S45\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-{retraction_amount} F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F9000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" + }, + "machine_end_gcode": { + "default_value": "; -- END GCODE --\nM106 S255\nM140 S5\nM104 S5 T0\nM104 S5 T1\nG1 X20.0 Y260.0 F6000\nG4 S7\nM84\nG4 S90\nM107\nM42 P12 S0\nM42 P13 S0\nM84\n; -- end of END GCODE --" + }, + "machine_nozzle_heat_up_speed": {"default_value": 20}, + "machine_nozzle_cool_down_speed": {"default_value": 20}, + "machine_min_cool_heat_time_window": {"default_value": 5}, + "retraction_prime_speed": {"value": "10"}, + "switch_extruder_prime_speed": {"value": "10"}, + "extruder_prime_pos_abs": { "default_value": true } + } +} From b96f45aa2acf9c637430bd0cfca96bb8c6bb7020 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:48:27 +0100 Subject: [PATCH 008/197] Create cartesio_extruder_1.def.json --- .../extruders/cartesio_extruder_1.def.json | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 resources/extruders/cartesio_extruder_1.def.json diff --git a/resources/extruders/cartesio_extruder_1.def.json b/resources/extruders/cartesio_extruder_1.def.json new file mode 100644 index 0000000000..8549ffcfcb --- /dev/null +++ b/resources/extruders/cartesio_extruder_1.def.json @@ -0,0 +1,25 @@ +{ + "id": "cartesio_extruder_1", + "version": 2, + "name": "Extruder 1", + "inherits": "fdmextruder", + "metadata": { + "machine": "cartesio", + "position": "1" + }, + + "overrides": { + "extruder_nr": { + "default_value": 1, + "maximum_value": "3" + }, + "machine_nozzle_offset_x": { "default_value": 24.0 }, + "machine_nozzle_offset_y": { "default_value": 0.0 }, + "machine_extruder_start_code": { + "default_value": "\n;start extruder_1\nG1 X70 Y20 F9000\n" + }, + "machine_extruder_end_code": { + "default_value": "\nM104 T0 S120\n;end extruder_1\n" + } + } +} From c06e97c93aab4139b00afa04fe408910d65bbac9 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:48:53 +0100 Subject: [PATCH 009/197] Create cartesio_extruder_2.def.json --- .../extruders/cartesio_extruder_2.def.json | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 resources/extruders/cartesio_extruder_2.def.json diff --git a/resources/extruders/cartesio_extruder_2.def.json b/resources/extruders/cartesio_extruder_2.def.json new file mode 100644 index 0000000000..0cd520f2fc --- /dev/null +++ b/resources/extruders/cartesio_extruder_2.def.json @@ -0,0 +1,25 @@ +{ + "id": "cartesio_extruder_2", + "version": 2, + "name": "Extruder 2", + "inherits": "fdmextruder", + "metadata": { + "machine": "cartesio", + "position": "2" + }, + + "overrides": { + "extruder_nr": { + "default_value": 2, + "maximum_value": "3" + }, + "machine_nozzle_offset_x": { "default_value": 0.0 }, + "machine_nozzle_offset_y": { "default_value": 60.0 }, + "machine_extruder_start_code": { + "default_value": "\n;start extruder_2\nG1 X70 Y20 F9000\n" + }, + "machine_extruder_end_code": { + "default_value": "\nM104 T0 S120\n;end extruder_2\n" + } + } +} From 40bb5ba5606e75f0eba5321703d625ce1293dfcf Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:49:20 +0100 Subject: [PATCH 010/197] Create cartesio_extruder_3.def.json --- .../extruders/cartesio_extruder_3.def.json | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 resources/extruders/cartesio_extruder_3.def.json diff --git a/resources/extruders/cartesio_extruder_3.def.json b/resources/extruders/cartesio_extruder_3.def.json new file mode 100644 index 0000000000..2de8a72eb3 --- /dev/null +++ b/resources/extruders/cartesio_extruder_3.def.json @@ -0,0 +1,25 @@ +{ + "id": "cartesio_extruder_3", + "version": 2, + "name": "Extruder 3", + "inherits": "fdmextruder", + "metadata": { + "machine": "cartesio", + "position": "3" + }, + + "overrides": { + "extruder_nr": { + "default_value": 3, + "maximum_value": "3" + }, + "machine_nozzle_offset_x": { "default_value": 24.0 }, + "machine_nozzle_offset_y": { "default_value": 60.0 }, + "machine_extruder_start_code": { + "default_value": "\n;start extruder_3\nG1 X70 Y20 F9000\n" + }, + "machine_extruder_end_code": { + "default_value": "\nM104 T0 S120\n;end extruder_3\n" + } + } +} From 0cd2030e2a420a77f3d5679c940925be863cb706 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:50:09 +0100 Subject: [PATCH 011/197] Add cartesio_platform.stl --- resources/meshes/cartesio_platform.stl | Bin 0 -> 84884 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 resources/meshes/cartesio_platform.stl diff --git a/resources/meshes/cartesio_platform.stl b/resources/meshes/cartesio_platform.stl new file mode 100644 index 0000000000000000000000000000000000000000..65f0204881879029f9e619b64c63e8bf8fa25670 GIT binary patch literal 84884 zcmb`Qd$?vrb>=q*VLGUQ2_h;EBqBj>gCO39?tS`vN&s8#msZdy5ugF3L%K0zb{G%Muw*m0!9ZxO*?HQ-r^%hXUx=Ft5&^l)!zGf{+RE1 zIK9}bezoeds%r0Dm)$h~e}C6)-!xzN(5u@+zOj89V(xao`RNNE-{qkNSh?#n%NF)| z-(ykc^;tWoM57udD1&&~rEh32fAf!5l=045hH9GgcKG?qo!|1kXm75$?LB9;JM8mN zB&eCSl$&O^v$w3AUGvjK{I5@++dgae&qacoSxdQTwtnD&mHX_t%>?O~Yxe!Y1?|gE z`fwzunYEOg=7%4>YvsNFvV9^BT)C#*?H6k!LCvhC+%$WB@b;BEZ+%K4+K*k*KIOQ> zB0s{lhG2xW`k)LOV>PJtK^eqY4QhQ*1~FEHS|5}_ zjMbpl2W1drHK_GL8N_gXz+b%%R0a`h8tpIs7z(~y67z3*p455wx_90Q1ffi0goi@S zF8t|!P6WTY@X=pHf*Px54~2Xj``=%Xh?Mh9utAM^iHAa2opZ;F6Ol?c64aQtdnnY$ z##@&sBGq6dsIeC1p-|^1UOh=f@{&kUW3ARh!LL4Y!jXwco)`>Y`30@ZFz0esm&I ze-#O8toQLy=)1PQ=EOv#UUZ7GqQ-hS4~4#R-wm%GAgEDd*77>~tK=meY|t~xI#*vX zPaN_R*1z>7R{zm=N4$jfU;09BAF-?$s;qPMh1>=sp&Hh|^}AO8NY$8^u>P%YxB3S$ z<|V9ul%abGh%ql={o5F2^$%jqOIZJf``PNH(Gzg_#5UwGu1XA_e zzq94eC!Mh__9wgFe8|GqUtpX-D3_aNpSc4T?*6h}FA3EQ6Y#`SpLNrwlRtKTw6XP* zdoSF*+{PlMDKAElp0y;9k3(LtY*q)G*`cD_l3FVKO?o;zy0Fs>6RBPiv%^ZmU7cv_ZPb@{N%5no`}6acK-D2 zXWz5}bxzH!rQ9?hdE2fFd;RtDGJHM5qod5rtQT%!a$!!$~$m!Lkz za<2KHjItWbx#oj1h_Re&J}85*pN)m;eUxYIl@H&aeA@a%Fp=m~Gfcq7&tAP{`RtAB zrr?a&A(Xqv3%O~Q9rzCmJMRDFc)cW4Ls|)>>K}K%X~lQ0KR?>I@zq~l*!d2`rJ-gm zV_J+LtpxHB+D9AON6*GxFZlYxz1Q0Pr_y6Y7;%K43>*I%+D7;<+E5MU(8FEz$ilt% zJvHVpdPy7FhY?v5Y-G7OhwH!p*up0_@0^J1-ng#) z>gikJoeVXBkWg1X{8(xQDBX_)V(S~NMNxw~XDHBYgDF+9)ly?NJQPyMb{^UXa^8AA zOk?@*P$&iVB`5udL))w7toNbD%F08bq`kMxH5hGBV>RfZQ0Lws&oy^E>!ua2NIf+* zvzD@XrHuwCt1x~n_wfTh>f;1uZ#UNGmjv6O`K!~s4jZF>C0;_0fhVTY?fF&VCE2e) zjQW*$2|WhHm|v-vPzEvPSM(V3UGo@8Ro}0~m*`g@#{7yNV{Onp2E?dei7%=5jQf>( z31!$A^DFfd${_4#cQe{^QpOl{T#)MM1PwVCjQW-Ml6p_>8G3%DzC;-|#{5csi82WLag6ewlf9^qAJzw#g!Sj9 z879m|9&zFrp{y^tF%kW~1R5WsER^*nHzlIqmq6oVl!dasU&S%Xyo7!QV$849mnef6^DFfw%95(SU&S%Xyo7!QV$849mnef6^{Y5W znU~P7K#cj7`VwUjV}7MxLK%epbd0(t`Y3zRS$pD7-WBdF?RrV5W|)AD?>@5q^oLQm7Cih%?MYN~%7%^*=pbQ(QKI?Ov4!-%^XhSuW zo95srJ!^8$cI%_Px#mkJe|Xd5-@hOd)XZAS;SI}PyG-VfxI7W>`svzDYr@2!!;z8ER%N<)+zh_4g8i z(p4J_r8Y`>ygsyaDZ|ECeQ4=Y1~FD2TDp`$jMayhE@cp7^`WIp8HD}p?viDtC8{!r zP`b;#2DRKNH_cu zb?3<+Uh#eF846GziZIXl?KF?` zfd{vl+C{g>BrA#zcnsX4LP-ELbIjHwh4*3W^&DrppaLq6Q8(YKt;GIX? z{NQ=J?wsNZJzSQXX4Q9gns6RR3Dpb}s6l-aUbT9siO&ftO}Qevg2?o&C4qd%GfqLg z?}8mCKBLH(Dxy)15|lx_X}d$)%hH+&)lhDl^^>Pgd_FRINgLWnyicTN)=~~N_VAM@ zoV9#!n6-RWnzf`RtUQxY8&~cy;jHCfPPQ!HIjwr3X4X=+_F=1GP`bKK2JOSw$xt>= zq>YfOO`a;WJD=O6Z0(%+NbMu$9PPj~);>HGS`^DFl9tu5?*JkeFq77=S zhx1VA6W!l(PaU6~shPEuZ8Y$C?z!f_g`Ve6-(c+nJ+ik0%GNf$rIiF*r}gJf^E&Ed z%&*i-D8my&=??mpdI@C^V}7MxLK(!EU#XW+1~KMW>Lrv@ss{av9;1E*V$84TF*Zh- z$AB2~D|(ELqMSueBWKUA)JrJCM!Ey&`IUMJWe}m=$M_*=&q>+(V1FB35Dh}PW|%M= z7&**NO&ARud*qm413!Bgt{T!xq2K={}JL3>Wh@R9?I@gt9FVKks-m@pd{J$#HR z364?A3mcgTsiKDVkSf2P@*yLRYtSZKHiGRVq^KZVGfconIYzC@E$X~oUB-y>%F!{3 znqi_Eal&Zu%G_sYyp$^_9d>t809j?s8-6V>`PpO zG0J6(Q7dw7)_sXLrvxjQN#%31tvtex+VQ8ALfo(XZ4?D5q4(y^s4+=_T|S5MzF& zUP2kfm|v-vPzF(sQSM8Xmt>CtQI1jWOQn}+{nuj@`&#y*@RC&%-`iUdVFaLNm_VvF ze(2TH|UlHbPVS}1kOSx$-+Ub;u?x`%*;fBnpsP^XjOj=bDRlTsQsQZ^r$c9W}F-a?{*?!f6xV+d0>)`@=t&9{Sq2 zXSAbc)>3YoAKiM|#P^bxHW*56lyp&p4Qs8e57rIpTxwA2wyY1<4G5{hMm1U=ltD-h zO5K+A!MXty|eH1mtI;iVI?#McZnzfXTu$|tx_koRn zI?eWmBb4s}r)*xr-Q*VrzuNds+kcKaH;vV^heAHMV?E`31@1_xv7CD-lofZyr_zlC zHCDPF3iZLA_o)UWL5+mF~jOk;hbhtmGIB&bnhpl?Sn-N6Pu!@R^jgZ1y8IOHX)fAta& zV_w4gFMT1mk62a=Ro1!sLT-bRPz~$f`dzDkq-xAdSpU|yTm6F=^Ags76Z;see-L9{ z!uq!{%IY7)n3t$$PzDhyFM0?Bj;Xje^l{hf{OY|APJ7~nh@o6FOu$CEBeU^5+^b)G z72KR8cJ!IEQLN&t#dY^Qk7;WGV^0qVVGyc_=(VuHSNCB6OW4HQ~urLg6WO^(6--B0X)#eUQ}Hv#f_g{kt#Z=krKVqeSgj zV>xG@H0LO*v78tA$aw-Wnsdpm<`3-yKYKf&-bdNyw#}#ESN1ak^EIv+CXlMvzj4c* z*M@mvkVd>Tl)J|Z+2#k&d52vu3C!@ghO`n$)d9QQwCOE3*gks9_Pl-TOM3A#ro{-- zHka#x%CRz(axd)|H>tHi4kVYW?^P13tEKTa%T}o*2DEHA+xMS@ru8O9?}HU*cyv_4^WNe2lVC)|Z?ROJt}o zfyT!u3uS%Daf#^nCD8a7WudGuIW`f}m!vTY8Xu!9l=T>XnpJwAC}R{fK1Nw6>q}N8 z8~rf~8t;89l=T>|OoXf*?5OeH$3mf`*Bp6NBBU>gt0qn3W0ZxmzQoV*O6#xCa^tGW z+s=T-dmjsBBayeL{upKLPD5!+8ycf(qHeWgeuYxl_<(r{Wq9J4U#Txq2GJj*%&*j! zD1#XDEA=JHAjGfI7-fE?zC=0Zqc=vGU#Txqj)dLy#lBZH^cZV{Yu3VJK!{(3`5N36 znMQqyG6?ajxF*&8N_~kk2=S{lMwwr!mrw>_KOLj2uQgw?Ud=`ZyIv4!j9QE^8}%4v z1mpEF>P@Ld`DlaGSt!#C6OxZuAAJI}dpm6)c72Xg8#MtNpL*SvJ8v$Yqb`zoA=?=B z)_2(Tl0dn;#!9y)hDMwVwqDqamoY6yz%z`tG0JU+cT3?p>M(hZavL^&m_4P(2!D<; zf;7si-Nj1WqrxHiIBb|jZx6}7-gZXFFB`7m5fo)_!woOtj9Rp3HBxFISLvd zqb!v57;jF5^d)JGg2u-v3uS%DS&5LoB#lwf_!woOtS>n;5z?2WF$x+Vqb!v5CElX? zW0bWb4P~A`L{Q`R)O8z#w~zUi`VwV$;+S92W9%uzJO;#=U#Txq1~KMW>PwVCh+m~K z%KS=wiL#^$eie7PtiHtjN_~lPBeTgy%@vAgOnO~_dQ3fG?mBuLZEA=JH zAjGfI7-fE?UP2j!{dA17o|C<(?dQGvM!Q}R9rhBrW|)ADwA(3;AK0Dc1omV7^OiNS zP4N0SVLP>)APpkz^NKc9L%C_N2W$KLFG+1M?b?b2HMTR%Lt&rSZojuK5!;15ag#7F zj54DpjISCh?2o(mm@W|~p7P-p4~2PQ5ZFa$nvmWsH*r7Sf$e39Nc#sPft`A$nYEN{ zkK#T5?!;dld)SIem=}f(>=QJN?HTk?*su7l_rELININGZLCvhCZ2LKX@FOSE4$w$o zccy7@fu{^Xbr-~SPg1@PzEtpgIXVyL5$U))(2$} zV>QUSDeGyj8LL5-mF;A;8ibAE`mlYwRtGABu%F$LX-!eKUD!_NJ=Li54*P_?ZYkS- zZm<8m7daBxbL?J1+4hXn6E}pl3@Sd$EY@zbIk|k zRJz!)9=%;Pnh(k#Bp-2CyypWzy{{K!aKz{V}cV} zuHM`3uPEDjmi`1#5;&p7HNylvQTIXOgcg71P?~Z@bOn)VJ5R`Mhy77u_Vqe@Dk=z^ z@3Qd$dn#f~$hi>l6k5NpRe~~zboNfH57kh%a}GCdYfpM}%|T(N`lK(|OdQUQF^!!% zX3)R=`i+`in0n%+splFn;JVq$U~K0q69TcsF%RT zXwGwTAjd9;g0n=cQ5#iBCjLo!$i1y6@oH|eZxNbzfSw;RYN(f*}n9i1)qb@Q6383&U}QNw<+hb9r!GnhC+|Q zvZ_!1@;N#Ug`UW3GuB}1bxw_)lIEe%C%V7oo;rFWHFgr4heA*7^W6CyFSL(%X1BKk z4OO@SfhUSziN}>*LXQC}#`S81CjB*)c)O$w9C~8P6(I0Wv=RQN@rMwui`2?piM$vXX;&>>G zQSZ&Yn$lwg#wZe$QC8BIbgH3@G3pBGccm{0W0Y&q`?%bM9^-w|w@Y8rQG?!xp?10K z&t&|NzNDiDV-!PO`S1tQNQBZY$0*mpmt00)^5`PpOG0J7!k$pt+QI1ir!M&)< zxa<3vL_^eTi!@M!Af>MR1808v_I4+}) zVM{AVHENWoTdnw&_-pAU^cZ-e_?38E=_T|S5aL(jaiy2gV?c;sg)z!~sq_+hOd@2A za$hRFgdPK8%&*i-D1#XDtHMjN$AB31EAbL~42W>|D)&C_OO=;oj{#ARQSM7x=jvA= zeC$Byu01DZlyvBWW&F@ljhbP?Y#??YqbeeeQ8@2eZIDn6Q(~u08Ybl4_{89s^?3uf$8}F(7n|Qcd9{*{?w87{yRp=jvA=eC)uOpgkvL zl(c@OvL<}j?=WFD5Ic6CbyMzY!WGPMpS}Pk_MYfoWL(3qBy>lW(#VJZ!dNKrDxo{L zGSR_??gmqOkO+oKLU*4jooz%yHA-+F8%CV;>tKU>;t+w9Rk3r@k($t*dP-*-h_omx zCAb?B`6s_iu=z!O{fp}tM6skc$Y??b@|SFrN>jH1a}73HCV0$^c{!3 zrm$Smh}?8jB{U^Vv%%RnL>4?hc}$rPwZTvQ=S21U&BT zTWxoRhB8k)av)Xa4cw1mEAV}n&`|?~c?sA5`)&^N#9u|2FP#|URoi7*sSS9^b!Xa6 z3#At))^AxAZ77|I?1>()d7=^UlCRwFyE%eGrC&EyO--!6k=6+x$bU$xN=pJXKdqhr^65M&c)Kn=^?hUtG<8R1^ z>{8cMEtTLdF{R6#s|{;W`^H+ckw|u*<(#WV36q70nc#?H8YQeXS47OYYHGrtyvux8 zJLk?~4`uCqzX4CQw#L1|{-(fM?fwIVwL#ncuJqCfYpE}a@hV;BLv2_~Jv0(ZFHZP7 zAf+=AYSBg<-%V_-_P}VvTJs?TIaf_h*qfr^5y#dVC~fWhpwdQ6mDaiS)aHp=vt>S1 zqxC#qy6U?o+nBLP`;fk*Cj2=urYhvYo(C<|*r;aL%Y2xJ507d-+LeTrl@V4}mJcft z8@ozEHC9$O_E}jC5s26C2h9fW;e1_A--c_<2Jhkg?kp21t|`~51^+qlEt4Z|dUx~; zy{jE3!rs|QGr!(^N$7Ec>(hdHrSZS%hd0lRR|#FQSK8njK}14&X$03KmUL-D<5fae zP?m(QBvpE81lNczHC0M*>PxPBWt(q&nxMhRWT zToSq>TIn9q!7fsz1Xo={x0F;V!ByUM>2k$*6|bz>kNN1JN2-+2)#^)2l@hvJp(?BP zzs`Hx)=*rfS?8m9>y7i@{Lj`KXsD+7;e7AexkElc>~Ys0#ojWA89|ikM*1ys#!H{mpx>uEs5rUr?pr9Q%Z@1Y8L+IrWdZQY(&3OLhbczggoHa zO}R2N%}%FTM6LgvssSRbPfP??j)-4%eH*%hlJvL@U75)hlwu>Lit#FebxS@zMjIhT zcF(|-vdB5<9uWZix~USn8dvE$ABdHjMDqrsJhc zO^=Y-*O={?bFOakvT_@~Zn3Tpu3`fb?B(@EOCh*6uB7YIWxPsom0q1HT_dWgS{lKX zt4mFl5?m>pQq@`cc2llN(-m!HN!K|?om(Anr5jeg=*mp5Klfdqqt!a^5jj=5mXE9d zmYOOhbmd{44|;>9YB7QTVm9_7VGPWo;R#dSG@qjLvuSB=`>nwdHudgrB~>iJst ztS}CKX4yiXACh~+9uZQ6UrC&|!_QadxhbJbztU7GvD?{ORu0d3ZT-LlEAw2M#M>jf zn5d8{C4TtPyH@6TJfX)^rNo{eynW^H{9t$a%`5Y~qr}@Ia;lWrdcjRA^PH#9DxOGZCr;?*PJcM$#yO67lnX zBau^uQuK3umF^KCe!J^a0yXGo{3<=3Dkb1Oe%^1HDtMfq>#Onhh@2`V;O&0KuhQeG zQUYz$&-*P?h1Th7BQ)L~kyE7vdItX{meOUa`oupjAUdUg74d`+MlVJ@eZjwJU^a}d z38dZQEs3qa*umaqA(`pdO%a!CkSE$WBwT+ciOvvvj&e;&R|J4Sl?0x`Xpgqbd{`*6 zjyt3s_kVIsiPDP`{>?$9OF}h}oxuIv&Ucu-l2A=e__qin5ps>6JxBRB2bG3g5HWa7 z;J)n$q0$wh@dnum+>!IEh%wXgPq@<$ny!a`YLj5^}z$D>B+ z9ub50h(Mos{gxg*7h|_Sr45Xho1fTfgwQ2{w0oJ<`SARegx(3GPxL!vJcVz5;+kl$ zB(A&r`uVS(yeeum6lON|TKk~^BF7I+Ph#IAP1b{%< ze3TQI=elRR^*wsdqK|*^tTsO%-d4s?N?^up{)o%%I>L7N0~?r$`|2w$iyEbSL=0XN znBjYDZe5R_i?Q3EGF3`oc5%(mFCIu0W-UK)(b`_TJtC*7B*MINDh16`nJOhP<4Sv^ zOCrv)rg)XWY;Tc|oGQ#avwRruAQ7l;ssv`ISvRD|Q>6rE#)~@7slpsReTnf75;0Xu zU?$(aQcGk!RZ3tLLD4>Ps;~mW+nUBZNW@eraqo}Lo_GsZx=fW4SXtq{fzl-;nvT^X*DBCD%*CP>3;MYx+ zuo3Q#9^EH)Uv2R!VdLOOBV7`zQNl*M>jwzc)Wj~Iy?uy?qrnYPW8<`YFpMT%#0iyfyLGx$*t7&W`J3WS48iBP2$G+kXkx+ULN$cm1hX^}CVIM6{urP@=Tae5jp2>ZBnetfsi`OQ%LnC!v}RtJ-Cc9#;}w zOx2J6WIBJbrCmcc&%I-M&-;!q3Cp<>Vo&KgUgynv2!Mr9w)GJee)C6U!Aur z>2U(9CcR%#x*{ZAC9r~W&kKh}9IV;gu-rx#jdy9p@nPqS_nb%m-vvA7?>K9`JtC({iB+q2%HMQWdOTH1toqJQ@_lDF zfHsKL-2VOw_3ZDjw4_TLs!;+yHvIky-tO|^n-*4qw1_I3y6zANXWs|mf2R@<5A*}y9JJS!)=a~C80 zYu$_Och-23CvT6q?s9E|nu3t;tw$o{+S&*9#CT0jH z1oi^ChnA_r{vr2jjkiZwqC%>az}_WqQA&@eN(tIe4_8+(k_ z2Q^9@|G7PL{<4i&x+j14H*=Z5+r6F#iI^%SPCx0nQXiyC8yc??2Y+v`>n_6B-J#-@`3Zy5dVU;dCzD&b)njPSw@< z8}zo*d#pa#M=8N?-q+7KCx5q<`XD_>#8fG9`bjHuJ!@~5^AT%MHA)=(y@l*!6(N0} z(mf)i2)}UO{^j%Auf5mS%6H*8;r5+ zOE<=qc53N<1K9R`2$2Z6#xHoH?lA~nx%WkB4@K~W-hP8F5~6`0I{{BT;s-;%s~ROj zYR9}iJXQbfxReqJg{SRhpSGHiMgZCnG{dk zp`7sRrY}0|t&Ka1H^T2I&bp&7ri`cG}PILylwKcJ&ztBzVnRp zC$m4Yv}>rtFFb$plJj0gqVt?9q4t!Xv%v9hH`RP-s+2AXjSI5B9qOej+3BXLsfprE zQD=w|u2BN{^LI`$RhdwY63Bm_|+w_4i*qXW}~p z%bYily=B53hry2%-6J|AD|)*Sx(i!vmpRvbXsUXInFu-8ct3dW*%RN}i8m9&_YA60 zB6|Daos4Rffb2U%%X}bJzBja{3nCU2%Bmnjx#j!0(KDSiUerw{(8mntLo`aD28Zt~ zQ3rmP8tWj%J4kfMhZ3kwzbjU{^eZLcyMEuUbV;a23ACHx`*zhRfwt*S7NrfAbD60sW|zX9b1^!H(Dt4|=Y$~p9n$#hl4@$=C3?3MOyC#B+Hi;L8YOVI?Dt(| zS*b<|Jb(JVT}h}$36#R{eIn-W{GL-oVII%#WJ?=(mf>A7Lt&=T@3l+9YRc}THPqlN znU$5SbW(dtS2mh8iVQ z2Jx@kG}FKO>}z48(ReA(+H!7N3Dpb}$j4iDd+5%8-e6yF(YbBXvzFIE{KE^cUGeA| z`?@3Q+3%e-6t9EW_2~WDUmmt1=A-C8G97H>S!)pg@{KpQdmpwreq9Ca&Yw~=6t9B_ z)zHRr!XNE%G95}cUl$uIfEFGup?F>L0Xtpc;kh>mHgY=$k;*C(+SW7_uY*YS5%Z$$ zSwrzUh*am1Kt20&zlP#<5XloG0Z+^;!7^>0Z`VPj_JOhrKW_(3^kWaj>q5jDq_>xJ zNvJ2%`@+|R@_G;TM6?g}M0#JSoV*Ui>cc&>^hEk7QssWEo(LQ2iS#}=fUm_czj6;P zJh7vX1`~sxC^n)e(npQ3k<(Je5ht}M^Q-KAmMROSo+xD%33{L9+{PsxgMv!`wP{27-{k=I7X zLCPWLG6t7~YK94T`z0G6-1NXBXPJ#W4wmsUri$oz&w%og`-dV`zkkDTPj|a`C2W*L z9;r)ut`Q=PAB>lGHG#-9O81f1o-%#j@9kju5Di0xJmvc<sR>Dx zP`pzE5p=08f~fa!Sq`ZRvb{kP8`k?|jnN(o_Uzpfh?I{ugo!Efw@w-gd9u4#5UH#p zK~2CV6w1)vAc07AZba4uBFk3)_67+=@{o2}H zW9c%~tmWK9NskfXtl~WXp)^wU%%*9-bjxdDqhqL&;A{p`b<8s#TK>N`tcwISA+9`2 zGHW?60^*Nec4XDbJ&VVP!rN9q4<6u#BYA%&C|bX zH^zVlta#Q zJ4bz}4Te%1O~dQ3u~-dyt+8&zOL{fPy3ra0k=kI)IYR~0xo)%uL5$U))(2$}V>PJt zK^eqY4YF>mhx0k4vHH+DP#HF)r|z_-DA)Ziyqt9s#*DbnE5sYezIuk&YA_RBd{?|E zfmHo+_OunBJLA$2C&od}t5FW$43inUl2FYsfmHqaXC7SfnMclwHt-JF=Lbp8T3!bc z?lRhN7aj?`d-eC98j9CJy#2IO+EdTmArg4w<@cf*iq}D`yZ)kf?-lQleLLQZ`8^dw zH4Wv(2+~TRbVH#cMe)Z_vlg=5>6vV{$BCw?3En5Be8e`$P$hwU*xOnut0|I2jmqJ9 zFqFEztp$jL8Lm51T{@V+5F1i$(A-4N^O*Mwt*7v=u5VS!SD1D zllxn?5ed~$ww$}am3~EEvQ+tV4ZQ?4I94Al=~+t|MDpEOR;tm`r3_-YbhSiP29er% zw1Kkna;J=b1?}H=j3}X+VFGn-Klga=OFZ7w7otATrS}NYurEQ~o|R|&bBpTgxHJ^! z^vs5*D8=P>;Sw(il$HI`^D{yzk)I8Geo*p(((Pi}7bV0-D0BQmTyY*al~tM(ZqU!C z>p4}4poTPJ^6RkiS9d;b)5G>ori+@CDm;1Fj3Vp>BIT(dEUu(cf--FEe9MEI4omN3 zR6{w~2+xK#qlmKFF1%s6#NM#Pr+A-h)KGZ-v>8PZH-z^koxCscxke3z=USVy0P&3L zFA85a;`z@_P8r0j!h43T--vT}O|cp?ujPzo z71H1R&;G!WDY1*?XI&J>Zr!cPAQ#3bm2X*+va2p_*X= zIS+5>m*=^=eB$@4B^~NNUk7p5i>}>trOn-SSn+G?eL|a%P`nNz%rs2X++D{tyC_ko zn}*jx%)*7RLx*f5YpN5A(#l z*4a{(SMucRAW~UHf-9{p=e`z)*FmKEhy?1uR@PYQ`uZDQ2a)RBQWdV{H7u!pSf7|z4+la*HTgPh47Vucd_Me#R;04zd>X2<@akbt zgtx0F()-3d5rldoy$>lF@>WVR@Lm*m`aW9nIy`ZhuqQ7kNQ3x`TOM5Ttn>~*HI(fgfREJi z4xkP9iKxL2&u2cKQ?_R{-ZQ*7yaTu`y#v7WlCMLhY)@XiFS$0n12}qld3pFb$uv$H=TWp9rJ{MA=uQV#7A?It~6 zl>{}`KAh%t)cIIhY0fE24aQWdMsrRX#8_Er&MAW!D=W=8We`6<^Wy1~x5WFzj_bl_ zE#*+Pc_le=e*UwMnO?Tm)_5`0ti^g!Ul-2nupvZ4jS?z@*zn7L-_+h}_lX)WmX8nfM`$$ey69QcpXHl^GKkceGRpS;&l+o6C(jn^!q^# z#p@ta`>;Ei+zy)P$N4TZUl$_wqV)EVsT@jW5bBBaJ}U*=$Dp2w_Mx6g?`s;$Rv*4| zq4Y$0Ur0&z525drlD+ouzP6f ziS*GiPqg|7Re}~9?gaQ9@8B8ojua;$*q0aKi55EkQxN>>cu7YB!NadB;#Gp*CQmkE za1i|Fc^Pky=z!D&ztCRN>Tgpnch)q{maG1pLju>`Mr#K*9A@Z3Db|JerRG`PS=%EFs0f~{The9eYP?GD#NIkp zJPEjrw@2huDZx{SOL{z2O7L{!I#oP1xs10*T@Wnk zGF57WC&Y&LS9vc`ohsERQLjUej@Y4{a}Ngc5!MT*dn&}lwSysi2#sG!s6D02eDD+~ z^tFDHCuBbns?JAEK?;H~k(Lr%2kVjz;_SI#ojC(_&|>(u))B;W(+% z&ajml3?pMW0vvqEX~@65G4!4!Shq=ob$|8v^zh&6<*@!+17+=l;AnAHNmrE%XpVY z@Z8#xE_1G_Qi5mZ)~Ql&P`XD1zqL0-C`CJYc-EqH?R;XZkDj+@-*t@=s98H3xlR?l z!OmPRR3RVXhn|5Wa!FL9 za~FX~P*W0ox-WCC&p1lxlT1bAoe1H+B(Jm7_3cttA!XsdL65TNir}XVXWo2Jwuk(RAu&=$B@eUF(RZ8%? z@g+T;Dkb1o_67SoRq)rJJbrXqBg%c^gG5Y~5@=mpUvpxQ9#54LXoJNJZ)3l%^lqT>0?3)Ax(5hjTjH2wCakxa}Gxu6+38 znJx*8=Oh^F%7?!&N<0?6s(Ws%0}X{9+`hJ3mz8OpP#M$V1f8lm(eM7RUk_`utv4W-8kjGWh>dA<=sFG7T|@BaI7cBze`PG=(f zRXGmgd$Q)o!()_=Mes5EW-SQF_)=_LgCP7}kA{M5-*itzND+Q$QT`oXi`PTJ-|V{? zeH%)Y_MFZ+@7dt@eJ$sn+L~azO7Pplbw2pb;xgVI5%Z0lE5UCem-Kk5l;C%m>s0ak z&SkvgL|toM=XO6oROhNO+Wg9{n_T9@?$z;aVt*d6cn66NWu*jU`|5B>kK3?&UwprK z7GrXHal*bWY|jby_2b$THD1V0*!}e*(Ozi-8vC-bKTTLDyVu4Sh-(|r*f)gzdB8&1 zy*9olyeOge;U=1n_7=CH@$P(wrDWWOY9KoSFR`x=)u~cVP279!QwDMlZ@>4x zr$&v^kb6Yz844oM_O&BxT_dRy8}KXp!jZKur^^~t8z8>+vYlcIl`aX@6h!bu`zBId zR`7P$)Wjz@?>tae@OB@)3Od9zOz88VKC$S1X_*hS1HTi7?DuWx=UuJ|YD(geaG$tu znU7e5JD>Klh1(u7jmC>RgB}svpc1QYnP0f=jQwJ~N{^>XiS=(hd|}Oz`wygQ{c~Tr zux9N6y?6(Sm?|aSdE3zo>$e=(qsLRF#5=!#?853x4q~c8IoV7D#&g$T45tm&O>Ki3 zC2;@X`6~(Bmw1_I4fcqfDkX5g!}_4@(uT&X1n#xm7ixmupmdKws=}`e?}>1-nss!?La?|(e|bRRCCwlec@h4$ERmbP^?8l2gpC26irILV+p}rmWAKsqzxgYl^JtF2q3EVSyU!rtf zR!pxFxM%QwEE65d3gfx=eH!l|5mTiEMrZGLmCiOIp&BJHQhN^`iI5`q_Ah45<`eD` z8=;;?dLL?(IO;if=lqqaI{DIja+zoi_K2J+B`!Sa%Tgb-UE0uimDuI7`?4?81ieA& zaRMvP{&~xq=!v=`Ti=(JHk62K2h*uDN@pVEzH61hs=4j&za-jIIuoeG@E(7D-cPep z0xR}*`@MA>&qHYZx)y5(?>(mL#XCrJHGvg|2ey~>=@Np(u)&5H=%SUI;2W9ke$F)}z{P=aP5^7KBY$FqH9r617N6$ty02``N;`p$-ZOz&@GgTnM zuWMCP6Fz%VrV6X()^9mG#s%6#;d(Lu(M1!%23G0$EQ!)R!hnhZz50@KqCKU{RH+TD zhx7R_r85yyR_46UhvzR7A!Y8n=6%?Yb9MYGP1znJ5#q1AXK9Sb`1IZ zpfXjeDG8+Tl(Nn{q{>1a5j7@TC~Hx6y|#h4oM1|nE^}VmSQYBSo?bMyi`js^m!=ew zt_f<)ULwLyz1}lU%sKX2`BM>6l2bKA#2Qor`@H6s<#Q9T^(&MR80{iibr=k!)e(oje87fy^(y@J*#(c>L>+LEc+E7hRobwK&V?ILs z_*pOd_N^yJ&rlk2K^RaG)(0Qiqsy{FD7Rrf>QRwUdU0aoww6MrGtnU*s{-P^uz;Vyh@n&*xUL{#QIQ8O+9K&Y40b?#$HNodaNd=x!(h#$W$e*4Iuig;ch)-BEFw<6g_ zkKpN)dhTTX9K{nmL%ee8snVql)f7ZNMYOhoQ{?RHz`=%u;u)qrLe84gP&_%dN64wU zp?pFay*qkFkLXagC|zj$3^Lg86UCISaxU=}gq)aH5uz!GPzpSc%u1ZvRF9pedqfgU0{_bVs#L_wuvK0;{x%oCl6-j|*;l`eCx8YT41!^%cD>C{iQ zQG#bF_Uc^DVk`-+ZY*u^B*#!b@)aGPVOrZL37-9^beZ#_eTcVfE2s!*ABDGzzx9cH z@{{;duLfiFp$2t#ug+TIdv5;qkZhxi?L#yL5%-CozL1}UVI%xH`Qjx?cYfY?zUWu~ zqKyv0dqiQ6bR+_RUsuK(Jm2@q^lTUa-<59;qOCX)@|3=iS=YI03L>#D}JjnocAiBtgWOyMkuNdf4qJ8jw21FUtug$#jiUC8~HoM-X6t4ubhA5vLsZa1m5)y*9UgBdEII# zyjymUDQ#d^n}5YqL*cEn`*cZQUz)c&4TXJdz4j679DCoq6)8PPbnp@-bmyGXL;hx>Dhgi4LOBU-}^<|`i8zULtQ-MllMMhUL}RXT!^1lUfST9fT3-x zJ Date: Thu, 12 Jan 2017 10:51:00 +0100 Subject: [PATCH 012/197] Create cartesio_0.4.inst.cfg --- resources/variants/cartesio_0.4.inst.cfg | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 resources/variants/cartesio_0.4.inst.cfg diff --git a/resources/variants/cartesio_0.4.inst.cfg b/resources/variants/cartesio_0.4.inst.cfg new file mode 100644 index 0000000000..5212b7fede --- /dev/null +++ b/resources/variants/cartesio_0.4.inst.cfg @@ -0,0 +1,15 @@ +[general] +name = 0.4 mm +version = 2 +definition = cartesio + +[metadata] +author = Cartesio +type = variant + +[values] +machine_nozzle_size = 0.4 +machine_nozzle_tip_outer_diameter = 1.05 +speed_wall = =round(speed_print / 1.25, 1) +speed_wall_0 = =1 if speed_wall < 10 else (speed_wall - 10) +speed_topbottom = =round(speed_print / 2.25, 1) From 713cd5341d92803636fd3623d51f1a7e6811252e Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:51:31 +0100 Subject: [PATCH 013/197] Create cartesio_0.6.inst.cfg --- resources/variants/cartesio_0.6.inst.cfg | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 resources/variants/cartesio_0.6.inst.cfg diff --git a/resources/variants/cartesio_0.6.inst.cfg b/resources/variants/cartesio_0.6.inst.cfg new file mode 100644 index 0000000000..458c894310 --- /dev/null +++ b/resources/variants/cartesio_0.6.inst.cfg @@ -0,0 +1,15 @@ +[general] +name = 0.6 mm +version = 2 +definition = cartesio + +[metadata] +author = Cartesio +type = variant + +[values] +machine_nozzle_size = 0.6 +machine_nozzle_tip_outer_diameter = 1.05 +speed_wall = =round(speed_print / 1.25, 1) +speed_wall_0 = =1 if speed_wall < 10 else (speed_wall - 10) +speed_topbottom = =round(speed_print / 2.25, 1) From 0b879a5e944460f3be92b6f3540d1e4b37cdd84a Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:51:52 +0100 Subject: [PATCH 014/197] Create cartesio_0.8.inst.cfg --- resources/variants/cartesio_0.8.inst.cfg | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 resources/variants/cartesio_0.8.inst.cfg diff --git a/resources/variants/cartesio_0.8.inst.cfg b/resources/variants/cartesio_0.8.inst.cfg new file mode 100644 index 0000000000..24f632f5f6 --- /dev/null +++ b/resources/variants/cartesio_0.8.inst.cfg @@ -0,0 +1,15 @@ +[general] +name = 0.8 mm +version = 2 +definition = cartesio + +[metadata] +author = Cartesio +type = variant + +[values] +machine_nozzle_size = 0.8 +machine_nozzle_tip_outer_diameter = 1.05 +speed_wall = =round(speed_print / 1.25, 1) +speed_wall_0 = =1 if speed_wall < 10 else (speed_wall - 10) +speed_topbottom = =round(speed_print / 2.25, 1) From be26aad89bec0751eeb4bb10eca1518489ff8499 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 12 Jan 2017 10:52:20 +0100 Subject: [PATCH 015/197] Create cartesio_0.25.inst.cfg --- resources/variants/cartesio_0.25.inst.cfg | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 resources/variants/cartesio_0.25.inst.cfg diff --git a/resources/variants/cartesio_0.25.inst.cfg b/resources/variants/cartesio_0.25.inst.cfg new file mode 100644 index 0000000000..a286c43381 --- /dev/null +++ b/resources/variants/cartesio_0.25.inst.cfg @@ -0,0 +1,15 @@ +[general] +name = 0.25 mm +version = 2 +definition = cartesio + +[metadata] +author = Cartesio +type = variant + +[values] +machine_nozzle_size = 0.25 +machine_nozzle_tip_outer_diameter = 1.05 +speed_wall = =round(speed_print / 1.25, 1) +speed_wall_0 = =1 if speed_wall < 10 else (speed_wall - 10) +speed_topbottom = =round(speed_print / 2.25, 1) From 33e3dea2130bd765442015540e921bdb488bee2e Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 15 Jan 2017 03:41:07 +0100 Subject: [PATCH 016/197] Create renkforce_rf100.def.json --- .../definitions/renkforce_rf100.def.json | 87 +++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 resources/definitions/renkforce_rf100.def.json diff --git a/resources/definitions/renkforce_rf100.def.json b/resources/definitions/renkforce_rf100.def.json new file mode 100644 index 0000000000..8e7086836a --- /dev/null +++ b/resources/definitions/renkforce_rf100.def.json @@ -0,0 +1,87 @@ +{ + "id": "RF100", + "version": 2, + "name": "Renkforce RF100", + "inherits": "fdmprinter", + "metadata": { + "author": "Simon Peter (based on RF100.ini by Conrad Electronic SE)", + "category": "Other", + "file_formats": "text/x-gcode", + "manufacturer": "Renkforce", + "platform_offset": [0, 0, 0], + "visible": true + }, + + "overrides": { + "adhesion_type": { + "default_value": "skirt" + }, + "bottom_thickness": { + "default_value": 0 + }, + "infill_sparse_density": { + "default_value": 15 + }, + "machine_depth": { + "default_value": 100 + }, + "machine_end_gcode": { + "default_value": ";End GCode\nM104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning" + }, + "machine_gcode_flavor": { + "default_value": "RepRap (Marlin/Sprinter)" + }, + "machine_height": { + "default_value": 100 + }, + "machine_name": { + "default_value": "Renkforce RF100" + }, + "machine_start_gcode": { + "default_value": ";Sliced at: {day} {date} {time}\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{speed_travel} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{speed_travel}\nM117 Printing..." + }, + "machine_width": { + "default_value": 100 + }, + "material_diameter": { + "default_value": 1.75 + }, + "retraction_amount": { + "default_value": 2 + }, + "speed_layer_0": { + "default_value": 30 + }, + "speed_topbottom": { + "default_value": 30 + }, + "speed_travel": { + "default_value": 50 + }, + "speed_wall_0": { + "default_value": 25 + }, + "speed_wall_x": { + "default_value": 35 + }, + "support_xy_distance": { + "default_value": 0 + }, + "support_z_distance": { + "default_value": 0.1 + }, + "top_thickness": { + "default_value": 0.5 + } + }, + + "categories": { + "material": { + "settings": { + "material_bed_temperature": { + "visible": false + } + } + } + } +} From 86c631de265c96a81c0ed6066b958ad0705dc6c4 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 15 Jan 2017 12:27:02 +0100 Subject: [PATCH 017/197] Carry over all settings from ini and correct brand spelling --- .../definitions/renkforce_rf100.def.json | 192 ++++++++++++++++-- 1 file changed, 180 insertions(+), 12 deletions(-) diff --git a/resources/definitions/renkforce_rf100.def.json b/resources/definitions/renkforce_rf100.def.json index 8e7086836a..c8313c64d0 100644 --- a/resources/definitions/renkforce_rf100.def.json +++ b/resources/definitions/renkforce_rf100.def.json @@ -1,13 +1,13 @@ { "id": "RF100", "version": 2, - "name": "Renkforce RF100", + "name": "renkforce RF100", "inherits": "fdmprinter", "metadata": { "author": "Simon Peter (based on RF100.ini by Conrad Electronic SE)", "category": "Other", "file_formats": "text/x-gcode", - "manufacturer": "Renkforce", + "manufacturer": "renkforce", "platform_offset": [0, 0, 0], "visible": true }, @@ -17,10 +17,52 @@ "default_value": "skirt" }, "bottom_thickness": { - "default_value": 0 + "default_value": 0.5 + }, + "brim_line_count": { + "default_value": 20.0 + }, + "cool_fan_enabled": { + "default_value": true + }, + "cool_fan_full_at_height": { + "default_value": 0.5 + }, + "cool_fan_speed_max": { + "default_value": 100.0 + }, + "cool_fan_speed_min": { + "default_value": 100.0 + }, + "cool_lift_head": { + "default_value": true + }, + "cool_min_layer_time": { + "default_value": 5.0 + }, + "cool_min_speed": { + "default_value": 10.0 + }, + "infill_before_walls": { + "default_value": 1.0 + }, + "infill_overlap": { + "default_value": 15.0 }, "infill_sparse_density": { - "default_value": 15 + "default_value": 15.0 + }, + "layer_0_z_overlap": { + "default_value": 0.22 + }, + "layer_height": { + "default_value": 0.1 + }, + "layer_height_0": { + "default_value": 0.3 + }, + "line_width": { + "default_value": 0.4 }, "machine_depth": { "default_value": 100 @@ -35,7 +77,10 @@ "default_value": 100 }, "machine_name": { - "default_value": "Renkforce RF100" + "default_value": "renkforce RF100" + }, + "machine_nozzle_size": { + "default_value": 0.4 }, "machine_start_gcode": { "default_value": ";Sliced at: {day} {date} {time}\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{speed_travel} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{speed_travel}\nM117 Printing..." @@ -43,35 +88,158 @@ "machine_width": { "default_value": 100 }, + "magic_mesh_surface_mode": { + "default_value": "surface" + }, + "magic_spiralize": { + "default_value": true + }, + "material_bed_temperature": { + "default_value": 70.0 + }, "material_diameter": { "default_value": 1.75 }, + "material_flow": { + "default_value": 100.0 + }, + "material_print_temperature": { + "default_value": 210.0 + }, + "meshfix_extensive_stitching": { + "default_value": true + }, + "meshfix_keep_open_polygons": { + "default_value": true + }, + "meshfix_union_all": { + "default_value": true + }, + "meshfix_union_all_remove_holes": { + "default_value": true + }, + "ooze_shield_enabled": { + "default_value": true + }, + "prime_tower_enable": { + "default_value": true + }, + "prime_tower_size": { + "default_value": 12.24744871391589 + }, + "raft_airgap": { + "default_value": 0.22 + }, + "raft_base_line_spacing": { + "default_value": 3.0 + }, + "raft_base_line_width": { + "default_value": 1.0 + }, + "raft_base_thickness": { + "default_value": 0.3 + }, + "raft_interface_line_spacing": { + "default_value": 3.0 + }, + "raft_interface_line_width": { + "default_value": 0.4 + }, + "raft_interface_thickness": { + "default_value": 0.27 + }, + "raft_margin": { + "default_value": 5.0 + }, + "raft_surface_layers": { + "default_value": 2.0 + }, + "raft_surface_line_spacing": { + "default_value": 3.0 + }, + "raft_surface_line_width": { + "default_value": 0.4 + }, + "raft_surface_thickness": { + "default_value": 0.27 + }, "retraction_amount": { - "default_value": 2 + "default_value": 2.0 + }, + "retraction_combing": { + "default_value": "all" + }, + "retraction_enable": { + "default_value": true + }, + "retraction_hop_enabled": { + "default_value": 1.0 + }, + "retraction_min_travel": { + "default_value": 1.5 + }, + "retraction_speed": { + "default_value": 40.0 + }, + "skin_overlap": { + "default_value": 15.0 + }, + "skirt_brim_minimal_length": { + "default_value": 150.0 + }, + "skirt_gap": { + "default_value": 3.0 + }, + "skirt_line_count": { + "default_value": 1.0 + }, + "speed_infill": { + "default_value": 50.0 }, "speed_layer_0": { - "default_value": 30 + "default_value": 30.0 + }, + "speed_print": { + "default_value": 50.0 }, "speed_topbottom": { - "default_value": 30 + "default_value": 30.0 }, "speed_travel": { - "default_value": 50 + "default_value": 50.0 }, "speed_wall_0": { - "default_value": 25 + "default_value": 25.0 }, "speed_wall_x": { - "default_value": 35 + "default_value": 35.0 + }, + "support_angle": { + "default_value": 60.0 + }, + "support_enable": { + "default_value": 0.0 + }, + "support_infill_rate": { + "default_value": 15.0 + }, + "support_pattern": { + "default_value": "lines" + }, + "support_type": { + "default_value": "everywhere" }, "support_xy_distance": { - "default_value": 0 + "default_value": 0.5 }, "support_z_distance": { "default_value": 0.1 }, "top_thickness": { "default_value": 0.5 + }, + "wall_thickness": { + "default_value": 0.8 } }, From 19dcb3f23023470609eb7b817479743d47653ecc Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 15 Jan 2017 15:04:57 +0100 Subject: [PATCH 018/197] Remove magic_mesh_surface_mode and magic_spiralize --- resources/definitions/renkforce_rf100.def.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/resources/definitions/renkforce_rf100.def.json b/resources/definitions/renkforce_rf100.def.json index c8313c64d0..04190fd648 100644 --- a/resources/definitions/renkforce_rf100.def.json +++ b/resources/definitions/renkforce_rf100.def.json @@ -88,12 +88,6 @@ "machine_width": { "default_value": 100 }, - "magic_mesh_surface_mode": { - "default_value": "surface" - }, - "magic_spiralize": { - "default_value": true - }, "material_bed_temperature": { "default_value": 70.0 }, From 38a7ffa7da151501028350d94ab82c45d57112ae Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 16 Jan 2017 21:35:28 +0100 Subject: [PATCH 019/197] Some fixes regarding submodules and imports. --- .../VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py | 2 +- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py index dce2b311bb..031e6c16f3 100644 --- a/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py +++ b/plugins/VersionUpgrade/VersionUpgrade22to24/VersionUpgrade.py @@ -6,7 +6,7 @@ import os import os.path import io -from UM import Resources +from UM.Resources import Resources from UM.VersionUpgrade import VersionUpgrade # Superclass of the plugin. class VersionUpgrade22to24(VersionUpgrade): diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 6be8d45b0a..5d5561f7aa 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -72,7 +72,7 @@ class XmlMaterialProfile(InstanceContainer): super().setDirty(dirty) base_file = self.getMetaDataEntry("base_file", None) if base_file is not None and base_file != self._id: - containers = UM.Settings.ContainerRegistry.getInstance().findContainers(id=base_file) + containers = ContainerRegistry.getInstance().findContainers(id=base_file) if containers: base_container = containers[0] if not base_container.isReadOnly(): @@ -479,7 +479,7 @@ class XmlMaterialProfile(InstanceContainer): new_material_id = self.id + "_" + machine_id # It could be that we are overwriting, so check if the ID already exists. - materials = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=new_material_id) + materials = ContainerRegistry.getInstance().findInstanceContainers(id=new_material_id) if materials: new_material = materials[0] new_material.clearData() @@ -533,7 +533,7 @@ class XmlMaterialProfile(InstanceContainer): # It could be that we are overwriting, so check if the ID already exists. new_hotend_id = self.id + "_" + machine_id + "_" + hotend_id.replace(" ", "_") - materials = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=new_hotend_id) + materials = ContainerRegistry.getInstance().findInstanceContainers(id=new_hotend_id) if materials: new_hotend_material = materials[0] new_hotend_material.clearData() From 1b43e4981ed4b6623c9f0553d9269bf07c36ed9e Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 17 Jan 2017 16:57:37 +0100 Subject: [PATCH 020/197] Fixes for all of the plugins. Added a script to invoke mypy. (I'm stiiiick of .bat files. They are just broken.) --- cura/CrashHandler.py | 12 ++++--- plugins/3MFReader/ThreeMFReader.py | 4 ++- plugins/3MFReader/__init__.py | 8 ++--- plugins/3MFWriter/ThreeMFWriter.py | 4 ++- .../WindowsRemovableDrivePlugin.py | 2 +- plugins/SliceInfoPlugin/SliceInfo.py | 5 +-- .../NetworkPrinterOutputDevicePlugin.py | 2 +- plugins/USBPrinting/USBPrinterOutputDevice.py | 2 +- .../USBPrinterOutputDeviceManager.py | 4 +-- plugins/USBPrinting/avr_isp/stk500v2.py | 4 +-- plugins/X3DReader/X3DReader.py | 4 ++- run_mypy.py | 31 +++++++++++++++++++ 12 files changed, 62 insertions(+), 20 deletions(-) create mode 100644 run_mypy.py diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index ba8499d4f2..b658f88824 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -12,10 +12,14 @@ from UM.Logger import Logger from UM.i18n import i18nCatalog catalog = i18nCatalog("cura") -try: - from cura.CuraVersion import CuraDebugMode -except ImportError: - CuraDebugMode = False # [CodeStyle: Reflecting imported value] +MYPY = False +if MYPY: + CuraDebugMode = False +else: + try: + from cura.CuraVersion import CuraDebugMode + except ImportError: + CuraDebugMode = False # [CodeStyle: Reflecting imported value] # List of exceptions that should be considered "fatal" and abort the program. # These are primarily some exception types that we simply cannot really recover from diff --git a/plugins/3MFReader/ThreeMFReader.py b/plugins/3MFReader/ThreeMFReader.py index 976f54ba25..5638ce551c 100644 --- a/plugins/3MFReader/ThreeMFReader.py +++ b/plugins/3MFReader/ThreeMFReader.py @@ -17,8 +17,10 @@ from cura.Settings.ExtruderManager import ExtruderManager from cura.QualityManager import QualityManager from UM.Scene.SceneNode import SceneNode +MYPY = False try: - import xml.etree.cElementTree as ET + if not MYPY: + import xml.etree.cElementTree as ET except ImportError: Logger.log("w", "Unable to load cElementTree, switching to slower version") import xml.etree.ElementTree as ET diff --git a/plugins/3MFReader/__init__.py b/plugins/3MFReader/__init__.py index 3e05cb8dc7..cb4f9b9761 100644 --- a/plugins/3MFReader/__init__.py +++ b/plugins/3MFReader/__init__.py @@ -1,16 +1,16 @@ # Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. +from typing import Dict from . import ThreeMFReader from . import ThreeMFWorkspaceReader from UM.i18n import i18nCatalog -import UM.Platform +from UM.Platform import Platform catalog = i18nCatalog("cura") - -def getMetaData(): +def getMetaData() -> Dict: # Workarround for osx not supporting double file extensions correclty. - if UM.Platform.isOSX(): + if Platform.isOSX(): workspace_extension = "3mf" else: workspace_extension = "curaproject.3mf" diff --git a/plugins/3MFWriter/ThreeMFWriter.py b/plugins/3MFWriter/ThreeMFWriter.py index 882740c4ed..361cf796d0 100644 --- a/plugins/3MFWriter/ThreeMFWriter.py +++ b/plugins/3MFWriter/ThreeMFWriter.py @@ -7,8 +7,10 @@ from UM.Logger import Logger from UM.Math.Matrix import Matrix from UM.Application import Application +MYPY = False try: - import xml.etree.cElementTree as ET + if not MYPY: + import xml.etree.cElementTree as ET except ImportError: Logger.log("w", "Unable to load cElementTree, switching to slower version") import xml.etree.ElementTree as ET diff --git a/plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py b/plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py index 14a4681bc3..42f3935f65 100644 --- a/plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py +++ b/plugins/RemovableDriveOutputDevice/WindowsRemovableDrivePlugin.py @@ -8,7 +8,7 @@ catalog = i18nCatalog("cura") from . import RemovableDrivePlugin import string -import ctypes +import ctypes # type: ignore from ctypes import wintypes # Using ctypes.wintypes in the code below does not seem to work from UM.i18n import i18nCatalog diff --git a/plugins/SliceInfoPlugin/SliceInfo.py b/plugins/SliceInfoPlugin/SliceInfo.py index 4f39fd4818..05f7c0e6f5 100644 --- a/plugins/SliceInfoPlugin/SliceInfo.py +++ b/plugins/SliceInfoPlugin/SliceInfo.py @@ -1,5 +1,6 @@ # Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. +from typing import Any from cura.CuraApplication import CuraApplication @@ -26,8 +27,8 @@ import json catalog = i18nCatalog("cura") class SliceInfoJob(Job): - data = None - url = None + data = None # type: Any + url = None # type: str def __init__(self, url, data): super().__init__() diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py index 2725fa8d17..fe35b60de5 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py @@ -1,7 +1,7 @@ from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin from . import NetworkPrinterOutputDevice -from zeroconf import Zeroconf, ServiceBrowser, ServiceStateChange, ServiceInfo +from zeroconf import Zeroconf, ServiceBrowser, ServiceStateChange, ServiceInfo # type: ignore from UM.Logger import Logger from UM.Signal import Signal, signalemitter from UM.Application import Application diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index e344caee1d..7adb0b0d08 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -2,7 +2,7 @@ # Cura is released under the terms of the AGPLv3 or higher. from .avr_isp import stk500v2, ispBase, intelHex -import serial +import serial # type: ignore import threading import time import queue diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index 4dec2e3a06..ed97076df6 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -258,7 +258,7 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension): def getSerialPortList(self, only_list_usb = False): base_list = [] if platform.system() == "Windows": - import winreg #@UnresolvedImport + import winreg # type: ignore @UnresolvedImport try: key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\SERIALCOMM") i = 0 @@ -277,4 +277,4 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension): base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.*") + glob.glob("/dev/tty.usb*") + glob.glob("/dev/rfcomm*") + glob.glob("/dev/serial/by-id/*") return list(base_list) - _instance = None + _instance = None # type: "USBPrinterOutputDeviceManager" diff --git a/plugins/USBPrinting/avr_isp/stk500v2.py b/plugins/USBPrinting/avr_isp/stk500v2.py index 91bef53875..dbfc8dc756 100644 --- a/plugins/USBPrinting/avr_isp/stk500v2.py +++ b/plugins/USBPrinting/avr_isp/stk500v2.py @@ -7,7 +7,7 @@ import struct import sys import time -from serial import Serial +from serial import Serial # type: ignore from serial import SerialException from serial import SerialTimeoutException from UM.Logger import Logger @@ -184,7 +184,7 @@ class Stk500v2(ispBase.IspBase): def portList(): ret = [] - import _winreg + import _winreg # type: ignore key=_winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,"HARDWARE\\DEVICEMAP\\SERIALCOMM") #@UndefinedVariable i=0 while True: diff --git a/plugins/X3DReader/X3DReader.py b/plugins/X3DReader/X3DReader.py index 0a81e98d0d..f78023dfab 100644 --- a/plugins/X3DReader/X3DReader.py +++ b/plugins/X3DReader/X3DReader.py @@ -13,8 +13,10 @@ from UM.Mesh.MeshBuilder import MeshBuilder from UM.Mesh.MeshReader import MeshReader from UM.Scene.SceneNode import SceneNode +MYPY = False try: - import xml.etree.cElementTree as ET + if not MYPY: + import xml.etree.cElementTree as ET except ImportError: import xml.etree.ElementTree as ET diff --git a/run_mypy.py b/run_mypy.py new file mode 100644 index 0000000000..7c203f87d9 --- /dev/null +++ b/run_mypy.py @@ -0,0 +1,31 @@ +#!env python +import os +import subprocess + +os.putenv("MYPYPATH", r".;.\plugins;..\Uranium_hint\;..\Uranium_hint\stubs\\" ) + +def findModules(path): + result = [] + for entry in os.scandir(path): + if entry.is_dir() and os.path.exists(os.path.join(path, entry.name, "__init__.py")): + result.append(entry.name) + return result + +plugins = findModules("plugins") +plugins.sort() + +mods = ["cura"] + plugins + +for mod in mods: + print("------------- Checking module {mod}".format(**locals())) + result = subprocess.run(["python", r"c:\python35\Scripts\mypy", "-p", mod]) + if result.returncode != 0: + print(""" +Module {mod} failed checking. :( +""".format(**locals())) + break +else: + print(""" + +Done checking. All is good. +""") From cf85831d87daee40cf9b7cd8c66931a0558ecfd5 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 17 Jan 2017 20:56:28 +0100 Subject: [PATCH 021/197] Also check the upgrade plugins. --- plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py | 8 ++++---- run_mypy.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py index 5897524e93..3bff7c1bf5 100644 --- a/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py +++ b/plugins/VersionUpgrade/VersionUpgrade21to22/Profile.py @@ -26,7 +26,7 @@ class Profile: # # \param serialised A string with the contents of a profile. # \param filename The supposed filename of the profile, without extension. - def __init__(self, serialised: str, filename: str): + def __init__(self, serialised: str, filename: str) -> None: self._filename = filename parser = configparser.ConfigParser(interpolation = None) @@ -58,17 +58,17 @@ class Profile: self._material_name = None # Parse the settings. - self._settings = {} + self._settings = {} # type: Dict[str,str] if parser.has_section("settings"): for key, value in parser["settings"].items(): self._settings[key] = value # Parse the defaults and the disabled defaults. - self._changed_settings_defaults = {} + self._changed_settings_defaults = {} # type: Dict[str,str] if parser.has_section("defaults"): for key, value in parser["defaults"].items(): self._changed_settings_defaults[key] = value - self._disabled_settings_defaults = [] + self._disabled_settings_defaults = [] # type: List[str] if parser.has_section("disabled_defaults"): disabled_defaults_string = parser.get("disabled_defaults", "values") self._disabled_settings_defaults = [item for item in disabled_defaults_string.split(",") if item != ""] # Split by comma. diff --git a/run_mypy.py b/run_mypy.py index 7c203f87d9..c5dfb23802 100644 --- a/run_mypy.py +++ b/run_mypy.py @@ -2,7 +2,7 @@ import os import subprocess -os.putenv("MYPYPATH", r".;.\plugins;..\Uranium_hint\;..\Uranium_hint\stubs\\" ) +os.putenv("MYPYPATH", r".;.\plugins;.\plugins\VersionUpgrade;..\Uranium_hint\;..\Uranium_hint\stubs\\" ) def findModules(path): result = [] @@ -14,7 +14,7 @@ def findModules(path): plugins = findModules("plugins") plugins.sort() -mods = ["cura"] + plugins +mods = ["cura"] + plugins + findModules("plugins/VersionUpgrade") for mod in mods: print("------------- Checking module {mod}".format(**locals())) From 4fecf55b3b0e64e4f6720d8d628ba209c20a65a3 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 17 Jan 2017 20:56:50 +0100 Subject: [PATCH 022/197] Use double quotes instead of singles. --- cura/QualityManager.py | 2 +- cura/Settings/ContainerManager.py | 2 +- cura/Settings/ExtruderManager.py | 2 +- cura/Settings/ProfilesModel.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/QualityManager.py b/cura/QualityManager.py index 8aa3c3a097..d7b2c7d705 100644 --- a/cura/QualityManager.py +++ b/cura/QualityManager.py @@ -22,7 +22,7 @@ class QualityManager: QualityManager.__instance = cls() return QualityManager.__instance - __instance = None # type: 'QualityManager' + __instance = None # type: "QualityManager" ## Find a quality by name for a specific machine definition and materials. # diff --git a/cura/Settings/ContainerManager.py b/cura/Settings/ContainerManager.py index 061f0f9b79..4e4fc36784 100644 --- a/cura/Settings/ContainerManager.py +++ b/cura/Settings/ContainerManager.py @@ -697,7 +697,7 @@ class ContainerManager(QObject): ContainerManager.__instance = cls() return ContainerManager.__instance - __instance = None # type: 'ContainerManager' + __instance = None # type: "ContainerManager" # Factory function, used by QML @staticmethod diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 52a2a9c694..add906c166 100644 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -89,7 +89,7 @@ class ExtruderManager(QObject): # # \return The extruder manager. @classmethod - def getInstance(cls) -> 'ExtruderManager': + def getInstance(cls) -> "ExtruderManager": if not cls.__instance: cls.__instance = ExtruderManager() return cls.__instance diff --git a/cura/Settings/ProfilesModel.py b/cura/Settings/ProfilesModel.py index d60a633549..404bb569a5 100644 --- a/cura/Settings/ProfilesModel.py +++ b/cura/Settings/ProfilesModel.py @@ -38,7 +38,7 @@ class ProfilesModel(InstanceContainersModel): ProfilesModel.__instance = cls() return ProfilesModel.__instance - __instance = None # type: 'ProfilesModel' + __instance = None # type: "ProfilesModel" ## Fetch the list of containers to display. # From d5c96c1aaee119b96596c820bb636e254eb9643c Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Wed, 18 Jan 2017 13:49:18 +0100 Subject: [PATCH 023/197] Removed a line of debug. --- cura/Settings/MachineManager.py | 1 - 1 file changed, 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 8c14c7b007..fec31094ce 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -378,7 +378,6 @@ class MachineManager(QObject): # \param fallback_name \type{string} Name to use when (stripped) new_name is empty # \return \type{string} Name that is unique for the specified type and name/id def _createUniqueName(self, container_type: str, current_name: str, new_name: str, fallback_name: str) -> str: - Logger.log('d', str(ContainerRegistry.getInstance())) return ContainerRegistry.getInstance().createUniqueName(container_type, current_name, new_name, fallback_name) def _checkStacksHaveErrors(self): From 7e7031cd7feca9eb38ea14286682ced478210b0f Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 19 Jan 2017 09:25:29 +0100 Subject: [PATCH 024/197] Update cartesio.def.json --- resources/definitions/cartesio.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/cartesio.def.json b/resources/definitions/cartesio.def.json index 3c2f9be9c7..d08b1bb79d 100644 --- a/resources/definitions/cartesio.def.json +++ b/resources/definitions/cartesio.def.json @@ -37,7 +37,7 @@ "machine_width": { "default_value": 430 }, "machine_name": { "default_value": "Cartesio" }, "machine_start_gcode": { - "default_value": "M92 E162:162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S45\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-{retraction_amount} F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F9000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" + "default_value": "M92 E162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S{material_bed_temperature}\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-{retraction_amount} F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F9000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" }, "machine_end_gcode": { "default_value": "; -- END GCODE --\nM106 S255\nM140 S5\nM104 S5 T0\nM104 S5 T1\nG1 X20.0 Y260.0 F6000\nG4 S7\nM84\nG4 S90\nM107\nM42 P12 S0\nM42 P13 S0\nM84\n; -- end of END GCODE --" From 8f75f9d46a290eefb7b8d1beaa38cfe1b2a011c7 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Fri, 20 Jan 2017 10:44:20 +0100 Subject: [PATCH 025/197] Update cartesio.def.json --- resources/definitions/cartesio.def.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/resources/definitions/cartesio.def.json b/resources/definitions/cartesio.def.json index d08b1bb79d..a8439dafcf 100644 --- a/resources/definitions/cartesio.def.json +++ b/resources/definitions/cartesio.def.json @@ -47,6 +47,10 @@ "machine_min_cool_heat_time_window": {"default_value": 5}, "retraction_prime_speed": {"value": "10"}, "switch_extruder_prime_speed": {"value": "10"}, - "extruder_prime_pos_abs": { "default_value": true } + "retraction_speed": {"value": "40"}, + "switch_extruder_retraction_speeds": {"value": "40"}, + "retraction_min_travel": {"value": "5"}, + "switch_extruder_retraction_amount": {"value": "2"}, + "cool_fan_speed": {"value": "50"} } } From 1bb62dae6fd62c75a90baee30c44c1949fc63435 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Fri, 20 Jan 2017 10:48:34 +0100 Subject: [PATCH 026/197] Update cartesio.def.json --- resources/definitions/cartesio.def.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/definitions/cartesio.def.json b/resources/definitions/cartesio.def.json index a8439dafcf..66c70baf74 100644 --- a/resources/definitions/cartesio.def.json +++ b/resources/definitions/cartesio.def.json @@ -50,7 +50,6 @@ "retraction_speed": {"value": "40"}, "switch_extruder_retraction_speeds": {"value": "40"}, "retraction_min_travel": {"value": "5"}, - "switch_extruder_retraction_amount": {"value": "2"}, - "cool_fan_speed": {"value": "50"} + "switch_extruder_retraction_amount": {"value": "2"} } } From 6d05252dce0bca837ab3e0cf0b962e382604c8e3 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 21 Jan 2017 13:01:47 +0100 Subject: [PATCH 027/197] Fix "Unable to slice with the current settings. The following settings have errors: Prime Tower X Position, Prime Tower Y Position." --- resources/definitions/renkforce_rf100.def.json | 6 ------ 1 file changed, 6 deletions(-) diff --git a/resources/definitions/renkforce_rf100.def.json b/resources/definitions/renkforce_rf100.def.json index 04190fd648..4660631f50 100644 --- a/resources/definitions/renkforce_rf100.def.json +++ b/resources/definitions/renkforce_rf100.def.json @@ -115,12 +115,6 @@ "ooze_shield_enabled": { "default_value": true }, - "prime_tower_enable": { - "default_value": true - }, - "prime_tower_size": { - "default_value": 12.24744871391589 - }, "raft_airgap": { "default_value": 0.22 }, From 90648bc756af5cf68f8169d8e2218b801a506a83 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sat, 21 Jan 2017 15:27:39 +0100 Subject: [PATCH 028/197] Remove meshfix_* so that http://www.thingiverse.com/thing:692523 can be sliced --- resources/definitions/renkforce_rf100.def.json | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/resources/definitions/renkforce_rf100.def.json b/resources/definitions/renkforce_rf100.def.json index 4660631f50..1f76ffc06b 100644 --- a/resources/definitions/renkforce_rf100.def.json +++ b/resources/definitions/renkforce_rf100.def.json @@ -100,18 +100,6 @@ "material_print_temperature": { "default_value": 210.0 }, - "meshfix_extensive_stitching": { - "default_value": true - }, - "meshfix_keep_open_polygons": { - "default_value": true - }, - "meshfix_union_all": { - "default_value": true - }, - "meshfix_union_all_remove_holes": { - "default_value": true - }, "ooze_shield_enabled": { "default_value": true }, From eaa8cbb1601758651b0f48cf4b7c7311a220e5f1 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 22 Jan 2017 22:56:59 +0100 Subject: [PATCH 029/197] Changes as suggested by @Ghostkeeper in https://github.com/Ultimaker/Cura/pull/1350#pullrequestreview-17836965 --- .../definitions/renkforce_rf100.def.json | 38 +++---------------- 1 file changed, 6 insertions(+), 32 deletions(-) diff --git a/resources/definitions/renkforce_rf100.def.json b/resources/definitions/renkforce_rf100.def.json index 1f76ffc06b..3b17848476 100644 --- a/resources/definitions/renkforce_rf100.def.json +++ b/resources/definitions/renkforce_rf100.def.json @@ -1,14 +1,13 @@ { "id": "RF100", "version": 2, - "name": "renkforce RF100", + "name": "Renkforce RF100", "inherits": "fdmprinter", "metadata": { "author": "Simon Peter (based on RF100.ini by Conrad Electronic SE)", "category": "Other", "file_formats": "text/x-gcode", - "manufacturer": "renkforce", - "platform_offset": [0, 0, 0], + "manufacturer": "Renkforce", "visible": true }, @@ -17,7 +16,7 @@ "default_value": "skirt" }, "bottom_thickness": { - "default_value": 0.5 + "value": 0.5 }, "brim_line_count": { "default_value": 20.0 @@ -44,26 +43,17 @@ "default_value": 10.0 }, "infill_before_walls": { - "default_value": 1.0 + "default_value": true }, "infill_overlap": { "default_value": 15.0 }, - "infill_sparse_density": { - "default_value": 15.0 - }, "layer_0_z_overlap": { "default_value": 0.22 }, - "layer_height": { - "default_value": 0.1 - }, "layer_height_0": { "default_value": 0.3 }, - "line_width": { - "default_value": 0.4 - }, "machine_depth": { "default_value": 100 }, @@ -77,10 +67,7 @@ "default_value": 100 }, "machine_name": { - "default_value": "renkforce RF100" - }, - "machine_nozzle_size": { - "default_value": 0.4 + "default_value": "Renkforce RF100" }, "machine_start_gcode": { "default_value": ";Sliced at: {day} {date} {time}\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{speed_travel} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{speed_travel}\nM117 Printing..." @@ -89,14 +76,11 @@ "default_value": 100 }, "material_bed_temperature": { - "default_value": 70.0 + "visible": false }, "material_diameter": { "default_value": 1.75 }, - "material_flow": { - "default_value": 100.0 - }, "material_print_temperature": { "default_value": 210.0 }, @@ -217,15 +201,5 @@ "wall_thickness": { "default_value": 0.8 } - }, - - "categories": { - "material": { - "settings": { - "material_bed_temperature": { - "visible": false - } - } - } } } From e7cad12bf612fbf4c8c78d87cab8ab896776ca9f Mon Sep 17 00:00:00 2001 From: probonopd Date: Mon, 23 Jan 2017 00:26:53 +0000 Subject: [PATCH 030/197] Replace default_value by value, and convert the content to a string that evaluates to the same value in Python As per https://github.com/Ultimaker/Cura/issues/1316#issuecomment-274371670 --- .../definitions/renkforce_rf100.def.json | 126 +++++++++--------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/resources/definitions/renkforce_rf100.def.json b/resources/definitions/renkforce_rf100.def.json index 3b17848476..7a350c3d5e 100644 --- a/resources/definitions/renkforce_rf100.def.json +++ b/resources/definitions/renkforce_rf100.def.json @@ -13,193 +13,193 @@ "overrides": { "adhesion_type": { - "default_value": "skirt" + "value": "skirt" }, "bottom_thickness": { - "value": 0.5 + "value": "0.5" }, "brim_line_count": { - "default_value": 20.0 + "value": "20.0" }, "cool_fan_enabled": { - "default_value": true + "value": "True" }, "cool_fan_full_at_height": { - "default_value": 0.5 + "value": "0.5" }, "cool_fan_speed_max": { - "default_value": 100.0 + "value": "100.0" }, "cool_fan_speed_min": { - "default_value": 100.0 + "value": "100.0" }, "cool_lift_head": { - "default_value": true + "value": "True" }, "cool_min_layer_time": { - "default_value": 5.0 + "value": "5.0" }, "cool_min_speed": { - "default_value": 10.0 + "value": "10.0" }, "infill_before_walls": { - "default_value": true + "value": "True" }, "infill_overlap": { - "default_value": 15.0 + "value": "15.0" }, "layer_0_z_overlap": { - "default_value": 0.22 + "value": "0.22" }, "layer_height_0": { - "default_value": 0.3 + "value": "0.3" }, "machine_depth": { - "default_value": 100 + "value": "100" }, "machine_end_gcode": { - "default_value": ";End GCode\nM104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning" + "value": ";End GCode\nM104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning" }, "machine_gcode_flavor": { - "default_value": "RepRap (Marlin/Sprinter)" + "value": "RepRap (Marlin/Sprinter)" }, "machine_height": { - "default_value": 100 + "value": "100" }, "machine_name": { - "default_value": "Renkforce RF100" + "value": "Renkforce RF100" }, "machine_start_gcode": { - "default_value": ";Sliced at: {day} {date} {time}\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{speed_travel} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{speed_travel}\nM117 Printing..." + "value": ";Sliced at: {day} {date} {time}\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{speed_travel} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{speed_travel}\nM117 Printing..." }, "machine_width": { - "default_value": 100 + "value": "100" }, "material_bed_temperature": { - "visible": false + "visible": "False" }, "material_diameter": { - "default_value": 1.75 + "value": "1.75" }, "material_print_temperature": { - "default_value": 210.0 + "value": "210.0" }, "ooze_shield_enabled": { - "default_value": true + "value": "True" }, "raft_airgap": { - "default_value": 0.22 + "value": "0.22" }, "raft_base_line_spacing": { - "default_value": 3.0 + "value": "3.0" }, "raft_base_line_width": { - "default_value": 1.0 + "value": "1.0" }, "raft_base_thickness": { - "default_value": 0.3 + "value": "0.3" }, "raft_interface_line_spacing": { - "default_value": 3.0 + "value": "3.0" }, "raft_interface_line_width": { - "default_value": 0.4 + "value": "0.4" }, "raft_interface_thickness": { - "default_value": 0.27 + "value": "0.27" }, "raft_margin": { - "default_value": 5.0 + "value": "5.0" }, "raft_surface_layers": { - "default_value": 2.0 + "value": "2.0" }, "raft_surface_line_spacing": { - "default_value": 3.0 + "value": "3.0" }, "raft_surface_line_width": { - "default_value": 0.4 + "value": "0.4" }, "raft_surface_thickness": { - "default_value": 0.27 + "value": "0.27" }, "retraction_amount": { - "default_value": 2.0 + "value": "2.0" }, "retraction_combing": { - "default_value": "all" + "value": "all" }, "retraction_enable": { - "default_value": true + "value": "True" }, "retraction_hop_enabled": { - "default_value": 1.0 + "value": "1.0" }, "retraction_min_travel": { - "default_value": 1.5 + "value": "1.5" }, "retraction_speed": { - "default_value": 40.0 + "value": "40.0" }, "skin_overlap": { - "default_value": 15.0 + "value": "15.0" }, "skirt_brim_minimal_length": { - "default_value": 150.0 + "value": "150.0" }, "skirt_gap": { - "default_value": 3.0 + "value": "3.0" }, "skirt_line_count": { - "default_value": 1.0 + "value": "1.0" }, "speed_infill": { - "default_value": 50.0 + "value": "50.0" }, "speed_layer_0": { - "default_value": 30.0 + "value": "30.0" }, "speed_print": { - "default_value": 50.0 + "value": "50.0" }, "speed_topbottom": { - "default_value": 30.0 + "value": "30.0" }, "speed_travel": { - "default_value": 50.0 + "value": "50.0" }, "speed_wall_0": { - "default_value": 25.0 + "value": "25.0" }, "speed_wall_x": { - "default_value": 35.0 + "value": "35.0" }, "support_angle": { - "default_value": 60.0 + "value": "60.0" }, "support_enable": { - "default_value": 0.0 + "value": "False" }, "support_infill_rate": { - "default_value": 15.0 + "value": "15.0" }, "support_pattern": { - "default_value": "lines" + "value": "lines" }, "support_type": { - "default_value": "everywhere" + "value": "everywhere" }, "support_xy_distance": { - "default_value": 0.5 + "value": "0.5" }, "support_z_distance": { - "default_value": 0.1 + "value": "0.1" }, "top_thickness": { - "default_value": 0.5 + "value": "0.5" }, "wall_thickness": { - "default_value": 0.8 + "value": "0.8" } } } From db8f241b6d2b8d8373e2ce7cb84cded94ef1b04c Mon Sep 17 00:00:00 2001 From: MaukCC Date: Mon, 23 Jan 2017 12:49:28 +0100 Subject: [PATCH 031/197] Update cartesio.def.json --- resources/definitions/cartesio.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/cartesio.def.json b/resources/definitions/cartesio.def.json index 66c70baf74..6cffc38816 100644 --- a/resources/definitions/cartesio.def.json +++ b/resources/definitions/cartesio.def.json @@ -37,7 +37,7 @@ "machine_width": { "default_value": 430 }, "machine_name": { "default_value": "Cartesio" }, "machine_start_gcode": { - "default_value": "M92 E162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S{material_bed_temperature}\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-{retraction_amount} F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F9000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" + "default_value": "M92 E162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S{material_bed_temperature}\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-1 F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F9000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" }, "machine_end_gcode": { "default_value": "; -- END GCODE --\nM106 S255\nM140 S5\nM104 S5 T0\nM104 S5 T1\nG1 X20.0 Y260.0 F6000\nG4 S7\nM84\nG4 S90\nM107\nM42 P12 S0\nM42 P13 S0\nM84\n; -- end of END GCODE --" From ada08c8cbfe1f7ef8652968f8a50a7b71109d51b Mon Sep 17 00:00:00 2001 From: MaukCC Date: Wed, 25 Jan 2017 12:47:46 +0100 Subject: [PATCH 032/197] Delete cartesio_0.6.inst.cfg --- resources/variants/cartesio_0.6.inst.cfg | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 resources/variants/cartesio_0.6.inst.cfg diff --git a/resources/variants/cartesio_0.6.inst.cfg b/resources/variants/cartesio_0.6.inst.cfg deleted file mode 100644 index 458c894310..0000000000 --- a/resources/variants/cartesio_0.6.inst.cfg +++ /dev/null @@ -1,15 +0,0 @@ -[general] -name = 0.6 mm -version = 2 -definition = cartesio - -[metadata] -author = Cartesio -type = variant - -[values] -machine_nozzle_size = 0.6 -machine_nozzle_tip_outer_diameter = 1.05 -speed_wall = =round(speed_print / 1.25, 1) -speed_wall_0 = =1 if speed_wall < 10 else (speed_wall - 10) -speed_topbottom = =round(speed_print / 2.25, 1) From 3751117f8fffa80fdf1b41cf22df57074ca8c098 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Wed, 25 Jan 2017 12:49:00 +0100 Subject: [PATCH 033/197] Update cartesio_0.4.inst.cfg --- resources/variants/cartesio_0.4.inst.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/variants/cartesio_0.4.inst.cfg b/resources/variants/cartesio_0.4.inst.cfg index 5212b7fede..b871cfeec4 100644 --- a/resources/variants/cartesio_0.4.inst.cfg +++ b/resources/variants/cartesio_0.4.inst.cfg @@ -10,6 +10,6 @@ type = variant [values] machine_nozzle_size = 0.4 machine_nozzle_tip_outer_diameter = 1.05 -speed_wall = =round(speed_print / 1.25, 1) -speed_wall_0 = =1 if speed_wall < 10 else (speed_wall - 10) -speed_topbottom = =round(speed_print / 2.25, 1) +speed_wall = =round(speed_print / 2, 1) +speed_wall_0 = =10 if speed_wall < 11 else (speed_print / 5 * 3) +speed_topbottom = =round(speed_print / 5 * 3, 1) From 61d48778259e57c83758be571fbcea0fe54cc8d3 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Wed, 25 Jan 2017 12:49:18 +0100 Subject: [PATCH 034/197] Update cartesio_0.25.inst.cfg --- resources/variants/cartesio_0.25.inst.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/variants/cartesio_0.25.inst.cfg b/resources/variants/cartesio_0.25.inst.cfg index a286c43381..1f72527eae 100644 --- a/resources/variants/cartesio_0.25.inst.cfg +++ b/resources/variants/cartesio_0.25.inst.cfg @@ -10,6 +10,6 @@ type = variant [values] machine_nozzle_size = 0.25 machine_nozzle_tip_outer_diameter = 1.05 -speed_wall = =round(speed_print / 1.25, 1) -speed_wall_0 = =1 if speed_wall < 10 else (speed_wall - 10) -speed_topbottom = =round(speed_print / 2.25, 1) +speed_wall = =round(speed_print / 2, 1) +speed_wall_0 = =10 if speed_wall < 11 else (speed_print / 5 * 3) +speed_topbottom = =round(speed_print / 5 * 3, 1) From 3a27deb4af4908791f66cf3e14f20aa432ea609f Mon Sep 17 00:00:00 2001 From: MaukCC Date: Wed, 25 Jan 2017 12:49:37 +0100 Subject: [PATCH 035/197] Update cartesio_0.8.inst.cfg --- resources/variants/cartesio_0.8.inst.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/variants/cartesio_0.8.inst.cfg b/resources/variants/cartesio_0.8.inst.cfg index 24f632f5f6..f1f4ce8f8d 100644 --- a/resources/variants/cartesio_0.8.inst.cfg +++ b/resources/variants/cartesio_0.8.inst.cfg @@ -10,6 +10,6 @@ type = variant [values] machine_nozzle_size = 0.8 machine_nozzle_tip_outer_diameter = 1.05 -speed_wall = =round(speed_print / 1.25, 1) -speed_wall_0 = =1 if speed_wall < 10 else (speed_wall - 10) -speed_topbottom = =round(speed_print / 2.25, 1) +speed_wall = =round(speed_print / 2, 1) +speed_wall_0 = =10 if speed_wall < 11 else (speed_print / 5 * 3) +speed_topbottom = =round(speed_print / 5 * 3, 1) From cc499ec59eb5578bc9b88d10c4bfc220ceba42c0 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Wed, 25 Jan 2017 14:57:42 +0100 Subject: [PATCH 036/197] Update cartesio.def.json --- resources/definitions/cartesio.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/cartesio.def.json b/resources/definitions/cartesio.def.json index 6cffc38816..ca5520484f 100644 --- a/resources/definitions/cartesio.def.json +++ b/resources/definitions/cartesio.def.json @@ -37,7 +37,7 @@ "machine_width": { "default_value": 430 }, "machine_name": { "default_value": "Cartesio" }, "machine_start_gcode": { - "default_value": "M92 E162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S{material_bed_temperature}\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-1 F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F9000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" + "default_value": "M92 E162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S{material_bed_temperature}\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-1 F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F6000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" }, "machine_end_gcode": { "default_value": "; -- END GCODE --\nM106 S255\nM140 S5\nM104 S5 T0\nM104 S5 T1\nG1 X20.0 Y260.0 F6000\nG4 S7\nM84\nG4 S90\nM107\nM42 P12 S0\nM42 P13 S0\nM84\n; -- end of END GCODE --" From 6acfa572e04ee5d5aa60f615aaee27594bacfcf9 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Wed, 25 Jan 2017 14:59:18 +0100 Subject: [PATCH 037/197] Update cartesio_extruder_0.def.json --- resources/extruders/cartesio_extruder_0.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/extruders/cartesio_extruder_0.def.json b/resources/extruders/cartesio_extruder_0.def.json index f943bb7fed..8b72e81a4d 100644 --- a/resources/extruders/cartesio_extruder_0.def.json +++ b/resources/extruders/cartesio_extruder_0.def.json @@ -16,7 +16,7 @@ "machine_nozzle_offset_x": { "default_value": 0.0 }, "machine_nozzle_offset_y": { "default_value": 0.0 }, "machine_extruder_start_code": { - "default_value": "\n;start extruder_0\nG1 X70 Y20 F9000\n" + "default_value": "\n;start extruder_0\nM117 Heating nozzles....\nM104 S190 T0\nG1 X70 Y20 F9000\nM109 S190 T0 ;wait for nozzle to heat up\nT0\n\nM117 purging nozzle\nG92 E0\nG1 E6 F90\nG92 E0\nG1 E-2 F300\nG92 E0\nM117 wiping nozzle\nG1 X1 Y28 F3000\nG1 X70 F6000\n\nM117 printing\n" }, "machine_extruder_end_code": { "default_value": "\nM104 T0 S120\n;end extruder_0\n" From 6047f807ec1d1a612722da588dc6d517767321f3 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Wed, 25 Jan 2017 15:16:15 +0100 Subject: [PATCH 038/197] Update cartesio_extruder_1.def.json --- resources/extruders/cartesio_extruder_1.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/extruders/cartesio_extruder_1.def.json b/resources/extruders/cartesio_extruder_1.def.json index 8549ffcfcb..ee09b6d363 100644 --- a/resources/extruders/cartesio_extruder_1.def.json +++ b/resources/extruders/cartesio_extruder_1.def.json @@ -16,7 +16,7 @@ "machine_nozzle_offset_x": { "default_value": 24.0 }, "machine_nozzle_offset_y": { "default_value": 0.0 }, "machine_extruder_start_code": { - "default_value": "\n;start extruder_1\nG1 X70 Y20 F9000\n" + "default_value": "\n;start extruder_1\nM117 Heating nozzles....\nM104 S190 T1\nG1 X70 Y20 F9000\nM109 S190 T1 ;wait for nozzle to heat up\n\nM117 purging nozzle\nG92 E0\nG1 E6 F90\nG92 E0\nG1 E-2 F300\nG92 E0\n\nM117 wiping nozzle\nG1 X1 Y28 F3000\nG1 X70 F6000\n\nM117 printing\n" }, "machine_extruder_end_code": { "default_value": "\nM104 T0 S120\n;end extruder_1\n" From 9a117b40299af2330211792646847aaed5e822e4 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Wed, 25 Jan 2017 15:17:03 +0100 Subject: [PATCH 039/197] Update cartesio_extruder_0.def.json --- resources/extruders/cartesio_extruder_0.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/extruders/cartesio_extruder_0.def.json b/resources/extruders/cartesio_extruder_0.def.json index 8b72e81a4d..cf413a2fc5 100644 --- a/resources/extruders/cartesio_extruder_0.def.json +++ b/resources/extruders/cartesio_extruder_0.def.json @@ -16,7 +16,7 @@ "machine_nozzle_offset_x": { "default_value": 0.0 }, "machine_nozzle_offset_y": { "default_value": 0.0 }, "machine_extruder_start_code": { - "default_value": "\n;start extruder_0\nM117 Heating nozzles....\nM104 S190 T0\nG1 X70 Y20 F9000\nM109 S190 T0 ;wait for nozzle to heat up\nT0\n\nM117 purging nozzle\nG92 E0\nG1 E6 F90\nG92 E0\nG1 E-2 F300\nG92 E0\nM117 wiping nozzle\nG1 X1 Y28 F3000\nG1 X70 F6000\n\nM117 printing\n" + "default_value": "\n;start extruder_0\nM117 Heating nozzles....\nM104 S190 T0\nG1 X70 Y20 F9000\nM109 S190 T0\n\nM117 purging nozzle\nG92 E0\nG1 E6 F90\nG92 E0\nG1 E-2 F300\nG92 E0\n\nM117 wiping nozzle\nG1 X1 Y28 F3000\nG1 X70 F6000\n\nM117 printing\n" }, "machine_extruder_end_code": { "default_value": "\nM104 T0 S120\n;end extruder_0\n" From 873340376e7ae44ea689ba9094950f3ebcd84196 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 12:38:26 +0100 Subject: [PATCH 040/197] Update cartesio_0.25.inst.cfg --- resources/variants/cartesio_0.25.inst.cfg | 44 +++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/resources/variants/cartesio_0.25.inst.cfg b/resources/variants/cartesio_0.25.inst.cfg index 1f72527eae..7f828ba1b4 100644 --- a/resources/variants/cartesio_0.25.inst.cfg +++ b/resources/variants/cartesio_0.25.inst.cfg @@ -10,6 +10,44 @@ type = variant [values] machine_nozzle_size = 0.25 machine_nozzle_tip_outer_diameter = 1.05 -speed_wall = =round(speed_print / 2, 1) -speed_wall_0 = =10 if speed_wall < 11 else (speed_print / 5 * 3) -speed_topbottom = =round(speed_print / 5 * 3, 1) + +wall_0_inset = -0.05 +fill_perimeter_gaps = nowhere +travel_compensate_overlapping_walls_enabled = + +infill_sparse_density = 25 +infill_overlap = -50 +skin_overlap = -40 + +material_print_temperature_layer_0 = =round(material_print_temperature) +material_initial_print_temperature = =round(material_print_temperature) +material_diameter = 1.75 +retraction_amount = 1 +retraction_speed = 40 +retraction_prime_speed = =round(retraction_speed / 4) +retraction_min_travel = =round(line_width * 10) +switch_extruder_retraction_amount = 2 +switch_extruder_retraction_speeds = 40 +switch_extruder_prime_speed = =round(switch_extruder_retraction_speeds / 4) + +speed_print = =50 if layer_height < 0.4 else 30 +speed_infill = =round(speed_print) +speed_layer_0 = =round(speed_print / 5 * 4) +speed_wall = =round(speed_print / 2) +speed_wall_0 = =10 if speed_wall < 11 else (speed_print / 5 *3) +speed_topbottom = =round(speed_print / 5 * 4) +speed_slowdown_layers = 1 +speed_travel = =round(speed_print if magic_spiralize else 150) +speed_travel_layer_0 = =round(speed_travel) + +retraction_combing = off +retraction_hop_enabled = true + +adhesion_type = skirt +skirt_gap = 0.5 +skirt_brim_minimal_length = 50 + +coasting_enable = true +coasting_volume = 0.1 +coasting_min_volume = 0.17 +coasting_speed = 90 From f68e09ce9ad65ec4134b1e5317c57b933c070355 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 12:38:57 +0100 Subject: [PATCH 041/197] Update cartesio_0.4.inst.cfg --- resources/variants/cartesio_0.4.inst.cfg | 44 ++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/resources/variants/cartesio_0.4.inst.cfg b/resources/variants/cartesio_0.4.inst.cfg index b871cfeec4..ded164c660 100644 --- a/resources/variants/cartesio_0.4.inst.cfg +++ b/resources/variants/cartesio_0.4.inst.cfg @@ -10,6 +10,44 @@ type = variant [values] machine_nozzle_size = 0.4 machine_nozzle_tip_outer_diameter = 1.05 -speed_wall = =round(speed_print / 2, 1) -speed_wall_0 = =10 if speed_wall < 11 else (speed_print / 5 * 3) -speed_topbottom = =round(speed_print / 5 * 3, 1) + +wall_0_inset = -0.05 +fill_perimeter_gaps = nowhere +travel_compensate_overlapping_walls_enabled = + +infill_sparse_density = 25 +infill_overlap = -50 +skin_overlap = -40 + +material_print_temperature_layer_0 = =round(material_print_temperature) +material_initial_print_temperature = =round(material_print_temperature) +material_diameter = 1.75 +retraction_amount = 1 +retraction_speed = 40 +retraction_prime_speed = =round(retraction_speed / 4) +retraction_min_travel = =round(line_width * 10) +switch_extruder_retraction_amount = 2 +switch_extruder_retraction_speeds = 40 +switch_extruder_prime_speed = =round(switch_extruder_retraction_speeds / 4) + +speed_print = =50 if layer_height < 0.4 else 30 +speed_infill = =round(speed_print) +speed_layer_0 = =round(speed_print / 5 * 4) +speed_wall = =round(speed_print / 2) +speed_wall_0 = =10 if speed_wall < 11 else (speed_print / 5 *3) +speed_topbottom = =round(speed_print / 5 * 4) +speed_slowdown_layers = 1 +speed_travel = =round(speed_print if magic_spiralize else 150) +speed_travel_layer_0 = =round(speed_travel) + +retraction_combing = off +retraction_hop_enabled = true + +adhesion_type = skirt +skirt_gap = 0.5 +skirt_brim_minimal_length = 50 + +coasting_enable = true +coasting_volume = 0.1 +coasting_min_volume = 0.17 +coasting_speed = 90 From 059c70968ea0d982fe6427430e0ec174253fe65f Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 12:39:21 +0100 Subject: [PATCH 042/197] Update cartesio_0.8.inst.cfg --- resources/variants/cartesio_0.8.inst.cfg | 44 ++++++++++++++++++++++-- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/resources/variants/cartesio_0.8.inst.cfg b/resources/variants/cartesio_0.8.inst.cfg index f1f4ce8f8d..34381b9688 100644 --- a/resources/variants/cartesio_0.8.inst.cfg +++ b/resources/variants/cartesio_0.8.inst.cfg @@ -10,6 +10,44 @@ type = variant [values] machine_nozzle_size = 0.8 machine_nozzle_tip_outer_diameter = 1.05 -speed_wall = =round(speed_print / 2, 1) -speed_wall_0 = =10 if speed_wall < 11 else (speed_print / 5 * 3) -speed_topbottom = =round(speed_print / 5 * 3, 1) + +wall_0_inset = -0.05 +fill_perimeter_gaps = nowhere +travel_compensate_overlapping_walls_enabled = + +infill_sparse_density = 25 +infill_overlap = -50 +skin_overlap = -40 + +material_print_temperature_layer_0 = =round(material_print_temperature) +material_initial_print_temperature = =round(material_print_temperature) +material_diameter = 1.75 +retraction_amount = 2 +retraction_speed = 40 +retraction_prime_speed = =round(retraction_speed / 4) +retraction_min_travel = =round(line_width * 10) +switch_extruder_retraction_amount = 2 +switch_extruder_retraction_speeds = 40 +switch_extruder_prime_speed = =round(switch_extruder_retraction_speeds / 4) + +speed_print = =50 if layer_height < 0.4 else 30 +speed_infill = =round(speed_print) +speed_layer_0 = =round(speed_print / 5 * 4) +speed_wall = =round(speed_print / 2) +speed_wall_0 = =10 if speed_wall < 11 else (speed_print / 5 *3) +speed_topbottom = =round(speed_print / 5 * 4) +speed_slowdown_layers = 1 +speed_travel = =round(speed_print if magic_spiralize else 150) +speed_travel_layer_0 = =round(speed_travel) + +retraction_combing = off +retraction_hop_enabled = true + +adhesion_type = skirt +skirt_gap = 0.5 +skirt_brim_minimal_length = 50 + +coasting_enable = true +coasting_volume = 0.1 +coasting_min_volume = 0.17 +coasting_speed = 90 From 7586054cdf218f5c7d26d5ef12dc949799fdb0a1 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 12:41:39 +0100 Subject: [PATCH 043/197] Update cartesio.def.json --- resources/definitions/cartesio.def.json | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/resources/definitions/cartesio.def.json b/resources/definitions/cartesio.def.json index ca5520484f..579b1edd25 100644 --- a/resources/definitions/cartesio.def.json +++ b/resources/definitions/cartesio.def.json @@ -27,7 +27,6 @@ }, "overrides": { - "material_diameter": { "default_value": 1.75 }, "machine_extruder_count": { "default_value": 4 }, "machine_heated_bed": { "default_value": true }, "machine_center_is_zero": { "default_value": false }, @@ -44,12 +43,6 @@ }, "machine_nozzle_heat_up_speed": {"default_value": 20}, "machine_nozzle_cool_down_speed": {"default_value": 20}, - "machine_min_cool_heat_time_window": {"default_value": 5}, - "retraction_prime_speed": {"value": "10"}, - "switch_extruder_prime_speed": {"value": "10"}, - "retraction_speed": {"value": "40"}, - "switch_extruder_retraction_speeds": {"value": "40"}, - "retraction_min_travel": {"value": "5"}, - "switch_extruder_retraction_amount": {"value": "2"} + "machine_min_cool_heat_time_window": {"default_value": 5} } } From 7d98b98a993ed1f2b80e8191f753741c5fa804f8 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 12:45:47 +0100 Subject: [PATCH 044/197] Update cartesio_extruder_2.def.json --- resources/extruders/cartesio_extruder_2.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/extruders/cartesio_extruder_2.def.json b/resources/extruders/cartesio_extruder_2.def.json index 0cd520f2fc..72020ced95 100644 --- a/resources/extruders/cartesio_extruder_2.def.json +++ b/resources/extruders/cartesio_extruder_2.def.json @@ -16,7 +16,7 @@ "machine_nozzle_offset_x": { "default_value": 0.0 }, "machine_nozzle_offset_y": { "default_value": 60.0 }, "machine_extruder_start_code": { - "default_value": "\n;start extruder_2\nG1 X70 Y20 F9000\n" + "default_value": "\n;start extruder_2\nM117 Heating nozzles....\nM104 S190 T2\nG1 X70 Y20 F9000\nM109 S190 T2\n\nM117 purging nozzle\nG92 E0\nG1 E6 F90\nG92 E0\nG1 E-2 F300\nG92 E0\n\nM117 wiping nozzle\nG1 X1 Y28 F3000\nG1 X70 F6000\n\nM117 printing\n" }, "machine_extruder_end_code": { "default_value": "\nM104 T0 S120\n;end extruder_2\n" From 7398cdba186b6c5df7d20c5ef7a128aade6b8b02 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 12:46:03 +0100 Subject: [PATCH 045/197] Update cartesio_extruder_2.def.json --- resources/extruders/cartesio_extruder_2.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/extruders/cartesio_extruder_2.def.json b/resources/extruders/cartesio_extruder_2.def.json index 72020ced95..9d4bfd8c42 100644 --- a/resources/extruders/cartesio_extruder_2.def.json +++ b/resources/extruders/cartesio_extruder_2.def.json @@ -19,7 +19,7 @@ "default_value": "\n;start extruder_2\nM117 Heating nozzles....\nM104 S190 T2\nG1 X70 Y20 F9000\nM109 S190 T2\n\nM117 purging nozzle\nG92 E0\nG1 E6 F90\nG92 E0\nG1 E-2 F300\nG92 E0\n\nM117 wiping nozzle\nG1 X1 Y28 F3000\nG1 X70 F6000\n\nM117 printing\n" }, "machine_extruder_end_code": { - "default_value": "\nM104 T0 S120\n;end extruder_2\n" + "default_value": "\nM104 T2 S120\n;end extruder_2\n" } } } From d6251158150f0cd81a1e58fd898665c119c70936 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 12:46:33 +0100 Subject: [PATCH 046/197] Update cartesio_extruder_3.def.json --- resources/extruders/cartesio_extruder_3.def.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/extruders/cartesio_extruder_3.def.json b/resources/extruders/cartesio_extruder_3.def.json index 2de8a72eb3..cdcb392876 100644 --- a/resources/extruders/cartesio_extruder_3.def.json +++ b/resources/extruders/cartesio_extruder_3.def.json @@ -16,10 +16,10 @@ "machine_nozzle_offset_x": { "default_value": 24.0 }, "machine_nozzle_offset_y": { "default_value": 60.0 }, "machine_extruder_start_code": { - "default_value": "\n;start extruder_3\nG1 X70 Y20 F9000\n" + "default_value": "\n;start extruder_3\nM117 Heating nozzles....\nM104 S190 T3\nG1 X70 Y20 F9000\nM109 S190 T3\n\nM117 purging nozzle\nG92 E0\nG1 E6 F90\nG92 E0\nG1 E-2 F300\nG92 E0\n\nM117 wiping nozzle\nG1 X1 Y28 F3000\nG1 X70 F6000\n\nM117 printing\n" }, "machine_extruder_end_code": { - "default_value": "\nM104 T0 S120\n;end extruder_3\n" + "default_value": "\nM104 T3 S120\n;end extruder_3\n" } } } From 5ba4e3549d85f4d63d2aabe34ed6ecddd5717df5 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 13:46:37 +0100 Subject: [PATCH 047/197] Update cartesio_0.25.inst.cfg --- resources/variants/cartesio_0.25.inst.cfg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/variants/cartesio_0.25.inst.cfg b/resources/variants/cartesio_0.25.inst.cfg index 7f828ba1b4..96d8bed6b5 100644 --- a/resources/variants/cartesio_0.25.inst.cfg +++ b/resources/variants/cartesio_0.25.inst.cfg @@ -43,6 +43,11 @@ speed_travel_layer_0 = =round(speed_travel) retraction_combing = off retraction_hop_enabled = true +support_z_distance = 0 +support_xy_distance = 0.5 +support_join_distance = 10 +support_interface_enable = true + adhesion_type = skirt skirt_gap = 0.5 skirt_brim_minimal_length = 50 From 50b65da860d9562213313d2ee48b4a53bca15a9c Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 13:46:50 +0100 Subject: [PATCH 048/197] Update cartesio_0.4.inst.cfg --- resources/variants/cartesio_0.4.inst.cfg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/variants/cartesio_0.4.inst.cfg b/resources/variants/cartesio_0.4.inst.cfg index ded164c660..d31ce33152 100644 --- a/resources/variants/cartesio_0.4.inst.cfg +++ b/resources/variants/cartesio_0.4.inst.cfg @@ -43,6 +43,11 @@ speed_travel_layer_0 = =round(speed_travel) retraction_combing = off retraction_hop_enabled = true +support_z_distance = 0 +support_xy_distance = 0.5 +support_join_distance = 10 +support_interface_enable = true + adhesion_type = skirt skirt_gap = 0.5 skirt_brim_minimal_length = 50 From 06830fe16adcc0eed6111a6e5c9faa66e5aa416f Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 13:47:03 +0100 Subject: [PATCH 049/197] Update cartesio_0.8.inst.cfg --- resources/variants/cartesio_0.8.inst.cfg | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/resources/variants/cartesio_0.8.inst.cfg b/resources/variants/cartesio_0.8.inst.cfg index 34381b9688..b82f0436c7 100644 --- a/resources/variants/cartesio_0.8.inst.cfg +++ b/resources/variants/cartesio_0.8.inst.cfg @@ -43,6 +43,11 @@ speed_travel_layer_0 = =round(speed_travel) retraction_combing = off retraction_hop_enabled = true +support_z_distance = 0 +support_xy_distance = 0.5 +support_join_distance = 10 +support_interface_enable = true + adhesion_type = skirt skirt_gap = 0.5 skirt_brim_minimal_length = 50 From c70229ff88ba3ba9dd587eb950b11af3e0775b0e Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 13:51:34 +0100 Subject: [PATCH 050/197] Update cartesio_0.8.inst.cfg --- resources/variants/cartesio_0.8.inst.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/variants/cartesio_0.8.inst.cfg b/resources/variants/cartesio_0.8.inst.cfg index b82f0436c7..772ede33fb 100644 --- a/resources/variants/cartesio_0.8.inst.cfg +++ b/resources/variants/cartesio_0.8.inst.cfg @@ -39,6 +39,7 @@ speed_topbottom = =round(speed_print / 5 * 4) speed_slowdown_layers = 1 speed_travel = =round(speed_print if magic_spiralize else 150) speed_travel_layer_0 = =round(speed_travel) +speed_support_interface = =round(speed_topbottom) retraction_combing = off retraction_hop_enabled = true From e3aff8e2ac2f099a573f6c4544e8e996e3b23080 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 13:51:45 +0100 Subject: [PATCH 051/197] Update cartesio_0.25.inst.cfg --- resources/variants/cartesio_0.25.inst.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/variants/cartesio_0.25.inst.cfg b/resources/variants/cartesio_0.25.inst.cfg index 96d8bed6b5..455fd7ee56 100644 --- a/resources/variants/cartesio_0.25.inst.cfg +++ b/resources/variants/cartesio_0.25.inst.cfg @@ -39,6 +39,7 @@ speed_topbottom = =round(speed_print / 5 * 4) speed_slowdown_layers = 1 speed_travel = =round(speed_print if magic_spiralize else 150) speed_travel_layer_0 = =round(speed_travel) +speed_support_interface = =round(speed_topbottom) retraction_combing = off retraction_hop_enabled = true From 70a4d0bd521419d3daf0f5a6131e0c6764db9417 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Thu, 26 Jan 2017 13:51:57 +0100 Subject: [PATCH 052/197] Update cartesio_0.4.inst.cfg --- resources/variants/cartesio_0.4.inst.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/variants/cartesio_0.4.inst.cfg b/resources/variants/cartesio_0.4.inst.cfg index d31ce33152..0ac6d55f10 100644 --- a/resources/variants/cartesio_0.4.inst.cfg +++ b/resources/variants/cartesio_0.4.inst.cfg @@ -39,6 +39,7 @@ speed_topbottom = =round(speed_print / 5 * 4) speed_slowdown_layers = 1 speed_travel = =round(speed_print if magic_spiralize else 150) speed_travel_layer_0 = =round(speed_travel) +speed_support_interface = =round(speed_topbottom) retraction_combing = off retraction_hop_enabled = true From f65ea57e80d3fb53c895c7492764202c1f97ae40 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Tue, 31 Jan 2017 09:01:14 +0100 Subject: [PATCH 053/197] Update cartesio.def.json --- resources/definitions/cartesio.def.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/definitions/cartesio.def.json b/resources/definitions/cartesio.def.json index 579b1edd25..ba32a2bf9c 100644 --- a/resources/definitions/cartesio.def.json +++ b/resources/definitions/cartesio.def.json @@ -36,7 +36,7 @@ "machine_width": { "default_value": 430 }, "machine_name": { "default_value": "Cartesio" }, "machine_start_gcode": { - "default_value": "M92 E162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S{material_bed_temperature}\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-1 F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F6000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" + "default_value": "M92 E162\nG21\nG90\nM42 S255 P13;chamber lights\nM42 S255 P12;fume extraction\nM140 S{material_bed_temperature}\n\nM117 Homing Y ......\nG28 Y\nM117 Homing X ......\nG28 X\nM117 Homing Z ......\nG28 Z F100\nG1 Z10 F600\nG1 X70 Y20 F9000;go to wipe point\n\nM190 S{material_bed_temperature}\nM104 S120 T1\nM109 S{material_print_temperature} T0\nM104 S21 T1\n\nM117 purging nozzle....\n\nT0\nG92 E0;set E\nG1 E10 F100\nG92 E0\nG1 E-{retraction_amount} F600\nG92 E0\n\nM117 wiping nozzle....\n\nG1 X1 Y24 F3000\nG1 X70 F9000\n\nM117 Printing .....\n\nG1 E1 F100\nG92 E-1\n" }, "machine_end_gcode": { "default_value": "; -- END GCODE --\nM106 S255\nM140 S5\nM104 S5 T0\nM104 S5 T1\nG1 X20.0 Y260.0 F6000\nG4 S7\nM84\nG4 S90\nM107\nM42 P12 S0\nM42 P13 S0\nM84\n; -- end of END GCODE --" From 26854eedcf37491ba600e025c695730fc0672dfd Mon Sep 17 00:00:00 2001 From: MaukCC Date: Tue, 31 Jan 2017 09:01:46 +0100 Subject: [PATCH 054/197] Update cartesio_extruder_0.def.json --- resources/extruders/cartesio_extruder_0.def.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/extruders/cartesio_extruder_0.def.json b/resources/extruders/cartesio_extruder_0.def.json index cf413a2fc5..8f71c68c43 100644 --- a/resources/extruders/cartesio_extruder_0.def.json +++ b/resources/extruders/cartesio_extruder_0.def.json @@ -16,10 +16,10 @@ "machine_nozzle_offset_x": { "default_value": 0.0 }, "machine_nozzle_offset_y": { "default_value": 0.0 }, "machine_extruder_start_code": { - "default_value": "\n;start extruder_0\nM117 Heating nozzles....\nM104 S190 T0\nG1 X70 Y20 F9000\nM109 S190 T0\n\nM117 purging nozzle\nG92 E0\nG1 E6 F90\nG92 E0\nG1 E-2 F300\nG92 E0\n\nM117 wiping nozzle\nG1 X1 Y28 F3000\nG1 X70 F6000\n\nM117 printing\n" + "default_value": "M117 Heating nozzles....\nM104 S190 T0\nG1 X70 Y20 F9000\nM109 S270 T0 ;wait for nozzle to heat up\nT0\n\nM117 purging nozzle\nG92 E0\nG1 E6 F90\nG92 E0\nG1 E-2 F300\nG92 E0\nM117 wiping nozzle\nG1 X1 Y28 F3000\nG1 X70 F6000\n\nM117 printing\n" }, "machine_extruder_end_code": { - "default_value": "\nM104 T0 S120\n;end extruder_0\n" + "default_value": "\nM104 S160 T0\n;end extruder_0\nM117 temp is {material_print_temp}" } } } From e2b208eebd0dd2b414ac99bd8b4fe6506e9d20f6 Mon Sep 17 00:00:00 2001 From: MaukCC Date: Tue, 31 Jan 2017 09:02:31 +0100 Subject: [PATCH 055/197] Update cartesio_0.4.inst.cfg --- resources/variants/cartesio_0.4.inst.cfg | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/resources/variants/cartesio_0.4.inst.cfg b/resources/variants/cartesio_0.4.inst.cfg index 0ac6d55f10..44a09c706f 100644 --- a/resources/variants/cartesio_0.4.inst.cfg +++ b/resources/variants/cartesio_0.4.inst.cfg @@ -1,43 +1,44 @@ + [general] name = 0.4 mm version = 2 definition = cartesio [metadata] -author = Cartesio +author = Scheepers type = variant [values] machine_nozzle_size = 0.4 -machine_nozzle_tip_outer_diameter = 1.05 +machine_nozzle_tip_outer_diameter = 0.8 wall_0_inset = -0.05 fill_perimeter_gaps = nowhere -travel_compensate_overlapping_walls_enabled = +travel_compensate_overlapping_walls_enabled = infill_sparse_density = 25 infill_overlap = -50 skin_overlap = -40 + material_print_temperature_layer_0 = =round(material_print_temperature) material_initial_print_temperature = =round(material_print_temperature) material_diameter = 1.75 retraction_amount = 1 retraction_speed = 40 -retraction_prime_speed = =round(retraction_speed / 4) +retraction_prime_speed = =round(retraction_speed /4) retraction_min_travel = =round(line_width * 10) switch_extruder_retraction_amount = 2 switch_extruder_retraction_speeds = 40 -switch_extruder_prime_speed = =round(switch_extruder_retraction_speeds / 4) +switch_extruder_prime_speed = =round(switch_extruder_retraction_speeds /4) -speed_print = =50 if layer_height < 0.4 else 30 -speed_infill = =round(speed_print) +speed_print = 50 speed_layer_0 = =round(speed_print / 5 * 4) -speed_wall = =round(speed_print / 2) +speed_wall = =round(speed_print / 2, 1) speed_wall_0 = =10 if speed_wall < 11 else (speed_print / 5 *3) speed_topbottom = =round(speed_print / 5 * 4) speed_slowdown_layers = 1 -speed_travel = =round(speed_print if magic_spiralize else 150) +speed_travel = =round(speed_print if magic_spiralize else 150) speed_travel_layer_0 = =round(speed_travel) speed_support_interface = =round(speed_topbottom) From a9b8fbe72b16f0e0c78a2a0239ed88752454be0f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 31 Jan 2017 14:19:21 +0100 Subject: [PATCH 056/197] Don't start menu entry with 'Configur' Because OSX triggers on that and moves the entry in its own main menu. Contributes to issue CURA-3029. --- resources/i18n/nl/cura.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/i18n/nl/cura.po b/resources/i18n/nl/cura.po index 4cf6a4b323..6ca970fe84 100644 --- a/resources/i18n/nl/cura.po +++ b/resources/i18n/nl/cura.po @@ -3010,7 +3010,7 @@ msgstr "Engine-&logboek Weergeven..." #: /home/ruben/Projects/Cura/resources/qml/Actions.qml:307 msgctxt "@action:inmenu menubar:help" msgid "Show Configuration Folder" -msgstr "Configuratiemap Weergeven" +msgstr "Open Configuratiemap" #: /home/ruben/Projects/Cura/resources/qml/Actions.qml:314 msgctxt "@action:menu" From 3aec36018f62a75354c8cc41b62ab603c1ef3400 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 23 Jan 2017 17:18:27 +0100 Subject: [PATCH 057/197] Add entry that we switched Linux to AppImage format It was deemed worthy to mention. Contributes to issue CURA-3048. --- plugins/ChangeLogPlugin/ChangeLog.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/ChangeLogPlugin/ChangeLog.txt b/plugins/ChangeLogPlugin/ChangeLog.txt index 8ed82a3940..ed4d6888d3 100644 --- a/plugins/ChangeLogPlugin/ChangeLog.txt +++ b/plugins/ChangeLogPlugin/ChangeLog.txt @@ -98,6 +98,9 @@ Use a mesh to specify a volume within which to classify nothing as overhang for *Delta printer support This release adds support for printers with elliptic buildplates. This feature has not been extensively tested so please let us know if it works or get involved in improving it. +*AppImage for Linux +The Linux distribution is now in AppImage format, which makes Cura easier to install. + *bugfixes The user is now notified when a new version of Cura is available. When searching in the setting visibility preferences, the category for each setting is always displayed. From 1a4d71c3f8272160e660ee6ab6637bef34598f5a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 31 Jan 2017 17:42:32 +0100 Subject: [PATCH 058/197] Save last-opened file path as local-file format It's stored in the format of '/home/user/Models/Basic' rather than 'file:///home/user/Models/Basic'. The QML FileDialog class expects the latter format though. Contributes to issue CURA-3297. --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 561df90f8d..9fcaf58698 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -400,7 +400,7 @@ class CuraApplication(QtApplication): @pyqtSlot(str, str) def setDefaultPath(self, key, default_path): - Preferences.getInstance().setValue("local_file/%s" % key, default_path) + Preferences.getInstance().setValue("local_file/%s" % key, QUrl.toLocalFile(default_path)) ## Handle loading of all plugin types (and the backend explicitly) # \sa PluginRegistery From 307896cb41be262d55c0a70d1c5cf9bf76b89fcc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 09:48:06 +0100 Subject: [PATCH 059/197] Fix converting URL to local path in setDefaultPath It is a method, not a static function. Contributes to issue CURA-3297. --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 9fcaf58698..df3f44c14f 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -400,7 +400,7 @@ class CuraApplication(QtApplication): @pyqtSlot(str, str) def setDefaultPath(self, key, default_path): - Preferences.getInstance().setValue("local_file/%s" % key, QUrl.toLocalFile(default_path)) + Preferences.getInstance().setValue("local_file/%s" % key, QUrl(default_path).toLocalFile()) ## Handle loading of all plugin types (and the backend explicitly) # \sa PluginRegistery From 2db15602a474db5b027b0f9424d17b17f0ce9ce6 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Wed, 1 Feb 2017 13:05:17 +0100 Subject: [PATCH 060/197] fix: minmum line width is 1 micron (CURA-2572) --- resources/definitions/fdmprinter.def.json | 26 +++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index f6cb2060c6..42d68acba8 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -615,7 +615,7 @@ "label": "Line Width", "description": "Width of a single line. Generally, the width of each line should correspond to the width of the nozzle. However, slightly reducing this value could produce better prints.", "unit": "mm", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "0.5 * machine_nozzle_size", "maximum_value_warning": "2 * machine_nozzle_size", "default_value": 0.4, @@ -629,7 +629,7 @@ "label": "Wall Line Width", "description": "Width of a single wall line.", "unit": "mm", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "0.75 * machine_nozzle_size", "maximum_value_warning": "2 * machine_nozzle_size", "value": "line_width", @@ -643,7 +643,7 @@ "label": "Outer Wall Line Width", "description": "Width of the outermost wall line. By lowering this value, higher levels of detail can be printed.", "unit": "mm", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "0.75 * machine_nozzle_size if outer_inset_first else 0.1 * machine_nozzle_size", "maximum_value_warning": "2 * machine_nozzle_size", "default_value": 0.4, @@ -656,7 +656,7 @@ "label": "Inner Wall(s) Line Width", "description": "Width of a single wall line for all wall lines except the outermost one.", "unit": "mm", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "0.5 * machine_nozzle_size", "maximum_value_warning": "2 * machine_nozzle_size", "default_value": 0.4, @@ -671,7 +671,7 @@ "label": "Top/Bottom Line Width", "description": "Width of a single top/bottom line.", "unit": "mm", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "0.1 * machine_nozzle_size", "maximum_value_warning": "2 * machine_nozzle_size", "default_value": 0.4, @@ -684,7 +684,7 @@ "label": "Infill Line Width", "description": "Width of a single infill line.", "unit": "mm", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "0.75 * machine_nozzle_size", "maximum_value_warning": "3 * machine_nozzle_size", "default_value": 0.4, @@ -698,7 +698,7 @@ "label": "Skirt/Brim Line Width", "description": "Width of a single skirt or brim line.", "unit": "mm", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "0.75 * machine_nozzle_size", "maximum_value_warning": "3 * machine_nozzle_size", "default_value": 0.4, @@ -713,7 +713,7 @@ "label": "Support Line Width", "description": "Width of a single support structure line.", "unit": "mm", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "0.75 * machine_nozzle_size", "maximum_value_warning": "3 * machine_nozzle_size", "default_value": 0.4, @@ -730,7 +730,7 @@ "description": "Width of a single support interface line.", "unit": "mm", "default_value": 0.4, - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "0.4 * machine_nozzle_size", "maximum_value_warning": "2 * machine_nozzle_size", "type": "float", @@ -749,7 +749,7 @@ "enabled": "resolveOrValue('prime_tower_enable')", "default_value": 0.4, "value": "line_width", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "0.75 * machine_nozzle_size", "maximum_value_warning": "2 * machine_nozzle_size", "settable_per_mesh": false, @@ -3347,7 +3347,7 @@ "type": "float", "default_value": 0.4, "value": "line_width", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "extruderValue(adhesion_extruder_nr, 'machine_nozzle_size') * 0.1", "maximum_value_warning": "extruderValue(adhesion_extruder_nr, 'machine_nozzle_size') * 2", "enabled": "resolveOrValue('adhesion_type') == 'raft'", @@ -3395,7 +3395,7 @@ "type": "float", "default_value": 0.7, "value": "line_width * 2", - "minimum_value": "0.0001", + "minimum_value": "0.001", "minimum_value_warning": "extruderValue(adhesion_extruder_nr, 'machine_nozzle_size') * 0.5", "maximum_value_warning": "extruderValue(adhesion_extruder_nr, 'machine_nozzle_size') * 3", "enabled": "resolveOrValue('adhesion_type') == 'raft'", @@ -3442,7 +3442,7 @@ "unit": "mm", "type": "float", "default_value": 0.8, - "minimum_value": "0.0001", + "minimum_value": "0.001", "value": "extruderValue(adhesion_extruder_nr, 'machine_nozzle_size') * 2", "minimum_value_warning": "extruderValue(adhesion_extruder_nr, 'machine_nozzle_size') * 0.5", "maximum_value_warning": "extruderValue(adhesion_extruder_nr, 'machine_nozzle_size') * 3", From 6b7876d60ee4a3f10bb5c25ea85f8cb6d0e1f8e0 Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Wed, 1 Feb 2017 13:06:02 +0100 Subject: [PATCH 061/197] fix: fill line distance of 0 is possible, but generates no fill (CURA-2572) --- resources/definitions/fdmprinter.def.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 42d68acba8..edac6a8dae 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3362,7 +3362,7 @@ "unit": "mm", "type": "float", "default_value": 0.4, - "minimum_value": "0.0001", + "minimum_value": "0", "minimum_value_warning": "extruderValue(adhesion_extruder_nr, 'raft_surface_line_width')", "maximum_value_warning": "extruderValue(adhesion_extruder_nr, 'raft_surface_line_width') * 3", "enabled": "resolveOrValue('adhesion_type') == 'raft'", @@ -3459,7 +3459,7 @@ "type": "float", "default_value": 1.6, "value": "raft_base_line_width * 2", - "minimum_value": "0.0001", + "minimum_value": "0", "minimum_value_warning": "extruderValue(adhesion_extruder_nr, 'raft_base_line_width')", "maximum_value_warning": "100", "enabled": "resolveOrValue('adhesion_type') == 'raft'", From 6e84805c935b95f5e0977c1de5f2e087c9ad522a Mon Sep 17 00:00:00 2001 From: Tim Kuipers Date: Wed, 1 Feb 2017 13:10:39 +0100 Subject: [PATCH 062/197] fix: angle limitations for machine_nozzle_expansion_angle (CURA-2572) --- resources/definitions/fdmprinter.def.json | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index edac6a8dae..b19c97b793 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -219,8 +219,11 @@ { "label": "Nozzle angle", "description": "The angle between the horizontal plane and the conical part right above the tip of the nozzle.", - "default_value": 45, + "unit": "°", "type": "int", + "default_value": 45, + "maximum_value": 89, + "minimum_value": 1, "settable_per_mesh": false, "settable_per_extruder": false, "settable_per_meshgroup": false From d45f292324fb115ca7daf713fc59cee9162e75b9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 13:04:48 +0100 Subject: [PATCH 063/197] Add ABAX printer definitions These are exactly how they were delivered to me by Pedro J. from ABAX 3D Tech. --- resources/definitions/abax_pri3.def.json | 90 +++++++++++++++++++++++ resources/definitions/abax_pri5.def.json | 90 +++++++++++++++++++++++ resources/definitions/abax_titan.def.json | 90 +++++++++++++++++++++++ 3 files changed, 270 insertions(+) create mode 100644 resources/definitions/abax_pri3.def.json create mode 100644 resources/definitions/abax_pri5.def.json create mode 100644 resources/definitions/abax_titan.def.json diff --git a/resources/definitions/abax_pri3.def.json b/resources/definitions/abax_pri3.def.json new file mode 100644 index 0000000000..af37c24edd --- /dev/null +++ b/resources/definitions/abax_pri3.def.json @@ -0,0 +1,90 @@ +{ + "id": "PRi3", + "name": "ABAX PRi3", + "version": 2, + "inherits": "fdmprinter", + "metadata": { + "visible": true, + "author": "ABAX 3d Technologies", + "manufacturer": "ABAX 3d Technologies", + "category": "3D Printer", + "file_formats": "text/x-gcode", + "platform": "bq_hephestos_platform.stl", + "platform_offset": [ + 0, + -82, + 0 + ] + }, + "overrides": { + "machine_start_gcode": { + "default_value": "; -- START GCODE --\nG21 ;set units to millimetres\nG90 ;set to absolute positioning\nM106 S0 ;set fan speed to zero (turned off)\nG28 X0 Y0 ;move to the X/Y origin (Home)\nG28 Z0 ;move to the Z origin (Home)\nG1 Z5.0 F200 ;move Z to position 5.0 mm\nG92 E0 ;zero the extruded length\n; -- end of START GCODE --" + }, + "machine_end_gcode": { + "default_value": "; -- END GCODE --\nM104 S0 ;set extruder temperature to zero (turned off)\nM140 S0 ;set temp of bed to Zero \nG91 ;set to relative positioning\nG1 E-10 F300 ;retract the filament a bit to release some of the pressure\nG1 F2000 X0 Y215 ;move X to min and Y to max \nG90 ;set to absolute positioning\nM84 ;turn off steppers\n; -- end of END GCODE --" + }, + "machine_width": { + "default_value": 225 + }, + "machine_depth": { + "default_value": 220 + }, + "machine_height": { + "default_value": 200 + }, + "machine_heated_bed": { + "default_value": false + }, + "machine_center_is_zero": { + "default_value": false + }, + "machine_gcode_flavor": { + "default_value": "RepRap" + }, + "layer_height": { + "default_value": 0.2 + }, + "layer_height_0": { + "default_value": 0.2 + }, + "wall_thickness": { + "default_value": 1 + }, + "top_bottom_thickness": { + "default_value": 1 + }, + "bottom_thickness": { + "default_value": 1 + }, + "material_print_temperature": { + "default_value": 200 + }, + "material_bed_temperature": { + "default_value": 0 + }, + "material_diameter": { + "default_value": 1.75 + }, + "speed_print": { + "default_value": 40 + }, + "speed_infill": { + "default_value": 70 + }, + "speed_wall": { + "default_value": 25 + }, + "speed_topbottom": { + "default_value": 15 + }, + "speed_travel": { + "default_value": 150 + }, + "speed_layer_0": { + "default_value": 30 + }, + "support_enable": { + "default_value": true + } + } +} \ No newline at end of file diff --git a/resources/definitions/abax_pri5.def.json b/resources/definitions/abax_pri5.def.json new file mode 100644 index 0000000000..9f2009f75c --- /dev/null +++ b/resources/definitions/abax_pri5.def.json @@ -0,0 +1,90 @@ +{ + "id": "PRi5", + "name": "ABAX PRi5", + "version": 2, + "inherits": "fdmprinter", + "metadata": { + "visible": true, + "author": "ABAX 3d Technologies", + "manufacturer": "ABAX 3d Technologies", + "category": "3D Printer", + "file_formats": "text/x-gcode", + "platform": "bq_hephestos_platform.stl", + "platform_offset": [ + 0, + -82, + 0 + ] + }, + "overrides": { + "machine_start_gcode": { + "default_value": "; -- START GCODE --\nG21 ;set units to millimetres\nG90 ;set to absolute positioning\nM106 S0 ;set fan speed to zero (turned off)\nG28 X0 Y0 ;move to the X/Y origin (Home)\nG28 Z0 ;move to the Z origin (Home)\nG1 Z5.0 F200 ;move Z to position 5.0 mm\nG92 E0 ;zero the extruded length\n; -- end of START GCODE --" + }, + "machine_end_gcode": { + "default_value": "; -- END GCODE --\nM104 S0 ;set extruder temperature to zero (turned off)\nM140 S0 ;set temp of bed to Zero \nG91 ;set to relative positioning\nG1 E-10 F300 ;retract the filament a bit to release some of the pressure\nG1 F2000 X0 Y300 ;move X to min and Y to max \nG90 ;set to absolute positioning\nM84 ;turn off steppers\n; -- end of END GCODE --" + }, + "machine_width": { + "default_value": 310 + }, + "machine_depth": { + "default_value": 310 + }, + "machine_height": { + "default_value": 300 + }, + "machine_heated_bed": { + "default_value": false + }, + "machine_center_is_zero": { + "default_value": false + }, + "machine_gcode_flavor": { + "default_value": "RepRap" + }, + "layer_height": { + "default_value": 0.2 + }, + "layer_height_0": { + "default_value": 0.2 + }, + "wall_thickness": { + "default_value": 1 + }, + "top_bottom_thickness": { + "default_value": 1 + }, + "bottom_thickness": { + "default_value": 1 + }, + "material_print_temperature": { + "default_value": 200 + }, + "material_bed_temperature": { + "default_value": 0 + }, + "material_diameter": { + "default_value": 1.75 + }, + "speed_print": { + "default_value": 40 + }, + "speed_infill": { + "default_value": 70 + }, + "speed_wall": { + "default_value": 25 + }, + "speed_topbottom": { + "default_value": 15 + }, + "speed_travel": { + "default_value": 150 + }, + "speed_layer_0": { + "default_value": 30 + }, + "support_enable": { + "default_value": true + } + } +} \ No newline at end of file diff --git a/resources/definitions/abax_titan.def.json b/resources/definitions/abax_titan.def.json new file mode 100644 index 0000000000..d1ac92139e --- /dev/null +++ b/resources/definitions/abax_titan.def.json @@ -0,0 +1,90 @@ +{ + "id": "Titan", + "name": "ABAX Titan", + "version": 2, + "inherits": "fdmprinter", + "metadata": { + "visible": true, + "author": "ABAX 3d Technologies", + "manufacturer": "ABAX 3d Technologies", + "category": "3D Printer", + "file_formats": "text/x-gcode", + "platform": "bq_hephestos_platform.stl", + "platform_offset": [ + 0, + -82, + 0 + ] + }, + "overrides": { + "machine_start_gcode": { + "default_value": "; -- START GCODE --\nG21 ;set units to millimetres\nG90 ;set to absolute positioning\nM106 S0 ;set fan speed to zero (turned off)\nG28 X0 Y0 ;move to the X/Y origin (Home)\nG28 Z0 ;move to the Z origin (Home)\nG1 Z5.0 F200 ;move Z to position 5.0 mm\nG92 E0 ;zero the extruded length\n; -- end of START GCODE --" + }, + "machine_end_gcode": { + "default_value": "; -- END GCODE --\nM104 S0 ;set extruder temperature to zero (turned off)\nM140 S0 ;set temp of bed to Zero \nG91 ;set to relative positioning\nG1 E-10 F300 ;retract the filament a bit to release some of the pressure\nG1 F2000 X0 Y300 ;move X to min and Y to max \nG90 ;set to absolute positioning\nM84 ;turn off steppers\n; -- end of END GCODE --" + }, + "machine_width": { + "default_value": 310 + }, + "machine_depth": { + "default_value": 310 + }, + "machine_height": { + "default_value": 300 + }, + "machine_heated_bed": { + "default_value": false + }, + "machine_center_is_zero": { + "default_value": false + }, + "machine_gcode_flavor": { + "default_value": "RepRap" + }, + "layer_height": { + "default_value": 0.2 + }, + "layer_height_0": { + "default_value": 0.2 + }, + "wall_thickness": { + "default_value": 1 + }, + "top_bottom_thickness": { + "default_value": 1 + }, + "bottom_thickness": { + "default_value": 1 + }, + "material_print_temperature": { + "default_value": 200 + }, + "material_bed_temperature": { + "default_value": 0 + }, + "material_diameter": { + "default_value": 1.75 + }, + "speed_print": { + "default_value": 40 + }, + "speed_infill": { + "default_value": 70 + }, + "speed_wall": { + "default_value": 25 + }, + "speed_topbottom": { + "default_value": 15 + }, + "speed_travel": { + "default_value": 150 + }, + "speed_layer_0": { + "default_value": 30 + }, + "support_enable": { + "default_value": true + } + } +} \ No newline at end of file From 2c893e2ea12ada92d21c694b25d4369ecb8b7d4a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 13:05:57 +0100 Subject: [PATCH 064/197] Conform ABAX printers to our code style Fixed indenting, that's mostly all. --- resources/definitions/abax_pri3.def.json | 170 +++++++++++----------- resources/definitions/abax_pri5.def.json | 170 +++++++++++----------- resources/definitions/abax_titan.def.json | 170 +++++++++++----------- 3 files changed, 249 insertions(+), 261 deletions(-) diff --git a/resources/definitions/abax_pri3.def.json b/resources/definitions/abax_pri3.def.json index af37c24edd..05469e3da7 100644 --- a/resources/definitions/abax_pri3.def.json +++ b/resources/definitions/abax_pri3.def.json @@ -1,90 +1,86 @@ { - "id": "PRi3", - "name": "ABAX PRi3", - "version": 2, - "inherits": "fdmprinter", - "metadata": { - "visible": true, - "author": "ABAX 3d Technologies", - "manufacturer": "ABAX 3d Technologies", - "category": "3D Printer", - "file_formats": "text/x-gcode", - "platform": "bq_hephestos_platform.stl", - "platform_offset": [ - 0, - -82, - 0 - ] - }, - "overrides": { - "machine_start_gcode": { - "default_value": "; -- START GCODE --\nG21 ;set units to millimetres\nG90 ;set to absolute positioning\nM106 S0 ;set fan speed to zero (turned off)\nG28 X0 Y0 ;move to the X/Y origin (Home)\nG28 Z0 ;move to the Z origin (Home)\nG1 Z5.0 F200 ;move Z to position 5.0 mm\nG92 E0 ;zero the extruded length\n; -- end of START GCODE --" + "id": "PRi3", + "name": "ABAX PRi3", + "version": 2, + "inherits": "fdmprinter", + "metadata": { + "visible": true, + "author": "ABAX 3d Technologies", + "manufacturer": "ABAX 3d Technologies", + "category": "Other", + "file_formats": "text/x-gcode", + "platform": "bq_hephestos_platform.stl", + "platform_offset": [0, -82, 0] }, - "machine_end_gcode": { - "default_value": "; -- END GCODE --\nM104 S0 ;set extruder temperature to zero (turned off)\nM140 S0 ;set temp of bed to Zero \nG91 ;set to relative positioning\nG1 E-10 F300 ;retract the filament a bit to release some of the pressure\nG1 F2000 X0 Y215 ;move X to min and Y to max \nG90 ;set to absolute positioning\nM84 ;turn off steppers\n; -- end of END GCODE --" - }, - "machine_width": { - "default_value": 225 - }, - "machine_depth": { - "default_value": 220 - }, - "machine_height": { - "default_value": 200 - }, - "machine_heated_bed": { - "default_value": false - }, - "machine_center_is_zero": { - "default_value": false - }, - "machine_gcode_flavor": { - "default_value": "RepRap" - }, - "layer_height": { - "default_value": 0.2 - }, - "layer_height_0": { - "default_value": 0.2 - }, - "wall_thickness": { - "default_value": 1 - }, - "top_bottom_thickness": { - "default_value": 1 - }, - "bottom_thickness": { - "default_value": 1 - }, - "material_print_temperature": { - "default_value": 200 - }, - "material_bed_temperature": { - "default_value": 0 - }, - "material_diameter": { - "default_value": 1.75 - }, - "speed_print": { - "default_value": 40 - }, - "speed_infill": { - "default_value": 70 - }, - "speed_wall": { - "default_value": 25 - }, - "speed_topbottom": { - "default_value": 15 - }, - "speed_travel": { - "default_value": 150 - }, - "speed_layer_0": { - "default_value": 30 - }, - "support_enable": { - "default_value": true + "overrides": { + "machine_start_gcode": { + "default_value": "; -- START GCODE --\nG21 ;set units to millimetres\nG90 ;set to absolute positioning\nM106 S0 ;set fan speed to zero (turned off)\nG28 X0 Y0 ;move to the X/Y origin (Home)\nG28 Z0 ;move to the Z origin (Home)\nG1 Z5.0 F200 ;move Z to position 5.0 mm\nG92 E0 ;zero the extruded length\n; -- end of START GCODE --" + }, + "machine_end_gcode": { + "default_value": "; -- END GCODE --\nM104 S0 ;set extruder temperature to zero (turned off)\nM140 S0 ;set temp of bed to Zero \nG91 ;set to relative positioning\nG1 E-10 F300 ;retract the filament a bit to release some of the pressure\nG1 F2000 X0 Y215 ;move X to min and Y to max \nG90 ;set to absolute positioning\nM84 ;turn off steppers\n; -- end of END GCODE --" + }, + "machine_width": { + "default_value": 225 + }, + "machine_depth": { + "default_value": 220 + }, + "machine_height": { + "default_value": 200 + }, + "machine_heated_bed": { + "default_value": false + }, + "machine_center_is_zero": { + "default_value": false + }, + "machine_gcode_flavor": { + "default_value": "RepRap" + }, + "layer_height": { + "default_value": 0.2 + }, + "layer_height_0": { + "default_value": 0.2 + }, + "wall_thickness": { + "default_value": 1 + }, + "top_bottom_thickness": { + "default_value": 1 + }, + "bottom_thickness": { + "default_value": 1 + }, + "material_print_temperature": { + "default_value": 200 + }, + "material_bed_temperature": { + "default_value": 0 + }, + "material_diameter": { + "default_value": 1.75 + }, + "speed_print": { + "default_value": 40 + }, + "speed_infill": { + "default_value": 70 + }, + "speed_wall": { + "default_value": 25 + }, + "speed_topbottom": { + "default_value": 15 + }, + "speed_travel": { + "default_value": 150 + }, + "speed_layer_0": { + "default_value": 30 + }, + "support_enable": { + "default_value": true + } } - } -} \ No newline at end of file +} diff --git a/resources/definitions/abax_pri5.def.json b/resources/definitions/abax_pri5.def.json index 9f2009f75c..8300eb7858 100644 --- a/resources/definitions/abax_pri5.def.json +++ b/resources/definitions/abax_pri5.def.json @@ -1,90 +1,86 @@ { - "id": "PRi5", - "name": "ABAX PRi5", - "version": 2, - "inherits": "fdmprinter", - "metadata": { - "visible": true, - "author": "ABAX 3d Technologies", - "manufacturer": "ABAX 3d Technologies", - "category": "3D Printer", - "file_formats": "text/x-gcode", - "platform": "bq_hephestos_platform.stl", - "platform_offset": [ - 0, - -82, - 0 - ] - }, - "overrides": { - "machine_start_gcode": { - "default_value": "; -- START GCODE --\nG21 ;set units to millimetres\nG90 ;set to absolute positioning\nM106 S0 ;set fan speed to zero (turned off)\nG28 X0 Y0 ;move to the X/Y origin (Home)\nG28 Z0 ;move to the Z origin (Home)\nG1 Z5.0 F200 ;move Z to position 5.0 mm\nG92 E0 ;zero the extruded length\n; -- end of START GCODE --" + "id": "PRi5", + "name": "ABAX PRi5", + "version": 2, + "inherits": "fdmprinter", + "metadata": { + "visible": true, + "author": "ABAX 3d Technologies", + "manufacturer": "ABAX 3d Technologies", + "category": "Other", + "file_formats": "text/x-gcode", + "platform": "bq_hephestos_platform.stl", + "platform_offset": [0, -82, 0] }, - "machine_end_gcode": { - "default_value": "; -- END GCODE --\nM104 S0 ;set extruder temperature to zero (turned off)\nM140 S0 ;set temp of bed to Zero \nG91 ;set to relative positioning\nG1 E-10 F300 ;retract the filament a bit to release some of the pressure\nG1 F2000 X0 Y300 ;move X to min and Y to max \nG90 ;set to absolute positioning\nM84 ;turn off steppers\n; -- end of END GCODE --" - }, - "machine_width": { - "default_value": 310 - }, - "machine_depth": { - "default_value": 310 - }, - "machine_height": { - "default_value": 300 - }, - "machine_heated_bed": { - "default_value": false - }, - "machine_center_is_zero": { - "default_value": false - }, - "machine_gcode_flavor": { - "default_value": "RepRap" - }, - "layer_height": { - "default_value": 0.2 - }, - "layer_height_0": { - "default_value": 0.2 - }, - "wall_thickness": { - "default_value": 1 - }, - "top_bottom_thickness": { - "default_value": 1 - }, - "bottom_thickness": { - "default_value": 1 - }, - "material_print_temperature": { - "default_value": 200 - }, - "material_bed_temperature": { - "default_value": 0 - }, - "material_diameter": { - "default_value": 1.75 - }, - "speed_print": { - "default_value": 40 - }, - "speed_infill": { - "default_value": 70 - }, - "speed_wall": { - "default_value": 25 - }, - "speed_topbottom": { - "default_value": 15 - }, - "speed_travel": { - "default_value": 150 - }, - "speed_layer_0": { - "default_value": 30 - }, - "support_enable": { - "default_value": true + "overrides": { + "machine_start_gcode": { + "default_value": "; -- START GCODE --\nG21 ;set units to millimetres\nG90 ;set to absolute positioning\nM106 S0 ;set fan speed to zero (turned off)\nG28 X0 Y0 ;move to the X/Y origin (Home)\nG28 Z0 ;move to the Z origin (Home)\nG1 Z5.0 F200 ;move Z to position 5.0 mm\nG92 E0 ;zero the extruded length\n; -- end of START GCODE --" + }, + "machine_end_gcode": { + "default_value": "; -- END GCODE --\nM104 S0 ;set extruder temperature to zero (turned off)\nM140 S0 ;set temp of bed to Zero \nG91 ;set to relative positioning\nG1 E-10 F300 ;retract the filament a bit to release some of the pressure\nG1 F2000 X0 Y300 ;move X to min and Y to max \nG90 ;set to absolute positioning\nM84 ;turn off steppers\n; -- end of END GCODE --" + }, + "machine_width": { + "default_value": 310 + }, + "machine_depth": { + "default_value": 310 + }, + "machine_height": { + "default_value": 300 + }, + "machine_heated_bed": { + "default_value": false + }, + "machine_center_is_zero": { + "default_value": false + }, + "machine_gcode_flavor": { + "default_value": "RepRap" + }, + "layer_height": { + "default_value": 0.2 + }, + "layer_height_0": { + "default_value": 0.2 + }, + "wall_thickness": { + "default_value": 1 + }, + "top_bottom_thickness": { + "default_value": 1 + }, + "bottom_thickness": { + "default_value": 1 + }, + "material_print_temperature": { + "default_value": 200 + }, + "material_bed_temperature": { + "default_value": 0 + }, + "material_diameter": { + "default_value": 1.75 + }, + "speed_print": { + "default_value": 40 + }, + "speed_infill": { + "default_value": 70 + }, + "speed_wall": { + "default_value": 25 + }, + "speed_topbottom": { + "default_value": 15 + }, + "speed_travel": { + "default_value": 150 + }, + "speed_layer_0": { + "default_value": 30 + }, + "support_enable": { + "default_value": true + } } - } -} \ No newline at end of file +} diff --git a/resources/definitions/abax_titan.def.json b/resources/definitions/abax_titan.def.json index d1ac92139e..2ce2874563 100644 --- a/resources/definitions/abax_titan.def.json +++ b/resources/definitions/abax_titan.def.json @@ -1,90 +1,86 @@ { - "id": "Titan", - "name": "ABAX Titan", - "version": 2, - "inherits": "fdmprinter", - "metadata": { - "visible": true, - "author": "ABAX 3d Technologies", - "manufacturer": "ABAX 3d Technologies", - "category": "3D Printer", - "file_formats": "text/x-gcode", - "platform": "bq_hephestos_platform.stl", - "platform_offset": [ - 0, - -82, - 0 - ] - }, - "overrides": { - "machine_start_gcode": { - "default_value": "; -- START GCODE --\nG21 ;set units to millimetres\nG90 ;set to absolute positioning\nM106 S0 ;set fan speed to zero (turned off)\nG28 X0 Y0 ;move to the X/Y origin (Home)\nG28 Z0 ;move to the Z origin (Home)\nG1 Z5.0 F200 ;move Z to position 5.0 mm\nG92 E0 ;zero the extruded length\n; -- end of START GCODE --" + "id": "Titan", + "name": "ABAX Titan", + "version": 2, + "inherits": "fdmprinter", + "metadata": { + "visible": true, + "author": "ABAX 3d Technologies", + "manufacturer": "ABAX 3d Technologies", + "category": "Other", + "file_formats": "text/x-gcode", + "platform": "bq_hephestos_platform.stl", + "platform_offset": [0, -82, 0] }, - "machine_end_gcode": { - "default_value": "; -- END GCODE --\nM104 S0 ;set extruder temperature to zero (turned off)\nM140 S0 ;set temp of bed to Zero \nG91 ;set to relative positioning\nG1 E-10 F300 ;retract the filament a bit to release some of the pressure\nG1 F2000 X0 Y300 ;move X to min and Y to max \nG90 ;set to absolute positioning\nM84 ;turn off steppers\n; -- end of END GCODE --" - }, - "machine_width": { - "default_value": 310 - }, - "machine_depth": { - "default_value": 310 - }, - "machine_height": { - "default_value": 300 - }, - "machine_heated_bed": { - "default_value": false - }, - "machine_center_is_zero": { - "default_value": false - }, - "machine_gcode_flavor": { - "default_value": "RepRap" - }, - "layer_height": { - "default_value": 0.2 - }, - "layer_height_0": { - "default_value": 0.2 - }, - "wall_thickness": { - "default_value": 1 - }, - "top_bottom_thickness": { - "default_value": 1 - }, - "bottom_thickness": { - "default_value": 1 - }, - "material_print_temperature": { - "default_value": 200 - }, - "material_bed_temperature": { - "default_value": 0 - }, - "material_diameter": { - "default_value": 1.75 - }, - "speed_print": { - "default_value": 40 - }, - "speed_infill": { - "default_value": 70 - }, - "speed_wall": { - "default_value": 25 - }, - "speed_topbottom": { - "default_value": 15 - }, - "speed_travel": { - "default_value": 150 - }, - "speed_layer_0": { - "default_value": 30 - }, - "support_enable": { - "default_value": true + "overrides": { + "machine_start_gcode": { + "default_value": "; -- START GCODE --\nG21 ;set units to millimetres\nG90 ;set to absolute positioning\nM106 S0 ;set fan speed to zero (turned off)\nG28 X0 Y0 ;move to the X/Y origin (Home)\nG28 Z0 ;move to the Z origin (Home)\nG1 Z5.0 F200 ;move Z to position 5.0 mm\nG92 E0 ;zero the extruded length\n; -- end of START GCODE --" + }, + "machine_end_gcode": { + "default_value": "; -- END GCODE --\nM104 S0 ;set extruder temperature to zero (turned off)\nM140 S0 ;set temp of bed to Zero \nG91 ;set to relative positioning\nG1 E-10 F300 ;retract the filament a bit to release some of the pressure\nG1 F2000 X0 Y300 ;move X to min and Y to max \nG90 ;set to absolute positioning\nM84 ;turn off steppers\n; -- end of END GCODE --" + }, + "machine_width": { + "default_value": 310 + }, + "machine_depth": { + "default_value": 310 + }, + "machine_height": { + "default_value": 300 + }, + "machine_heated_bed": { + "default_value": false + }, + "machine_center_is_zero": { + "default_value": false + }, + "machine_gcode_flavor": { + "default_value": "RepRap" + }, + "layer_height": { + "default_value": 0.2 + }, + "layer_height_0": { + "default_value": 0.2 + }, + "wall_thickness": { + "default_value": 1 + }, + "top_bottom_thickness": { + "default_value": 1 + }, + "bottom_thickness": { + "default_value": 1 + }, + "material_print_temperature": { + "default_value": 200 + }, + "material_bed_temperature": { + "default_value": 0 + }, + "material_diameter": { + "default_value": 1.75 + }, + "speed_print": { + "default_value": 40 + }, + "speed_infill": { + "default_value": 70 + }, + "speed_wall": { + "default_value": 25 + }, + "speed_topbottom": { + "default_value": 15 + }, + "speed_travel": { + "default_value": 150 + }, + "speed_layer_0": { + "default_value": 30 + }, + "support_enable": { + "default_value": true + } } - } -} \ No newline at end of file +} From f2695a40e0400dd90e64e272ed2ddea0756e56bf Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 13:07:28 +0100 Subject: [PATCH 065/197] Remove Prusa platforms from ABAX printers The Prusa platform meshes say 'PRUSA' in huge letters. They are not the ABAX printers, though the structure is mostly the same. To prevent confusion I'm removing the platform mesh. --- resources/definitions/abax_pri3.def.json | 4 +--- resources/definitions/abax_pri5.def.json | 4 +--- resources/definitions/abax_titan.def.json | 4 +--- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/resources/definitions/abax_pri3.def.json b/resources/definitions/abax_pri3.def.json index 05469e3da7..cf1f2b466d 100644 --- a/resources/definitions/abax_pri3.def.json +++ b/resources/definitions/abax_pri3.def.json @@ -8,9 +8,7 @@ "author": "ABAX 3d Technologies", "manufacturer": "ABAX 3d Technologies", "category": "Other", - "file_formats": "text/x-gcode", - "platform": "bq_hephestos_platform.stl", - "platform_offset": [0, -82, 0] + "file_formats": "text/x-gcode" }, "overrides": { "machine_start_gcode": { diff --git a/resources/definitions/abax_pri5.def.json b/resources/definitions/abax_pri5.def.json index 8300eb7858..aa2a7eec22 100644 --- a/resources/definitions/abax_pri5.def.json +++ b/resources/definitions/abax_pri5.def.json @@ -8,9 +8,7 @@ "author": "ABAX 3d Technologies", "manufacturer": "ABAX 3d Technologies", "category": "Other", - "file_formats": "text/x-gcode", - "platform": "bq_hephestos_platform.stl", - "platform_offset": [0, -82, 0] + "file_formats": "text/x-gcode" }, "overrides": { "machine_start_gcode": { diff --git a/resources/definitions/abax_titan.def.json b/resources/definitions/abax_titan.def.json index 2ce2874563..75f1267b4f 100644 --- a/resources/definitions/abax_titan.def.json +++ b/resources/definitions/abax_titan.def.json @@ -8,9 +8,7 @@ "author": "ABAX 3d Technologies", "manufacturer": "ABAX 3d Technologies", "category": "Other", - "file_formats": "text/x-gcode", - "platform": "bq_hephestos_platform.stl", - "platform_offset": [0, -82, 0] + "file_formats": "text/x-gcode" }, "overrides": { "machine_start_gcode": { From 9cf0fdc4a3cd16e2ab2df86ea2c3539c92fbcea9 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 13:16:50 +0100 Subject: [PATCH 066/197] Add quality profiles for ABAX printers These are delivered to me by Pedro J. of ABAX 3D Tech. I modified the file names to be in line with our code standards, and I modified the link to the machine definition to coincide with the file names that were changed there to be in line with our code standards. --- .../quality/abax_pri3/apri3_pla_fast.inst.cfg | 22 +++++++++++++++++++ .../quality/abax_pri3/apri3_pla_high.inst.cfg | 22 +++++++++++++++++++ .../abax_pri3/apri3_pla_normal.inst.cfg | 22 +++++++++++++++++++ .../quality/abax_pri5/apri5_pla_fast.inst.cfg | 22 +++++++++++++++++++ .../quality/abax_pri5/apri5_pla_high.inst.cfg | 22 +++++++++++++++++++ .../abax_pri5/apri5_pla_normal.inst.cfg | 22 +++++++++++++++++++ .../abax_titan/atitan_pla_fast.inst.cfg | 22 +++++++++++++++++++ .../abax_titan/atitan_pla_high.inst.cfg | 21 ++++++++++++++++++ .../abax_titan/atitan_pla_normal.inst.cfg | 22 +++++++++++++++++++ 9 files changed, 197 insertions(+) create mode 100644 resources/quality/abax_pri3/apri3_pla_fast.inst.cfg create mode 100644 resources/quality/abax_pri3/apri3_pla_high.inst.cfg create mode 100644 resources/quality/abax_pri3/apri3_pla_normal.inst.cfg create mode 100644 resources/quality/abax_pri5/apri5_pla_fast.inst.cfg create mode 100644 resources/quality/abax_pri5/apri5_pla_high.inst.cfg create mode 100644 resources/quality/abax_pri5/apri5_pla_normal.inst.cfg create mode 100644 resources/quality/abax_titan/atitan_pla_fast.inst.cfg create mode 100644 resources/quality/abax_titan/atitan_pla_high.inst.cfg create mode 100644 resources/quality/abax_titan/atitan_pla_normal.inst.cfg diff --git a/resources/quality/abax_pri3/apri3_pla_fast.inst.cfg b/resources/quality/abax_pri3/apri3_pla_fast.inst.cfg new file mode 100644 index 0000000000..7f3bf240ac --- /dev/null +++ b/resources/quality/abax_pri3/apri3_pla_fast.inst.cfg @@ -0,0 +1,22 @@ + +[general] +version = 2 +name = Normal Quality +definition = abax_pri3 + +[metadata] +type = quality +material = generic_pla +weight = 0 +quality_type = normal + +[values] +layer_height = 0.2 +wall_thickness = 1.05 +top_bottom_thickness = 0.8 +infill_sparse_density = 20 +speed_print = 80 +speed_layer_0 = =round(speed_print * 30 / 50) +speed_topbottom = 20 +cool_min_layer_time = 5 +cool_min_speed = 10 \ No newline at end of file diff --git a/resources/quality/abax_pri3/apri3_pla_high.inst.cfg b/resources/quality/abax_pri3/apri3_pla_high.inst.cfg new file mode 100644 index 0000000000..be93de160e --- /dev/null +++ b/resources/quality/abax_pri3/apri3_pla_high.inst.cfg @@ -0,0 +1,22 @@ + +[general] +version = 2 +name = High Quality +definition = abax_pri3 + +[metadata] +type = quality +material = generic_pla +weight = 1 +quality_type = high + +[values] +layer_height = 0.1 +wall_thickness = 1.05 +top_bottom_thickness = 0.8 +infill_sparse_density = 20 +speed_print = 50 +speed_layer_0 = =round(speed_print * 30 / 50) +speed_topbottom = 20 +cool_min_layer_time = 5 +cool_min_speed = 10 \ No newline at end of file diff --git a/resources/quality/abax_pri3/apri3_pla_normal.inst.cfg b/resources/quality/abax_pri3/apri3_pla_normal.inst.cfg new file mode 100644 index 0000000000..a116ff4485 --- /dev/null +++ b/resources/quality/abax_pri3/apri3_pla_normal.inst.cfg @@ -0,0 +1,22 @@ + +[general] +version = 2 +name = Normal Quality +definition = abax_pri3 + +[metadata] +type = quality +material = generic_pla +weight = 0 +quality_type = normal + +[values] +layer_height = 0.2 +wall_thickness = 1.05 +top_bottom_thickness = 0.8 +infill_sparse_density = 20 +speed_print = 50 +speed_layer_0 = =round(speed_print * 30 / 50) +speed_topbottom = 20 +cool_min_layer_time = 5 +cool_min_speed = 10 \ No newline at end of file diff --git a/resources/quality/abax_pri5/apri5_pla_fast.inst.cfg b/resources/quality/abax_pri5/apri5_pla_fast.inst.cfg new file mode 100644 index 0000000000..4bfb02fe77 --- /dev/null +++ b/resources/quality/abax_pri5/apri5_pla_fast.inst.cfg @@ -0,0 +1,22 @@ + +[general] +version = 2 +name = Normal Quality +definition = abax_pri5 + +[metadata] +type = quality +material = generic_pla +weight = 0 +quality_type = normal + +[values] +layer_height = 0.2 +wall_thickness = 1.05 +top_bottom_thickness = 0.8 +infill_sparse_density = 20 +speed_print = 80 +speed_layer_0 = =round(speed_print * 30 / 50) +speed_topbottom = 20 +cool_min_layer_time = 5 +cool_min_speed = 10 \ No newline at end of file diff --git a/resources/quality/abax_pri5/apri5_pla_high.inst.cfg b/resources/quality/abax_pri5/apri5_pla_high.inst.cfg new file mode 100644 index 0000000000..4c89f5cf28 --- /dev/null +++ b/resources/quality/abax_pri5/apri5_pla_high.inst.cfg @@ -0,0 +1,22 @@ + +[general] +version = 2 +name = High Quality +definition = abax_pri5 + +[metadata] +type = quality +material = generic_pla +weight = 1 +quality_type = high + +[values] +layer_height = 0.1 +wall_thickness = 1.05 +top_bottom_thickness = 0.8 +infill_sparse_density = 20 +speed_print = 50 +speed_layer_0 = =round(speed_print * 30 / 50) +speed_topbottom = 20 +cool_min_layer_time = 5 +cool_min_speed = 10 \ No newline at end of file diff --git a/resources/quality/abax_pri5/apri5_pla_normal.inst.cfg b/resources/quality/abax_pri5/apri5_pla_normal.inst.cfg new file mode 100644 index 0000000000..fc11c5af19 --- /dev/null +++ b/resources/quality/abax_pri5/apri5_pla_normal.inst.cfg @@ -0,0 +1,22 @@ + +[general] +version = 2 +name = Normal Quality +definition = abax_pri5 + +[metadata] +type = quality +material = generic_pla +weight = 0 +quality_type = normal + +[values] +layer_height = 0.2 +wall_thickness = 1.05 +top_bottom_thickness = 0.8 +infill_sparse_density = 20 +speed_print = 50 +speed_layer_0 = =round(speed_print * 30 / 50) +speed_topbottom = 20 +cool_min_layer_time = 5 +cool_min_speed = 10 \ No newline at end of file diff --git a/resources/quality/abax_titan/atitan_pla_fast.inst.cfg b/resources/quality/abax_titan/atitan_pla_fast.inst.cfg new file mode 100644 index 0000000000..63189c1ed1 --- /dev/null +++ b/resources/quality/abax_titan/atitan_pla_fast.inst.cfg @@ -0,0 +1,22 @@ + +[general] +version = 2 +name = Normal Quality +definition = abax_titan + +[metadata] +type = quality +material = generic_pla +weight = 0 +quality_type = normal + +[values] +layer_height = 0.2 +wall_thickness = 1.05 +top_bottom_thickness = 0.8 +infill_sparse_density = 20 +speed_print = 80 +speed_layer_0 = =round(speed_print * 30 / 50) +speed_topbottom = 20 +cool_min_layer_time = 5 +cool_min_speed = 10 \ No newline at end of file diff --git a/resources/quality/abax_titan/atitan_pla_high.inst.cfg b/resources/quality/abax_titan/atitan_pla_high.inst.cfg new file mode 100644 index 0000000000..7d6f8bb3d7 --- /dev/null +++ b/resources/quality/abax_titan/atitan_pla_high.inst.cfg @@ -0,0 +1,21 @@ + +[general] +version = 2 +name = High Quality +definition = abax_titan +[metadata] +type = quality +material = generic_pla +weight = 1 +quality_type = high + +[values] +layer_height = 0.1 +wall_thickness = 1.05 +top_bottom_thickness = 0.8 +infill_sparse_density = 20 +speed_print = 50 +speed_layer_0 = =round(speed_print * 30 / 50) +speed_topbottom = 20 +cool_min_layer_time = 5 +cool_min_speed = 10 \ No newline at end of file diff --git a/resources/quality/abax_titan/atitan_pla_normal.inst.cfg b/resources/quality/abax_titan/atitan_pla_normal.inst.cfg new file mode 100644 index 0000000000..6de6a1df32 --- /dev/null +++ b/resources/quality/abax_titan/atitan_pla_normal.inst.cfg @@ -0,0 +1,22 @@ + +[general] +version = 2 +name = Normal Quality +definition = abax_titan + +[metadata] +type = quality +material = generic_pla +weight = 0 +quality_type = normal + +[values] +layer_height = 0.2 +wall_thickness = 1.05 +top_bottom_thickness = 0.8 +infill_sparse_density = 20 +speed_print = 50 +speed_layer_0 = =round(speed_print * 30 / 50) +speed_topbottom = 20 +cool_min_layer_time = 5 +cool_min_speed = 10 \ No newline at end of file From 31e88aa5af0e71329df4c476471437d6eb87b7bb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 14:14:50 +0100 Subject: [PATCH 067/197] Also check for errors via limit_to_extruder settings The error should then not be checked in the active stack but in the stack which has the correct setting value. Contributes to issue CURA-3291. --- cura/Settings/MachineManager.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 329bf90b7a..b4cdafa1e9 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Ultimaker B.V. +# Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from PyQt5.QtCore import QObject, pyqtProperty, pyqtSignal @@ -301,9 +301,15 @@ class MachineManager(QObject): if not self._stacks_have_errors: # fast update, we only have to look at the current changed property if self._active_container_stack.getProperty(key, "settable_per_extruder"): - changed_validation_state = self._active_container_stack.getProperty(key, property_name) + if self._active_container_stack.hasProperty(key, "limit_to_extruder"): #We have to look this value up from a different extruder. + extruder_index = self._active_container_stack.getProperty("limit_to_extruder") + extruder_manager = ExtruderManager.getInstance() + stack = extruder_manager.getExtruderStack(extruder_index) + else: + stack = self._active_container_stack else: - changed_validation_state = self._global_container_stack.getProperty(key, property_name) + stack = self._global_container_stack + changed_validation_state = stack.getProperty(key, property_name) if changed_validation_state is None: # Setting is not validated. This can happen if there is only a setting definition. From 7d536e2f8b0c42faa84a38af9d4b5a95809a95f8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 14:17:23 +0100 Subject: [PATCH 068/197] Clarify global container stack checking code in _checkStacksHaveErrors The order of operations was a bit weird. This made the code unclear and also required an extra check in an if-statement. This is simpler and theoretically even a bit faster. Contributes sorta to issue CURA-3291. --- cura/Settings/MachineManager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index b4cdafa1e9..32664c2ee5 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -381,11 +381,11 @@ class MachineManager(QObject): return UM.Settings.ContainerRegistry.getInstance().createUniqueName(container_type, current_name, new_name, fallback_name) def _checkStacksHaveErrors(self): - if self._global_container_stack is not None and self._global_container_stack.hasErrors(): - return True - - if self._global_container_stack is None: + if self._global_container_stack is None: #No active machine. return False + + if self._global_container_stack.hasErrors(): + return True stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())) for stack in stacks: if stack.hasErrors(): From 039015e3df83d3e61badd489e6ca5090559cf3bf Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 14:24:03 +0100 Subject: [PATCH 069/197] Don't unnecessarily copy extruder stacks to list You're just looping over it. No need to actually make a list out of it. Contributes to issue CURA-3291. --- cura/Settings/MachineManager.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 32664c2ee5..fc89fa2f2a 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -386,8 +386,7 @@ class MachineManager(QObject): if self._global_container_stack.hasErrors(): return True - stacks = list(ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId())) - for stack in stacks: + for stack in ExtruderManager.getInstance().getMachineExtruders(self._global_container_stack.getId()): if stack.hasErrors(): return True From ed2b09c9759560306abc353ddae2bdd935fb2625 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 14:26:37 +0100 Subject: [PATCH 070/197] Fix getting limit to extruder property Apparently it didn't even reach this code up until now. Well, now it does. Contributes to issue CURA-3291. --- cura/Settings/MachineManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index fc89fa2f2a..16ff1f59c0 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -302,7 +302,7 @@ class MachineManager(QObject): # fast update, we only have to look at the current changed property if self._active_container_stack.getProperty(key, "settable_per_extruder"): if self._active_container_stack.hasProperty(key, "limit_to_extruder"): #We have to look this value up from a different extruder. - extruder_index = self._active_container_stack.getProperty("limit_to_extruder") + extruder_index = self._active_container_stack.getProperty(key, "limit_to_extruder") extruder_manager = ExtruderManager.getInstance() stack = extruder_manager.getExtruderStack(extruder_index) else: From 362c5835ee5acc929b9b0a8180501314455cc6ff Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 14:42:06 +0100 Subject: [PATCH 071/197] Don't use limit_to_extruder if it evaluates to -1 The default value for the limit_to_extruder property is -1. So no need to check if the property exists. Just check if it is positive. Contributes to issue CURA-3291. --- cura/Settings/MachineManager.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 16ff1f59c0..bd431340e3 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -301,10 +301,9 @@ class MachineManager(QObject): if not self._stacks_have_errors: # fast update, we only have to look at the current changed property if self._active_container_stack.getProperty(key, "settable_per_extruder"): - if self._active_container_stack.hasProperty(key, "limit_to_extruder"): #We have to look this value up from a different extruder. - extruder_index = self._active_container_stack.getProperty(key, "limit_to_extruder") - extruder_manager = ExtruderManager.getInstance() - stack = extruder_manager.getExtruderStack(extruder_index) + extruder_index = int(self._active_container_stack.getProperty(key, "limit_to_extruder")) + if extruder_index >= 0: #We have to look up the value from a different extruder. + stack = ExtruderManager.getInstance().getExtruderStack(str(extruder_index)) else: stack = self._active_container_stack else: From 4715afdad60097b972914724809fd17bea26a5a2 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Wed, 1 Feb 2017 14:53:22 +0100 Subject: [PATCH 072/197] Fixed one new class variable. Updated the script to run mypy. --- cura/LayerPolygon.py | 4 ++-- run_mypy.py | 48 ++++++++++++++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 17 deletions(-) diff --git a/cura/LayerPolygon.py b/cura/LayerPolygon.py index 70b17cff75..81fe66a80d 100644 --- a/cura/LayerPolygon.py +++ b/cura/LayerPolygon.py @@ -1,6 +1,6 @@ from UM.Math.Color import Color from UM.Application import Application - +from typing import Any import numpy @@ -173,7 +173,7 @@ class LayerPolygon: return normals - __color_map = None + __color_map = None # type: numpy.ndarray[Any] ## Gets the instance of the VersionUpgradeManager, or creates one. @classmethod diff --git a/run_mypy.py b/run_mypy.py index c5dfb23802..24c9d3ae31 100644 --- a/run_mypy.py +++ b/run_mypy.py @@ -1,8 +1,17 @@ #!env python import os +import sys import subprocess -os.putenv("MYPYPATH", r".;.\plugins;.\plugins\VersionUpgrade;..\Uranium_hint\;..\Uranium_hint\stubs\\" ) +# A quick Python implementation of unix 'where' command. +def where(exeName): + searchPath = os.getenv("PATH") + paths = searchPath.split(";" if sys.platform == "win32" else ":") + for path in paths: + candidatePath = os.path.join(path, exeName) + if os.path.exists(candidatePath): + return candidatePath + return None def findModules(path): result = [] @@ -11,21 +20,30 @@ def findModules(path): result.append(entry.name) return result -plugins = findModules("plugins") -plugins.sort() +def main(): + os.putenv("MYPYPATH", r".;.\plugins;.\plugins\VersionUpgrade;..\Uranium_hint\;..\Uranium_hint\stubs\\" ) -mods = ["cura"] + plugins + findModules("plugins/VersionUpgrade") + # Mypy really needs to be run via its Python script otherwise it can't find its data files. + mypyExe = where("mypy.bat" if sys.platform == "win32" else "mypy") + mypyModule = os.path.join(os.path.dirname(mypyExe), "mypy") -for mod in mods: - print("------------- Checking module {mod}".format(**locals())) - result = subprocess.run(["python", r"c:\python35\Scripts\mypy", "-p", mod]) - if result.returncode != 0: + plugins = findModules("plugins") + plugins.sort() + + mods = ["cura"] + plugins + findModules("plugins/VersionUpgrade") + + for mod in mods: + print("------------- Checking module {mod}".format(**locals())) + result = subprocess.run([sys.executable, mypyModule, "-p", mod]) + if result.returncode != 0: + print(""" + Module {mod} failed checking. :( + """.format(**locals())) + break + else: print(""" -Module {mod} failed checking. :( -""".format(**locals())) - break -else: - print(""" -Done checking. All is good. -""") + Done checking. All is good. + """) + return 0 +sys.exit(main()) From a0ba1188a1ca12b3c6e1f9a4d6b48726f2888fcb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 16:17:12 +0100 Subject: [PATCH 073/197] Always listen to changes on all extruder stacks of the current machine We need to listen for changes on all extruder stacks because the values might change and therefore the validation states might change. The value of a different extruder stack could change if you change a global value that has impact on a per-extruder value via inheritance, or in this case if a limit-to-extruder property specifies that the setting should be changed on a different stack. It could change on the stack that is not active in either case. This might have some performance impact, but it is very small. Other than layer_height there aren't many global settings that have impact on multiple extruders via inheritance. And via limit-to-extruder there will typically only be one changed value which you want to update for. Changing layer height will be a bit slower though. Contributes to issue CURA-3291. --- cura/Settings/MachineManager.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index bd431340e3..c81d1a1bc7 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -220,6 +220,11 @@ class MachineManager(QObject): quality = self._global_container_stack.findContainer({"type": "quality"}) quality.nameChanged.disconnect(self._onQualityNameChanged) + if self._global_container_stack.getProperty("machine_extruder_count", "value") > 1: + for extruder_stack in ExtruderManager.getInstance().getActiveExtruderStacks(): + extruder_stack.propertyChanged.disconnect(self._onPropertyChanged) + extruder_stack.containersChanged.disconnect(self._onInstanceContainersChanged) + self._global_container_stack = Application.getInstance().getGlobalContainerStack() self._active_container_stack = self._global_container_stack @@ -243,6 +248,10 @@ class MachineManager(QObject): if global_material != self._empty_material_container: self._global_container_stack.replaceContainer(self._global_container_stack.getContainerIndex(global_material), self._empty_material_container) + for extruder_stack in ExtruderManager.getInstance().getActiveExtruderStacks(): #Listen for changes on all extruder stacks. + extruder_stack.propertyChanged.connect(self._onPropertyChanged) + extruder_stack.containersChanged.connect(self._onInstanceContainersChanged) + else: material = self._global_container_stack.findContainer({"type": "material"}) material.nameChanged.connect(self._onMaterialNameChanged) @@ -263,14 +272,8 @@ class MachineManager(QObject): self.blurSettings.emit() # Ensure no-one has focus. old_active_container_stack = self._active_container_stack - if self._active_container_stack and self._active_container_stack != self._global_container_stack: - self._active_container_stack.containersChanged.disconnect(self._onInstanceContainersChanged) - self._active_container_stack.propertyChanged.disconnect(self._onPropertyChanged) self._active_container_stack = ExtruderManager.getInstance().getActiveExtruderStack() - if self._active_container_stack: - self._active_container_stack.containersChanged.connect(self._onInstanceContainersChanged) - self._active_container_stack.propertyChanged.connect(self._onPropertyChanged) - else: + if not self._active_container_stack: self._active_container_stack = self._global_container_stack self._updateStacksHaveErrors() From 3ac9036b4a1164633eac14282627966b963e1fe8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 16:28:45 +0100 Subject: [PATCH 074/197] Only listen for other container stack errors if multi-extrusion It's not even necessary to check otherwise. Requesting an extruder stack would give None anyway, which would give errors. Contributes to issue CURA-3291. --- cura/Settings/MachineManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index c81d1a1bc7..27c4ae1961 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -303,7 +303,7 @@ class MachineManager(QObject): if property_name == "validationState": if not self._stacks_have_errors: # fast update, we only have to look at the current changed property - if self._active_container_stack.getProperty(key, "settable_per_extruder"): + if self._global_container_stack.getProperty("machine_extruder_count", "value") > 1 and self._active_container_stack.getProperty(key, "settable_per_extruder"): extruder_index = int(self._active_container_stack.getProperty(key, "limit_to_extruder")) if extruder_index >= 0: #We have to look up the value from a different extruder. stack = ExtruderManager.getInstance().getExtruderStack(str(extruder_index)) From 425dbf1ad8d24df4cc45973be514aecdc920392a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 16:29:59 +0100 Subject: [PATCH 075/197] Only check for validationState changes if it's not already a value change No need to check the second if-statement in most cases. Contributes to issue CURA-3291. --- cura/Settings/MachineManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 27c4ae1961..b5aaf7e4ff 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -300,7 +300,7 @@ class MachineManager(QObject): # Notify UI items, such as the "changed" star in profile pull down menu. self.activeStackValueChanged.emit() - if property_name == "validationState": + elif property_name == "validationState": if not self._stacks_have_errors: # fast update, we only have to look at the current changed property if self._global_container_stack.getProperty("machine_extruder_count", "value") > 1 and self._active_container_stack.getProperty(key, "settable_per_extruder"): From 5c2f1a935a4a95dd842d3b4392f84cb53406dcfe Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 1 Feb 2017 17:31:36 +0100 Subject: [PATCH 076/197] Move monitorLabel into PrintMonitor.qml It's a label that belongs to the print monitor after all. Let the print monitor file decide how it's going to look. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 13 ++++++++++++- resources/qml/Sidebar.qml | 17 ++--------------- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index cd2f2a7376..887c70f457 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2016 Ultimaker B.V. +// Copyright (c) 2017 Ultimaker B.V. // Cura is released under the terms of the AGPLv3 or higher. import QtQuick 2.2 @@ -20,6 +20,17 @@ Column simpleNames: true } + Label { + id: monitorLabel + text: catalog.i18nc("@label","Printer Monitor"); + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width; + width: parent.width * 0.45 + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + visible: monitoringPrint + } + Item { width: base.width - 2 * UM.Theme.getSize("default_margin").width diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 148606679f..45dc49d076 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -1,4 +1,4 @@ -// Copyright (c) 2015 Ultimaker B.V. +// Copyright (c) 2017 Ultimaker B.V. // Cura is released under the terms of the AGPLv3 or higher. import QtQuick 2.2 @@ -455,19 +455,6 @@ Rectangle } } - Label { - id: monitorLabel - text: catalog.i18nc("@label","Printer Monitor"); - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width; - anchors.top: headerSeparator.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height - width: parent.width * 0.45 - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text") - visible: monitoringPrint - } - StackView { id: sidebarContents @@ -511,7 +498,7 @@ Rectangle Loader { anchors.bottom: footerSeparator.top - anchors.top: monitorLabel.bottom + anchors.top: headerSeparator.bottom anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: base.left anchors.leftMargin: UM.Theme.getSize("default_margin").width From cda5ee1dca80daa5072b071467e45204b57d1bec Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 2 Feb 2017 14:27:49 +0100 Subject: [PATCH 077/197] Separate name from address in properties This way we can display them separately. Contributes to issue CURA-3161. --- .../NetworkPrinterOutputDevice.py | 9 +++++++-- .../NetworkPrinterOutputDevicePlugin.py | 19 +++++++++++++++---- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 549c0905d6..c1e75e6181 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Ultimaker B.V. +# Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from UM.i18n import i18nCatalog @@ -100,7 +100,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self.setPriority(2) # Make sure the output device gets selected above local file output self.setName(key) - self.setShortDescription(i18n_catalog.i18nc("@action:button Preceded by 'Ready to'.", "Print over network")) + self.setShortDescription(i18n_catalog.i18nc("@action:button Preceded by 'Ready to'.", "print over network")) self.setDescription(i18n_catalog.i18nc("@properties:tooltip", "Print over network")) self.setIconName("print") @@ -220,6 +220,11 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def getKey(self): return self._key + ## The IP address of the printer. + @pyqtProperty(str, constant = True) + def address(self): + return self._properties.get(b"address", b"0.0.0.0").decode("utf-8") + ## Name of the printer (as returned from the zeroConf properties) @pyqtProperty(str, constant = True) def name(self): diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py index 2725fa8d17..9165bd5273 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py @@ -1,3 +1,6 @@ +# Copyright (c) 2017 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + from UM.OutputDevice.OutputDevicePlugin import OutputDevicePlugin from . import NetworkPrinterOutputDevice @@ -75,9 +78,13 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin): self._manual_instances.append(address) self._preferences.setValue("um3networkprinting/manual_instances", ",".join(self._manual_instances)) - name = address instance_name = "manual:%s" % address - properties = { b"name": name.encode("utf-8"), b"manual": b"true", b"incomplete": b"true" } + properties = { + b"name": address.encode("utf-8"), + b"address": address.encode("utf-8"), + b"manual": b"true", + b"incomplete": b"true" + } if instance_name not in self._printers: # Add a preliminary printer instance @@ -112,10 +119,14 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin): if status_code == 200: system_info = json.loads(bytes(reply.readAll()).decode("utf-8")) address = reply.url().host() - name = ("%s (%s)" % (system_info["name"], address)) instance_name = "manual:%s" % address - properties = { b"name": name.encode("utf-8"), b"firmware_version": system_info["firmware"].encode("utf-8"), b"manual": b"true" } + properties = { + b"name": system_info["name"].encode("utf-8"), + b"address": address.encode("utf-8"), + b"firmware_version": system_info["firmware"].encode("utf-8"), + b"manual": b"true" + } if instance_name in self._printers: # Only replace the printer if it is still in the list of (manual) printers self.removePrinter(instance_name) From 1f0bcc1abdb601ebb5355c7f0d4aba9fd8f481bf Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 2 Feb 2017 14:34:40 +0100 Subject: [PATCH 078/197] Add header bar for print monitor It lists the name of the printer it is connected to, and the address on the right side. This won't work for USB printing (it'll give errors there). I'll solve that later. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 887c70f457..e4d9d84ac7 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -20,6 +20,42 @@ Column simpleNames: true } + Rectangle + { + id: connectedPrinterHeader + width: parent.width + height: UM.Theme.getSize("sidebar_header").height + color: UM.Theme.getColor("setting_category") + + Label + { + id: connectedPrinterNameLabel + text: printerConnected ? connectedPrinter.name : catalog.i18nc("@info:status", "No printer connected") + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + } + Label + { + id: connectedPrinterAddressLabel + text: printerConnected ? connectedPrinter.address : "" + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_inactive") + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + horizontalAlignment: Text.AlignRight + } + } + Label { id: monitorLabel text: catalog.i18nc("@label","Printer Monitor"); From c7a91f07d25128b6484c0367b936df666b454c00 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 2 Feb 2017 14:45:44 +0100 Subject: [PATCH 079/197] Add label for printer connection text to header Also fixed the indenting of the previous two labels to use spaces instead of tabs. I knew I was going to forget putting it back to spaces after working on a different project that uses tabs. The information is duplicated now. I'll remove the old one promptly. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 68 ++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 28 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index e4d9d84ac7..c5bf160657 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -24,36 +24,48 @@ Column { id: connectedPrinterHeader width: parent.width - height: UM.Theme.getSize("sidebar_header").height + height: childrenRect.height + UM.Theme.getSize("default_margin").height * 2 color: UM.Theme.getColor("setting_category") - Label - { - id: connectedPrinterNameLabel - text: printerConnected ? connectedPrinter.name : catalog.i18nc("@info:status", "No printer connected") - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text") - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - } - Label - { - id: connectedPrinterAddressLabel - text: printerConnected ? connectedPrinter.address : "" - font: UM.Theme.getFont("small") - color: UM.Theme.getColor("text_inactive") - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - horizontalAlignment: Text.AlignRight - } + Label + { + id: connectedPrinterNameLabel + text: printerConnected ? connectedPrinter.name : catalog.i18nc("@info:status", "No printer connected") + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + } + Label + { + id: connectedPrinterAddressLabel + text: printerConnected ? connectedPrinter.address : "" + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_inactive") + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + horizontalAlignment: Text.AlignRight + } + Label + { + text: printerConnected ? connectedPrinter.connectionText : catalog.i18nc("@info:status", "The printer is not connected.") + color: printerConnected && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + font: UM.Theme.getFont("default") + wrapMode: Text.WordWrap + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.top: connectedPrinterNameLabel.bottom + } } Label { From 7b8d41cb8f956bdb175dd5dfef81949166dc841c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 2 Feb 2017 14:48:06 +0100 Subject: [PATCH 080/197] Remove old connected printer header It has been replaced by a nicer header. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index c5bf160657..97ecfeb46a 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -68,34 +68,6 @@ Column } } - Label { - id: monitorLabel - text: catalog.i18nc("@label","Printer Monitor"); - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width; - width: parent.width * 0.45 - font: UM.Theme.getFont("large") - color: UM.Theme.getColor("text") - visible: monitoringPrint - } - - Item - { - width: base.width - 2 * UM.Theme.getSize("default_margin").width - height: childrenRect.height + UM.Theme.getSize("default_margin").height - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - - Label - { - text: printerConnected ? connectedPrinter.connectionText : catalog.i18nc("@info:status", "The printer is not connected.") - color: printerConnected && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - font: UM.Theme.getFont("default") - wrapMode: Text.WordWrap - width: parent.width - } - } - Loader { sourceComponent: monitorSection From 7b41e844cc6f0832d8ff9496761a38a771de38cd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 2 Feb 2017 15:19:56 +0100 Subject: [PATCH 081/197] Fix name and address for USB printing devices As address it uses the serial port, which would be COM# for Windows and /dev/ttyUSB# for Linux. I don't know what it would display there on OSX, probably a drive directory. Contributes to issue CURA-3161. --- plugins/USBPrinting/USBPrinterOutputDevice.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index e344caee1d..e30ba613bc 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -124,6 +124,16 @@ class USBPrinterOutputDevice(PrinterOutputDevice): def _homeBed(self): self._sendCommand("G28 Z") + ## A name for the device. + @pyqtProperty(str, constant = True) + def name(self): + return self.getName() + + ## The address of the device. + @pyqtProperty(str, constant = True) + def address(self): + return self._serial_port + def startPrint(self): self.writeStarted.emit(self) gcode_list = getattr( Application.getInstance().getController().getScene(), "gcode_list") From 0e306df1bcc0c0e6126530a28a498073be85898c Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Thu, 2 Feb 2017 15:59:09 +0100 Subject: [PATCH 082/197] Initial basic version of this feature. CURA-3335 --- cura/CuraApplication.py | 35 +++++++++++++++++++++++++++++++++++ cura_app.py | 36 +++++++++++++++++++++++++++++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index df3f44c14f..7b566c17ac 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1,5 +1,9 @@ # Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. +import json + +from PyQt5.QtCore import QTextStream +from PyQt5.QtNetwork import QLocalServer from UM.Qt.QtApplication import QtApplication from UM.Scene.SceneNode import SceneNode @@ -420,13 +424,44 @@ class CuraApplication(QtApplication): self._plugins_loaded = True + @classmethod def addCommandLineOptions(self, parser): super().addCommandLineOptions(parser) parser.add_argument("file", nargs="*", help="Files to load after starting the application.") + parser.add_argument("--single-instance", action="store_true", default=False) + + def _setUpSingleInstanceServer(self): + if self.getCommandLineOption("single_instance", False): + self.__single_instance_server = QLocalServer() + self.__single_instance_server.newConnection.connect(self._singleInstanceServerNewConnection) + self.__single_instance_server.listen("ultimaker-cura") + + def _singleInstanceServerNewConnection(self): + Logger.log('d', 'Saw something on the single instance server') + other_cura_connection = self.__single_instance_server.nextPendingConnection() + if other_cura_connection is not None: + def readyRead(): + while other_cura_connection.canReadLine(): + line = other_cura_connection.readLine() + payload = json.loads(str(line, encoding="ASCII").strip()) + command = payload["command"] + if command == "clear-all": + self.deleteAll() + + elif command == "open": + self.deleteAll() + self._openFile(payload["filePath"]) + + elif command == "focus": + self.focusWindow() + + other_cura_connection.readyRead.connect(readyRead) def run(self): self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Setting up scene...")) + self._setUpSingleInstanceServer() + controller = self.getController() controller.setActiveView("SolidView") diff --git a/cura_app.py b/cura_app.py index 5c3ea811b5..c2ee6a72b1 100755 --- a/cura_app.py +++ b/cura_app.py @@ -2,11 +2,14 @@ # Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. - +import argparse +import json import os import sys import platform +import time +from PyQt5.QtNetwork import QLocalSocket from UM.Platform import Platform #WORKAROUND: GITHUB-88 GITHUB-385 GITHUB-612 @@ -58,5 +61,36 @@ if Platform.isWindows() and hasattr(sys, "frozen"): # Force an instance of CuraContainerRegistry to be created and reused later. cura.Settings.CuraContainerRegistry.getInstance() +# Peek the arguments and look for the 'single-instance' flag. +parser = argparse.ArgumentParser(prog="cura") # pylint: disable=bad-whitespace +cura.CuraApplication.CuraApplication.addCommandLineOptions(parser) +parsed_command_line = vars(parser.parse_args()) + +if "single_instance" in parsed_command_line and parsed_command_line["single_instance"]: + print("Check for single instance") + single_instance_socket = QLocalSocket() + single_instance_socket.connectToServer("ultimaker-cura") + single_instance_socket.waitForConnected() + if single_instance_socket.state() == QLocalSocket.ConnectedState: + print("Connected to the other Cura instance.") + print(repr(parsed_command_line)) + + payload = {"command": "clear-all"} + single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) + + payload = {"command": "focus"} + single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) + + if len(parsed_command_line["file"]) != 0: + for filename in parsed_command_line["file"]: + payload = { "command": "open", "filePath": filename } + single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) + + single_instance_socket.flush() + + + single_instance_socket.close() + sys.exit(0) + app = cura.CuraApplication.CuraApplication.getInstance() app.run() From 39cbed61e5191909843fde5d0ef296baf65e332b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Feb 2017 11:30:54 +0100 Subject: [PATCH 083/197] Make machine_nozzle_expansion_angle min/max properly into functions They are inheritance functions so they must be written as a string in the JSON. Contributes to issue CURA-2572. --- resources/definitions/fdmprinter.def.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index b19c97b793..6f01030c66 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -222,8 +222,8 @@ "unit": "°", "type": "int", "default_value": 45, - "maximum_value": 89, - "minimum_value": 1, + "maximum_value": "89", + "minimum_value": "1", "settable_per_mesh": false, "settable_per_extruder": false, "settable_per_meshgroup": false From 9546c85967492ef46c73a277748238a190fc68e0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Feb 2017 13:50:17 +0100 Subject: [PATCH 084/197] Add boxes containing information on extruders These are meant to eventually replace the bullet-list of information we currently have. Contributes to issue CURA-3161. --- .../NetworkPrinterOutputDevice.py | 2 +- resources/qml/PrintMonitor.qml | 42 ++++++++++++++++++- resources/themes/cura/theme.json | 6 +++ 3 files changed, 48 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index c1e75e6181..32ebd354ee 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -100,7 +100,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self.setPriority(2) # Make sure the output device gets selected above local file output self.setName(key) - self.setShortDescription(i18n_catalog.i18nc("@action:button Preceded by 'Ready to'.", "print over network")) + self.setShortDescription(i18n_catalog.i18nc("@action:button Preceded by 'Ready to'.", "Print over network")) self.setDescription(i18n_catalog.i18nc("@properties:tooltip", "Print over network")) self.setIconName("print") diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 97ecfeb46a..556f500348 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -58,7 +58,7 @@ Column { text: printerConnected ? connectedPrinter.connectionText : catalog.i18nc("@info:status", "The printer is not connected.") color: printerConnected && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") - font: UM.Theme.getFont("default") + font: UM.Theme.getFont("very_small") wrapMode: Text.WordWrap anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width @@ -68,6 +68,46 @@ Column } } + GridLayout + { + id: extrudersGrid + columns: 2 + columnSpacing: UM.Theme.getSize("sidebar_lining_thin").width + rowSpacing: UM.Theme.getSize("sidebar_lining_thin").height + width: parent.width + + Repeater + { + model: machineExtruderCount.properties.value + delegate: Rectangle + { + id: extruderRectangle + color: UM.Theme.getColor("sidebar") + width: extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2 + height: UM.Theme.getSize("sidebar_extruder_box").height + + Text //Extruder name. + { + text: machineExtruderCount.properties.value > 1 ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") + color: UM.Theme.getColor("text") + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + } + Text //Temperature indication. + { + text: printerConnected ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" + font: UM.Theme.getFont("large") + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + } + } + } + } + Loader { sourceComponent: monitorSection diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index 23ebacd7f9..80fe6a3236 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -24,6 +24,10 @@ "bold": true, "family": "Open Sans" }, + "very_small": { + "size": 1.0, + "family": "Open Sans" + }, "button_tooltip": { "size": 1.0, "family": "Open Sans" @@ -247,9 +251,11 @@ "sidebar_header_mode_toggle": [0.0, 2.0], "sidebar_header_mode_tabs": [0.0, 3.0], "sidebar_lining": [0.5, 0.5], + "sidebar_lining_thin": [0.2, 0.2], "sidebar_setup": [0.0, 2.0], "sidebar_tabs": [0.0, 3.5], "sidebar_inputfields": [0.0, 2.0], + "sidebar_extruder_box": [0.0, 4.0], "simple_mode_infill_caption": [0.0, 5.0], "simple_mode_infill_height": [0.0, 8.0], From 687cdcc30ea4c74dc02e5012f82c445c105b87e7 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Feb 2017 13:54:37 +0100 Subject: [PATCH 085/197] Add grey border between extruder boxes This is done by fitting tightly a rectangle around the grid of boxes. The boxes themselves have a white background but there is spacing between the boxes, which results in the little border. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 65 +++++++++++++++++++--------------- 1 file changed, 36 insertions(+), 29 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 556f500348..2db524a794 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -68,41 +68,48 @@ Column } } - GridLayout + Rectangle { - id: extrudersGrid - columns: 2 - columnSpacing: UM.Theme.getSize("sidebar_lining_thin").width - rowSpacing: UM.Theme.getSize("sidebar_lining_thin").height + color: UM.Theme.getColor("sidebar_lining") width: parent.width + height: childrenRect.height - Repeater + GridLayout { - model: machineExtruderCount.properties.value - delegate: Rectangle - { - id: extruderRectangle - color: UM.Theme.getColor("sidebar") - width: extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2 - height: UM.Theme.getSize("sidebar_extruder_box").height + id: extrudersGrid + columns: 2 + columnSpacing: UM.Theme.getSize("sidebar_lining_thin").width + rowSpacing: UM.Theme.getSize("sidebar_lining_thin").height + width: parent.width - Text //Extruder name. + Repeater + { + model: machineExtruderCount.properties.value + delegate: Rectangle { - text: machineExtruderCount.properties.value > 1 ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") - color: UM.Theme.getColor("text") - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width - anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - } - Text //Temperature indication. - { - text: printerConnected ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" - font: UM.Theme.getFont("large") - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width - anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height + id: extruderRectangle + color: UM.Theme.getColor("sidebar") + width: extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2 + height: UM.Theme.getSize("sidebar_extruder_box").height + + Text //Extruder name. + { + text: machineExtruderCount.properties.value > 1 ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") + color: UM.Theme.getColor("text") + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + } + Text //Temperature indication. + { + text: printerConnected ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" + font: UM.Theme.getFont("large") + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + } } } } From ee3e0ba6abb659cd1a1b5322b6da6ab3d75ba18b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Feb 2017 14:52:09 +0100 Subject: [PATCH 086/197] Add material indication to extruder boxes Only if a material is known of course. But the case where it is unknown is not tested. Contributes to issue CURA-3161. --- cura/PrinterOutputDevice.py | 22 ++++++++++++++++++++++ resources/qml/PrintMonitor.qml | 24 ++++++++++++++++++++++++ resources/themes/cura/theme.json | 2 +- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 6e7305b27b..ed67bbb1ca 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -323,6 +323,28 @@ class PrinterOutputDevice(QObject, OutputDevice): result.append(i18n_catalog.i18nc("@item:material", "Unknown material")) return result + ## List of the colours of the currently loaded materials. + # + # The list is in order of extruders. If there is no material in an + # extruder, the colour is shown as transparent. + # + # The colours are returned in hex-format AARRGGBB or RRGGBB + # (e.g. #800000ff for transparent blue or #00ff00 for pure green). + @pyqtProperty("QVariantList", notify = materialIdChanged) + def materialColors(self): + result = [] + for material_id in self._material_ids: + if material_id is None: + result.append("#800000FF") #No material. + continue + + containers = self._container_registry.findInstanceContainers(type = "material", GUID = material_id) + if containers: + result.append(containers[0].getMetaDataEntry("color_code")) + else: + result.append("#800000FF") #Unknown material. + return result + ## Protected setter for the current material id. # /param index Index of the extruder # /param material_id id of the material diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 2db524a794..537adc53e5 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -110,6 +110,30 @@ Column anchors.top: parent.top anchors.topMargin: UM.Theme.getSize("default_margin").height } + Rectangle //Material colour indication. + { + id: materialColor + width: materialName.height * 0.75 + height: materialName.height * 0.75 + color: printerConnected ? connectedPrinter.materialColors[index] : [0, 0, 0, 0] //Need to check for printerConnected or materialColors[index] gives an error. + border.width: UM.Theme.getSize("default_lining").width + border.color: UM.Theme.getColor("lining") + visible: printerConnected + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: materialName.verticalCenter + } + Text //Material name. + { + id: materialName + text: printerConnected ? connectedPrinter.materialNames[index] : "" + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + anchors.left: materialColor.right + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + } } } } diff --git a/resources/themes/cura/theme.json b/resources/themes/cura/theme.json index 80fe6a3236..acce27b74e 100644 --- a/resources/themes/cura/theme.json +++ b/resources/themes/cura/theme.json @@ -255,7 +255,7 @@ "sidebar_setup": [0.0, 2.0], "sidebar_tabs": [0.0, 3.5], "sidebar_inputfields": [0.0, 2.0], - "sidebar_extruder_box": [0.0, 4.0], + "sidebar_extruder_box": [0.0, 6.0], "simple_mode_infill_caption": [0.0, 5.0], "simple_mode_infill_height": [0.0, 8.0], From 41c94fd247cd5400e39a66961fab560fefe53cb3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Feb 2017 15:03:24 +0100 Subject: [PATCH 087/197] Add variant names to extruder boxes In the bottom-right corner. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 537adc53e5..c23d732d62 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -134,6 +134,16 @@ Column anchors.bottom: parent.bottom anchors.bottomMargin: UM.Theme.getSize("default_margin").height } + Text //Variant name. + { + text: printerConnected ? connectedPrinter.hotendIds[index] : "" + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + } } } } From a6c244f969aaab248e5b20865d068b8faf0c339b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Feb 2017 15:06:21 +0100 Subject: [PATCH 088/197] Use setting separator margin between material colour and name It's a bit smaller. Looks like it belongs together now. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index c23d732d62..debc7657f8 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -130,7 +130,7 @@ Column font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") anchors.left: materialColor.right - anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width anchors.bottom: parent.bottom anchors.bottomMargin: UM.Theme.getSize("default_margin").height } From 1305dd88d74909e28a1aaf34014d025e0708002e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Feb 2017 15:20:24 +0100 Subject: [PATCH 089/197] Remove old extruder monitoring code It has been replaced by these fancy new boxes. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index debc7657f8..616b90fe72 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -149,21 +149,6 @@ Column } } - Loader - { - sourceComponent: monitorSection - property string label: catalog.i18nc("@label", "Temperatures") - } - Repeater - { - model: machineExtruderCount.properties.value - delegate: Loader - { - sourceComponent: monitorItem - property string label: machineExtruderCount.properties.value > 1 ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") - property string value: printerConnected ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" - } - } Repeater { model: machineHeatedBed.properties.value == "True" ? 1 : 0 From 03e16b53982a5efba061043a42ab431391bb97be Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Feb 2017 15:49:18 +0100 Subject: [PATCH 090/197] Fix material colour when no printer is selected It's invisible anyway, but the hex colour gives no errors at least. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 616b90fe72..d74f769fd5 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -115,7 +115,7 @@ Column id: materialColor width: materialName.height * 0.75 height: materialName.height * 0.75 - color: printerConnected ? connectedPrinter.materialColors[index] : [0, 0, 0, 0] //Need to check for printerConnected or materialColors[index] gives an error. + color: printerConnected ? connectedPrinter.materialColors[index] : "#00000000" //Need to check for printerConnected or materialColors[index] gives an error. border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") visible: printerConnected From abb9b8d7f09174a73ae4ec4609427299cbaee325 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Feb 2017 15:52:14 +0100 Subject: [PATCH 091/197] Add box for build plate monitoring This one's a bit bigger. It is supposed to contain the pre-heat button. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 41 +++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index d74f769fd5..e0c1d7ceca 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -149,14 +149,43 @@ Column } } - Repeater + Rectangle { - model: machineHeatedBed.properties.value == "True" ? 1 : 0 - delegate: Loader + color: UM.Theme.getColor("sidebar") + width: parent.width + height: machineHeatedBed.properties.value == "True" ? UM.Theme.getSize("sidebar_extruder_box").height : 0 + visible: machineHeatedBed.properties.value == "True" + + Label //Build plate label. { - sourceComponent: monitorItem - property string label: catalog.i18nc("@label", "Build plate") - property string value: printerConnected ? Math.round(connectedPrinter.bedTemperature) + "°C" : "" + text: catalog.i18nc("@label", "Build plate") + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height + } + Text //Target temperature. + { + id: bedTargetTemperature + text: printerConnected ? connectedPrinter.targetBedTemperature + "°C" : "" + font: UM.Theme.getFont("small") + color: UM.Theme.getColor("text_inactive") + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.bottom: bedCurrentTemperature.bottom + } + Text //Current temperature. + { + id: bedCurrentTemperature + text: printerConnected ? connectedPrinter.bedTemperature + "°C" : "" + font: UM.Theme.getFont("large") + color: UM.Theme.getColor("text") + anchors.right: bedTargetTemperature.left + anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.top: parent.top + anchors.topMargin: UM.Theme.getSize("default_margin").height } } From 3fb625109e0ec75ae26e2f1453765cdf5c1d5c1f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 3 Feb 2017 17:04:31 +0100 Subject: [PATCH 092/197] Add text field for target pre-heat temperature I'm sure it's quite buggy on all sides though. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 75 ++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index e0c1d7ceca..56f16ed7c2 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -187,6 +187,81 @@ Column anchors.top: parent.top anchors.topMargin: UM.Theme.getSize("default_margin").height } + Rectangle //Input field for pre-heat temperature. + { + id: preheatTemperatureControl + color: UM.Theme.getColor("setting_validation_ok") + border.width: UM.Theme.getSize("default_lining").width + border.color: hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("default_margin").width + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + width: UM.Theme.getSize("setting_control").width + height: UM.Theme.getSize("setting_control").height + + Rectangle //Highlight of input field. + { + anchors.fill: parent + anchors.margins: UM.Theme.getSize("default_lining").width + color: UM.Theme.getColor("setting_control_highlight") + opacity: preheatTemperatureControl.hovered ? 1.0 : 0 + } + Label //Maximum temperature indication. + { + text: "MAXTEMP" //TODO: Placeholder! + color: UM.Theme.getColor("setting_unit") + font: UM.Theme.getFont("default") + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.verticalCenter: parent.verticalCenter + } + MouseArea //Change cursor on hovering. + { + id: mouseArea + anchors.fill: parent + cursorShape: Qt.IBeamCursor + } + TextInput + { + id: preheatTemperatureInput + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("setting_control_text") + selectByMouse: true + maximumLength: 10 + validator: RegExpValidator { regExp: /^-?[0-9]{0,9}[.,]?[0-9]{0,10}$/ } //Floating point regex. + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + + text: "60" //TODO: Bind this to the default. + /*Binding + { + target: preheatTemperatureInput + property: "text" + value: { + // Stacklevels + // 0: user -> unsaved change + // 1: quality changes -> saved change + // 2: quality + // 3: material -> user changed material in materialspage + // 4: variant + // 5: machine_changes + // 6: machine + if ((base.resolve != "None" && base.resolve) && (stackLevel != 0) && (stackLevel != 1)) { + // We have a resolve function. Indicates that the setting is not settable per extruder and that + // we have to choose between the resolved value (default) and the global value + // (if user has explicitly set this). + return base.resolve; + } else { + return propertyProvider.properties.value; + } + } + when: !preheatTemperatureInput.activeFocus + }*/ + } + } } Loader From c19544a2937ef792abfdeee7c177f0bdac49b410 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 6 Feb 2017 14:26:26 +0100 Subject: [PATCH 093/197] Remove duplicate minimum/maximum of prime tower Y position This seems to have gone wrong in merging a pull request. --- resources/definitions/fdmprinter.def.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/definitions/fdmprinter.def.json b/resources/definitions/fdmprinter.def.json index 6f01030c66..332aacf194 100644 --- a/resources/definitions/fdmprinter.def.json +++ b/resources/definitions/fdmprinter.def.json @@ -3819,8 +3819,6 @@ "default_value": 200, "minimum_value_warning": "-1000", "maximum_value_warning": "1000", - "maximum_value": "machine_depth - resolveOrValue('prime_tower_size')", - "minimum_value": "0", "maximum_value": "machine_depth / 2 - resolveOrValue('prime_tower_size') if machine_center_is_zero else machine_depth - resolveOrValue('prime_tower_size')", "minimum_value": "machine_depth / -2 if machine_center_is_zero else 0", "settable_per_mesh": false, From 27ff55d75b6ee2cfce95e1b9d5adb4dc49f0bdbb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 6 Feb 2017 15:09:18 +0100 Subject: [PATCH 094/197] Add binding to current maximum bed temperature Instead of the MAXTEMP placeholder. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 56f16ed7c2..b61d56feec 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -209,7 +209,7 @@ Column } Label //Maximum temperature indication. { - text: "MAXTEMP" //TODO: Placeholder! + text: bedTemperature.properties.maximum_value color: UM.Theme.getColor("setting_unit") font: UM.Theme.getFont("default") anchors.right: parent.right @@ -264,6 +264,15 @@ Column } } + UM.SettingPropertyProvider + { + id: bedTemperature + containerStackId: Cura.MachineManager.activeMachineId + key: "material_bed_temperature" + watchedProperties: ["value", "minimum_value", "maximum_value", "minimum_value_warning", "maximum_value_warning"] + storeIndex: 0 + } + Loader { sourceComponent: monitorSection From 78fed0531dc39dfb228c99153493e11b5b9a1538 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 6 Feb 2017 15:17:59 +0100 Subject: [PATCH 095/197] Fix hovering the setting box The 'hovered' property was taken from the example of the setting item, but that doesn't exist apparently. I looked up how it is normally done in QML. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index b61d56feec..b28944f008 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -192,7 +192,7 @@ Column id: preheatTemperatureControl color: UM.Theme.getColor("setting_validation_ok") border.width: UM.Theme.getSize("default_lining").width - border.color: hovered ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") + border.color: mouseArea.containsMouse ? UM.Theme.getColor("setting_control_border_highlight") : UM.Theme.getColor("setting_control_border") anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.bottom: parent.bottom @@ -219,6 +219,7 @@ Column MouseArea //Change cursor on hovering. { id: mouseArea + hoverEnabled: true anchors.fill: parent cursorShape: Qt.IBeamCursor } From b1a8b28e87415c4f71d43a7c39dd79d027a252d4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 6 Feb 2017 15:44:40 +0100 Subject: [PATCH 096/197] Bind default pre-heat temperature to current build plate temperature Currently the setting 'resets' when you go out of the print monitor mode. That wasn't the original intention but it works kind of nicely. We'll bring it up in a meeting whether this needs to be changed. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index b28944f008..49f49502a6 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -236,12 +236,12 @@ Column anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter - text: "60" //TODO: Bind this to the default. - /*Binding + Binding { target: preheatTemperatureInput property: "text" - value: { + value: + { // Stacklevels // 0: user -> unsaved change // 1: quality changes -> saved change @@ -250,17 +250,20 @@ Column // 4: variant // 5: machine_changes // 6: machine - if ((base.resolve != "None" && base.resolve) && (stackLevel != 0) && (stackLevel != 1)) { + if ((bedTemperature.resolve != "None" && bedTemperature.resolve) && (bedTemperature.stackLevels[0] != 0) && (bedTemperature.stackLevels[0] != 1)) + { // We have a resolve function. Indicates that the setting is not settable per extruder and that // we have to choose between the resolved value (default) and the global value // (if user has explicitly set this). - return base.resolve; - } else { - return propertyProvider.properties.value; + return bedTemperature.resolve; + } + else + { + return bedTemperature.properties.value; } } when: !preheatTemperatureInput.activeFocus - }*/ + } } } } @@ -270,8 +273,10 @@ Column id: bedTemperature containerStackId: Cura.MachineManager.activeMachineId key: "material_bed_temperature" - watchedProperties: ["value", "minimum_value", "maximum_value", "minimum_value_warning", "maximum_value_warning"] + watchedProperties: ["value", "minimum_value", "maximum_value", "minimum_value_warning", "maximum_value_warning", "resolve"] storeIndex: 0 + + property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None" } Loader From b1448887ba05a5e6dae8230f0cc73a96b7b6bf4c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 6 Feb 2017 16:45:52 +0100 Subject: [PATCH 097/197] Add button to pre-heat build plate This is the one. The actual commit that implements the issue. It doesn't do anything yet, this button, but it's how it should look. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 98 ++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 49f49502a6..ee7fb1a692 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -266,6 +266,104 @@ Column } } } + + Button //The pre-heat button. + { + text: catalog.i18nc("@button", "Pre-heat") + tooltip: catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") + height: UM.Theme.getSize("setting_control").height + anchors.right: parent.right + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.bottom: parent.bottom + anchors.bottomMargin: UM.Theme.getSize("default_margin").height + style: ButtonStyle { + background: Rectangle + { + border.width: UM.Theme.getSize("default_lining").width + implicitWidth: actualLabel.contentWidth + (UM.Theme.getSize("default_margin").width * 2) + border.color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_border"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active_border"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_border"); + } + else + { + return UM.Theme.getColor("action_button_border"); + } + } + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered"); + } + else + { + return UM.Theme.getColor("action_button"); + } + } + Behavior on color + { + ColorAnimation + { + duration: 50 + } + } + + Label + { + id: actualLabel + anchors.centerIn: parent + color: + { + if(!control.enabled) + { + return UM.Theme.getColor("action_button_disabled_text"); + } + else if(control.pressed) + { + return UM.Theme.getColor("action_button_active_text"); + } + else if(control.hovered) + { + return UM.Theme.getColor("action_button_hovered_text"); + } + else + { + return UM.Theme.getColor("action_button_text"); + } + } + font: UM.Theme.getFont("action_button") + text: control.text; + } + } + label: Item + { + } + } + + onClicked: + { + print("Click!"); + } + } } UM.SettingPropertyProvider From 62fdaf52f2c8457e7f8e9ef14161329c361ce573 Mon Sep 17 00:00:00 2001 From: probonopd Date: Mon, 6 Feb 2017 19:32:01 +0100 Subject: [PATCH 098/197] Add extra quotes as per https://github.com/Ultimaker/Cura/pull/1350#discussion_r99554294 --- resources/definitions/renkforce_rf100.def.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/definitions/renkforce_rf100.def.json b/resources/definitions/renkforce_rf100.def.json index 7a350c3d5e..e238495ca6 100644 --- a/resources/definitions/renkforce_rf100.def.json +++ b/resources/definitions/renkforce_rf100.def.json @@ -58,7 +58,7 @@ "value": "100" }, "machine_end_gcode": { - "value": ";End GCode\nM104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning" + "value": "';End GCode\nM104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning'" }, "machine_gcode_flavor": { "value": "RepRap (Marlin/Sprinter)" @@ -70,7 +70,7 @@ "value": "Renkforce RF100" }, "machine_start_gcode": { - "value": ";Sliced at: {day} {date} {time}\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{speed_travel} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{speed_travel}\nM117 Printing..." + "value": "';Sliced at: {day} {date} {time}\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{speed_travel} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{speed_travel}\nM117 Printing...'" }, "machine_width": { "value": "100" From b56cf165eccb17297a9d82dca4a934e1305af26d Mon Sep 17 00:00:00 2001 From: PETER Delphin Date: Mon, 6 Feb 2017 23:38:55 +0100 Subject: [PATCH 099/197] French translation correction --- resources/i18n/fr/cura.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/i18n/fr/cura.po b/resources/i18n/fr/cura.po index 18f6b58c42..80bfff6ecc 100644 --- a/resources/i18n/fr/cura.po +++ b/resources/i18n/fr/cura.po @@ -1425,7 +1425,7 @@ msgstr "X min" #: /home/ruben/Projects/Cura/plugins/MachineSettingsAction/MachineSettingsAction.qml:278 msgctxt "@label" msgid "Y min" -msgstr "X min" +msgstr "Y min" #: /home/ruben/Projects/Cura/plugins/MachineSettingsAction/MachineSettingsAction.qml:294 msgctxt "@label" From f24d778cc5269fe8e4fef61c9610e65d03f644b0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 12:51:02 +0100 Subject: [PATCH 100/197] Disable pre-heat button when not connected This covers the case when there is no printer added as well as the case where a printer is added but not connected. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index ee7fb1a692..c1fbdef983 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -272,6 +272,7 @@ Column text: catalog.i18nc("@button", "Pre-heat") tooltip: catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") height: UM.Theme.getSize("setting_control").height + enabled: printerConnected anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.bottom: parent.bottom From cfbcf567399449beff2e9db8b22ab0f2c289c0e5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 13:18:41 +0100 Subject: [PATCH 101/197] Add function to pre-head bed This makes a PUT-request to the printer with the new API function call. Contributes to issue CURA-3161. --- .../UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 32ebd354ee..99d07a8b81 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -240,6 +240,18 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def ipAddress(self): return self._address + ## Pre-heats the heated bed of the printer. + # + # \param temperature The temperature to heat the bed to, in degrees + # Celsius. + # \param duration How long the bed should stay warm, in seconds. + def preheatBed(self, temperature, duration): + url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") + data = """{"temperature": "{temperature}", "timeout": "{timeout}"}""".format(temperature=temperature, timeout=duration) + put_request = QNetworkRequest(url) + put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") + self._manager.put(put_request, data.encode()) + def _stopCamera(self): self._camera_timer.stop() if self._image_reply: From 9d8034d14fcc4dc1665226ccb480ff7dc79a24ce Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 13:22:21 +0100 Subject: [PATCH 102/197] Add default for duration parameter of preheatBed It defaults to 15 minutes. Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 99d07a8b81..5ac06e7154 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -244,8 +244,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # # \param temperature The temperature to heat the bed to, in degrees # Celsius. - # \param duration How long the bed should stay warm, in seconds. - def preheatBed(self, temperature, duration): + # \param duration How long the bed should stay warm, in seconds. Defaults + # to a quarter hour. + def preheatBed(self, temperature, duration=900): url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") data = """{"temperature": "{temperature}", "timeout": "{timeout}"}""".format(temperature=temperature, timeout=duration) put_request = QNetworkRequest(url) From d7bf23ca21616788cb0345bf3da71432ede3bec5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 13:23:56 +0100 Subject: [PATCH 103/197] Add function to cancel pre-heating the bed You could also do this by calling preheatBed with a temperature of 0. In fact, that's what this function does. Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 5ac06e7154..470d0efa0a 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -253,6 +253,12 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") self._manager.put(put_request, data.encode()) + ## Cancels pre-heating the heated bed of the printer. + # + # If the bed is not pre-heated, nothing happens. + def cancelPreheatBed(self): + self.preheatBed(temperature=0) + def _stopCamera(self): self._camera_timer.stop() if self._image_reply: From 0df4afff33a823cfaebcf2b1538791c37abaa5f5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 13:26:10 +0100 Subject: [PATCH 104/197] Convert parameters to string before including them This way you can provide normal floating point values instead of providing strings with numbers in them. Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 470d0efa0a..e43e522c0c 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -248,7 +248,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # to a quarter hour. def preheatBed(self, temperature, duration=900): url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") - data = """{"temperature": "{temperature}", "timeout": "{timeout}"}""".format(temperature=temperature, timeout=duration) + data = """{"temperature": "{temperature}", "timeout": "{timeout}"}""".format(temperature=str(temperature), timeout=str(duration)) put_request = QNetworkRequest(url) put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") self._manager.put(put_request, data.encode()) From 559b40867ef88c37379244fed2947743058f7da2 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 13:29:57 +0100 Subject: [PATCH 105/197] Call pre-heat if pre-heat button is pressed Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 2 ++ resources/qml/PrintMonitor.qml | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index e43e522c0c..59c04dd822 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -246,6 +246,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # Celsius. # \param duration How long the bed should stay warm, in seconds. Defaults # to a quarter hour. + @pyqtSlot(float, float) def preheatBed(self, temperature, duration=900): url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") data = """{"temperature": "{temperature}", "timeout": "{timeout}"}""".format(temperature=str(temperature), timeout=str(duration)) @@ -256,6 +257,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): ## Cancels pre-heating the heated bed of the printer. # # If the bed is not pre-heated, nothing happens. + @pyqtSlot() def cancelPreheatBed(self): self.preheatBed(temperature=0) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index c1fbdef983..4ff6d02c54 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -362,7 +362,7 @@ Column onClicked: { - print("Click!"); + connectedPrinter.preheatBed(preheatTemperatureInput.text, 900) } } } From 412e299f0cd316b7b3b4132878ae5f9059d782e1 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 7 Feb 2017 13:33:37 +0100 Subject: [PATCH 106/197] Cleaned up and bug fixed the command loop. CURA-3335 Single instance Cura and model reloading --- cura/CuraApplication.py | 94 ++++++++++++++++++++++++++++++++--------- cura_app.py | 37 ++-------------- 2 files changed, 77 insertions(+), 54 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7b566c17ac..a797cc2966 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -1,9 +1,7 @@ # Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. -import json - -from PyQt5.QtCore import QTextStream from PyQt5.QtNetwork import QLocalServer +from PyQt5.QtNetwork import QLocalSocket from UM.Qt.QtApplication import QtApplication from UM.Scene.SceneNode import SceneNode @@ -63,7 +61,8 @@ import numpy import copy import urllib.parse import os - +import argparse +import json numpy.seterr(all="ignore") @@ -430,6 +429,7 @@ class CuraApplication(QtApplication): parser.add_argument("file", nargs="*", help="Files to load after starting the application.") parser.add_argument("--single-instance", action="store_true", default=False) + # Set up a local socket server which listener which coordinates single instances Curas and accepts commands. def _setUpSingleInstanceServer(self): if self.getCommandLineOption("single_instance", False): self.__single_instance_server = QLocalServer() @@ -437,25 +437,79 @@ class CuraApplication(QtApplication): self.__single_instance_server.listen("ultimaker-cura") def _singleInstanceServerNewConnection(self): - Logger.log('d', 'Saw something on the single instance server') - other_cura_connection = self.__single_instance_server.nextPendingConnection() - if other_cura_connection is not None: - def readyRead(): - while other_cura_connection.canReadLine(): - line = other_cura_connection.readLine() - payload = json.loads(str(line, encoding="ASCII").strip()) - command = payload["command"] - if command == "clear-all": - self.deleteAll() + Logger.log("i", "New connection recevied on our single-instance server") + remote_cura_connection = self.__single_instance_server.nextPendingConnection() - elif command == "open": - self.deleteAll() - self._openFile(payload["filePath"]) + if remote_cura_connection is not None: + def readCommands(): + line = remote_cura_connection.readLine() + while len(line) != 0: # There is also a .canReadLine() + try: + Logger.log('d', "JSON command: " + str(line, encoding="ASCII")) + payload = json.loads(str(line, encoding="ASCII").strip()) + command = payload["command"] - elif command == "focus": - self.focusWindow() + # Command: Remove all models from the build plate. + if command == "clear-all": + self.deleteAll() - other_cura_connection.readyRead.connect(readyRead) + # Command: Load a model file + elif command == "open": + self._openFile(payload["filePath"]) + # FIXME ^ this method is async and we really should wait until + # the file load is complete before processing more commands. + + # Command: Activate the window and bring it to the top. + elif command == "focus": + self.getMainWindow().raise_() + self.focusWindow() + + else: + Logger.log("w", "Received an unrecognized command " + str(command)) + except json.decoder.JSONDecodeError as ex: + Logger.log("w", "Unable to parse JSON command in _singleInstanceServerNewConnection(): " + repr(ex)) + line = remote_cura_connection.readLine() + + remote_cura_connection.readyRead.connect(readCommands) + remote_cura_connection.disconnected.connect(readCommands) # Get any last commands before it is destroyed. + + ## Perform any checks before creating the main application. + # + # This should be called directly before creating an instance of CuraApplication. + # \returns \type{bool} True if the whole Cura app should continue running. + @classmethod + def preStartUp(cls): + # Peek the arguments and look for the 'single-instance' flag. + parser = argparse.ArgumentParser(prog="cura") # pylint: disable=bad-whitespace + CuraApplication.addCommandLineOptions(parser) + parsed_command_line = vars(parser.parse_args()) + + if "single_instance" in parsed_command_line and parsed_command_line["single_instance"]: + Logger.log("i", "Checking for the presence of an ready running Cura instance.") + single_instance_socket = QLocalSocket() + single_instance_socket.connectToServer("ultimaker-cura") + single_instance_socket.waitForConnected() + if single_instance_socket.state() == QLocalSocket.ConnectedState: + Logger.log("i", "Connection has been made to the single-instance Cura socket.") + + # Protocol is one line of JSON terminated with a carriage return. + # "command" field is required and holds the name of the command to execute. + # Other fields depend on the command. + + payload = {"command": "clear-all"} + single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) + + payload = {"command": "focus"} + single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) + + if len(parsed_command_line["file"]) != 0: + for filename in parsed_command_line["file"]: + payload = {"command": "open", "filePath": filename} + single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) + single_instance_socket.flush() + single_instance_socket.close() + return False + return True def run(self): self.showSplashMessage(self._i18n_catalog.i18nc("@info:progress", "Setting up scene...")) diff --git a/cura_app.py b/cura_app.py index c2ee6a72b1..653f56d34d 100755 --- a/cura_app.py +++ b/cura_app.py @@ -2,14 +2,10 @@ # Copyright (c) 2015 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. -import argparse -import json import os import sys import platform -import time -from PyQt5.QtNetwork import QLocalSocket from UM.Platform import Platform #WORKAROUND: GITHUB-88 GITHUB-385 GITHUB-612 @@ -61,36 +57,9 @@ if Platform.isWindows() and hasattr(sys, "frozen"): # Force an instance of CuraContainerRegistry to be created and reused later. cura.Settings.CuraContainerRegistry.getInstance() -# Peek the arguments and look for the 'single-instance' flag. -parser = argparse.ArgumentParser(prog="cura") # pylint: disable=bad-whitespace -cura.CuraApplication.CuraApplication.addCommandLineOptions(parser) -parsed_command_line = vars(parser.parse_args()) - -if "single_instance" in parsed_command_line and parsed_command_line["single_instance"]: - print("Check for single instance") - single_instance_socket = QLocalSocket() - single_instance_socket.connectToServer("ultimaker-cura") - single_instance_socket.waitForConnected() - if single_instance_socket.state() == QLocalSocket.ConnectedState: - print("Connected to the other Cura instance.") - print(repr(parsed_command_line)) - - payload = {"command": "clear-all"} - single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) - - payload = {"command": "focus"} - single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) - - if len(parsed_command_line["file"]) != 0: - for filename in parsed_command_line["file"]: - payload = { "command": "open", "filePath": filename } - single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) - - single_instance_socket.flush() - - - single_instance_socket.close() - sys.exit(0) +# This prestart up check is needed to determine if we should start the application at all. +if not cura.CuraApplication.CuraApplication.preStartUp(): + sys.exit(0) app = cura.CuraApplication.CuraApplication.getInstance() app.run() From 3618ae0d4f9e9435ac7ba093927f9ac7de83b862 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 13:35:09 +0100 Subject: [PATCH 107/197] Properly float-format input of preheatBed It rounds to 3 digits. The specification of the feature in the API doesn't mention how detailed the temperature and duration can go, but thousands seems more than enough. This also eliminates pesky problems with the JSON brackets in the format function. Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 59c04dd822..87986afbf3 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -249,7 +249,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): @pyqtSlot(float, float) def preheatBed(self, temperature, duration=900): url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") - data = """{"temperature": "{temperature}", "timeout": "{timeout}"}""".format(temperature=str(temperature), timeout=str(duration)) + data = """{"temperature": "%0.3f", "timeout": "%0.3f"}""" % (temperature, duration) put_request = QNetworkRequest(url) put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") self._manager.put(put_request, data.encode()) From b27a9e65352db035de78edddb01797ef6b5600ba Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 13:52:44 +0100 Subject: [PATCH 108/197] Implement tracking target bed temperature I had already assumed it was tracking this but apparently it wasn't. This works though. Contributes to issue CURA-3161. --- .../UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 87986afbf3..c4177953fe 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -97,6 +97,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self._material_ids = [""] * self._num_extruders self._hotend_ids = [""] * self._num_extruders + self._target_bed_temperature = 0 self.setPriority(2) # Make sure the output device gets selected above local file output self.setName(key) @@ -261,6 +262,15 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def cancelPreheatBed(self): self.preheatBed(temperature=0) + ## Changes the target bed temperature and makes sure that its signal is + # emitted. + # + # /param temperature The new target temperature of the bed. + def _setTargetBedTemperature(self, temperature): + if self._target_bed_temperature != temperature: + self._target_bed_temperature = temperature + self.targetBedTemperatureChanged.emit() + def _stopCamera(self): self._camera_timer.stop() if self._image_reply: @@ -492,6 +502,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): bed_temperature = self._json_printer_state["bed"]["temperature"]["current"] self._setBedTemperature(bed_temperature) + target_bed_temperature = self._json_printer_state["bed"]["temperature"]["target"] + self._setTargetBedTemperature(target_bed_temperature) head_x = self._json_printer_state["heads"][0]["position"]["x"] head_y = self._json_printer_state["heads"][0]["position"]["y"] From d751285713b57177f79e007133e4d4c4cb1f03d4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 14:39:56 +0100 Subject: [PATCH 109/197] Provide pre-heat command with integer parameters The firmware only accepts integers, apparently. Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index c4177953fe..3d2d4bbc07 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -247,10 +247,10 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # Celsius. # \param duration How long the bed should stay warm, in seconds. Defaults # to a quarter hour. - @pyqtSlot(float, float) + @pyqtSlot(int, int) def preheatBed(self, temperature, duration=900): url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") - data = """{"temperature": "%0.3f", "timeout": "%0.3f"}""" % (temperature, duration) + data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration) put_request = QNetworkRequest(url) put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") self._manager.put(put_request, data.encode()) From 8a4b6adfb3d5bba5ab0a53eb6ca1308ecab394f4 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 7 Feb 2017 15:47:45 +0100 Subject: [PATCH 110/197] Flash the window icon instead of trying (and failing) to make it visible directly. CURA-3335 Single instance Cura and model reloading --- cura/CuraApplication.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a797cc2966..783fb9821e 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -461,8 +461,9 @@ class CuraApplication(QtApplication): # Command: Activate the window and bring it to the top. elif command == "focus": - self.getMainWindow().raise_() - self.focusWindow() + # Operating systems these days prevent windows from moving around by themselves. + # 'alert' or flashing the icon in the taskbar is the best thing we do now. + self.getMainWindow().alert(0) else: Logger.log("w", "Received an unrecognized command " + str(command)) From d3d36d47ebbb2e3d31f2a11ffc08df4ea6e7ac75 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 16:22:47 +0100 Subject: [PATCH 111/197] Add countdown timer for pre-heat time Not happy with how there is '900' in multiple places in the code. I might do something about that later. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 47 +++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 4ff6d02c54..9bc30f324e 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -267,8 +267,47 @@ Column } } + Timer + { + id: preheatCountdownTimer + interval: 100 //Update every 100ms. You want to update every 1s, but then you have one timer for the updating running out of sync with the actual date timer and you might skip seconds. + running: false + repeat: true + onTriggered: update() + property var endTime: new Date() + function update() + { + var now = new Date(); + if (now.getTime() < endTime.getTime()) + { + var remaining = endTime - now; //This is in milliseconds. + var minutes = Math.floor(remaining / 60 / 1000); + var seconds = Math.floor((remaining / 1000) % 60); + preheatCountdown.text = minutes + ":" + (seconds < 10 ? "0" + seconds : seconds); + preheatCountdown.visible = true; + } + else + { + preheatCountdown.visible = false; + running = false; + } + } + } + Text + { + id: preheatCountdown + text: "0:00" + visible: false //It only becomes visible when the timer is running. + font: UM.Theme.getFont("default") + color: UM.Theme.getColor("text") + anchors.right: preheatButton.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.verticalCenter: preheatButton.verticalCenter + } + Button //The pre-heat button. { + id: preheatButton text: catalog.i18nc("@button", "Pre-heat") tooltip: catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") height: UM.Theme.getSize("setting_control").height @@ -362,7 +401,13 @@ Column onClicked: { - connectedPrinter.preheatBed(preheatTemperatureInput.text, 900) + connectedPrinter.preheatBed(preheatTemperatureInput.text, 900); + var now = new Date(); + var end_time = new Date(); + end_time.setTime(now.getTime() + 900 * 1000); //*1000 because time is in milliseconds here. + preheatCountdownTimer.endTime = end_time; + preheatCountdownTimer.start(); + preheatCountdownTimer.update(); //Update once before the first timer is triggered. } } } From d705fb1d763e3f1065c7774cb4ed74d35927d3d4 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 16:24:28 +0100 Subject: [PATCH 112/197] Document why we set endTime to the current date initially Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 9bc30f324e..0a34eb8f31 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -274,7 +274,7 @@ Column running: false repeat: true onTriggered: update() - property var endTime: new Date() + property var endTime: new Date() //Set initial endTime to be the current date, so that the endTime has initially already passed and the timer text becomes invisible if you were to update. function update() { var now = new Date(); From 927055806cfac441e3398b8c013f0570489d9a7d Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 7 Feb 2017 16:26:44 +0100 Subject: [PATCH 113/197] Postpone containersChanged signals when doign setActive* calls This makes sure we do not trigger everything three times when switching variants. --- cura/Settings/MachineManager.py | 203 ++++++++++++++++---------------- 1 file changed, 104 insertions(+), 99 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index b5aaf7e4ff..94c37a885e 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -10,6 +10,7 @@ from UM.Application import Application from UM.Preferences import Preferences from UM.Logger import Logger from UM.Message import Message +from UM.Signal import postponeSignals import UM.Settings @@ -694,134 +695,138 @@ class MachineManager(QObject): # Depending on from/to material+current variant, a quality profile is chosen and set. @pyqtSlot(str) def setActiveMaterial(self, material_id): - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = material_id) - if not containers or not self._active_container_stack: - return - material_container = containers[0] + with postponeSignals(self._global_container_stack.containersChanged, self._active_container_stack.containersChanged, compress = True): + containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = material_id) + if not containers or not self._active_container_stack: + return + material_container = containers[0] - Logger.log("d", "Attempting to change the active material to %s", material_id) + Logger.log("d", "Attempting to change the active material to %s", material_id) - old_material = self._active_container_stack.findContainer({"type": "material"}) - old_quality = self._active_container_stack.findContainer({"type": "quality"}) - old_quality_changes = self._active_container_stack.findContainer({"type": "quality_changes"}) - if not old_material: - Logger.log("w", "While trying to set the active material, no material was found to replace it.") - return + old_material = self._active_container_stack.findContainer({"type": "material"}) + old_quality = self._active_container_stack.findContainer({"type": "quality"}) + old_quality_changes = self._active_container_stack.findContainer({"type": "quality_changes"}) + if not old_material: + Logger.log("w", "While trying to set the active material, no material was found to replace it.") + return - if old_quality_changes.getId() == "empty_quality_changes": - old_quality_changes = None + if old_quality_changes.getId() == "empty_quality_changes": + old_quality_changes = None - self.blurSettings.emit() - old_material.nameChanged.disconnect(self._onMaterialNameChanged) + self.blurSettings.emit() + old_material.nameChanged.disconnect(self._onMaterialNameChanged) - material_index = self._active_container_stack.getContainerIndex(old_material) - self._active_container_stack.replaceContainer(material_index, material_container) - Logger.log("d", "Active material changed") + material_index = self._active_container_stack.getContainerIndex(old_material) + self._active_container_stack.replaceContainer(material_index, material_container) + Logger.log("d", "Active material changed") - material_container.nameChanged.connect(self._onMaterialNameChanged) + material_container.nameChanged.connect(self._onMaterialNameChanged) - if material_container.getMetaDataEntry("compatible") == False: - self._material_incompatible_message.show() - else: - self._material_incompatible_message.hide() + if material_container.getMetaDataEntry("compatible") == False: + self._material_incompatible_message.show() + else: + self._material_incompatible_message.hide() - new_quality_id = old_quality.getId() - quality_type = old_quality.getMetaDataEntry("quality_type") - if old_quality_changes: - quality_type = old_quality_changes.getMetaDataEntry("quality_type") - new_quality_id = old_quality_changes.getId() + new_quality_id = old_quality.getId() + quality_type = old_quality.getMetaDataEntry("quality_type") + if old_quality_changes: + quality_type = old_quality_changes.getMetaDataEntry("quality_type") + new_quality_id = old_quality_changes.getId() - # See if the requested quality type is available in the new situation. - machine_definition = self._active_container_stack.getBottom() - quality_manager = QualityManager.getInstance() - candidate_quality = quality_manager.findQualityByQualityType(quality_type, - quality_manager.getWholeMachineDefinition(machine_definition), - [material_container]) - if not candidate_quality or candidate_quality.getId() == "empty_quality": - # Fall back to a quality - new_quality = quality_manager.findQualityByQualityType(None, - quality_manager.getWholeMachineDefinition(machine_definition), - [material_container]) - if new_quality: - new_quality_id = new_quality.getId() - else: - if not old_quality_changes: - new_quality_id = candidate_quality.getId() + # See if the requested quality type is available in the new situation. + machine_definition = self._active_container_stack.getBottom() + quality_manager = QualityManager.getInstance() + candidate_quality = quality_manager.findQualityByQualityType(quality_type, + quality_manager.getWholeMachineDefinition(machine_definition), + [material_container]) + if not candidate_quality or candidate_quality.getId() == "empty_quality": + # Fall back to a quality + new_quality = quality_manager.findQualityByQualityType(None, + quality_manager.getWholeMachineDefinition(machine_definition), + [material_container]) + if new_quality: + new_quality_id = new_quality.getId() + else: + if not old_quality_changes: + new_quality_id = candidate_quality.getId() - self.setActiveQuality(new_quality_id) + self.setActiveQuality(new_quality_id) @pyqtSlot(str) + @profile def setActiveVariant(self, variant_id): - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = variant_id) - if not containers or not self._active_container_stack: - return - Logger.log("d", "Attempting to change the active variant to %s", variant_id) - old_variant = self._active_container_stack.findContainer({"type": "variant"}) - old_material = self._active_container_stack.findContainer({"type": "material"}) - if old_variant: - self.blurSettings.emit() - variant_index = self._active_container_stack.getContainerIndex(old_variant) - self._active_container_stack.replaceContainer(variant_index, containers[0]) - Logger.log("d", "Active variant changed") - preferred_material = None - if old_material: - preferred_material_name = old_material.getName() + with postponeSignals(self._global_container_stack.containersChanged, self._active_container_stack.containersChanged, compress = True): + containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = variant_id) + if not containers or not self._active_container_stack: + return + Logger.log("d", "Attempting to change the active variant to %s", variant_id) + old_variant = self._active_container_stack.findContainer({"type": "variant"}) + old_material = self._active_container_stack.findContainer({"type": "material"}) + if old_variant: + self.blurSettings.emit() + variant_index = self._active_container_stack.getContainerIndex(old_variant) + self._active_container_stack.replaceContainer(variant_index, containers[0]) + Logger.log("d", "Active variant changed") + preferred_material = None + if old_material: + preferred_material_name = old_material.getName() - self.setActiveMaterial(self._updateMaterialContainer(self._global_container_stack.getBottom(), containers[0], preferred_material_name).id) - else: - Logger.log("w", "While trying to set the active variant, no variant was found to replace.") + self.setActiveMaterial(self._updateMaterialContainer(self._global_container_stack.getBottom(), containers[0], preferred_material_name).id) + else: + Logger.log("w", "While trying to set the active variant, no variant was found to replace.") ## set the active quality # \param quality_id The quality_id of either a quality or a quality_changes @pyqtSlot(str) def setActiveQuality(self, quality_id): - self.blurSettings.emit() + with postponeSignals(self._global_container_stack.containersChanged, self._active_container_stack.containersChanged, compress = True): + self.blurSettings.emit() - containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = quality_id) - if not containers or not self._global_container_stack: - return + containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = quality_id) + if not containers or not self._global_container_stack: + return - Logger.log("d", "Attempting to change the active quality to %s", quality_id) + Logger.log("d", "Attempting to change the active quality to %s", quality_id) - # Quality profile come in two flavours: type=quality and type=quality_changes - # If we found a quality_changes profile then look up its parent quality profile. - container_type = containers[0].getMetaDataEntry("type") - quality_name = containers[0].getName() - quality_type = containers[0].getMetaDataEntry("quality_type") + # Quality profile come in two flavours: type=quality and type=quality_changes + # If we found a quality_changes profile then look up its parent quality profile. + container_type = containers[0].getMetaDataEntry("type") + quality_name = containers[0].getName() + quality_type = containers[0].getMetaDataEntry("quality_type") - # Get quality container and optionally the quality_changes container. - if container_type == "quality": - new_quality_settings_list = self.determineQualityAndQualityChangesForQualityType(quality_type) - elif container_type == "quality_changes": - new_quality_settings_list = self._determineQualityAndQualityChangesForQualityChanges(quality_name) - else: - Logger.log("e", "Tried to set quality to a container that is not of the right type") - return + # Get quality container and optionally the quality_changes container. + if container_type == "quality": + new_quality_settings_list = self.determineQualityAndQualityChangesForQualityType(quality_type) + elif container_type == "quality_changes": + new_quality_settings_list = self._determineQualityAndQualityChangesForQualityChanges(quality_name) + else: + Logger.log("e", "Tried to set quality to a container that is not of the right type") + return - name_changed_connect_stacks = [] # Connect these stacks to the name changed callback - for setting_info in new_quality_settings_list: - stack = setting_info["stack"] - stack_quality = setting_info["quality"] - stack_quality_changes = setting_info["quality_changes"] + name_changed_connect_stacks = [] # Connect these stacks to the name changed callback + for setting_info in new_quality_settings_list: + stack = setting_info["stack"] + stack_quality = setting_info["quality"] + stack_quality_changes = setting_info["quality_changes"] - name_changed_connect_stacks.append(stack_quality) - name_changed_connect_stacks.append(stack_quality_changes) - self._replaceQualityOrQualityChangesInStack(stack, stack_quality, postpone_emit = True) - self._replaceQualityOrQualityChangesInStack(stack, stack_quality_changes, postpone_emit = True) + name_changed_connect_stacks.append(stack_quality) + name_changed_connect_stacks.append(stack_quality_changes) + self._replaceQualityOrQualityChangesInStack(stack, stack_quality, postpone_emit = True) + self._replaceQualityOrQualityChangesInStack(stack, stack_quality_changes, postpone_emit = True) - # Send emits that are postponed in replaceContainer. - # Here the stacks are finished replacing and every value can be resolved based on the current state. - for setting_info in new_quality_settings_list: - setting_info["stack"].sendPostponedEmits() + # Send emits that are postponed in replaceContainer. + # Here the stacks are finished replacing and every value can be resolved based on the current state. + for setting_info in new_quality_settings_list: + setting_info["stack"].sendPostponedEmits() - # Connect to onQualityNameChanged - for stack in name_changed_connect_stacks: - stack.nameChanged.connect(self._onQualityNameChanged) + # Connect to onQualityNameChanged + for stack in name_changed_connect_stacks: + stack.nameChanged.connect(self._onQualityNameChanged) - if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1: - self._askUserToKeepOrClearCurrentSettings() + if self.hasUserSettings and Preferences.getInstance().getValue("cura/active_mode") == 1: + self._askUserToKeepOrClearCurrentSettings() - self.activeQualityChanged.emit() + self.activeQualityChanged.emit() ## Determine the quality and quality changes settings for the current machine for a quality name. # From 0292756ad7c45c0b96b1f7aa74f55dbba949abe3 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 7 Feb 2017 16:28:08 +0100 Subject: [PATCH 114/197] Do not limit containersChanged methods to a single container type This may trigger a few extra updates, but allows us to use signal compression in the postponesignals context manager, which greatly improves performance. --- cura/Settings/ExtrudersModel.py | 3 +-- cura/Settings/MachineManager.py | 11 ++++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/cura/Settings/ExtrudersModel.py b/cura/Settings/ExtrudersModel.py index af3cb62406..6681cc23f0 100644 --- a/cura/Settings/ExtrudersModel.py +++ b/cura/Settings/ExtrudersModel.py @@ -105,8 +105,7 @@ class ExtrudersModel(UM.Qt.ListModel.ListModel): def _onExtruderStackContainersChanged(self, container): # The ExtrudersModel needs to be updated when the material-name or -color changes, because the user identifies extruders by material-name - if container.getMetaDataEntry("type") == "material": - self._updateExtruders() + self._updateExtruders() modelChanged = pyqtSignal() diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 94c37a885e..8634a9dba3 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -286,13 +286,10 @@ class MachineManager(QObject): def _onInstanceContainersChanged(self, container): container_type = container.getMetaDataEntry("type") - - if container_type == "material": - self.activeMaterialChanged.emit() - elif container_type == "variant": - self.activeVariantChanged.emit() - elif container_type == "quality": - self.activeQualityChanged.emit() + + self.activeVariantChanged.emit() + self.activeMaterialChanged.emit() + self.activeQualityChanged.emit() self._updateStacksHaveErrors() From 1a902b21bb8704dca2fea80a2199a8fe2c699a86 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 16:29:41 +0100 Subject: [PATCH 115/197] Store default pre-heat time in central location Its default is 900s or 15 minutes. QML now requests the time-out time and sends it on to the printer. Contributes to issue CURA-3161. --- cura/PrinterOutputDevice.py | 6 ++++++ plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 4 ++-- resources/qml/PrintMonitor.qml | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index ed67bbb1ca..56ae34b6f4 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -45,6 +45,7 @@ class PrinterOutputDevice(QObject, OutputDevice): self._job_name = "" self._error_text = "" self._accepts_commands = True + self._preheat_bed_timeout = 900 #Default time-out for pre-heating the bed, in seconds. self._printer_state = "" self._printer_type = "unknown" @@ -199,6 +200,11 @@ class PrinterOutputDevice(QObject, OutputDevice): self._target_bed_temperature = temperature self.targetBedTemperatureChanged.emit() + ## + @pyqtProperty(int) + def preheatBedTimeout(self): + return self._preheat_bed_timeout + ## Time the print has been printing. # Note that timeTotal - timeElapsed should give time remaining. @pyqtProperty(float, notify = timeElapsedChanged) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 3d2d4bbc07..bf708f23d7 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -248,7 +248,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # \param duration How long the bed should stay warm, in seconds. Defaults # to a quarter hour. @pyqtSlot(int, int) - def preheatBed(self, temperature, duration=900): + def preheatBed(self, temperature, duration): url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration) put_request = QNetworkRequest(url) @@ -260,7 +260,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # If the bed is not pre-heated, nothing happens. @pyqtSlot() def cancelPreheatBed(self): - self.preheatBed(temperature=0) + self.preheatBed(temperature = 0, duration = 0) ## Changes the target bed temperature and makes sure that its signal is # emitted. diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 0a34eb8f31..65a56b3441 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -404,7 +404,7 @@ Column connectedPrinter.preheatBed(preheatTemperatureInput.text, 900); var now = new Date(); var end_time = new Date(); - end_time.setTime(now.getTime() + 900 * 1000); //*1000 because time is in milliseconds here. + end_time.setTime(now.getTime() + connectedPrinter.preheatBedTimeout * 1000); //*1000 because time is in milliseconds here. preheatCountdownTimer.endTime = end_time; preheatCountdownTimer.start(); preheatCountdownTimer.update(); //Update once before the first timer is triggered. From 8e25a1c73fbc7430b0f2e2a3c7b682eb2c882668 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 16:32:36 +0100 Subject: [PATCH 116/197] Also use central pre-heat time when sending time to printer Oops. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 65a56b3441..277ae9b325 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -401,7 +401,7 @@ Column onClicked: { - connectedPrinter.preheatBed(preheatTemperatureInput.text, 900); + connectedPrinter.preheatBed(preheatTemperatureInput.text, connectedPrinter.preheatBedTimeout); var now = new Date(); var end_time = new Date(); end_time.setTime(now.getTime() + connectedPrinter.preheatBedTimeout * 1000); //*1000 because time is in milliseconds here. From 9b235aebf2cf829ec89413f57a1bab1a1804a0f1 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 16:38:28 +0100 Subject: [PATCH 117/197] Add clock icon to pre-heat countdown It's aligned left of the pre-heat countdown and only visible if the countdown is visible. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 277ae9b325..30f021675b 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -267,6 +267,21 @@ Column } } + UM.RecolorImage + { + id: preheatCountdownIcon + width: UM.Theme.getSize("save_button_specs_icons").width + height: UM.Theme.getSize("save_button_specs_icons").height + sourceSize.width: width + sourceSize.height: height + color: UM.Theme.getColor("text") + visible: preheatCountdown.visible + source: UM.Theme.getIcon("print_time") + anchors.right: preheatCountdown.left + anchors.rightMargin: UM.Theme.getSize("default_margin").width / 2 + anchors.verticalCenter: preheatCountdown.verticalCenter + } + Timer { id: preheatCountdownTimer From 8d09c538967e5cf841064e38cd4a80526a443da8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 16:46:22 +0100 Subject: [PATCH 118/197] Make pre-heat button cancel if currently heating This is based on the timer, which is locally. Eventually we'd want to make the timer update every now and then or so. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 30f021675b..848aa5f9a5 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -323,7 +323,7 @@ Column Button //The pre-heat button. { id: preheatButton - text: catalog.i18nc("@button", "Pre-heat") + text: preheatCountdownTimer.running ? catalog.i18nc("@button Cancel pre-heating", "Cancel") : catalog.i18nc("@button", "Pre-heat") tooltip: catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") height: UM.Theme.getSize("setting_control").height enabled: printerConnected @@ -416,13 +416,22 @@ Column onClicked: { - connectedPrinter.preheatBed(preheatTemperatureInput.text, connectedPrinter.preheatBedTimeout); - var now = new Date(); - var end_time = new Date(); - end_time.setTime(now.getTime() + connectedPrinter.preheatBedTimeout * 1000); //*1000 because time is in milliseconds here. - preheatCountdownTimer.endTime = end_time; - preheatCountdownTimer.start(); - preheatCountdownTimer.update(); //Update once before the first timer is triggered. + if (!preheatCountdownTimer.running) + { + connectedPrinter.preheatBed(preheatTemperatureInput.text, connectedPrinter.preheatBedTimeout); + var now = new Date(); + var end_time = new Date(); + end_time.setTime(now.getTime() + connectedPrinter.preheatBedTimeout * 1000); //*1000 because time is in milliseconds here. + preheatCountdownTimer.endTime = end_time; + preheatCountdownTimer.start(); + preheatCountdownTimer.update(); //Update once before the first timer is triggered. + } + else + { + connectedPrinter.cancelPreheatBed(); + preheatCountdownTimer.endTime = new Date(); + preheatCountdownTimer.update(); + } } } } From 785f10966efaf2e3e584384d41f185e96bf0f794 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 16:48:27 +0100 Subject: [PATCH 119/197] Don't send a time-out for preheat if timeout is 0 The printer doesn't accept 0. Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index bf708f23d7..074bc92cda 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -250,7 +250,10 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): @pyqtSlot(int, int) def preheatBed(self, temperature, duration): url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") - data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration) + if duration > 0: + data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration) + else: + data = """{"temperature": "%i"}""" % temperature put_request = QNetworkRequest(url) put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") self._manager.put(put_request, data.encode()) From 4ccadc6208796ea98aa5611621deaa6877e58c98 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 16:57:20 +0100 Subject: [PATCH 120/197] Round pre-heat temperature and duration to integer but allow floats We want to allow floats in the interface since the interface needs to be agnostic of what device it is connected to. But the UM3 API only allows integers, so we still need to round it to the nearest integer. Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 074bc92cda..3694ada361 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -247,8 +247,10 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # Celsius. # \param duration How long the bed should stay warm, in seconds. Defaults # to a quarter hour. - @pyqtSlot(int, int) + @pyqtSlot(float, float) def preheatBed(self, temperature, duration): + temperature = round(temperature) #The API doesn't allow floating point. + duration = round(duration) url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") if duration > 0: data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration) From a63b4646e9ea6a3eec0a4bebc8b6de26d3fda76f Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 7 Feb 2017 17:01:52 +0100 Subject: [PATCH 121/197] Postpone containersChanged signals of all active stacks This avoids things taking longer because the not-active extruder stack was still emitting containersChanged. --- cura/Settings/MachineManager.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/cura/Settings/MachineManager.py b/cura/Settings/MachineManager.py index 8634a9dba3..2a11ddb56d 100644 --- a/cura/Settings/MachineManager.py +++ b/cura/Settings/MachineManager.py @@ -692,7 +692,7 @@ class MachineManager(QObject): # Depending on from/to material+current variant, a quality profile is chosen and set. @pyqtSlot(str) def setActiveMaterial(self, material_id): - with postponeSignals(self._global_container_stack.containersChanged, self._active_container_stack.containersChanged, compress = True): + with postponeSignals(*self._getContainerChangedSignals(), compress = True): containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = material_id) if not containers or not self._active_container_stack: return @@ -750,9 +750,8 @@ class MachineManager(QObject): self.setActiveQuality(new_quality_id) @pyqtSlot(str) - @profile def setActiveVariant(self, variant_id): - with postponeSignals(self._global_container_stack.containersChanged, self._active_container_stack.containersChanged, compress = True): + with postponeSignals(*self._getContainerChangedSignals(), compress = True): containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = variant_id) if not containers or not self._active_container_stack: return @@ -776,7 +775,7 @@ class MachineManager(QObject): # \param quality_id The quality_id of either a quality or a quality_changes @pyqtSlot(str) def setActiveQuality(self, quality_id): - with postponeSignals(self._global_container_stack.containersChanged, self._active_container_stack.containersChanged, compress = True): + with postponeSignals(*self._getContainerChangedSignals(), compress = True): self.blurSettings.emit() containers = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id = quality_id) @@ -808,8 +807,8 @@ class MachineManager(QObject): name_changed_connect_stacks.append(stack_quality) name_changed_connect_stacks.append(stack_quality_changes) - self._replaceQualityOrQualityChangesInStack(stack, stack_quality, postpone_emit = True) - self._replaceQualityOrQualityChangesInStack(stack, stack_quality_changes, postpone_emit = True) + self._replaceQualityOrQualityChangesInStack(stack, stack_quality) + self._replaceQualityOrQualityChangesInStack(stack, stack_quality_changes) # Send emits that are postponed in replaceContainer. # Here the stacks are finished replacing and every value can be resolved based on the current state. @@ -1298,3 +1297,8 @@ class MachineManager(QObject): def _onQualityNameChanged(self): self.activeQualityChanged.emit() + + def _getContainerChangedSignals(self): + stacks = ExtruderManager.getInstance().getActiveExtruderStacks() + stacks.append(self._global_container_stack) + return [ s.containersChanged for s in stacks ] From 57ec987cd9a350db4b08998695d26a9fcf3667ca Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 17:13:36 +0100 Subject: [PATCH 122/197] Disable pre-heat if temperature is invalid Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 848aa5f9a5..598b9489d9 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -326,7 +326,7 @@ Column text: preheatCountdownTimer.running ? catalog.i18nc("@button Cancel pre-heating", "Cancel") : catalog.i18nc("@button", "Pre-heat") tooltip: catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") height: UM.Theme.getSize("setting_control").height - enabled: printerConnected + enabled: printerConnected && (preheatCountdownTimer.running || (parseInt(preheatTemperatureInput.text) >= parseInt(bedTemperature.properties.minimum_value) && parseInt(preheatTemperatureInput.text) <= parseInt(bedTemperature.properties.maximum_value))) anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.bottom: parent.bottom From d30430381f5e37094aea9a4743861132e4675092 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 17:16:19 +0100 Subject: [PATCH 123/197] Add default implementations for preheatBed and cancelPreheatBed It is a no-op implementation that gives a warning. I'd rather give an exception and have that handled by whatever calls it, but this is how the other methods here do it. Contributes to issue CURA-3161. --- cura/PrinterOutputDevice.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 56ae34b6f4..f7b5ccbe05 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -260,6 +260,23 @@ class PrinterOutputDevice(QObject, OutputDevice): def _setTargetBedTemperature(self, temperature): Logger.log("w", "_setTargetBedTemperature is not implemented by this output device") + ## Pre-heats the heated bed of the printer. + # + # \param temperature The temperature to heat the bed to, in degrees + # Celsius. + # \param duration How long the bed should stay warm, in seconds. Defaults + # to a quarter hour. + @pyqtSlot(float, float) + def preheatBed(self, temperature, duration): + Logger.log("w", "preheatBed is not implemented by this output device.") + + ## Cancels pre-heating the heated bed of the printer. + # + # If the bed is not pre-heated, nothing happens. + @pyqtSlot() + def cancelPreheatBed(self): + Logger.log("w", "cancelPreheatBed is not implemented by this output device.") + ## Protected setter for the current bed temperature. # This simply sets the bed temperature, but ensures that a signal is emitted. # /param temperature temperature of the bed. From 9354a80504a03bf4e265468539be9416994fe03e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 17:17:45 +0100 Subject: [PATCH 124/197] Document no longer that pre-heating defaults to 15m Because that was removed. Contributes to issue CURA-3161. --- cura/PrinterOutputDevice.py | 3 +-- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index f7b5ccbe05..3cba132f9a 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -264,8 +264,7 @@ class PrinterOutputDevice(QObject, OutputDevice): # # \param temperature The temperature to heat the bed to, in degrees # Celsius. - # \param duration How long the bed should stay warm, in seconds. Defaults - # to a quarter hour. + # \param duration How long the bed should stay warm, in seconds. @pyqtSlot(float, float) def preheatBed(self, temperature, duration): Logger.log("w", "preheatBed is not implemented by this output device.") diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 3694ada361..6ce3a4fcc5 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -245,8 +245,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): # # \param temperature The temperature to heat the bed to, in degrees # Celsius. - # \param duration How long the bed should stay warm, in seconds. Defaults - # to a quarter hour. + # \param duration How long the bed should stay warm, in seconds. @pyqtSlot(float, float) def preheatBed(self, temperature, duration): temperature = round(temperature) #The API doesn't allow floating point. From b05697b0d57b3dc9d5ca93fceb39eb61834a44c0 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 17:21:14 +0100 Subject: [PATCH 125/197] Also cancel pre-heating bed from Cura after time-out Printers that don't automatically turn off their heated bed will get the task to do so by Cura then. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 598b9489d9..f52ea86312 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -305,6 +305,10 @@ Column { preheatCountdown.visible = false; running = false; + if (printerConnected) + { + connectedPrinter.cancelPreheatBed() + } } } } From 7cf81412ae4cc46e94013c3e9706069764601424 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 17:26:44 +0100 Subject: [PATCH 126/197] Implement bed pre-heating via USB It just calls the bed heating command without implementing the time-out. Implementing the time-out is impossible via just g-code. Contributes to issue CURA-3161. --- plugins/USBPrinting/USBPrinterOutputDevice.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/plugins/USBPrinting/USBPrinterOutputDevice.py b/plugins/USBPrinting/USBPrinterOutputDevice.py index e30ba613bc..9fd5bf02e0 100644 --- a/plugins/USBPrinting/USBPrinterOutputDevice.py +++ b/plugins/USBPrinting/USBPrinterOutputDevice.py @@ -641,3 +641,20 @@ class USBPrinterOutputDevice(PrinterOutputDevice): self._update_firmware_thread.daemon = True self.connect() + + ## Pre-heats the heated bed of the printer, if it has one. + # + # \param temperature The temperature to heat the bed to, in degrees + # Celsius. + # \param duration How long the bed should stay warm, in seconds. This is + # ignored because there is no g-code to set this. + @pyqtSlot(float, float) + def preheatBed(self, temperature, duration): + self._setTargetBedTemperature(temperature) + + ## Cancels pre-heating the heated bed of the printer. + # + # If the bed is not pre-heated, nothing happens. + @pyqtSlot() + def cancelPreheatBed(self): + self._setTargetBedTemperature(0) \ No newline at end of file From e9b30daad6b6ba079a739dd9c9d0b182adc21db5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 17:30:15 +0100 Subject: [PATCH 127/197] Write out pre-heat button enabled condition It should be equivalent. This needs to be done because the line is getting long and I need to add additional checks for if the properties are even set. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index f52ea86312..ee3f68ad17 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -330,7 +330,26 @@ Column text: preheatCountdownTimer.running ? catalog.i18nc("@button Cancel pre-heating", "Cancel") : catalog.i18nc("@button", "Pre-heat") tooltip: catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") height: UM.Theme.getSize("setting_control").height - enabled: printerConnected && (preheatCountdownTimer.running || (parseInt(preheatTemperatureInput.text) >= parseInt(bedTemperature.properties.minimum_value) && parseInt(preheatTemperatureInput.text) <= parseInt(bedTemperature.properties.maximum_value))) + enabled: + { + if (!printerConnected) + { + return false; //Can't preheat if not connected. + } + if (preheatCountdownTimer.running) + { + return true; //Can always cancel if the timer is running. + } + if (parseInt(preheatTemperatureInput.text) < parseInt(bedTemperature.properties.minimum_value)) + { + return false; //Target temperature too low. + } + if (parseInt(preheatTemperatureInput.text) > parseInt(bedTemperature.properties.maximum_value)) + { + return false; //Target temperature too high. + } + return true; //Preconditions are met. + } anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.bottom: parent.bottom From 0b10df01b01d06b3c7b75d23211cd4705bb70b2e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 17:33:59 +0100 Subject: [PATCH 128/197] Don't check for min/max temperature if we have no min/max If we have no minimum/maximum bed temperature, the property returns 'None'. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index ee3f68ad17..2d989aeb43 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -340,11 +340,11 @@ Column { return true; //Can always cancel if the timer is running. } - if (parseInt(preheatTemperatureInput.text) < parseInt(bedTemperature.properties.minimum_value)) + if (bedTemperature.properties.minimum_value != "None" && parseInt(preheatTemperatureInput.text) < parseInt(bedTemperature.properties.minimum_value)) { return false; //Target temperature too low. } - if (parseInt(preheatTemperatureInput.text) > parseInt(bedTemperature.properties.maximum_value)) + if (bedTemperature.properties.maximum_value != "None" && parseInt(preheatTemperatureInput.text) > parseInt(bedTemperature.properties.maximum_value)) { return false; //Target temperature too high. } From be9823e94fe07123bda7d4f588fe0ec7023eb288 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 7 Feb 2017 17:39:45 +0100 Subject: [PATCH 129/197] Hide maximum bed temperature if there is no maximum Instead of the ugly 'None' it would display. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 2d989aeb43..34cb3d438a 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -210,6 +210,7 @@ Column Label //Maximum temperature indication. { text: bedTemperature.properties.maximum_value + visible: bedTemperature.properties.maximum_value != "None" color: UM.Theme.getColor("setting_unit") font: UM.Theme.getFont("default") anchors.right: parent.right From 2cdf06413bb48628449594bc3c3ef8d2ef89d632 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 09:41:42 +0100 Subject: [PATCH 130/197] Remove margin on the left of print monitor For the other side bar objects this margin was applied doubly, so that makes it very easy to remove. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- resources/qml/Sidebar.qml | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 34cb3d438a..ea33dad592 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -533,7 +533,7 @@ Column Rectangle { color: UM.Theme.getColor("setting_category") - width: base.width - 2 * UM.Theme.getSize("default_margin").width + width: base.width height: UM.Theme.getSize("section").height Label diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 45dc49d076..ab3032e7f1 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -499,9 +499,7 @@ Rectangle { anchors.bottom: footerSeparator.top anchors.top: headerSeparator.bottom - anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.left: base.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.right: base.right source: monitoringPrint ? "PrintMonitor.qml": "SidebarContents.qml" } From 34f929c9df3ce7ebf49d1dc826feffd3f3e2549d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 10:18:21 +0100 Subject: [PATCH 131/197] Disable preheat button if printer is busy It is allowed to preheat the bed if the printer is waiting for the bed to clean up or for stuff to cool down after a print. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index ea33dad592..861b6d2bc1 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -337,6 +337,10 @@ Column { return false; //Can't preheat if not connected. } + if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "pre_print" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline") + { + return false; //Printer is in a state where it can't react to pre-heating. + } if (preheatCountdownTimer.running) { return true; //Can always cancel if the timer is running. From 98e3e2a25a8774c9c48a943fd017d67d9c7f4546 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 10:19:20 +0100 Subject: [PATCH 132/197] Allow pre-heating bed while pausing It is allowed during the pause. So it should also be allowed when transitioning towards the pause. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 861b6d2bc1..8bf3d41322 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -337,7 +337,7 @@ Column { return false; //Can't preheat if not connected. } - if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "pre_print" || connectedPrinter.jobState == "pausing" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline") + if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "pre_print" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline") { return false; //Printer is in a state where it can't react to pre-heating. } From 28e488dad712a5e5b3ce01d1e457e80b1c809263 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 11:37:04 +0100 Subject: [PATCH 133/197] Fix setting target bed temperature The previous implementation just emitted the signal twice, once in setTargetBedTemperature and once in _setTargetBedTemperature. I've made the private one actually set the temperature. Contributes to issue CURA-3161. --- .../NetworkPrinterOutputDevice.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 6ce3a4fcc5..5f7a36f316 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -266,14 +266,17 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def cancelPreheatBed(self): self.preheatBed(temperature = 0, duration = 0) - ## Changes the target bed temperature and makes sure that its signal is - # emitted. + ## Changes the target bed temperature on the printer. # # /param temperature The new target temperature of the bed. def _setTargetBedTemperature(self, temperature): - if self._target_bed_temperature != temperature: - self._target_bed_temperature = temperature - self.targetBedTemperatureChanged.emit() + if self._target_bed_temperature == temperature: + return + url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/temperature") + data = """{"target": "%i"}""" % temperature + put_request = QNetworkRequest(url) + put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") + self._manager.put(put_request, data.encode()) def _stopCamera(self): self._camera_timer.stop() From da4574cb32d78a169b000b5edb79d9affb7d63bb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 11:38:03 +0100 Subject: [PATCH 134/197] Use fallback without time-out if preheating bed on old firmware It manually sets the temperature just like what happens when you print via USB. Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 5f7a36f316..44aead8e5b 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -9,6 +9,7 @@ from UM.Signal import signalemitter from UM.Message import Message import UM.Settings +import UM.Version #To compare firmware version numbers. from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState import cura.Settings.ExtruderManager @@ -250,6 +251,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def preheatBed(self, temperature, duration): temperature = round(temperature) #The API doesn't allow floating point. duration = round(duration) + if UM.Version(self.firmwareVersion) < UM.Version("3.5.92"): #Real bed pre-heating support is implemented from 3.5.92 and up. + self.setTargetBedTemperature(temperature = temperature) #No firmware-side duration support then. + return url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") if duration > 0: data = """{"temperature": "%i", "timeout": "%i"}""" % (temperature, duration) From 9f66ad1132e213fdd0c50a4e2a40e3259b3c32f8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 11:40:40 +0100 Subject: [PATCH 135/197] Remove superfluous empty item Don't know where that came from. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 8bf3d41322..4b811f1806 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -437,9 +437,6 @@ Column text: control.text; } } - label: Item - { - } } onClicked: From 34793e06fb343c200b2ffdc31f5727d9f88fdc05 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Wed, 8 Feb 2017 11:41:30 +0100 Subject: [PATCH 136/197] Removed debug. Toned down a FIXME. CURA-3335 Single instance Cura and model reloading --- cura/CuraApplication.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 783fb9821e..428639aafc 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -445,7 +445,6 @@ class CuraApplication(QtApplication): line = remote_cura_connection.readLine() while len(line) != 0: # There is also a .canReadLine() try: - Logger.log('d', "JSON command: " + str(line, encoding="ASCII")) payload = json.loads(str(line, encoding="ASCII").strip()) command = payload["command"] @@ -456,7 +455,7 @@ class CuraApplication(QtApplication): # Command: Load a model file elif command == "open": self._openFile(payload["filePath"]) - # FIXME ^ this method is async and we really should wait until + # WARNING ^ this method is async and we really should wait until # the file load is complete before processing more commands. # Command: Activate the window and bring it to the top. From 2a114f1e533bef64e8b48a001e12998e63937275 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 11:59:19 +0100 Subject: [PATCH 137/197] Display last item with double width if there's room on the right side If it's on the left side and it's the last item, it gets the entire width. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 4b811f1806..b707b41151 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -91,6 +91,7 @@ Column color: UM.Theme.getColor("sidebar") width: extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2 height: UM.Theme.getSize("sidebar_extruder_box").height + Layout.fillWidth: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 Text //Extruder name. { From d7b0336c2411711acf944c4f2bb296caf80c34be Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 12:42:40 +0100 Subject: [PATCH 138/197] Fix colour of unknown material The other colour was just used for debugging. Contributes to issue CURA-3161. --- cura/PrinterOutputDevice.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 3cba132f9a..f989bf26cd 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -1,3 +1,6 @@ +# Copyright (c) 2017 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + from UM.i18n import i18nCatalog from UM.OutputDevice.OutputDevice import OutputDevice from PyQt5.QtCore import pyqtProperty, pyqtSignal, pyqtSlot, QObject @@ -357,14 +360,14 @@ class PrinterOutputDevice(QObject, OutputDevice): result = [] for material_id in self._material_ids: if material_id is None: - result.append("#800000FF") #No material. + result.append("#00000000") #No material. continue containers = self._container_registry.findInstanceContainers(type = "material", GUID = material_id) if containers: result.append(containers[0].getMetaDataEntry("color_code")) else: - result.append("#800000FF") #Unknown material. + result.append("#00000000") #Unknown material. return result ## Protected setter for the current material id. From 1395735ecef792e50a886231d13d43197f0086cb Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 12:53:54 +0100 Subject: [PATCH 139/197] No longer mention printer name in status The printer name is displayed right above it, so mentioning the name again is double. Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 44aead8e5b..69d5c8abc2 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -318,14 +318,14 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): if auth_state == AuthState.AuthenticationRequested: Logger.log("d", "Authentication state changed to authentication requested.") self.setAcceptsCommands(False) - self.setConnectionText(i18n_catalog.i18nc("@info:status", "Connected over the network to {0}. Please approve the access request on the printer.").format(self.name)) + self.setConnectionText(i18n_catalog.i18nc("@info:status", "Connected over the network. Please approve the access request on the printer.")) self._authentication_requested_message.show() self._authentication_request_active = True self._authentication_timer.start() # Start timer so auth will fail after a while. elif auth_state == AuthState.Authenticated: Logger.log("d", "Authentication state changed to authenticated") self.setAcceptsCommands(True) - self.setConnectionText(i18n_catalog.i18nc("@info:status", "Connected over the network to {0}.").format(self.name)) + self.setConnectionText(i18n_catalog.i18nc("@info:status", "Connected over the network.")) self._authentication_requested_message.hide() if self._authentication_request_active: self._authentication_succeeded_message.show() @@ -338,7 +338,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self.sendMaterialProfiles() elif auth_state == AuthState.AuthenticationDenied: self.setAcceptsCommands(False) - self.setConnectionText(i18n_catalog.i18nc("@info:status", "Connected over the network to {0}. No access to control the printer.").format(self.name)) + self.setConnectionText(i18n_catalog.i18nc("@info:status", "Connected over the network. No access to control the printer.")) self._authentication_requested_message.hide() if self._authentication_request_active: if self._authentication_timer.remainingTime() > 0: From bcab0d7be90d54da310901b69f318d284908b2ad Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 14:00:06 +0100 Subject: [PATCH 140/197] Add unit to maximum temperature indication Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index b707b41151..90111265f0 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -210,8 +210,7 @@ Column } Label //Maximum temperature indication. { - text: bedTemperature.properties.maximum_value - visible: bedTemperature.properties.maximum_value != "None" + text: (bedTemperature.properties.maximum_value != "None" ? bedTemperature.properties.maximum_value : "") + "°C" color: UM.Theme.getColor("setting_unit") font: UM.Theme.getFont("default") anchors.right: parent.right From 4013b500632f1cca1342910ec9ecba9afacdc484 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Wed, 8 Feb 2017 14:01:07 +0100 Subject: [PATCH 141/197] Only allow pre-heating if authenticated Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 90111265f0..b34d1af252 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -337,6 +337,10 @@ Column { return false; //Can't preheat if not connected. } + if (!connectedPrinter.acceptsCommands) + { + return false; //Not allowed to do anything. + } if (connectedPrinter.jobState == "printing" || connectedPrinter.jobState == "pre_print" || connectedPrinter.jobState == "resuming" || connectedPrinter.jobState == "error" || connectedPrinter.jobState == "offline") { return false; //Printer is in a state where it can't react to pre-heating. From c5655d4d8c1a3d1c02fd5092202803bae806fc91 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 9 Feb 2017 09:32:14 +0100 Subject: [PATCH 142/197] Document preheatBedTimeout Must've slipped through the cracks. Contributes to issue CURA-3161. --- cura/PrinterOutputDevice.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index f989bf26cd..c6bc3e8f3d 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -203,7 +203,9 @@ class PrinterOutputDevice(QObject, OutputDevice): self._target_bed_temperature = temperature self.targetBedTemperatureChanged.emit() - ## + ## The duration of the time-out to pre-heat the bed, in seconds. + # + # \return The duration of the time-out to pre-heat the bed, in seconds. @pyqtProperty(int) def preheatBedTimeout(self): return self._preheat_bed_timeout From e37d8b949e5427d7564da6e3c1af4cc9cbf04bcc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 9 Feb 2017 10:31:35 +0100 Subject: [PATCH 143/197] Add fallback in PrinterOutputDevice for getting address The fallback gives a warning that it's not implemented. Contributes to issue CURA-3161. --- cura/PrinterOutputDevice.py | 5 +++++ resources/qml/PrintMonitor.qml | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index c6bc3e8f3d..8f03bdff79 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -165,6 +165,11 @@ class PrinterOutputDevice(QObject, OutputDevice): self._job_name = name self.jobNameChanged.emit() + ## Gives a human-readable address where the device can be found. + @pyqtProperty(str, constant = True) + def address(self): + Logger.log("w", "address is not implemented by this output device.") + @pyqtProperty(str, notify = errorTextChanged) def errorText(self): return self._error_text diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index b34d1af252..8ce094cbd3 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -43,7 +43,7 @@ Column Label { id: connectedPrinterAddressLabel - text: printerConnected ? connectedPrinter.address : "" + text: (printerConnected && connectedPrinter.address != null) ? connectedPrinter.address : "" font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_inactive") anchors.left: parent.left From 27c30006da20b8cf1e849c2f5adfa1e4535c179e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 9 Feb 2017 10:33:14 +0100 Subject: [PATCH 144/197] Give no address instead of a wrong address if unknown Contributes to issue CURA-3161. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 69d5c8abc2..5790cdab77 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -225,7 +225,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): ## The IP address of the printer. @pyqtProperty(str, constant = True) def address(self): - return self._properties.get(b"address", b"0.0.0.0").decode("utf-8") + return self._properties.get(b"address", b"").decode("utf-8") ## Name of the printer (as returned from the zeroConf properties) @pyqtProperty(str, constant = True) From c2bf88751e2454b584d72a561dfc0020ea6772af Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 9 Feb 2017 16:06:36 +0100 Subject: [PATCH 145/197] Enable functions pauseSlicing and continueSlicing in combination with BlockSlicingDecorator. CURA-3361 --- plugins/CuraEngineBackend/CuraEngineBackend.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index cf53475fb4..ed2e108f6c 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -72,6 +72,7 @@ class CuraEngineBackend(Backend): self._scene.sceneChanged.connect(self._onSceneChanged) self._pause_slicing = False + self._block_slicing = False # continueSlicing does not have effect if True # Workaround to disable layer view processing if layer view is not active. self._layer_view_active = False @@ -196,7 +197,7 @@ class CuraEngineBackend(Backend): self.backendStateChange.emit(BackendState.Disabled) def continueSlicing(self): - if self._pause_slicing: + if self._pause_slicing and not self._block_slicing: self._pause_slicing = False self.backendStateChange.emit(BackendState.NotStarted) @@ -315,15 +316,19 @@ class CuraEngineBackend(Backend): if source is self._scene.getRoot(): return - should_pause = False + should_pause = self._pause_slicing + block_slicing = False for node in DepthFirstIterator(self._scene.getRoot()): if node.callDecoration("isBlockSlicing"): should_pause = True + block_slicing = True gcode_list = node.callDecoration("getGCodeList") if gcode_list is not None: self._scene.gcode_list = gcode_list - if should_pause: + self._block_slicing = block_slicing + + if should_pause and self._block_slicing: self.pauseSlicing() else: self.continueSlicing() From 3d1e5a84fc9ce2b1dc3e3caf4c5a3e80fedb6fa5 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 9 Feb 2017 17:19:59 +0100 Subject: [PATCH 146/197] Added PauseBackendPlugin, added to changelog. CURA-3361 --- plugins/ChangeLogPlugin/ChangeLog.txt | 3 + .../CuraEngineBackend/CuraEngineBackend.py | 2 +- plugins/PauseBackendPlugin/.gitignore | 62 ++ plugins/PauseBackendPlugin/CMakeLists.txt | 13 + plugins/PauseBackendPlugin/LICENSE | 661 ++++++++++++++++++ plugins/PauseBackendPlugin/PauseBackend.py | 53 ++ plugins/PauseBackendPlugin/PauseBackend.qml | 72 ++ plugins/PauseBackendPlugin/__init__.py | 21 + plugins/PauseBackendPlugin/pause.svg | 1 + plugins/PauseBackendPlugin/play.svg | 1 + 10 files changed, 888 insertions(+), 1 deletion(-) create mode 100644 plugins/PauseBackendPlugin/.gitignore create mode 100644 plugins/PauseBackendPlugin/CMakeLists.txt create mode 100644 plugins/PauseBackendPlugin/LICENSE create mode 100644 plugins/PauseBackendPlugin/PauseBackend.py create mode 100644 plugins/PauseBackendPlugin/PauseBackend.qml create mode 100644 plugins/PauseBackendPlugin/__init__.py create mode 100644 plugins/PauseBackendPlugin/pause.svg create mode 100644 plugins/PauseBackendPlugin/play.svg diff --git a/plugins/ChangeLogPlugin/ChangeLog.txt b/plugins/ChangeLogPlugin/ChangeLog.txt index ed4d6888d3..b5b528982d 100644 --- a/plugins/ChangeLogPlugin/ChangeLog.txt +++ b/plugins/ChangeLogPlugin/ChangeLog.txt @@ -1,3 +1,6 @@ +[2.5.0] +*Included PauseBackendPlugin. This enables pausing the backend and manually start the backend. Thanks to community member Aldo Hoeben for this feature. + [2.4.0] *Project saving & opening You can now save your build plate configuration - with all your active machine’s meshes and settings. When you reopen the project file, you’ll find that the build plate configuration and all settings will be exactly as you last left them when you saved the project. diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index ed2e108f6c..f433f5dd8f 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -155,7 +155,7 @@ class CuraEngineBackend(Backend): ## Perform a slice of the scene. def slice(self): Logger.log("d", "Starting slice job...") - if self._pause_slicing: + if self._pause_slicing or self._block_slicing: return self._slice_start_time = time() if not self._enabled or not self._global_container_stack: # We shouldn't be slicing. diff --git a/plugins/PauseBackendPlugin/.gitignore b/plugins/PauseBackendPlugin/.gitignore new file mode 100644 index 0000000000..1dbc687de0 --- /dev/null +++ b/plugins/PauseBackendPlugin/.gitignore @@ -0,0 +1,62 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints diff --git a/plugins/PauseBackendPlugin/CMakeLists.txt b/plugins/PauseBackendPlugin/CMakeLists.txt new file mode 100644 index 0000000000..83e1c61a7d --- /dev/null +++ b/plugins/PauseBackendPlugin/CMakeLists.txt @@ -0,0 +1,13 @@ +project(PauseBackendPlugin) +cmake_minimum_required(VERSION 2.8.12) + +install(FILES + __init__.py + PauseBackend.py + PauseBackend.qml + pause.svg + play.svg + LICENSE + README.md + DESTINATION lib/cura/plugins/PauseBackendPlugin +) diff --git a/plugins/PauseBackendPlugin/LICENSE b/plugins/PauseBackendPlugin/LICENSE new file mode 100644 index 0000000000..dbbe355815 --- /dev/null +++ b/plugins/PauseBackendPlugin/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. diff --git a/plugins/PauseBackendPlugin/PauseBackend.py b/plugins/PauseBackendPlugin/PauseBackend.py new file mode 100644 index 0000000000..2871ee30af --- /dev/null +++ b/plugins/PauseBackendPlugin/PauseBackend.py @@ -0,0 +1,53 @@ +# Copyright ;(c) 2016 Ultimaker B.V. +# Cura is released under the terms of the AGPLv3 or higher. + +from PyQt5.QtCore import QTimer + +from UM.Extension import Extension +from UM.Application import Application +from UM.PluginRegistry import PluginRegistry +from UM.Logger import Logger + +from UM.Backend.Backend import BackendState + +from PyQt5.QtQml import QQmlComponent, QQmlContext +from PyQt5.QtCore import QUrl, pyqtSlot, QObject + +import os.path + +class PauseBackend(QObject, Extension): + def __init__(self, parent = None): + super().__init__(parent = parent) + + self._additional_component = None + self._additional_components_view = None + + Application.getInstance().engineCreatedSignal.connect(self._createAdditionalComponentsView) + + def _createAdditionalComponentsView(self): + Logger.log("d", "Creating additional ui components for Pause Backend plugin.") + + path = QUrl.fromLocalFile(os.path.join(PluginRegistry.getInstance().getPluginPath("PauseBackendPlugin"), "PauseBackend.qml")) + self._additional_component = QQmlComponent(Application.getInstance()._engine, path) + + # We need access to engine (although technically we can't) + self._additional_components_context = QQmlContext(Application.getInstance()._engine.rootContext()) + self._additional_components_context.setContextProperty("manager", self) + + self._additional_components_view = self._additional_component.create(self._additional_components_context) + if not self._additional_components_view: + Logger.log("w", "Could not create additional components for Pause Backend plugin.") + return + + Application.getInstance().addAdditionalComponent("saveButton", self._additional_components_view.findChild(QObject, "pauseResumeButton")) + + @pyqtSlot() + def pauseBackend(self): + backend = Application.getInstance().getBackend() + backend.pauseSlicing() + + @pyqtSlot() + def resumeBackend(self): + backend = Application.getInstance().getBackend() + backend.continueSlicing() + backend.forceSlice() \ No newline at end of file diff --git a/plugins/PauseBackendPlugin/PauseBackend.qml b/plugins/PauseBackendPlugin/PauseBackend.qml new file mode 100644 index 0000000000..ac3c4fe477 --- /dev/null +++ b/plugins/PauseBackendPlugin/PauseBackend.qml @@ -0,0 +1,72 @@ +import UM 1.2 as UM +import Cura 1.0 as Cura + +import QtQuick 2.2 +import QtQuick.Controls 1.1 +import QtQuick.Controls.Styles 1.1 +import QtQuick.Layouts 1.1 +import QtQuick.Window 2.1 + +Item +{ + id: base + + Button + { + id: pauseResumeButton + objectName: "pauseResumeButton" + + property bool paused: false + + height: UM.Theme.getSize("save_button_save_to_button").height + width: height + + tooltip: paused ? catalog.i18nc("@info:tooltip", "Resume automatic slicing") : catalog.i18nc("@info:tooltip", "Pause automatic slicing") + + style: ButtonStyle { + background: Rectangle { + border.width: UM.Theme.getSize("default_lining").width + border.color: !control.enabled ? UM.Theme.getColor("action_button_disabled_border") : + control.pressed ? UM.Theme.getColor("action_button_active_border") : + control.hovered ? UM.Theme.getColor("action_button_hovered_border") : UM.Theme.getColor("action_button_border") + color: !control.enabled ? UM.Theme.getColor("action_button_disabled") : + control.pressed ? UM.Theme.getColor("action_button_active") : + control.hovered ? UM.Theme.getColor("action_button_hovered") : UM.Theme.getColor("action_button") + Behavior on color { ColorAnimation { duration: 50; } } + anchors.left: parent.left + anchors.leftMargin: UM.Theme.getSize("save_button_text_margin").width / 2; + width: parent.height + height: parent.height + + UM.RecolorImage { + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width / 2 + height: parent.height / 2 + sourceSize.width: width + sourceSize.height: height + color: !control.enabled ? UM.Theme.getColor("action_button_disabled_text") : + control.pressed ? UM.Theme.getColor("action_button_active_text") : + control.hovered ? UM.Theme.getColor("action_button_hovered_text") : UM.Theme.getColor("action_button_text"); + source: pauseResumeButton.paused ? "play.svg" : "pause.svg" + } + } + label: Label{ } + } + + onClicked: + { + paused = !paused + if(paused) + { + manager.pauseBackend() + } + else + { + manager.resumeBackend() + } + } + } + + UM.I18nCatalog{id: catalog; name:"cura"} +} \ No newline at end of file diff --git a/plugins/PauseBackendPlugin/__init__.py b/plugins/PauseBackendPlugin/__init__.py new file mode 100644 index 0000000000..2612086833 --- /dev/null +++ b/plugins/PauseBackendPlugin/__init__.py @@ -0,0 +1,21 @@ +# Copyright (c) 2016 Aldo Hoeben / fieldOfView. +# Cura is released under the terms of the AGPLv3 or higher. + +from . import PauseBackend + +from UM.i18n import i18nCatalog +catalog = i18nCatalog("cura") + +def getMetaData(): + return { + "plugin": { + "name": catalog.i18nc("@label", "Auto Save"), + "author": "Ultimaker", + "version": "2.3", + "description": catalog.i18nc("@info:whatsthis", "Adds a button to pause automatic background slicing."), + "api": 3 + }, + } + +def register(app): + return { "extension": PauseBackend.PauseBackend() } diff --git a/plugins/PauseBackendPlugin/pause.svg b/plugins/PauseBackendPlugin/pause.svg new file mode 100644 index 0000000000..7ca81f89c3 --- /dev/null +++ b/plugins/PauseBackendPlugin/pause.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/plugins/PauseBackendPlugin/play.svg b/plugins/PauseBackendPlugin/play.svg new file mode 100644 index 0000000000..9c56408a64 --- /dev/null +++ b/plugins/PauseBackendPlugin/play.svg @@ -0,0 +1 @@ + \ No newline at end of file From 655b3aa9cff66fdb3f7344f7709a27a4029ef7f3 Mon Sep 17 00:00:00 2001 From: Jack Ha Date: Thu, 9 Feb 2017 17:20:49 +0100 Subject: [PATCH 147/197] Removed .gitignore from PauseBackendPlugin. CURA-3361 --- plugins/PauseBackendPlugin/.gitignore | 62 --------------------------- 1 file changed, 62 deletions(-) delete mode 100644 plugins/PauseBackendPlugin/.gitignore diff --git a/plugins/PauseBackendPlugin/.gitignore b/plugins/PauseBackendPlugin/.gitignore deleted file mode 100644 index 1dbc687de0..0000000000 --- a/plugins/PauseBackendPlugin/.gitignore +++ /dev/null @@ -1,62 +0,0 @@ -# Byte-compiled / optimized / DLL files -__pycache__/ -*.py[cod] -*$py.class - -# C extensions -*.so - -# Distribution / packaging -.Python -env/ -build/ -develop-eggs/ -dist/ -downloads/ -eggs/ -.eggs/ -lib/ -lib64/ -parts/ -sdist/ -var/ -*.egg-info/ -.installed.cfg -*.egg - -# PyInstaller -# Usually these files are written by a python script from a template -# before PyInstaller builds the exe, so as to inject date/other infos into it. -*.manifest -*.spec - -# Installer logs -pip-log.txt -pip-delete-this-directory.txt - -# Unit test / coverage reports -htmlcov/ -.tox/ -.coverage -.coverage.* -.cache -nosetests.xml -coverage.xml -*,cover -.hypothesis/ - -# Translations -*.mo -*.pot - -# Django stuff: -*.log - -# Sphinx documentation -docs/_build/ - -# PyBuilder -target/ - -#Ipython Notebook -.ipynb_checkpoints From 0c9b9a3033cfe7e110103db15ce9acd7ec5a5b8a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Thu, 9 Feb 2017 17:34:51 +0100 Subject: [PATCH 148/197] Add fallback name property in PrinterOutputDevice It'll call this property, which gives an empty string, if the device doesn't implement giving a name. Contributes to issue CURA-3161. --- cura/PrinterOutputDevice.py | 6 ++++++ plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 4 ++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cura/PrinterOutputDevice.py b/cura/PrinterOutputDevice.py index 8f03bdff79..8a95748cf1 100644 --- a/cura/PrinterOutputDevice.py +++ b/cura/PrinterOutputDevice.py @@ -170,6 +170,12 @@ class PrinterOutputDevice(QObject, OutputDevice): def address(self): Logger.log("w", "address is not implemented by this output device.") + ## A human-readable name for the device. + @pyqtProperty(str, constant = True) + def name(self): + Logger.log("w", "name is not implemented by this output device.") + return "" + @pyqtProperty(str, notify = errorTextChanged) def errorText(self): return self._error_text diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 5790cdab77..7df3c7bf23 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -227,12 +227,12 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def address(self): return self._properties.get(b"address", b"").decode("utf-8") - ## Name of the printer (as returned from the zeroConf properties) + ## Name of the printer (as returned from the ZeroConf properties) @pyqtProperty(str, constant = True) def name(self): return self._properties.get(b"name", b"").decode("utf-8") - ## Firmware version (as returned from the zeroConf properties) + ## Firmware version (as returned from the ZeroConf properties) @pyqtProperty(str, constant=True) def firmwareVersion(self): return self._properties.get(b"firmware_version", b"").decode("utf-8") From f85e0f57adb7e394b4008a0a776349e17ab7c5c8 Mon Sep 17 00:00:00 2001 From: probonopd Date: Thu, 9 Feb 2017 19:21:52 +0100 Subject: [PATCH 149/197] Change gcode to default_value and remove single quotes --- resources/definitions/renkforce_rf100.def.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/definitions/renkforce_rf100.def.json b/resources/definitions/renkforce_rf100.def.json index e238495ca6..1f0137c562 100644 --- a/resources/definitions/renkforce_rf100.def.json +++ b/resources/definitions/renkforce_rf100.def.json @@ -58,7 +58,7 @@ "value": "100" }, "machine_end_gcode": { - "value": "';End GCode\nM104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning'" + "default_value": ";End GCode\nM104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning" }, "machine_gcode_flavor": { "value": "RepRap (Marlin/Sprinter)" @@ -70,7 +70,7 @@ "value": "Renkforce RF100" }, "machine_start_gcode": { - "value": "';Sliced at: {day} {date} {time}\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{speed_travel} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{speed_travel}\nM117 Printing...'" + "default_value": ";Sliced at: {day} {date} {time}\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{speed_travel} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{speed_travel}\nM117 Printing..." }, "machine_width": { "value": "100" From 45c045131baccacee688adf46ab366cc768b801e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 09:38:38 +0100 Subject: [PATCH 150/197] Fix rendering pre-heat button text twice It was rendered by the button and again by the style for the button. I'm just using the style since it has the proper styling. Thanks, fieldOfView. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 8ce094cbd3..db58927cfa 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -328,7 +328,6 @@ Column Button //The pre-heat button. { id: preheatButton - text: preheatCountdownTimer.running ? catalog.i18nc("@button Cancel pre-heating", "Cancel") : catalog.i18nc("@button", "Pre-heat") tooltip: catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") height: UM.Theme.getSize("setting_control").height enabled: @@ -438,7 +437,7 @@ Column } } font: UM.Theme.getFont("action_button") - text: control.text; + text: preheatCountdownTimer.running ? catalog.i18nc("@button Cancel pre-heating", "Cancel") : catalog.i18nc("@button", "Pre-heat") } } } From 928d13b1e56fb8593eba19a508bafbe65fe2d0bd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 09:59:36 +0100 Subject: [PATCH 151/197] Fix string-type settings by making them specify default_value None of these settings get a 'value' property defined in fdmprinter, so they can safely use 'default_value' to specify their setting value. --- resources/definitions/renkforce_rf100.def.json | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/definitions/renkforce_rf100.def.json b/resources/definitions/renkforce_rf100.def.json index 1f0137c562..7df1fa46fd 100644 --- a/resources/definitions/renkforce_rf100.def.json +++ b/resources/definitions/renkforce_rf100.def.json @@ -13,7 +13,7 @@ "overrides": { "adhesion_type": { - "value": "skirt" + "default_value": "skirt" }, "bottom_thickness": { "value": "0.5" @@ -61,13 +61,13 @@ "default_value": ";End GCode\nM104 S0 ;extruder heater off\nM140 S0 ;heated bed heater off (if you have it)\nG91 ;relative positioning\nG1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the pressure\nG1 Z+0.5 E-5 X-20 Y-20 F{speed_travel} ;move Z up a bit and retract filament even more\nG28 X0 Y0 ;move X/Y to min endstops, so the head is out of the way\nM84 ;steppers off\nG90 ;absolute positioning" }, "machine_gcode_flavor": { - "value": "RepRap (Marlin/Sprinter)" + "default_value": "RepRap (Marlin/Sprinter)" }, "machine_height": { "value": "100" }, "machine_name": { - "value": "Renkforce RF100" + "default_value": "Renkforce RF100" }, "machine_start_gcode": { "default_value": ";Sliced at: {day} {date} {time}\nG21 ;metric values\nG90 ;absolute positioning\nM82 ;set extruder to absolute mode\nM107 ;start with the fan off\nG28 X0 Y0 ;move X/Y to min endstops\nG28 Z0 ;move Z to min endstops\nG1 Z15.0 F{speed_travel} ;move the platform down 15mm\nG92 E0 ;zero the extruded length\nG1 F200 E3 ;extrude 3mm of feed stock\nG92 E0 ;zero the extruded length again\nG1 F{speed_travel}\nM117 Printing..." @@ -127,7 +127,7 @@ "value": "2.0" }, "retraction_combing": { - "value": "all" + "default_value": "all" }, "retraction_enable": { "value": "True" @@ -184,10 +184,10 @@ "value": "15.0" }, "support_pattern": { - "value": "lines" + "default_value": "lines" }, "support_type": { - "value": "everywhere" + "default_value": "everywhere" }, "support_xy_distance": { "value": "0.5" From 4ce755021abb5b18053878ab32e626d7efa73fb6 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 11:11:39 +0100 Subject: [PATCH 152/197] Don't use printerConnected from Sidebar.qml We don't need it if we just check for connectedPrinter to not be null each time. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 38 +++++++++++++++++----------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index db58927cfa..b39cec34b2 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -12,7 +12,7 @@ import Cura 1.0 as Cura Column { id: printMonitor - property var connectedPrinter: printerConnected ? Cura.MachineManager.printerOutputDevices[0] : null + property var connectedPrinter: Cura.MachineManager.printerOutputDevices.length >= 1 ? Cura.MachineManager.printerOutputDevices[0] : null Cura.ExtrudersModel { @@ -30,7 +30,7 @@ Column Label { id: connectedPrinterNameLabel - text: printerConnected ? connectedPrinter.name : catalog.i18nc("@info:status", "No printer connected") + text: connectedPrinter != null ? connectedPrinter.name : catalog.i18nc("@info:status", "No printer connected") font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") anchors.left: parent.left @@ -43,7 +43,7 @@ Column Label { id: connectedPrinterAddressLabel - text: (printerConnected && connectedPrinter.address != null) ? connectedPrinter.address : "" + text: (connectedPrinter != null && connectedPrinter.address != null) ? connectedPrinter.address : "" font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_inactive") anchors.left: parent.left @@ -56,8 +56,8 @@ Column } Label { - text: printerConnected ? connectedPrinter.connectionText : catalog.i18nc("@info:status", "The printer is not connected.") - color: printerConnected && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + text: connectedPrinter != null ? connectedPrinter.connectionText : catalog.i18nc("@info:status", "The printer is not connected.") + color: connectedPrinter != null && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") font: UM.Theme.getFont("very_small") wrapMode: Text.WordWrap anchors.left: parent.left @@ -104,7 +104,7 @@ Column } Text //Temperature indication. { - text: printerConnected ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" + text: connectedPrinter != null ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" font: UM.Theme.getFont("large") anchors.right: parent.right anchors.rightMargin: UM.Theme.getSize("default_margin").width @@ -116,10 +116,10 @@ Column id: materialColor width: materialName.height * 0.75 height: materialName.height * 0.75 - color: printerConnected ? connectedPrinter.materialColors[index] : "#00000000" //Need to check for printerConnected or materialColors[index] gives an error. + color: connectedPrinter != null ? connectedPrinter.materialColors[index] : "#00000000" border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") - visible: printerConnected + visible: connectedPrinter != null anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: materialName.verticalCenter @@ -127,7 +127,7 @@ Column Text //Material name. { id: materialName - text: printerConnected ? connectedPrinter.materialNames[index] : "" + text: connectedPrinter != null ? connectedPrinter.materialNames[index] : "" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") anchors.left: materialColor.right @@ -137,7 +137,7 @@ Column } Text //Variant name. { - text: printerConnected ? connectedPrinter.hotendIds[index] : "" + text: connectedPrinter != null ? connectedPrinter.hotendIds[index] : "" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") anchors.right: parent.right @@ -170,7 +170,7 @@ Column Text //Target temperature. { id: bedTargetTemperature - text: printerConnected ? connectedPrinter.targetBedTemperature + "°C" : "" + text: connectedPrinter != null ? connectedPrinter.targetBedTemperature + "°C" : "" font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_inactive") anchors.right: parent.right @@ -180,7 +180,7 @@ Column Text //Current temperature. { id: bedCurrentTemperature - text: printerConnected ? connectedPrinter.bedTemperature + "°C" : "" + text: connectedPrinter != null ? connectedPrinter.bedTemperature + "°C" : "" font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") anchors.right: bedTargetTemperature.left @@ -306,7 +306,7 @@ Column { preheatCountdown.visible = false; running = false; - if (printerConnected) + if (connectedPrinter != null) { connectedPrinter.cancelPreheatBed() } @@ -332,7 +332,7 @@ Column height: UM.Theme.getSize("setting_control").height enabled: { - if (!printerConnected) + if (!connectedPrinter != null) { return false; //Can't preheat if not connected. } @@ -484,19 +484,19 @@ Column { sourceComponent: monitorItem property string label: catalog.i18nc("@label", "Job Name") - property string value: printerConnected ? connectedPrinter.jobName : "" + property string value: connectedPrinter != null ? connectedPrinter.jobName : "" } Loader { sourceComponent: monitorItem property string label: catalog.i18nc("@label", "Printing Time") - property string value: printerConnected ? getPrettyTime(connectedPrinter.timeTotal) : "" + property string value: connectedPrinter != null ? getPrettyTime(connectedPrinter.timeTotal) : "" } Loader { sourceComponent: monitorItem property string label: catalog.i18nc("@label", "Estimated time left") - property string value: printerConnected ? getPrettyTime(connectedPrinter.timeTotal - connectedPrinter.timeElapsed) : "" + property string value: connectedPrinter != null ? getPrettyTime(connectedPrinter.timeTotal - connectedPrinter.timeElapsed) : "" } Component @@ -515,7 +515,7 @@ Column width: parent.width * 0.4 anchors.verticalCenter: parent.verticalCenter text: label - color: printerConnected && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + color: connectedPrinter != null && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") font: UM.Theme.getFont("default") elide: Text.ElideRight } @@ -524,7 +524,7 @@ Column width: parent.width * 0.6 anchors.verticalCenter: parent.verticalCenter text: value - color: printerConnected && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + color: connectedPrinter != null && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") font: UM.Theme.getFont("default") elide: Text.ElideRight } From 17a03d777ca01dd0b0e69b15770c64f629c7ee8d Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 11:14:28 +0100 Subject: [PATCH 153/197] No longer use printerAcceptsCommands It's an external variable we don't need. Just ask the currently connected printer. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index b39cec34b2..7984cd59c5 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -57,7 +57,7 @@ Column Label { text: connectedPrinter != null ? connectedPrinter.connectionText : catalog.i18nc("@info:status", "The printer is not connected.") - color: connectedPrinter != null && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") font: UM.Theme.getFont("very_small") wrapMode: Text.WordWrap anchors.left: parent.left @@ -515,7 +515,7 @@ Column width: parent.width * 0.4 anchors.verticalCenter: parent.verticalCenter text: label - color: connectedPrinter != null && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") font: UM.Theme.getFont("default") elide: Text.ElideRight } @@ -524,7 +524,7 @@ Column width: parent.width * 0.6 anchors.verticalCenter: parent.verticalCenter text: value - color: connectedPrinter != null && printerAcceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") + color: connectedPrinter != null && connectedPrinter.acceptsCommands ? UM.Theme.getColor("setting_control_text") : UM.Theme.getColor("setting_control_disabled_text") font: UM.Theme.getFont("default") elide: Text.ElideRight } From 60812139b78c927b52b91c8264adaa8ff4bb7989 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 11:27:45 +0100 Subject: [PATCH 154/197] Use global margins instead of specific per cardinal direction Makes it a bit shorter. But also makes it use the width of the margins for vertical margin, which is unintuitive. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 31 +++++++++---------------------- 1 file changed, 9 insertions(+), 22 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 7984cd59c5..6a78a23348 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -34,11 +34,8 @@ Column font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height - anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.margins: UM.Theme.getSize("default_margin").width } Label { @@ -46,12 +43,9 @@ Column text: (connectedPrinter != null && connectedPrinter.address != null) ? connectedPrinter.address : "" font: UM.Theme.getFont("small") color: UM.Theme.getColor("text_inactive") - anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width + anchors.margins: UM.Theme.getSize("default_margin").width horizontalAlignment: Text.AlignRight } Label @@ -98,18 +92,16 @@ Column text: machineExtruderCount.properties.value > 1 ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") color: UM.Theme.getColor("text") anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.margins: UM.Theme.getSize("default_margin").width } Text //Temperature indication. { text: connectedPrinter != null ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" font: UM.Theme.getFont("large") anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.margins: UM.Theme.getSize("default_margin").width } Rectangle //Material colour indication. { @@ -131,9 +123,8 @@ Column font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") anchors.left: materialColor.right - anchors.leftMargin: UM.Theme.getSize("setting_unit_margin").width anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.margins: UM.Theme.getSize("default_margin").width } Text //Variant name. { @@ -141,9 +132,8 @@ Column font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.margins: UM.Theme.getSize("default_margin").width } } } @@ -163,9 +153,8 @@ Column font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") anchors.left: parent.left - anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.margins: UM.Theme.getSize("default_margin").width } Text //Target temperature. { @@ -184,9 +173,8 @@ Column font: UM.Theme.getFont("large") color: UM.Theme.getColor("text") anchors.right: bedTargetTemperature.left - anchors.rightMargin: UM.Theme.getSize("setting_unit_margin").width anchors.top: parent.top - anchors.topMargin: UM.Theme.getSize("default_margin").height + anchors.margins: UM.Theme.getSize("default_margin").width } Rectangle //Input field for pre-heat temperature. { @@ -359,9 +347,8 @@ Column return true; //Preconditions are met. } anchors.right: parent.right - anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.bottom: parent.bottom - anchors.bottomMargin: UM.Theme.getSize("default_margin").height + anchors.margins: UM.Theme.getSize("default_margin").width style: ButtonStyle { background: Rectangle { From 6ed0e81492c46f8c9291df0bd805aabcaf5e1d88 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 11:30:05 +0100 Subject: [PATCH 155/197] Remove unnecessary alignment It is single-line text and already aligned to the right side via the anchors. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 1 - 1 file changed, 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 6a78a23348..29f3210c2d 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -46,7 +46,6 @@ Column anchors.top: parent.top anchors.right: parent.right anchors.margins: UM.Theme.getSize("default_margin").width - horizontalAlignment: Text.AlignRight } Label { From 28a3858bc2c3adee7b3f3743714c2d7bb65a6585 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 10 Feb 2017 11:30:50 +0100 Subject: [PATCH 156/197] Fixed small isue where no type was found in zeroconf object --- .../NetworkPrinterOutputDevicePlugin.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py index 2725fa8d17..8722c5361e 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevicePlugin.py @@ -196,12 +196,13 @@ class NetworkPrinterOutputDevicePlugin(OutputDevicePlugin): info = zeroconf.get_service_info(service_type, name) if info: - type_of_device = info.properties.get(b"type", None).decode("utf-8") - if type_of_device == "printer": - address = '.'.join(map(lambda n: str(n), info.address)) - self.addPrinterSignal.emit(str(name), address, info.properties) - else: - Logger.log("w", "The type of the found device is '%s', not 'printer'! Ignoring.." %type_of_device ) + type_of_device = info.properties.get(b"type", None) + if type_of_device: + if type_of_device == b"printer": + address = '.'.join(map(lambda n: str(n), info.address)) + self.addPrinterSignal.emit(str(name), address, info.properties) + else: + Logger.log("w", "The type of the found device is '%s', not 'printer'! Ignoring.." % type_of_device ) else: Logger.log("w", "Could not get information about %s" % name) From fce9df756cdc5d635375531e621c0ebc05e3f8e7 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 10 Feb 2017 11:43:38 +0100 Subject: [PATCH 157/197] Fixed pause slicing not working when moving an object CURA-3361 --- plugins/CuraEngineBackend/CuraEngineBackend.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index f433f5dd8f..4c644a653a 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -192,9 +192,10 @@ class CuraEngineBackend(Backend): def pauseSlicing(self): - self.close() - self._pause_slicing = True - self.backendStateChange.emit(BackendState.Disabled) + if not self._pause_slicing: + self.close() + self._pause_slicing = True + self.backendStateChange.emit(BackendState.Disabled) def continueSlicing(self): if self._pause_slicing and not self._block_slicing: @@ -328,7 +329,7 @@ class CuraEngineBackend(Backend): self._block_slicing = block_slicing - if should_pause and self._block_slicing: + if should_pause or self._block_slicing: self.pauseSlicing() else: self.continueSlicing() From f6fe4f9fd306c10332854b19abaff46fed6b86bd Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 11:56:37 +0100 Subject: [PATCH 158/197] Use Label for all text, not just labels The fonts use better fallbacks if they fail to load for labels. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 29f3210c2d..7666c175d2 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -86,7 +86,7 @@ Column height: UM.Theme.getSize("sidebar_extruder_box").height Layout.fillWidth: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 - Text //Extruder name. + Label //Extruder name. { text: machineExtruderCount.properties.value > 1 ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") color: UM.Theme.getColor("text") @@ -94,7 +94,7 @@ Column anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width } - Text //Temperature indication. + Label //Temperature indication. { text: connectedPrinter != null ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" font: UM.Theme.getFont("large") @@ -115,7 +115,7 @@ Column anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: materialName.verticalCenter } - Text //Material name. + Label //Material name. { id: materialName text: connectedPrinter != null ? connectedPrinter.materialNames[index] : "" @@ -125,7 +125,7 @@ Column anchors.bottom: parent.bottom anchors.margins: UM.Theme.getSize("default_margin").width } - Text //Variant name. + Label //Variant name. { text: connectedPrinter != null ? connectedPrinter.hotendIds[index] : "" font: UM.Theme.getFont("default") @@ -155,7 +155,7 @@ Column anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width } - Text //Target temperature. + Label //Target temperature. { id: bedTargetTemperature text: connectedPrinter != null ? connectedPrinter.targetBedTemperature + "°C" : "" @@ -165,7 +165,7 @@ Column anchors.rightMargin: UM.Theme.getSize("default_margin").width anchors.bottom: bedCurrentTemperature.bottom } - Text //Current temperature. + Label //Current temperature. { id: bedCurrentTemperature text: connectedPrinter != null ? connectedPrinter.bedTemperature + "°C" : "" @@ -300,7 +300,7 @@ Column } } } - Text + Label { id: preheatCountdown text: "0:00" From be5b656ef7139309e2de662d7917ccafc2f96255 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 13:28:59 +0100 Subject: [PATCH 159/197] Hide extruder information when hotend/material is not provided This happens when there is no extruder in the machine or the machine simply doesn't provide enough information. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 7666c175d2..cf15973c11 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -96,7 +96,7 @@ Column } Label //Temperature indication. { - text: connectedPrinter != null ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" + text: (connectedPrinter != null && connectedPrinter.hotendTemperatures[index] != null) ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" font: UM.Theme.getFont("large") anchors.right: parent.right anchors.top: parent.top @@ -107,10 +107,10 @@ Column id: materialColor width: materialName.height * 0.75 height: materialName.height * 0.75 - color: connectedPrinter != null ? connectedPrinter.materialColors[index] : "#00000000" + color: (connectedPrinter != null && connectedPrinter.materialColors[index] != null) ? connectedPrinter.materialColors[index] : "#00000000" border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") - visible: connectedPrinter != null + visible: (connectedPrinter != null && connectedPrinter.materialColors[index] != null) anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: materialName.verticalCenter @@ -118,7 +118,7 @@ Column Label //Material name. { id: materialName - text: connectedPrinter != null ? connectedPrinter.materialNames[index] : "" + text: (connectedPrinter != null && connectedPrinter.materialNames[index] != null) ? connectedPrinter.materialNames[index] : "" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") anchors.left: materialColor.right @@ -127,7 +127,7 @@ Column } Label //Variant name. { - text: connectedPrinter != null ? connectedPrinter.hotendIds[index] : "" + text: (connectedPrinter != null && connectedPrinter.hotendIds[index] != null) ? connectedPrinter.hotendIds[index] : "" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") anchors.right: parent.right From bda818b1046b2132741a9e68532122d78e0dd119 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 10 Feb 2017 14:15:35 +0100 Subject: [PATCH 160/197] MetaData of material profile is now set in one batch instead of multiple calls CURA-3311 --- .../XmlMaterialProfile/XmlMaterialProfile.py | 36 ++++++++----------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index a0e80df436..d5062da191 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -376,12 +376,10 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): # Reset previous metadata self.clearData() # Ensure any previous data is gone. - - self.addMetaDataEntry("type", "material") - self.addMetaDataEntry("base_file", self.id) - - # TODO: Add material verfication - self.addMetaDataEntry("status", "unknown") + meta_data = {} + meta_data["type"] = "material" + meta_data["base_file"] = self.id + meta_data["status"] = "unknown" # TODO: Add material verfication inherits = data.find("./um:inherits", self.__namespaces) if inherits is not None: @@ -402,20 +400,17 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): self.setName(label.text) else: self.setName(self._profile_name(material.text, color.text)) - - self.addMetaDataEntry("brand", brand.text) - self.addMetaDataEntry("material", material.text) - self.addMetaDataEntry("color_name", color.text) - + meta_data["brand"] = brand.text + meta_data["material"] = material.text + meta_data["color_name"] = color.text continue + meta_data[tag_name] = entry.text - self.addMetaDataEntry(tag_name, entry.text) + if not "description" in meta_data: + meta_data["description"] = "" - if not "description" in self.getMetaData(): - self.addMetaDataEntry("description", "") - - if not "adhesion_info" in self.getMetaData(): - self.addMetaDataEntry("adhesion_info", "") + if not "adhesion_info" in meta_data: + meta_data["adhesion_info"] = "" property_values = {} properties = data.iterfind("./um:properties/*", self.__namespaces) @@ -425,8 +420,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): diameter = float(property_values.get("diameter", 2.85)) # In mm density = float(property_values.get("density", 1.3)) # In g/cm3 - - self.addMetaDataEntry("properties", property_values) + meta_data["properties"] = property_values self.setDefinition(UM.Settings.ContainerRegistry.getInstance().findDefinitionContainers(id = "fdmprinter")[0]) @@ -444,8 +438,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): else: Logger.log("d", "Unsupported material setting %s", key) - self.addMetaDataEntry("compatible", global_compatibility) - + meta_data["compatible"] = global_compatibility + self.setMetaData(meta_data) self._dirty = False machines = data.iterfind("./um:settings/um:machine", self.__namespaces) From b3bd488c07bffec191a96dfdab564d176e2188ab Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 14:40:31 +0100 Subject: [PATCH 161/197] Use stylised tooltip for pre-heat button Took some figuring out, this one... But it works. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index cf15973c11..bead30d85b 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -315,7 +315,6 @@ Column Button //The pre-heat button. { id: preheatButton - tooltip: catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") height: UM.Theme.getSize("setting_control").height enabled: { @@ -447,6 +446,22 @@ Column preheatCountdownTimer.update(); } } + + onHoveredChanged: + { + if (hovered) + { + base.showTooltip( + base, + {x: 0, y: preheatButton.mapToItem(base, 0, 0).y}, + catalog.i18nc("@tooltip of pre-heat", "Heat the bed in advance before printing. You can continue adjusting your print while it is heating, and you won't have to wait for the bed to heat up when you're ready to print.") + ); + } + else + { + base.hideTooltip(); + } + } } } From 2f8fc0518157065ecdac1c83411478015fcc7b9f Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 14:43:31 +0100 Subject: [PATCH 162/197] Fix button enabled state depending on printer connection I think I made a mistake when I removed one of the global variables here. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index bead30d85b..6e9eafaf78 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -318,7 +318,7 @@ Column height: UM.Theme.getSize("setting_control").height enabled: { - if (!connectedPrinter != null) + if (connectedPrinter == null) { return false; //Can't preheat if not connected. } From f4d4fb9001ac22f31d329d65830340125aceb121 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 10 Feb 2017 14:50:16 +0100 Subject: [PATCH 163/197] Material values are now also lazy loaded CURA-3311 --- .../XmlMaterialProfile/XmlMaterialProfile.py | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index d5062da191..71ee719de1 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -430,13 +430,13 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): for entry in settings: key = entry.get("key") if key in self.__material_property_setting_map: - self.setProperty(self.__material_property_setting_map[key], "value", entry.text) global_setting_values[self.__material_property_setting_map[key]] = entry.text elif key in self.__unmapped_settings: if key == "hardware compatible": global_compatibility = parseBool(entry.text) else: Logger.log("d", "Unsupported material setting %s", key) + self._cached_values = global_setting_values meta_data["compatible"] = global_compatibility self.setMetaData(meta_data) @@ -457,6 +457,9 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): else: Logger.log("d", "Unsupported material setting %s", key) + cached_machine_setting_properties = global_setting_values.copy() + cached_machine_setting_properties.update(machine_setting_values) + identifiers = machine.iterfind("./um:machine_identifier", self.__namespaces) for identifier in identifiers: machine_id = self.__product_id_map.get(identifier.get("product"), None) @@ -488,11 +491,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): # Don't use setMetadata, as that overrides it for all materials with same base file new_material.getMetaData()["compatible"] = machine_compatibility - for key, value in global_setting_values.items(): - new_material.setProperty(key, "value", value) - - for key, value in machine_setting_values.items(): - new_material.setProperty(key, "value", value) + new_material.setCachedValues(cached_machine_setting_properties) new_material._dirty = False if not materials: @@ -542,14 +541,10 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): # Don't use setMetadata, as that overrides it for all materials with same base file new_hotend_material.getMetaData()["compatible"] = hotend_compatibility - for key, value in global_setting_values.items(): - new_hotend_material.setProperty(key, "value", value) + cached_hotend_setting_properties = cached_machine_setting_properties.copy() + cached_hotend_setting_properties.update(hotend_setting_values) - for key, value in machine_setting_values.items(): - new_hotend_material.setProperty(key, "value", value) - - for key, value in hotend_setting_values.items(): - new_hotend_material.setProperty(key, "value", value) + new_hotend_material.setCachedValues(cached_hotend_setting_properties) new_hotend_material._dirty = False if not materials: # It was not added yet, do so now. From b69ec56f66fd0050f7d4bf60578887df97f9294a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 14:55:06 +0100 Subject: [PATCH 164/197] Make extruder name recover if it returns null If it returns null, you'd get an error that it can't assign [undefined] to a text field. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 6e9eafaf78..f088e49c85 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -88,7 +88,7 @@ Column Label //Extruder name. { - text: machineExtruderCount.properties.value > 1 ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") + text: (machineExtruderCount.properties.value > 1 && extrudersModel.getItem(index).name != null) ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") color: UM.Theme.getColor("text") anchors.left: parent.left anchors.top: parent.top From 6e7c4711e3dc935f3e111be52f8d392c79a35927 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 10 Feb 2017 14:58:22 +0100 Subject: [PATCH 165/197] When creating XML profiles, directly set the name The setName function is intended if the user changes the name (as by means of the edit material menu). For deserializing this simply gives too much overhead --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 71ee719de1..999ddf19c3 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -397,9 +397,9 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): label = entry.find("./um:label", self.__namespaces) if label is not None: - self.setName(label.text) + self._name = label.text else: - self.setName(self._profile_name(material.text, color.text)) + self._name = self._profile_name(material.text, color.text) meta_data["brand"] = brand.text meta_data["material"] = material.text meta_data["color_name"] = color.text @@ -485,7 +485,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): else: new_material = XmlMaterialProfile(new_material_id) - new_material.setName(self.getName()) + # Update the private directly, as we want to prevent the lookup that is done when using setName + new_material._name = self.getName() new_material.setMetaData(copy.deepcopy(self.getMetaData())) new_material.setDefinition(definition) # Don't use setMetadata, as that overrides it for all materials with same base file @@ -534,7 +535,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): else: new_hotend_material = XmlMaterialProfile(new_hotend_id) - new_hotend_material.setName(self.getName()) + # Update the private directly, as we want to prevent the lookup that is done when using setName + new_hotend_material._name = self.getName() new_hotend_material.setMetaData(copy.deepcopy(self.getMetaData())) new_hotend_material.setDefinition(definition) new_hotend_material.addMetaDataEntry("variant", variant_containers[0].id) From 5e5cc723d79d403f994567dd092881beb23b415c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 10 Feb 2017 15:03:34 +0100 Subject: [PATCH 166/197] Calling the stop of USBPrinterOutput device no longer joins the thread. This caused quite a bit of delay on the application closing down (up to 5 seconds!) --- plugins/USBPrinting/USBPrinterOutputDeviceManager.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index 4dec2e3a06..84f1d26e16 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -79,10 +79,6 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension): def stop(self): self._check_updates = False - try: - self._update_thread.join() - except RuntimeError: - pass def _updateThread(self): while self._check_updates: From 6629c8d0cf3cbf296d237f65675877718cc147e3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 15:27:32 +0100 Subject: [PATCH 167/197] Anchor last-row extruder box to left and right to stretch it Layout.fillwidth seems to only stretch the box to full width on the first row, but without it the entire thing doesn't stretch. Leaving the width out will make the entire left column stretch so that the right column is no longer visible. It's all a bit weird, this QML stuff. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index f088e49c85..8abc5ec2c4 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -85,6 +85,8 @@ Column width: extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2 height: UM.Theme.getSize("sidebar_extruder_box").height Layout.fillWidth: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 + anchors.right: (index == machineExtruderCount.properties.value - 1 && index % 2 == 0) ? parent.right : undefined + anchors.left: (index == machineExtruderCount.properties.value - 1 && index % 2 == 0) ? parent.left : undefined Label //Extruder name. { From 5e3782e6c3005cf703d6fdb7a0b780f3ce7f0487 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 10 Feb 2017 15:44:45 +0100 Subject: [PATCH 168/197] Added more authentication logging to network printing --- .../NetworkPrinterOutputDevice.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 549c0905d6..47b1068b08 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -197,11 +197,11 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def _onAuthenticationRequired(self, reply, authenticator): if self._authentication_id is not None and self._authentication_key is not None: - Logger.log("d", "Authentication was required. Setting up authenticator.") + Logger.log("d", "Authentication was required. Setting up authenticator with ID %s",self._authentication_id ) authenticator.setUser(self._authentication_id) authenticator.setPassword(self._authentication_key) else: - Logger.log("d", "No authentication was required. The id is: %s", self._authentication_id) + Logger.log("d", "No authentication was required. The ID is: %s", self._authentication_id) def getProperties(self): return self._properties @@ -643,9 +643,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): ## Check if this machine was authenticated before. self._authentication_id = Application.getInstance().getGlobalContainerStack().getMetaDataEntry("network_authentication_id", None) self._authentication_key = Application.getInstance().getGlobalContainerStack().getMetaDataEntry("network_authentication_key", None) - + Logger.log("d", "Loaded authentication id %s from the metadata entry", self._authentication_id) self._update_timer.start() - #self.startCamera() ## Stop requesting data from printer def disconnect(self): @@ -760,7 +759,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): ## Check if the authentication request was allowed by the printer. def _checkAuthentication(self): - Logger.log("d", "Checking if authentication is correct.") + Logger.log("d", "Checking if authentication is correct for id %", self._authentication_id) self._manager.get(QNetworkRequest(QUrl("http://" + self._address + self._api_prefix + "auth/check/" + str(self._authentication_id)))) ## Request a authentication key from the printer so we can be authenticated @@ -907,7 +906,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): if status_code == 401: if self._authentication_state != AuthState.AuthenticationRequested: # Only request a new authentication when we have not already done so. - Logger.log("i", "Not authenticated. Attempting to request authentication") + Logger.log("i", "Not authenticated (Current auth state is %s). Attempting to request authentication", self._authentication_state ) self._requestAuthentication() elif status_code == 403: # If we already had an auth (eg; didn't request one), we only need a single 403 to see it as denied. @@ -917,6 +916,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): elif status_code == 200: self.setAuthenticationState(AuthState.Authenticated) global_container_stack = Application.getInstance().getGlobalContainerStack() + ## Save authentication details. if global_container_stack: if "network_authentication_key" in global_container_stack.getMetaData(): @@ -928,9 +928,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): else: global_container_stack.addMetaDataEntry("network_authentication_id", self._authentication_id) Application.getInstance().saveStack(global_container_stack) # Force save so we are sure the data is not lost. - Logger.log("i", "Authentication succeeded") + Logger.log("i", "Authentication succeeded for id %s", self._authentication_id) else: # Got a response that we didn't expect, so something went wrong. - Logger.log("w", "While trying to authenticate, we got an unexpected response: %s", reply.attribute(QNetworkRequest.HttpStatusCodeAttribute)) + Logger.log("e", "While trying to authenticate, we got an unexpected response: %s", reply.attribute(QNetworkRequest.HttpStatusCodeAttribute)) self.setAuthenticationState(AuthState.NotAuthenticated) elif "auth/check" in reply_url: # Check if we are authenticated (user can refuse this!) @@ -951,6 +951,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): global_container_stack = Application.getInstance().getGlobalContainerStack() if global_container_stack: # Remove any old data. + Logger.log("d", "Removing old network authentication data as a new one was requested.") global_container_stack.removeMetaDataEntry("network_authentication_key") global_container_stack.removeMetaDataEntry("network_authentication_id") Application.getInstance().saveStack(global_container_stack) # Force saving so we don't keep wrong auth data. From 440508f0025d2f35b01964b95294eb332034d4de Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 16:05:18 +0100 Subject: [PATCH 169/197] Don't display material if an unknown material is given This makes it more clear for the cases other than UM3. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 8abc5ec2c4..6f8345aae7 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -109,10 +109,10 @@ Column id: materialColor width: materialName.height * 0.75 height: materialName.height * 0.75 - color: (connectedPrinter != null && connectedPrinter.materialColors[index] != null) ? connectedPrinter.materialColors[index] : "#00000000" + color: (connectedPrinter != null && connectedPrinter.materialColors[index] != null && connectedPrinter.materialIds[index] != "") ? connectedPrinter.materialColors[index] : "#00000000" border.width: UM.Theme.getSize("default_lining").width border.color: UM.Theme.getColor("lining") - visible: (connectedPrinter != null && connectedPrinter.materialColors[index] != null) + visible: connectedPrinter != null && connectedPrinter.materialColors[index] != null && connectedPrinter.materialIds[index] != "" anchors.left: parent.left anchors.leftMargin: UM.Theme.getSize("default_margin").width anchors.verticalCenter: materialName.verticalCenter @@ -120,7 +120,7 @@ Column Label //Material name. { id: materialName - text: (connectedPrinter != null && connectedPrinter.materialNames[index] != null) ? connectedPrinter.materialNames[index] : "" + text: (connectedPrinter != null && connectedPrinter.materialNames[index] != null && connectedPrinter.materialIds[index] != "") ? connectedPrinter.materialNames[index] : "" font: UM.Theme.getFont("default") color: UM.Theme.getColor("text") anchors.left: materialColor.right From d3147a6e97f1bbc6b64d177e841b458734127264 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 16:07:16 +0100 Subject: [PATCH 170/197] Add font for extruder name label This allows it to get stylised. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 6f8345aae7..686dd11e3a 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -92,6 +92,7 @@ Column { text: (machineExtruderCount.properties.value > 1 && extrudersModel.getItem(index).name != null) ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") color: UM.Theme.getColor("text") + font: UM.Them.getFont("default") anchors.left: parent.left anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width From 185f5fe1c496d6af9d76328d091effd828016e77 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Fri, 10 Feb 2017 16:41:49 +0100 Subject: [PATCH 171/197] Added a clarification to the changelog regarding the inital print temperature --- plugins/ChangeLogPlugin/ChangeLog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ChangeLogPlugin/ChangeLog.txt b/plugins/ChangeLogPlugin/ChangeLog.txt index ed4d6888d3..f59a8846c3 100644 --- a/plugins/ChangeLogPlugin/ChangeLog.txt +++ b/plugins/ChangeLogPlugin/ChangeLog.txt @@ -24,7 +24,7 @@ When slicing is blocked by settings with error values, a message now appears, cl The initial and final printing temperatures reduce the amount of oozing during PLA-PLA, PLA-PVA and Nylon-PVA prints. This means printing a prime tower is now optional (except for CPE and ABS at the moment). The new Ultimaker 3 printing profiles ensure increased reliability and shorter print time. *Initial Layer Printing Temperature -Initial and final printing temperature settings have been tuned for higher quality results. +Initial and final printing temperature settings have been tuned for higher quality results. For all materials the initial print temperature is 5 degrees above the default value. *Printing temperature of the materials The printing temperature of the materials in the material profiles is now the same as the printing temperature for the Normal Quality profile. From 050f76e11db46ade1dee795a25dadc5ae5db3ea5 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 10 Feb 2017 18:09:34 +0100 Subject: [PATCH 172/197] Update quality profiles from material research This locks initial layer speed at 20, without scaling from the normal print speed. It also adjusts some jerk and speed of support infill. --- .../quality/ultimaker3/um3_aa0.4_ABS_Draft_Print.inst.cfg | 2 +- .../quality/ultimaker3/um3_aa0.4_ABS_Fast_Print.inst.cfg | 2 +- .../quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg | 2 +- .../ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg | 2 +- .../quality/ultimaker3/um3_aa0.4_CPE_Draft_Print.inst.cfg | 2 +- .../quality/ultimaker3/um3_aa0.4_CPE_Fast_Print.inst.cfg | 2 +- .../quality/ultimaker3/um3_aa0.4_CPE_High_Quality.inst.cfg | 2 +- .../ultimaker3/um3_aa0.4_CPE_Normal_Quality.inst.cfg | 2 +- .../quality/ultimaker3/um3_aa0.4_PLA_Draft_Print.inst.cfg | 1 + .../quality/ultimaker3/um3_aa0.4_PLA_Fast_Print.inst.cfg | 2 +- .../quality/ultimaker3/um3_aa0.4_PLA_High_Quality.inst.cfg | 2 +- .../ultimaker3/um3_aa0.4_PLA_Normal_Quality.inst.cfg | 1 + .../quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg | 6 ++++-- .../quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg | 7 ++++--- .../quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg | 6 ++++-- .../ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg | 7 ++++--- 16 files changed, 28 insertions(+), 20 deletions(-) diff --git a/resources/quality/ultimaker3/um3_aa0.4_ABS_Draft_Print.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_ABS_Draft_Print.inst.cfg index 97733a9858..00d93f3575 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_ABS_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_ABS_Draft_Print.inst.cfg @@ -18,7 +18,7 @@ material_final_print_temperature = =material_print_temperature - 10 prime_tower_size = 16 skin_overlap = 20 speed_print = 60 -speed_layer_0 = =round(speed_print * 30 / 60) +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 35 / 60) speed_wall = =math.ceil(speed_print * 45 / 60) speed_wall_0 = =math.ceil(speed_wall * 35 / 45) diff --git a/resources/quality/ultimaker3/um3_aa0.4_ABS_Fast_Print.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_ABS_Fast_Print.inst.cfg index f635afd255..066a044ee0 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_ABS_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_ABS_Fast_Print.inst.cfg @@ -19,7 +19,7 @@ material_final_print_temperature = =material_print_temperature - 10 material_standby_temperature = 100 prime_tower_size = 16 speed_print = 60 -speed_layer_0 = =round(speed_print * 30 / 60) +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 60) speed_wall = =math.ceil(speed_print * 40 / 60) speed_wall_0 = =math.ceil(speed_wall * 30 / 40) diff --git a/resources/quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg index fc5be26a52..850af33c27 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_ABS_High_Quality.inst.cfg @@ -19,7 +19,7 @@ material_initial_print_temperature = =material_print_temperature - 5 material_final_print_temperature = =material_print_temperature - 10 prime_tower_size = 16 speed_print = 50 -speed_layer_0 = =round(speed_print * 30 / 50) +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 50) speed_wall = =math.ceil(speed_print * 30 / 50) diff --git a/resources/quality/ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg index 91f55b3b6d..3793bf8b5e 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_ABS_Normal_Quality.inst.cfg @@ -17,7 +17,7 @@ material_final_print_temperature = =material_print_temperature - 10 material_standby_temperature = 100 prime_tower_size = 16 speed_print = 55 -speed_layer_0 = =round(speed_print * 30 / 55) +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 55) speed_wall = =math.ceil(speed_print * 30 / 55) diff --git a/resources/quality/ultimaker3/um3_aa0.4_CPE_Draft_Print.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_CPE_Draft_Print.inst.cfg index b6d6bc80b9..7a536ce033 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_CPE_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_CPE_Draft_Print.inst.cfg @@ -17,7 +17,7 @@ material_standby_temperature = 100 prime_tower_size = 17 skin_overlap = 20 speed_print = 60 -speed_layer_0 = =round(speed_print * 30 / 60) +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 35 / 60) speed_wall = =math.ceil(speed_print * 45 / 60) speed_wall_0 = =math.ceil(speed_wall * 35 / 45) diff --git a/resources/quality/ultimaker3/um3_aa0.4_CPE_Fast_Print.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_CPE_Fast_Print.inst.cfg index 3649b3fb5c..96467fe36c 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_CPE_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_CPE_Fast_Print.inst.cfg @@ -17,7 +17,7 @@ material_final_print_temperature = =material_print_temperature - 10 material_standby_temperature = 100 prime_tower_size = 17 speed_print = 60 -speed_layer_0 = =round(speed_print * 30 / 60) +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 60) speed_wall = =math.ceil(speed_print * 40 / 60) speed_wall_0 = =math.ceil(speed_wall * 30 / 40) diff --git a/resources/quality/ultimaker3/um3_aa0.4_CPE_High_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_CPE_High_Quality.inst.cfg index cc5cbcea30..1fd6167e67 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_CPE_High_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_CPE_High_Quality.inst.cfg @@ -19,7 +19,7 @@ material_final_print_temperature = =material_print_temperature - 10 material_standby_temperature = 100 prime_tower_size = 17 speed_print = 50 -speed_layer_0 = =round(speed_print * 30 / 50) +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 50) speed_wall = =math.ceil(speed_print * 30 / 50) diff --git a/resources/quality/ultimaker3/um3_aa0.4_CPE_Normal_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_CPE_Normal_Quality.inst.cfg index 68f8419640..5ad1ef6b43 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_CPE_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_CPE_Normal_Quality.inst.cfg @@ -17,7 +17,7 @@ material_final_print_temperature = =material_print_temperature - 10 material_standby_temperature = 100 prime_tower_size = 17 speed_print = 55 -speed_layer_0 = =round(speed_print * 30 / 55) +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 55) speed_wall = =math.ceil(speed_print * 30 / 55) diff --git a/resources/quality/ultimaker3/um3_aa0.4_PLA_Draft_Print.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_PLA_Draft_Print.inst.cfg index cd411fc241..eb56b0aa4c 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_PLA_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_PLA_Draft_Print.inst.cfg @@ -18,6 +18,7 @@ material_print_temperature = =default_material_print_temperature + 5 material_standby_temperature = 100 prime_tower_enable = False skin_overlap = 20 +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 35 / 70) speed_wall = =math.ceil(speed_print * 50 / 70) speed_wall_0 = =math.ceil(speed_wall * 35 / 50) diff --git a/resources/quality/ultimaker3/um3_aa0.4_PLA_Fast_Print.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_PLA_Fast_Print.inst.cfg index c0b28ca6b7..c5faa17a2b 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_PLA_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_PLA_Fast_Print.inst.cfg @@ -17,7 +17,7 @@ machine_nozzle_heat_up_speed = 1.6 material_standby_temperature = 100 prime_tower_enable = False speed_print = 80 -speed_layer_0 = =round(speed_print * 30 / 80) +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 80) speed_wall = =math.ceil(speed_print * 40 / 80) speed_wall_0 = =math.ceil(speed_wall * 30 / 40) diff --git a/resources/quality/ultimaker3/um3_aa0.4_PLA_High_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_PLA_High_Quality.inst.cfg index eff3a3971b..1a6db5e3b5 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_PLA_High_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_PLA_High_Quality.inst.cfg @@ -20,7 +20,7 @@ material_standby_temperature = 100 prime_tower_enable = False skin_overlap = 10 speed_print = 60 -speed_layer_0 = =round(speed_print * 30 / 60) +speed_layer_0 = 20 speed_topbottom = =math.ceil(speed_print * 30 / 60) speed_wall = =math.ceil(speed_print * 30 / 60) top_bottom_thickness = 1 diff --git a/resources/quality/ultimaker3/um3_aa0.4_PLA_Normal_Quality.inst.cfg b/resources/quality/ultimaker3/um3_aa0.4_PLA_Normal_Quality.inst.cfg index 84d9a5a001..c7a7be37c0 100644 --- a/resources/quality/ultimaker3/um3_aa0.4_PLA_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_aa0.4_PLA_Normal_Quality.inst.cfg @@ -18,6 +18,7 @@ machine_nozzle_heat_up_speed = 1.6 material_standby_temperature = 100 prime_tower_enable = False skin_overlap = 10 +speed_layer_0 = 20 top_bottom_thickness = 1 wall_thickness = 1 diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg index bf10c55ae9..83fd52a1fd 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Draft_Print.inst.cfg @@ -12,13 +12,15 @@ material = generic_pva_ultimaker3_BB_0.4 [values] acceleration_support = =math.ceil(acceleration_print * 500 / 4000) acceleration_support_infill = =acceleration_support -acceleration_support_interface = =acceleration_support jerk_support = =math.ceil(jerk_print * 5 / 25) jerk_support_infill = =jerk_support -jerk_support_interface = =jerk_support material_print_temperature = =default_material_print_temperature + 10 material_standby_temperature = 100 skin_overlap = 20 support_interface_height = 0.8 prime_tower_enable = False +speed_support_interface = =math.ceil(speed_support * 20 / 25) +jerk_support_interface = =math.ceil(jerk_support * 1 / 5) +acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 ) +support_xy_distance = =round(line_width * 1.5, 2) diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg index 2c6cb4af1a..582d6e9c76 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Fast_Print.inst.cfg @@ -12,13 +12,14 @@ material = generic_pva_ultimaker3_BB_0.4 [values] acceleration_support = =math.ceil(acceleration_print * 500 / 4000) acceleration_support_infill = =acceleration_support -acceleration_support_interface = =acceleration_support jerk_support = =math.ceil(jerk_print * 5 / 25) jerk_support_infill = =jerk_support -jerk_support_interface = =jerk_support material_print_temperature = =default_material_print_temperature + 5 material_standby_temperature = 100 skin_overlap = 15 support_interface_height = 0.8 prime_tower_enable = False - +speed_support_interface = =math.ceil(speed_support * 20 / 25) +jerk_support_interface = =math.ceil(jerk_support * 1 / 5) +acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 ) +support_xy_distance = =round(line_width * 1.5, 2) diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg index 331539dedf..fc6be3ea3d 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_High_Quality.inst.cfg @@ -12,12 +12,14 @@ material = generic_pva_ultimaker3_BB_0.4 [values] acceleration_support = =math.ceil(acceleration_print * 500 / 4000) acceleration_support_infill = =acceleration_support -acceleration_support_interface = =acceleration_support jerk_support = =math.ceil(jerk_print * 5 / 25) jerk_support_infill = =jerk_support -jerk_support_interface = =jerk_support support_infill_rate = 25 support_interface_height = 0.8 material_standby_temperature = 100 prime_tower_enable = False +speed_support_interface = =math.ceil(speed_support * 20 / 25) +jerk_support_interface = =math.ceil(jerk_support * 1 / 5) +acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 ) +support_xy_distance = =round(line_width * 1.5, 2) diff --git a/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg b/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg index 7ffda14a08..5eb690fa99 100644 --- a/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg +++ b/resources/quality/ultimaker3/um3_bb0.4_PVA_Normal_Quality.inst.cfg @@ -12,12 +12,13 @@ material = generic_pva_ultimaker3_BB_0.4 [values] acceleration_support = =math.ceil(acceleration_print * 500 / 4000) acceleration_support_infill = =acceleration_support -acceleration_support_interface = =acceleration_support jerk_support = =math.ceil(jerk_print * 5 / 25) jerk_support_infill = =jerk_support -jerk_support_interface = =jerk_support support_infill_rate = 25 support_interface_height = 0.8 material_standby_temperature = 100 prime_tower_enable = False - +speed_support_interface = =math.ceil(speed_support * 20 / 25) +jerk_support_interface = =math.ceil(jerk_support * 1 / 5) +acceleration_support_interface = =math.ceil(acceleration_support * 100 / 500 ) +support_xy_distance = =round(line_width * 1.5, 2) From 2fca555ea69a627b268e8c654114e41d226c1bf7 Mon Sep 17 00:00:00 2001 From: Torsten Blindert Date: Sat, 11 Feb 2017 16:34:49 +0100 Subject: [PATCH 173/197] FEATURE: Support wsh usb driver --- plugins/USBPrinting/USBPrinterOutputDeviceManager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index 84f1d26e16..666ec4c856 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -267,7 +267,7 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension): pass else: if only_list_usb: - base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.usb*") + base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.usb*") + glob.glob("/dev/tty.wchusb*") + glob.glob("/dev/cu.wchusb*") base_list = filter(lambda s: "Bluetooth" not in s, base_list) # Filter because mac sometimes puts them in the list else: base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.*") + glob.glob("/dev/tty.usb*") + glob.glob("/dev/rfcomm*") + glob.glob("/dev/serial/by-id/*") From 88395ebb6a89422681b6fb56cd09c2810bf0590f Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Sun, 12 Feb 2017 20:36:48 +0100 Subject: [PATCH 174/197] Reliability fix and more debug for testing purposes. CURA-3335 Single instance Cura and model reloading --- cura/CuraApplication.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 428639aafc..3e2099f8cb 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -435,6 +435,7 @@ class CuraApplication(QtApplication): self.__single_instance_server = QLocalServer() self.__single_instance_server.newConnection.connect(self._singleInstanceServerNewConnection) self.__single_instance_server.listen("ultimaker-cura") + Logger.log("d","Single-instance: Listening on: " + repr(self.__single_instance_server.fullServerName())) def _singleInstanceServerNewConnection(self): Logger.log("i", "New connection recevied on our single-instance server") @@ -442,9 +443,11 @@ class CuraApplication(QtApplication): if remote_cura_connection is not None: def readCommands(): + Logger.log("d", "Single-instance: readCommands()") line = remote_cura_connection.readLine() while len(line) != 0: # There is also a .canReadLine() try: + Logger.log("d", "Single-instance: Read command line: " + repr(line)) payload = json.loads(str(line, encoding="ASCII").strip()) command = payload["command"] @@ -464,6 +467,10 @@ class CuraApplication(QtApplication): # 'alert' or flashing the icon in the taskbar is the best thing we do now. self.getMainWindow().alert(0) + # Command: Close the socket connection. We're done. + elif command == "close-connection": + remote_cura_connection.close() + else: Logger.log("w", "Received an unrecognized command " + str(command)) except json.decoder.JSONDecodeError as ex: @@ -471,7 +478,11 @@ class CuraApplication(QtApplication): line = remote_cura_connection.readLine() remote_cura_connection.readyRead.connect(readCommands) - remote_cura_connection.disconnected.connect(readCommands) # Get any last commands before it is destroyed. + def disconnected(): + Logger.log("d", "Single-instance: Disconnected") + readCommands() + Logger.log("d", "Single-instance: Finished disconnected") + remote_cura_connection.disconnected.connect(disconnected) # Get any last commands before it is destroyed. ## Perform any checks before creating the main application. # @@ -487,6 +498,7 @@ class CuraApplication(QtApplication): if "single_instance" in parsed_command_line and parsed_command_line["single_instance"]: Logger.log("i", "Checking for the presence of an ready running Cura instance.") single_instance_socket = QLocalSocket() + Logger.log("d", "preStartUp(): full server name: " + single_instance_socket.fullServerName()) single_instance_socket.connectToServer("ultimaker-cura") single_instance_socket.waitForConnected() if single_instance_socket.state() == QLocalSocket.ConnectedState: @@ -506,8 +518,12 @@ class CuraApplication(QtApplication): for filename in parsed_command_line["file"]: payload = {"command": "open", "filePath": filename} single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) + + payload = {"command": "close-connection"} + single_instance_socket.write(bytes(json.dumps(payload) + "\n", encoding="ASCII")) + single_instance_socket.flush() - single_instance_socket.close() + single_instance_socket.waitForDisconnected() return False return True From a3170041f8b70a3144e2cd676baf166dbad6aa70 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 13 Feb 2017 09:15:58 +0100 Subject: [PATCH 175/197] Fix typo of theme This was giving a warning that we couldn't get a font from undefined. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 686dd11e3a..7e3c4e4b45 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -92,7 +92,7 @@ Column { text: (machineExtruderCount.properties.value > 1 && extrudersModel.getItem(index).name != null) ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") color: UM.Theme.getColor("text") - font: UM.Them.getFont("default") + font: UM.Theme.getFont("default") anchors.left: parent.left anchors.top: parent.top anchors.margins: UM.Theme.getSize("default_margin").width From 2722ac5a8f93f50529bed24bb8931c9a13f2ee27 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 13 Feb 2017 09:32:16 +0100 Subject: [PATCH 176/197] Re-use repeater count instead of listening to machineExtruderCount everywhere Might be slightly more efficient and/or update stuff in the correct order. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 7e3c4e4b45..43f771296a 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -77,6 +77,7 @@ Column Repeater { + id: extrudersRepeater model: machineExtruderCount.properties.value delegate: Rectangle { @@ -84,13 +85,13 @@ Column color: UM.Theme.getColor("sidebar") width: extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2 height: UM.Theme.getSize("sidebar_extruder_box").height - Layout.fillWidth: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 - anchors.right: (index == machineExtruderCount.properties.value - 1 && index % 2 == 0) ? parent.right : undefined - anchors.left: (index == machineExtruderCount.properties.value - 1 && index % 2 == 0) ? parent.left : undefined + Layout.fillWidth: index == extrudersRepeater.count - 1 && index % 2 == 0 + anchors.right: (index == extrudersRepeater.count - 1 && index % 2 == 0) ? parent.right : undefined + anchors.left: (index == extrudersRepeater.count - 1 && index % 2 == 0) ? parent.left : undefined Label //Extruder name. { - text: (machineExtruderCount.properties.value > 1 && extrudersModel.getItem(index).name != null) ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") + text: (extrudersRepeater.count > 1 && extrudersModel.getItem(index).name != null) ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") anchors.left: parent.left From c2c61c4331f3861225d0db5790ca1af30002c616 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 13 Feb 2017 09:35:09 +0100 Subject: [PATCH 177/197] Improve condition for extruder name fallback In effect this has no change. But semantically it is better: If there are no extruders or the extruders have no name, use 'hotend'. Otherwise use the available name. It has nothing to do with the amount of extruders. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 43f771296a..9865f94232 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -91,7 +91,7 @@ Column Label //Extruder name. { - text: (extrudersRepeater.count > 1 && extrudersModel.getItem(index).name != null) ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") + text: (extrudersModel.getItem(index) != null && extrudersModel.getItem(index).name != null) ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") anchors.left: parent.left From 40f32449c6d3747755b3d3193fa59174d694116e Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 13 Feb 2017 09:38:02 +0100 Subject: [PATCH 178/197] Remove unnecessary watched properties from machineExtruderCount Since we don't change the colour of the input box right now, we won't need the warning values. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 9865f94232..c10fd03464 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -474,7 +474,7 @@ Column id: bedTemperature containerStackId: Cura.MachineManager.activeMachineId key: "material_bed_temperature" - watchedProperties: ["value", "minimum_value", "maximum_value", "minimum_value_warning", "maximum_value_warning", "resolve"] + watchedProperties: ["value", "minimum_value", "maximum_value", "resolve"] storeIndex: 0 property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None" From c18fb02f8256a152597357eb58bae139720d4cc1 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 13 Feb 2017 11:06:21 +0100 Subject: [PATCH 179/197] Removed unneeded (and somewhat expensive) checks CURA-3311 --- .../XmlMaterialProfile/XmlMaterialProfile.py | 25 ++++++------------- 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 999ddf19c3..4364f8c423 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -477,13 +477,7 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): if machine_compatibility: new_material_id = self.id + "_" + machine_id - # It could be that we are overwriting, so check if the ID already exists. - materials = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=new_material_id) - if materials: - new_material = materials[0] - new_material.clearData() - else: - new_material = XmlMaterialProfile(new_material_id) + new_material = XmlMaterialProfile(new_material_id) # Update the private directly, as we want to prevent the lookup that is done when using setName new_material._name = self.getName() @@ -495,8 +489,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): new_material.setCachedValues(cached_machine_setting_properties) new_material._dirty = False - if not materials: - UM.Settings.ContainerRegistry.getInstance().addContainer(new_material) + + UM.Settings.ContainerRegistry.getInstance().addContainer(new_material) hotends = machine.iterfind("./um:hotend", self.__namespaces) for hotend in hotends: @@ -526,14 +520,9 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): else: Logger.log("d", "Unsupported material setting %s", key) - # It could be that we are overwriting, so check if the ID already exists. new_hotend_id = self.id + "_" + machine_id + "_" + hotend_id.replace(" ", "_") - materials = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(id=new_hotend_id) - if materials: - new_hotend_material = materials[0] - new_hotend_material.clearData() - else: - new_hotend_material = XmlMaterialProfile(new_hotend_id) + + new_hotend_material = XmlMaterialProfile(new_hotend_id) # Update the private directly, as we want to prevent the lookup that is done when using setName new_hotend_material._name = self.getName() @@ -549,8 +538,8 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer): new_hotend_material.setCachedValues(cached_hotend_setting_properties) new_hotend_material._dirty = False - if not materials: # It was not added yet, do so now. - UM.Settings.ContainerRegistry.getInstance().addContainer(new_hotend_material) + + UM.Settings.ContainerRegistry.getInstance().addContainer(new_hotend_material) def _addSettingElement(self, builder, instance): try: From adbcd874a84d831d7c9028e918382d20be95815a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 13 Feb 2017 11:52:46 +0100 Subject: [PATCH 180/197] Add SettingPropertyProvider for machineExtruderCount here too It's not necessary, but this keeps it more localised. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index c10fd03464..ac7297b4ab 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -480,6 +480,14 @@ Column property var resolve: Cura.MachineManager.activeStackId != Cura.MachineManager.activeMachineId ? properties.resolve : "None" } + UM.SettingPropertyProvider + { + id: machineExtruderCount + containerStackId: Cura.MachineManager.activeMachineId + key: "machine_extruder_count" + watchedProperties: ["value"] + } + Loader { sourceComponent: monitorSection From 77f07bbc1d3f921613d99470ffadf3dded5ad622 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 13 Feb 2017 11:54:12 +0100 Subject: [PATCH 181/197] Use Flow for extruder boxes instead of GridLayout Flow makes things a lot more simple with the double-width item at the bottom. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index ac7297b4ab..93cbaafffb 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -67,27 +67,23 @@ Column width: parent.width height: childrenRect.height - GridLayout + Flow { id: extrudersGrid - columns: 2 - columnSpacing: UM.Theme.getSize("sidebar_lining_thin").width - rowSpacing: UM.Theme.getSize("sidebar_lining_thin").height + spacing: UM.Theme.getSize("sidebar_lining_thin").width width: parent.width Repeater { id: extrudersRepeater model: machineExtruderCount.properties.value + delegate: Rectangle { id: extruderRectangle color: UM.Theme.getColor("sidebar") - width: extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2 + width: index == machineExtruderCount.properties.value - 1 && index % 2 == 0 ? extrudersGrid.width : extrudersGrid.width / 2 - UM.Theme.getSize("sidebar_lining_thin").width / 2 height: UM.Theme.getSize("sidebar_extruder_box").height - Layout.fillWidth: index == extrudersRepeater.count - 1 && index % 2 == 0 - anchors.right: (index == extrudersRepeater.count - 1 && index % 2 == 0) ? parent.right : undefined - anchors.left: (index == extrudersRepeater.count - 1 && index % 2 == 0) ? parent.left : undefined Label //Extruder name. { From 34dccfd6a63fba57b872c68891b49a36000e41fc Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 13 Feb 2017 11:57:01 +0100 Subject: [PATCH 182/197] Fix updating extruder names on machine switch The extruder name is asked from the extruder manager, so that the signal from extruder manager properly updates it once the new name is available. Contributes to issue CURA-3161. --- cura/Settings/ExtruderManager.py | 10 ++++++++++ resources/qml/PrintMonitor.qml | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/cura/Settings/ExtruderManager.py b/cura/Settings/ExtruderManager.py index 81579f74d0..77e8683e06 100644 --- a/cura/Settings/ExtruderManager.py +++ b/cura/Settings/ExtruderManager.py @@ -103,6 +103,16 @@ class ExtruderManager(QObject): def activeExtruderIndex(self): return self._active_extruder_index + ## Gets the extruder name of an extruder of the currently active machine. + # + # \param index The index of the extruder whose name to get. + @pyqtSlot(int, result = str) + def getExtruderName(self, index): + try: + return list(self.getActiveExtruderStacks())[index].getName() + except IndexError: + return "" + def getActiveExtruderStack(self): global_container_stack = UM.Application.getInstance().getGlobalContainerStack() if global_container_stack: diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 93cbaafffb..7c220ab7a2 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -87,7 +87,7 @@ Column Label //Extruder name. { - text: (extrudersModel.getItem(index) != null && extrudersModel.getItem(index).name != null) ? extrudersModel.getItem(index).name : catalog.i18nc("@label", "Hotend") + text: ExtruderManager.getExtruderName(index) != "" ? ExtruderManager.getExtruderName(index) : catalog.i18nc("@label", "Hotend") color: UM.Theme.getColor("text") font: UM.Theme.getFont("default") anchors.left: parent.left From 234130eb7af3bd0b51cb2a7c4b4d5d849bee0bc8 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 13 Feb 2017 11:57:34 +0100 Subject: [PATCH 183/197] Added a static "app version" method. CURA-3335 Single instance Cura and model reloading --- cura/CuraApplication.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 3e2099f8cb..49f1bac716 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -405,6 +405,10 @@ class CuraApplication(QtApplication): def setDefaultPath(self, key, default_path): Preferences.getInstance().setValue("local_file/%s" % key, QUrl(default_path).toLocalFile()) + @classmethod + def getStaticVersion(cls): + return CuraVersion + ## Handle loading of all plugin types (and the backend explicitly) # \sa PluginRegistery def _loadPlugins(self): From 2724af7508208a8e5119a1f48b3deaf1e020e54c Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 13 Feb 2017 12:01:27 +0100 Subject: [PATCH 184/197] Add lining between bottom of extruders and build plate boxes Using margins for this is not applicable since it was the background of the rectangle around the flow that has the correct lining colour. So this is manually adding a line. Contributes to issue CURA-3161. --- resources/qml/PrintMonitor.qml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 7c220ab7a2..7a150a1757 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -139,6 +139,13 @@ Column } } + Rectangle + { + color: UM.Theme.getColor("sidebar_lining") + width: parent.width + height: UM.Theme.getSize("sidebar_lining_thin").width + } + Rectangle { color: UM.Theme.getColor("sidebar") From 8d7b813318d8a6f552d7c5bfa362ca384c1d50cd Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 13 Feb 2017 13:26:36 +0100 Subject: [PATCH 185/197] All good 20x http replies are now accepted --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 7df3c7bf23..2b2f24e5fd 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -1022,7 +1022,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): self._progress_message.hide() elif reply.operation() == QNetworkAccessManager.PutOperation: - if status_code == 204: + if status_code in [200, 201, 202, 204]: pass # Request was successful! else: Logger.log("d", "Something went wrong when trying to update data of API (%s). Message: %s Statuscode: %s", reply_url, reply.readAll(), status_code) From 2020ff5622e6dbd7d97917d4464616fb66a8ab07 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Mon, 13 Feb 2017 13:27:10 +0100 Subject: [PATCH 186/197] Removed the debug which we no longer need. CURA-3335 Single instance Cura and model reloading --- cura/CuraApplication.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 49f1bac716..e5eee35746 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -439,7 +439,6 @@ class CuraApplication(QtApplication): self.__single_instance_server = QLocalServer() self.__single_instance_server.newConnection.connect(self._singleInstanceServerNewConnection) self.__single_instance_server.listen("ultimaker-cura") - Logger.log("d","Single-instance: Listening on: " + repr(self.__single_instance_server.fullServerName())) def _singleInstanceServerNewConnection(self): Logger.log("i", "New connection recevied on our single-instance server") @@ -447,11 +446,9 @@ class CuraApplication(QtApplication): if remote_cura_connection is not None: def readCommands(): - Logger.log("d", "Single-instance: readCommands()") line = remote_cura_connection.readLine() while len(line) != 0: # There is also a .canReadLine() try: - Logger.log("d", "Single-instance: Read command line: " + repr(line)) payload = json.loads(str(line, encoding="ASCII").strip()) command = payload["command"] @@ -482,11 +479,6 @@ class CuraApplication(QtApplication): line = remote_cura_connection.readLine() remote_cura_connection.readyRead.connect(readCommands) - def disconnected(): - Logger.log("d", "Single-instance: Disconnected") - readCommands() - Logger.log("d", "Single-instance: Finished disconnected") - remote_cura_connection.disconnected.connect(disconnected) # Get any last commands before it is destroyed. ## Perform any checks before creating the main application. # From 6deaf5bd6523b781d523833a41fae581ef7fcaa9 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 13 Feb 2017 13:28:32 +0100 Subject: [PATCH 187/197] Failure logging for network printing is now more explicit (also prints what the operation was) --- .../UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 2b2f24e5fd..1c8426c053 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -1025,7 +1025,17 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): if status_code in [200, 201, 202, 204]: pass # Request was successful! else: - Logger.log("d", "Something went wrong when trying to update data of API (%s). Message: %s Statuscode: %s", reply_url, reply.readAll(), status_code) + operation_type = "Unknown" + if reply.operation() == QNetworkAccessManager.GetOperation: + operation_type = "Get" + elif reply.operation() == QNetworkAccessManager.PutOperation: + operation_type = "Put" + elif reply.operation() == QNetworkAccessManager.PostOperation: + operation_type = "Post" + elif reply.operation() == QNetworkAccessManager.DeleteOperation: + operation_type = "Delete" + + Logger.log("d", "Something went wrong when trying to update data of API (%s). Message: %s Statuscode: %s, operation: %s", reply_url, reply.readAll(), status_code, operation_type) else: Logger.log("d", "NetworkPrinterOutputDevice got an unhandled operation %s", reply.operation()) From f62030dae5e9e30979634b6ed1ae2749d3c8d438 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 13 Feb 2017 13:30:51 +0100 Subject: [PATCH 188/197] setTargetBed temperature now directly sets target temp This is instead of sending /bed/temperature a json which contains target & temp as keyvalue. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 1c8426c053..ea15fc597e 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -276,8 +276,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def _setTargetBedTemperature(self, temperature): if self._target_bed_temperature == temperature: return - url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/temperature") - data = """{"target": "%i"}""" % temperature + url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/temperature/target") + data = str(temperature) put_request = QNetworkRequest(url) put_request.setHeader(QNetworkRequest.ContentTypeHeader, "application/json") self._manager.put(put_request, data.encode()) From a3af887d3f6a9bd6ef16c6a3f675b6ec08b93756 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Mon, 13 Feb 2017 13:46:30 +0100 Subject: [PATCH 189/197] Add support for WSH USB driver when not filtering USB-only This support was included when filtering for USB only, but not the case when we are not filtering. I don't like this bit of code much since we should just define a list of paths to check and iterate over it, so that we can re-use the data and prevent syncing mistakes like this. --- plugins/USBPrinting/USBPrinterOutputDeviceManager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py index 666ec4c856..67e21e1abe 100644 --- a/plugins/USBPrinting/USBPrinterOutputDeviceManager.py +++ b/plugins/USBPrinting/USBPrinterOutputDeviceManager.py @@ -1,4 +1,4 @@ -# Copyright (c) 2015 Ultimaker B.V. +# Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. from UM.Signal import Signal, signalemitter @@ -270,7 +270,7 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension): base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.usb*") + glob.glob("/dev/tty.wchusb*") + glob.glob("/dev/cu.wchusb*") base_list = filter(lambda s: "Bluetooth" not in s, base_list) # Filter because mac sometimes puts them in the list else: - base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.*") + glob.glob("/dev/tty.usb*") + glob.glob("/dev/rfcomm*") + glob.glob("/dev/serial/by-id/*") + base_list = base_list + glob.glob("/dev/ttyUSB*") + glob.glob("/dev/ttyACM*") + glob.glob("/dev/cu.*") + glob.glob("/dev/tty.usb*") + glob.glob("/dev/tty.wchusb*") + glob.glob("/dev/cu.wchusb*") + glob.glob("/dev/rfcomm*") + glob.glob("/dev/serial/by-id/*") return list(base_list) _instance = None From cc396d535777b263d441c788113ba2c479251d5c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Mon, 13 Feb 2017 14:16:22 +0100 Subject: [PATCH 190/197] Fixed target temp never updating --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index ea15fc597e..18229f9d2d 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -276,6 +276,9 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def _setTargetBedTemperature(self, temperature): if self._target_bed_temperature == temperature: return + self._target_bed_temperature = temperature + self.targetBedTemperatureChanged.emit() + url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/temperature/target") data = str(temperature) put_request = QNetworkRequest(url) From 25fb3fed162e629485048b4384bc3aa997f678bd Mon Sep 17 00:00:00 2001 From: fieldOfView Date: Tue, 14 Feb 2017 10:38:33 +0100 Subject: [PATCH 191/197] Add missing label color One of the labels in the newly redesigned printmonitor is lacking a color, thus making the hotend temperature unstylable. --- resources/qml/PrintMonitor.qml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/qml/PrintMonitor.qml b/resources/qml/PrintMonitor.qml index 7a150a1757..6fffa0f902 100644 --- a/resources/qml/PrintMonitor.qml +++ b/resources/qml/PrintMonitor.qml @@ -97,6 +97,7 @@ Column Label //Temperature indication. { text: (connectedPrinter != null && connectedPrinter.hotendTemperatures[index] != null) ? Math.round(connectedPrinter.hotendTemperatures[index]) + "°C" : "" + color: UM.Theme.getColor("text") font: UM.Theme.getFont("large") anchors.right: parent.right anchors.top: parent.top From cb400f02573bbe9bacf334decd63db10e03b00fd Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 14 Feb 2017 13:36:03 +0100 Subject: [PATCH 192/197] Fix for a recent merge problem. --- cura/PrintInformation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 10e15a5549..b88613b0ac 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -7,7 +7,7 @@ from UM.FlameProfiler import pyqtSlot from UM.Application import Application from UM.Qt.Duration import Duration from UM.Preferences import Preferences -from UM.Settings import ContainerRegistry +from UM.Settings.ContainerRegistry import ContainerRegistry from cura.Settings.ExtruderManager import ExtruderManager From 4928c919428249e9b73e2536d425168c0464cd6f Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Tue, 14 Feb 2017 13:47:37 +0100 Subject: [PATCH 193/197] Make run_mypy.py slightly more cross platform. --- run_mypy.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/run_mypy.py b/run_mypy.py index 24c9d3ae31..25ab54c0bf 100644 --- a/run_mypy.py +++ b/run_mypy.py @@ -21,7 +21,10 @@ def findModules(path): return result def main(): - os.putenv("MYPYPATH", r".;.\plugins;.\plugins\VersionUpgrade;..\Uranium_hint\;..\Uranium_hint\stubs\\" ) + if sys.platform == "win32": + os.putenv("MYPYPATH", r".;.\plugins;.\plugins\VersionUpgrade;..\Uranium\;..\Uranium\stubs\\" ) + else: + os.putenv("MYPYPATH", r".:./plugins:./plugins/VersionUpgrade:../Uranium/:../Uranium\stubs/") # Mypy really needs to be run via its Python script otherwise it can't find its data files. mypyExe = where("mypy.bat" if sys.platform == "win32" else "mypy") From 5055c534c5c31f60ef046cc04c6333cdba21979a Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Feb 2017 16:57:21 +0100 Subject: [PATCH 194/197] Fix links to ContainerRegistry ContainerRegistry is no longer exposed in UM.Settings.__init__, so we must dig the class up from inside the module. Contributes to issue CURA-2917. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 6 +++--- plugins/UltimakerMachineActions/UMOUpgradeSelection.py | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 91b1df0f95..60e1c51ae8 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -8,7 +8,7 @@ from UM.Signal import signalemitter from UM.Message import Message -import UM.Settings +import UM.Settings.ContainerRegistry import UM.Version #To compare firmware version numbers. from cura.PrinterOutputDevice import PrinterOutputDevice, ConnectionState @@ -633,7 +633,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): remote_material_guid, material.getMetaDataEntry("GUID")) - remote_materials = UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "material", GUID = remote_material_guid, read_only = True) + remote_materials = UM.Settings.ContainerRegistry.ContainerRegistry.getInstance().findInstanceContainers(type = "material", GUID = remote_material_guid, read_only = True) remote_material_name = "Unknown" if remote_materials: remote_material_name = remote_materials[0].getName() @@ -824,7 +824,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): ## Send all material profiles to the printer. def sendMaterialProfiles(self): - for container in UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(type = "material"): + for container in UM.Settings.ContainerRegistry.ContainerRegistry.getInstance().findInstanceContainers(type = "material"): try: xml_data = container.serialize() if xml_data == "" or xml_data is None: diff --git a/plugins/UltimakerMachineActions/UMOUpgradeSelection.py b/plugins/UltimakerMachineActions/UMOUpgradeSelection.py index 2b76aa138f..238a13bf61 100644 --- a/plugins/UltimakerMachineActions/UMOUpgradeSelection.py +++ b/plugins/UltimakerMachineActions/UMOUpgradeSelection.py @@ -1,3 +1,6 @@ +# Copyright (c) 2017 Ultimaker B.V. +# Uranium is released under the terms of the AGPLv3 or higher. + from UM.Settings.ContainerRegistry import ContainerRegistry from UM.Settings.InstanceContainer import InstanceContainer from cura.MachineAction import MachineAction @@ -47,7 +50,7 @@ class UMOUpgradeSelection(MachineAction): definition_changes_container.setDefinition(definition) definition_changes_container.addMetaDataEntry("type", "definition_changes") - UM.Settings.ContainerRegistry.getInstance().addContainer(definition_changes_container) + UM.Settings.ContainerRegistry.ContainerRegistry.getInstance().addContainer(definition_changes_container) # Insert definition_changes between the definition and the variant global_container_stack.insertContainer(-1, definition_changes_container) From b488441d81f7ee898982b273877c85f37b51427b Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Feb 2017 17:00:33 +0100 Subject: [PATCH 195/197] Fix link to ContainerRegistry This one was forgotten because it is in a comment. Contributes to issue CURA-2917. --- plugins/XmlMaterialProfile/XmlMaterialProfile.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/XmlMaterialProfile/XmlMaterialProfile.py b/plugins/XmlMaterialProfile/XmlMaterialProfile.py index 24a545bbd3..ccc0dad08e 100644 --- a/plugins/XmlMaterialProfile/XmlMaterialProfile.py +++ b/plugins/XmlMaterialProfile/XmlMaterialProfile.py @@ -1,4 +1,4 @@ -# Copyright (c) 2016 Ultimaker B.V. +# Copyright (c) 2017 Ultimaker B.V. # Cura is released under the terms of the AGPLv3 or higher. import copy @@ -86,7 +86,7 @@ class XmlMaterialProfile(InstanceContainer): # super().setProperty(key, property_name, property_value) # # basefile = self.getMetaDataEntry("base_file", self._id) #if basefile is self.id, this is a basefile. - # for container in UM.Settings.ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): + # for container in UM.Settings.ContainerRegistry.ContainerRegistry.getInstance().findInstanceContainers(base_file = basefile): # if not container.isReadOnly(): # container.setDirty(True) From 42982b7a861f2eec2260300e0de935b1bbffb0c8 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Tue, 14 Feb 2017 17:03:37 +0100 Subject: [PATCH 196/197] Fix link to UM.Version.Version The Version object is no longer exposed via UM.__init__, so we have to dig inside the UM.Version module to get it. Contributes to issue CURA-2917. --- plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py index 60e1c51ae8..fbe8eb884d 100644 --- a/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py +++ b/plugins/UM3NetworkPrinting/NetworkPrinterOutputDevice.py @@ -251,7 +251,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice): def preheatBed(self, temperature, duration): temperature = round(temperature) #The API doesn't allow floating point. duration = round(duration) - if UM.Version(self.firmwareVersion) < UM.Version("3.5.92"): #Real bed pre-heating support is implemented from 3.5.92 and up. + if UM.Version.Version(self.firmwareVersion) < UM.Version.Version("3.5.92"): #Real bed pre-heating support is implemented from 3.5.92 and up. self.setTargetBedTemperature(temperature = temperature) #No firmware-side duration support then. return url = QUrl("http://" + self._address + self._api_prefix + "printer/bed/pre_heat") From 60d4e6e4fd553dc9cce471d5b78eb8132f7cfc17 Mon Sep 17 00:00:00 2001 From: Simon Edwards Date: Wed, 15 Feb 2017 08:53:18 +0100 Subject: [PATCH 197/197] Make the run_mypy.py script find Uranium via the PYTHONPATH env var. --- run_mypy.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/run_mypy.py b/run_mypy.py index 25ab54c0bf..88adea8db9 100644 --- a/run_mypy.py +++ b/run_mypy.py @@ -4,8 +4,7 @@ import sys import subprocess # A quick Python implementation of unix 'where' command. -def where(exeName): - searchPath = os.getenv("PATH") +def where(exeName, searchPath=os.getenv("PATH")): paths = searchPath.split(";" if sys.platform == "win32" else ":") for path in paths: candidatePath = os.path.join(path, exeName) @@ -21,10 +20,18 @@ def findModules(path): return result def main(): + # Find Uranium via the PYTHONPATH var + uraniumUMPath = where("UM", os.getenv("PYTHONPATH")) + if uraniumUMPath is None: + uraniumUMPath = os.path.join("..", "Uranium") + uraniumPath = os.path.dirname(uraniumUMPath) + + mypyPathParts = [".", os.path.join(".", "plugins"), os.path.join(".", "plugins", "VersionUpgrade"), + uraniumPath, os.path.join(uraniumPath, "stubs")] if sys.platform == "win32": - os.putenv("MYPYPATH", r".;.\plugins;.\plugins\VersionUpgrade;..\Uranium\;..\Uranium\stubs\\" ) + os.putenv("MYPYPATH", ";".join(mypyPathParts)) else: - os.putenv("MYPYPATH", r".:./plugins:./plugins/VersionUpgrade:../Uranium/:../Uranium\stubs/") + os.putenv("MYPYPATH", ":".join(mypyPathParts)) # Mypy really needs to be run via its Python script otherwise it can't find its data files. mypyExe = where("mypy.bat" if sys.platform == "win32" else "mypy")