From 842689d88eac8ae10d041fbe830d7f33ae0aba0f Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 5 Aug 2015 17:26:52 +0200 Subject: [PATCH 01/56] Update all uses of the Resources API with the changed API --- cura/CuraApplication.py | 18 +++++++++++++----- plugins/CuraEngineBackend/CuraEngineBackend.py | 2 +- resources/qml/Cura.qml | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 9da84163e6..2a62cbaa2e 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -38,7 +38,7 @@ from . import PrintInformation from . import CuraActions from . import MultiMaterialDecorator -from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty +from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty, Q_ENUMS from PyQt5.QtGui import QColor, QIcon import platform @@ -50,14 +50,19 @@ import numpy numpy.seterr(all="ignore") class CuraApplication(QtApplication): + class ResourceTypes: + QmlFiles = Resources.UserType + 1 + Firmware = Resources.UserType + 2 + Q_ENUMS(ResourceTypes) + def __init__(self): - Resources.addResourcePath(os.path.join(QtApplication.getInstallPrefix(), "share", "cura")) + Resources.addSearchPath(os.path.join(QtApplication.getInstallPrefix(), "share", "cura")) if not hasattr(sys, "frozen"): - Resources.addResourcePath(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")) + Resources.addSearchPath(os.path.join(os.path.abspath(os.path.dirname(__file__)), "..")) super().__init__(name = "cura", version = "master") - self.setWindowIcon(QIcon(Resources.getPath(Resources.ImagesLocation, "cura-icon.png"))) + self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png"))) self.setRequiredPlugins([ "CuraEngineBackend", @@ -80,6 +85,9 @@ class CuraApplication(QtApplication): self.activeMachineChanged.connect(self._onActiveMachineChanged) + Resources.addType(self.ResourceTypes.QmlFiles, "qml") + Resources.addType(self.ResourceTypes.Firmware, "firmware") + Preferences.getInstance().addPreference("cura/active_machine", "") Preferences.getInstance().addPreference("cura/active_mode", "simple") Preferences.getInstance().addPreference("cura/recent_files", "") @@ -151,7 +159,7 @@ class CuraApplication(QtApplication): self.showSplashMessage(self._i18n_catalog.i18nc("Splash screen message", "Loading interface...")) - self.setMainQml(Resources.getPath(Resources.QmlFilesLocation, "Cura.qml")) + self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self.initializeEngine() if self.getMachines(): diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index f6b56b9386..e204285e23 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -71,7 +71,7 @@ class CuraEngineBackend(Backend): self.backendConnected.connect(self._onBackendConnected) def getEngineCommand(self): - return [Preferences.getInstance().getValue("backend/location"),"connect", "127.0.0.1:{0}".format(self._port), "-j", Resources.getPath(Resources.SettingsLocation, "fdmprinter.json"), "-vv"] + return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", Resources.getPath(Resources.Settings, "fdmprinter.json"), "-vv"] ## Emitted when we get a message containing print duration and material amount. This also implies the slicing has finished. # \param time The amount of time the print will take. diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 637a4298eb..22eb376066 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -506,6 +506,6 @@ UM.MainWindow { } } - Component.onCompleted: UM.Theme.load(UM.Resources.getPath(UM.Resources.ThemesLocation, "cura")) + Component.onCompleted: UM.Theme.load(UM.Resources.getPath(UM.Resources.Themes, "cura")) } From 1ff3a30ede21fc88adb4e1a6a737e312407cfca0 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 5 Aug 2015 20:11:37 +0200 Subject: [PATCH 02/56] Move the machine definition files to the new location --- resources/{settings => machines}/fdmprinter.json | 0 resources/{settings => machines}/grr_neo.json | 0 resources/{settings => machines}/hephestos.json | 0 resources/{settings => machines}/hephestos_xl.json | 0 resources/{settings => machines}/profiles/high_quality.conf | 0 resources/{settings => machines}/profiles/low_quality.conf | 0 resources/{settings => machines}/prusa_i3.json | 0 resources/{settings => machines}/ultimaker2.json | 0 resources/{settings => machines}/ultimaker2_extended.json | 0 resources/{settings => machines}/ultimaker2_go.json | 0 resources/{settings => machines}/ultimaker_original.json | 0 resources/{settings => machines}/ultimaker_original_plus.json | 0 resources/{settings => machines}/witbox.json | 0 13 files changed, 0 insertions(+), 0 deletions(-) rename resources/{settings => machines}/fdmprinter.json (100%) rename resources/{settings => machines}/grr_neo.json (100%) rename resources/{settings => machines}/hephestos.json (100%) rename resources/{settings => machines}/hephestos_xl.json (100%) rename resources/{settings => machines}/profiles/high_quality.conf (100%) rename resources/{settings => machines}/profiles/low_quality.conf (100%) rename resources/{settings => machines}/prusa_i3.json (100%) rename resources/{settings => machines}/ultimaker2.json (100%) rename resources/{settings => machines}/ultimaker2_extended.json (100%) rename resources/{settings => machines}/ultimaker2_go.json (100%) rename resources/{settings => machines}/ultimaker_original.json (100%) rename resources/{settings => machines}/ultimaker_original_plus.json (100%) rename resources/{settings => machines}/witbox.json (100%) diff --git a/resources/settings/fdmprinter.json b/resources/machines/fdmprinter.json similarity index 100% rename from resources/settings/fdmprinter.json rename to resources/machines/fdmprinter.json diff --git a/resources/settings/grr_neo.json b/resources/machines/grr_neo.json similarity index 100% rename from resources/settings/grr_neo.json rename to resources/machines/grr_neo.json diff --git a/resources/settings/hephestos.json b/resources/machines/hephestos.json similarity index 100% rename from resources/settings/hephestos.json rename to resources/machines/hephestos.json diff --git a/resources/settings/hephestos_xl.json b/resources/machines/hephestos_xl.json similarity index 100% rename from resources/settings/hephestos_xl.json rename to resources/machines/hephestos_xl.json diff --git a/resources/settings/profiles/high_quality.conf b/resources/machines/profiles/high_quality.conf similarity index 100% rename from resources/settings/profiles/high_quality.conf rename to resources/machines/profiles/high_quality.conf diff --git a/resources/settings/profiles/low_quality.conf b/resources/machines/profiles/low_quality.conf similarity index 100% rename from resources/settings/profiles/low_quality.conf rename to resources/machines/profiles/low_quality.conf diff --git a/resources/settings/prusa_i3.json b/resources/machines/prusa_i3.json similarity index 100% rename from resources/settings/prusa_i3.json rename to resources/machines/prusa_i3.json diff --git a/resources/settings/ultimaker2.json b/resources/machines/ultimaker2.json similarity index 100% rename from resources/settings/ultimaker2.json rename to resources/machines/ultimaker2.json diff --git a/resources/settings/ultimaker2_extended.json b/resources/machines/ultimaker2_extended.json similarity index 100% rename from resources/settings/ultimaker2_extended.json rename to resources/machines/ultimaker2_extended.json diff --git a/resources/settings/ultimaker2_go.json b/resources/machines/ultimaker2_go.json similarity index 100% rename from resources/settings/ultimaker2_go.json rename to resources/machines/ultimaker2_go.json diff --git a/resources/settings/ultimaker_original.json b/resources/machines/ultimaker_original.json similarity index 100% rename from resources/settings/ultimaker_original.json rename to resources/machines/ultimaker_original.json diff --git a/resources/settings/ultimaker_original_plus.json b/resources/machines/ultimaker_original_plus.json similarity index 100% rename from resources/settings/ultimaker_original_plus.json rename to resources/machines/ultimaker_original_plus.json diff --git a/resources/settings/witbox.json b/resources/machines/witbox.json similarity index 100% rename from resources/settings/witbox.json rename to resources/machines/witbox.json From 1947d773a3f59b2421db9c977096181e795c3ab4 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 5 Aug 2015 20:12:29 +0200 Subject: [PATCH 03/56] Update all usage of activeMachine to the new API --- cura/CuraApplication.py | 2 +- cura/PrintInformation.py | 4 ++-- plugins/CuraEngineBackend/CuraEngineBackend.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 2a62cbaa2e..690229220c 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -83,7 +83,7 @@ class CuraApplication(QtApplication): self._previous_active_tool = None self._platform_activity = False - self.activeMachineChanged.connect(self._onActiveMachineChanged) + self.getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineChanged) Resources.addType(self.ResourceTypes.QmlFiles, "qml") Resources.addType(self.ResourceTypes.Firmware, "firmware") diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 6df4ae04f6..f4a574c0b9 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -66,7 +66,7 @@ class PrintInformation(QObject): self._slice_pass = None self._slice_reason = None - Application.getInstance().activeMachineChanged.connect(self._onActiveMachineChanged) + Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineChanged) self._onActiveMachineChanged() Application.getInstance().getController().getScene().sceneChanged.connect(self._onSceneChanged) @@ -179,7 +179,7 @@ class PrintInformation(QObject): if self._current_settings: self._current_settings.settingChanged.disconnect(self._onSettingChanged) - self._current_settings = Application.getInstance().getActiveMachine() + self._current_settings = Application.getInstance().getMachineManager().getActiveMachineInstance() if self._current_settings: self._current_settings.settingChanged.connect(self._onSettingChanged) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index e204285e23..d3f7ec8bbe 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -45,7 +45,7 @@ class CuraEngineBackend(Backend): self._stored_layer_data = None self._settings = None - Application.getInstance().activeMachineChanged.connect(self._onActiveMachineChanged) + Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineChanged) self._onActiveMachineChanged() self._change_timer = QTimer() @@ -71,7 +71,7 @@ class CuraEngineBackend(Backend): self.backendConnected.connect(self._onBackendConnected) def getEngineCommand(self): - return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", Resources.getPath(Resources.Settings, "fdmprinter.json"), "-vv"] + return [Preferences.getInstance().getValue("backend/location"), "connect", "127.0.0.1:{0}".format(self._port), "-j", Resources.getPath(Resources.MachineDefinitions, "fdmprinter.json"), "-vv"] ## Emitted when we get a message containing print duration and material amount. This also implies the slicing has finished. # \param time The amount of time the print will take. @@ -194,7 +194,7 @@ class CuraEngineBackend(Backend): if self._settings: self._settings.settingChanged.disconnect(self._onSettingChanged) - self._settings = Application.getInstance().getActiveMachine() + self._settings = Application.getInstance().getMachineManager().getActiveMachineInstance() if self._settings: self._settings.settingChanged.connect(self._onSettingChanged) self._onChanged() From f60dc01e6638d8c8c78d515ff67f7e25ebf2079b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 5 Aug 2015 21:12:21 +0200 Subject: [PATCH 04/56] Disable machine detection code for the moment as it needs to be ported --- cura/CuraApplication.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 690229220c..ed0386413e 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -162,17 +162,17 @@ class CuraApplication(QtApplication): self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self.initializeEngine() - if self.getMachines(): - active_machine_pref = Preferences.getInstance().getValue("cura/active_machine") - if active_machine_pref: - for machine in self.getMachines(): - if machine.getName() == active_machine_pref: - self.setActiveMachine(machine) + #if self.getMachines(): + #active_machine_pref = Preferences.getInstance().getValue("cura/active_machine") + #if active_machine_pref: + #for machine in self.getMachines(): + #if machine.getName() == active_machine_pref: + #self.setActiveMachine(machine) - if not self.getActiveMachine(): - self.setActiveMachine(self.getMachines()[0]) - else: - self.requestAddPrinter.emit() + #if not self.getActiveMachine(): + #self.setActiveMachine(self.getMachines()[0]) + #else: + #self.requestAddPrinter.emit() if self._engine.rootObjects: self.closeSplash() From 09cfda095bb8aeb358994966602db688cc7dbba0 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 11 Aug 2015 17:02:17 +0200 Subject: [PATCH 05/56] Convert the last bits over to the changed API --- cura/BuildVolume.py | 10 +++++----- cura/ConvexHullDecorator.py | 2 +- cura/CuraApplication.py | 25 ++++++++++++++----------- plugins/LayerView/LayerView.py | 4 ++-- resources/qml/Cura.qml | 4 ++-- resources/qml/SidebarHeader.qml | 9 ++++----- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 1556ee8d22..4ee86e2ef0 100644 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -55,12 +55,12 @@ class BuildVolume(SceneNode): if not self._material: self._material = renderer.createMaterial( - Resources.getPath(Resources.ShadersLocation, "basic.vert"), - Resources.getPath(Resources.ShadersLocation, "vertexcolor.frag") + Resources.getPath(Resources.Shaders, "basic.vert"), + Resources.getPath(Resources.Shaders, "vertexcolor.frag") ) self._grid_material = renderer.createMaterial( - Resources.getPath(Resources.ShadersLocation, "basic.vert"), - Resources.getPath(Resources.ShadersLocation, "grid.frag") + Resources.getPath(Resources.Shaders, "basic.vert"), + Resources.getPath(Resources.Shaders, "grid.frag") ) self._grid_material.setUniformValue("u_gridColor0", Color(245, 245, 245, 255)) self._grid_material.setUniformValue("u_gridColor1", Color(205, 202, 201, 255)) @@ -135,7 +135,7 @@ class BuildVolume(SceneNode): self._aabb = AxisAlignedBox(minimum = Vector(minW, minH - 1.0, minD), maximum = Vector(maxW, maxH, maxD)) - settings = Application.getInstance().getActiveMachine() + settings = Application.getInstance().getMachineManager().getActiveMachineInstance() skirt_size = 0.0 if settings.getSettingValueByKey("adhesion_type") == "None": diff --git a/cura/ConvexHullDecorator.py b/cura/ConvexHullDecorator.py index c2a6913404..9edb111c77 100644 --- a/cura/ConvexHullDecorator.py +++ b/cura/ConvexHullDecorator.py @@ -14,7 +14,7 @@ class ConvexHullDecorator(SceneNodeDecorator): self._convex_hull_node = None self._convex_hull_job = None - settings = Application.getInstance().getActiveMachine() + settings = Application.getInstance().getMachineManager().getActiveMachineInstance() print_sequence_setting = settings.getSettingByKey("print_sequence") if print_sequence_setting: print_sequence_setting.valueChanged.connect(self._onPrintSequenceSettingChanged) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index ed0386413e..b6ecd34a63 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -162,17 +162,20 @@ class CuraApplication(QtApplication): self.setMainQml(Resources.getPath(self.ResourceTypes.QmlFiles, "Cura.qml")) self.initializeEngine() - #if self.getMachines(): - #active_machine_pref = Preferences.getInstance().getValue("cura/active_machine") - #if active_machine_pref: - #for machine in self.getMachines(): - #if machine.getName() == active_machine_pref: - #self.setActiveMachine(machine) + manager = self.getMachineManager() + if manager.getMachineInstances(): + active_machine_pref = Preferences.getInstance().getValue("cura/active_machine") + if active_machine_pref: + index = manager.findMachineInstance(active_machine_pref) + if index != -1: + manager.setActiveMachineInstance(manager.getMachineInstance(index)) - #if not self.getActiveMachine(): - #self.setActiveMachine(self.getMachines()[0]) - #else: - #self.requestAddPrinter.emit() + if not manager.getActiveMachineInstance(): + manager.setActiveMachineInstance(manager.getMachineInstance(index)) + else: + self.requestAddPrinter.emit() + + manager.setActiveProfile(manager.getProfiles()[0]) if self._engine.rootObjects: self.closeSplash() @@ -462,7 +465,7 @@ class CuraApplication(QtApplication): Selection.remove(node) def _onActiveMachineChanged(self): - machine = self.getActiveMachine() + machine = self.getMachineManager().getActiveMachineInstance() if machine: Preferences.getInstance().setValue("cura/active_machine", machine.getName()) diff --git a/plugins/LayerView/LayerView.py b/plugins/LayerView/LayerView.py index 1caf504ad1..b43ff0a5d3 100644 --- a/plugins/LayerView/LayerView.py +++ b/plugins/LayerView/LayerView.py @@ -52,10 +52,10 @@ class LayerView(View): renderer.setRenderSelection(False) if not self._material: - self._material = renderer.createMaterial(Resources.getPath(Resources.ShadersLocation, "basic.vert"), Resources.getPath(Resources.ShadersLocation, "vertexcolor.frag")) + self._material = renderer.createMaterial(Resources.getPath(Resources.Shaders, "basic.vert"), Resources.getPath(Resources.Shaders, "vertexcolor.frag")) self._material.setUniformValue("u_color", [1.0, 0.0, 0.0, 1.0]) - self._selection_material = renderer.createMaterial(Resources.getPath(Resources.ShadersLocation, "basic.vert"), Resources.getPath(Resources.ShadersLocation, "color.frag")) + self._selection_material = renderer.createMaterial(Resources.getPath(Resources.Shaders, "basic.vert"), Resources.getPath(Resources.Shaders, "color.frag")) self._selection_material.setUniformValue("u_color", Color(35, 35, 35, 128)) for node in DepthFirstIterator(scene.getRoot()): diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 22eb376066..e5a2219c8f 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -119,13 +119,13 @@ UM.MainWindow { title: qsTr("&Machine"); Instantiator { - model: UM.Models.machinesModel + model: UM.MachineInstancesModel { } MenuItem { text: model.name; checkable: true; checked: model.active; exclusiveGroup: machineMenuGroup; - onTriggered: UM.Models.machinesModel.setActive(index) + onTriggered: UM.MachineManager.setActiveMachineInstance(model.name) } onObjectAdded: machineMenu.insertItem(index, object) onObjectRemoved: machineMenu.removeItem(object) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index efc6949668..980da31adc 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -6,7 +6,7 @@ import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 import QtQuick.Layouts 1.1 -import UM 1.0 as UM +import UM 1.1 as UM Column { id: base; @@ -78,8 +78,7 @@ Column { ToolButton { id: machineButton; - text: UM.Application.machineName; - tooltip: UM.Application.machineName; + text: UM.MachineManager.activeMachineInstance; style: UM.Theme.styles.sidebar_header_button; @@ -88,13 +87,13 @@ Column { menu: Menu { id: machineMenu; Instantiator { - model: UM.Models.machinesModel + model: UM.MachineInstancesModel { } MenuItem { text: model.name; checkable: true; checked: model.active; exclusiveGroup: machineMenuGroup; - onTriggered: UM.Models.machinesModel.setActive(index) + onTriggered: UM.MachineManager.setActiveMachineInstance(model.name); } onObjectAdded: machineMenu.insertItem(index, object) onObjectRemoved: machineMenu.removeItem(object) From 255caf869316d8bedbeba1a095bc8faa7ae1902f Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 11 Aug 2015 17:35:36 +0200 Subject: [PATCH 06/56] Add a combo box to select active profile --- resources/qml/Sidebar.qml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 0c908fc789..e46cfbe501 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -60,6 +60,29 @@ Rectangle { onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex); } + Item { + Layout.fillWidth: true; + implicitHeight: UM.Theme.sizes.setting.height; + + Row { + spacing: UM.Theme.sizes.default_margin.width; + Label { + anchors.verticalCenter: parent.verticalCenter; + text: "Global Profile"; + } + + ComboBox { + anchors.verticalCenter: parent.verticalCenter; + model: UM.ProfilesModel { } + textRole: "name" + onActivated: UM.MachineManager.setActiveProfile(model.getItem(index).name) + } + + Button { + text: "Save"; + } + } + } Loader { id: sidebarContents; From 900e7338394860b1e9f72a46d39504c105b5d054 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 11 Aug 2015 17:36:05 +0200 Subject: [PATCH 07/56] Add a combo box and menu entries to select the current machine variant --- resources/qml/Cura.qml | 17 +++++++++++++++++ resources/qml/Sidebar.qml | 25 ++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index e5a2219c8f..5a11538763 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -135,6 +135,23 @@ UM.MainWindow { MenuSeparator { } + Instantiator { + model: UM.MachineVariantsModel { } + MenuItem { + text: model.name; + checkable: true; + checked: model.active; + exclusiveGroup: machineVariantsGroup; + onTriggered: UM.MachineManager.setActiveMachineVariant(model.name) + } + onObjectAdded: machineMenu.insertItem(index, object) + onObjectRemoved: machineMenu.removeItem(object) + } + + ExclusiveGroup { id: machineVariantsGroup; } + + MenuSeparator { visible: UM.MachineManager.hasVariants; } + MenuItem { action: actions.addMachine; } MenuItem { action: actions.configureMachines; } } diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index e46cfbe501..36798c2c73 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -6,7 +6,7 @@ import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 import QtQuick.Layouts 1.1 -import UM 1.0 as UM +import UM 1.1 as UM Rectangle { id: base; @@ -60,6 +60,28 @@ Rectangle { onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex); } + Item { + Layout.fillWidth: true; + implicitHeight: UM.Theme.sizes.setting.height; + + visible: UM.MachineManager.hasVariants; + + Row { + spacing: UM.Theme.sizes.default_margin.width; + Label { + anchors.verticalCenter: parent.verticalCenter; + text: "Variant"; + } + + ComboBox { + anchors.verticalCenter: parent.verticalCenter; + model: UM.MachineVariantsModel { } + textRole: "name" + onActivated: UM.MachineManager.setActiveMachineVariant(model.getItem(index).name); + } + } + } + Item { Layout.fillWidth: true; implicitHeight: UM.Theme.sizes.setting.height; @@ -83,6 +105,7 @@ Rectangle { } } } + Loader { id: sidebarContents; From 7101acb8503677a19cb75f2a6ec50f02978b5867 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 13 Aug 2015 09:30:25 +0200 Subject: [PATCH 08/56] Add some metadata to fdmprinter.json since that is now required --- resources/machines/fdmprinter.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/resources/machines/fdmprinter.json b/resources/machines/fdmprinter.json index 01a4e36753..a9c8be3e5d 100644 --- a/resources/machines/fdmprinter.json +++ b/resources/machines/fdmprinter.json @@ -1,9 +1,10 @@ { + "id": "fdmprinter", "visible": false, "version": 1, - "author": "other", - "manufacturer": "other", - "author": "other", + "name": "FDM Printer Base Description", + "author": "Ultimaker B.V.", + "manufacturer": "Ultimaker", "add_pages": [{"page": "AddMachine", "title": "Add new printer"}], From 2b6e954caa41c54c086f31cae0d93cb27388dfbc Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 13 Aug 2015 09:30:38 +0200 Subject: [PATCH 09/56] Add a very simple basic profile --- resources/profiles/Normal+Quality.cfg | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 resources/profiles/Normal+Quality.cfg diff --git a/resources/profiles/Normal+Quality.cfg b/resources/profiles/Normal+Quality.cfg new file mode 100644 index 0000000000..234dc39561 --- /dev/null +++ b/resources/profiles/Normal+Quality.cfg @@ -0,0 +1,5 @@ +[General] +version = 1 +name = Normal Quality + +[Settings] From a8c302a8ed5cc3a8d0666845f9a0cdb2701c7c64 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 18 Aug 2015 18:11:05 +0200 Subject: [PATCH 10/56] Properly send per-object settings to the engine --- .../CuraEngineBackend/CuraEngineBackend.py | 28 +++++++ plugins/CuraEngineBackend/Cura_pb2.py | 78 ++++++++++++------- 2 files changed, 78 insertions(+), 28 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index d3f7ec8bbe..1828fee137 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -10,6 +10,7 @@ from UM.Math.Vector import Vector from UM.Signal import Signal from UM.Logger import Logger from UM.Resources import Resources +from UM.Settings.SettingOverrideDecorator import SettingOverrideDecorator from cura.OneAtATimeIterator import OneAtATimeIterator from . import Cura_pb2 @@ -178,6 +179,33 @@ class CuraEngineBackend(Backend): verts[:,1] *= -1 obj.vertices = verts.tostring() + if object.getDecorator(SettingOverrideDecorator): + object_settings = object.callDecoration("getAllSettings") + for key, value in object_settings.items(): + if key == "profile": + for key, value in value.getChangedSettings().items(): + setting = obj.settings.add() + setting.name = key + setting.value = str(value).encode() + else: + setting = obj.settings.add() + setting.name = key + setting.value = str(value).encode() + + first = group[0] + if first.getDecorator(SettingOverrideDecorator): + object_settings = first.callDecoration("getAllSettings") + for key, value in object_settings.items(): + if key == "profile": + for key, value in value.getChangedSettings().items(): + setting = group_message.settings.add() + setting.name = key + setting.value = str(value).encode() + else: + setting = group_message.settings.add() + setting.name = key + setting.value = str(value).encode() + self._scene.releaseLock() self._socket.sendMessage(slice_message) diff --git a/plugins/CuraEngineBackend/Cura_pb2.py b/plugins/CuraEngineBackend/Cura_pb2.py index beeaaf24cc..a7964118cf 100644 --- a/plugins/CuraEngineBackend/Cura_pb2.py +++ b/plugins/CuraEngineBackend/Cura_pb2.py @@ -18,7 +18,8 @@ _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( name='Cura.proto', package='cura.proto', - serialized_pb=_b('\n\nCura.proto\x12\ncura.proto\"1\n\nObjectList\x12#\n\x07objects\x18\x01 \x03(\x0b\x32\x12.cura.proto.Object\"5\n\x05Slice\x12,\n\x0cobject_lists\x18\x01 \x03(\x0b\x32\x16.cura.proto.ObjectList\"o\n\x06Object\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x10\n\x08vertices\x18\x02 \x01(\x0c\x12\x0f\n\x07normals\x18\x03 \x01(\x0c\x12\x0f\n\x07indices\x18\x04 \x01(\x0c\x12%\n\x08settings\x18\x05 \x03(\x0b\x32\x13.cura.proto.Setting\"\x1a\n\x08Progress\x12\x0e\n\x06\x61mount\x18\x01 \x01(\x02\"=\n\x10SlicedObjectList\x12)\n\x07objects\x18\x01 \x03(\x0b\x32\x18.cura.proto.SlicedObject\"=\n\x0cSlicedObject\x12\n\n\x02id\x18\x01 \x01(\x03\x12!\n\x06layers\x18\x02 \x03(\x0b\x32\x11.cura.proto.Layer\"]\n\x05Layer\x12\n\n\x02id\x18\x01 \x01(\x05\x12\x0e\n\x06height\x18\x02 \x01(\x02\x12\x11\n\tthickness\x18\x03 \x01(\x02\x12%\n\x08polygons\x18\x04 \x03(\x0b\x32\x13.cura.proto.Polygon\"\xe1\x01\n\x07Polygon\x12&\n\x04type\x18\x01 \x01(\x0e\x32\x18.cura.proto.Polygon.Type\x12\x0e\n\x06points\x18\x02 \x01(\x0c\x12\x12\n\nline_width\x18\x03 \x01(\x02\"\x89\x01\n\x04Type\x12\x0c\n\x08NoneType\x10\x00\x12\x0e\n\nInset0Type\x10\x01\x12\x0e\n\nInsetXType\x10\x02\x12\x0c\n\x08SkinType\x10\x03\x12\x0f\n\x0bSupportType\x10\x04\x12\r\n\tSkirtType\x10\x05\x12\x0e\n\nInfillType\x10\x06\x12\x15\n\x11SupportInfillType\x10\x07\"&\n\nGCodeLayer\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\"D\n\x0fObjectPrintTime\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04time\x18\x02 \x01(\x02\x12\x17\n\x0fmaterial_amount\x18\x03 \x01(\x02\"4\n\x0bSettingList\x12%\n\x08settings\x18\x01 \x03(\x0b\x32\x13.cura.proto.Setting\"&\n\x07Setting\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c\"\x1b\n\x0bGCodePrefix\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x62\x06proto3') + syntax='proto3', + serialized_pb=_b('\n\nCura.proto\x12\ncura.proto\"X\n\nObjectList\x12#\n\x07objects\x18\x01 \x03(\x0b\x32\x12.cura.proto.Object\x12%\n\x08settings\x18\x02 \x03(\x0b\x32\x13.cura.proto.Setting\"5\n\x05Slice\x12,\n\x0cobject_lists\x18\x01 \x03(\x0b\x32\x16.cura.proto.ObjectList\"o\n\x06Object\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x10\n\x08vertices\x18\x02 \x01(\x0c\x12\x0f\n\x07normals\x18\x03 \x01(\x0c\x12\x0f\n\x07indices\x18\x04 \x01(\x0c\x12%\n\x08settings\x18\x05 \x03(\x0b\x32\x13.cura.proto.Setting\"\x1a\n\x08Progress\x12\x0e\n\x06\x61mount\x18\x01 \x01(\x02\"=\n\x10SlicedObjectList\x12)\n\x07objects\x18\x01 \x03(\x0b\x32\x18.cura.proto.SlicedObject\"=\n\x0cSlicedObject\x12\n\n\x02id\x18\x01 \x01(\x03\x12!\n\x06layers\x18\x02 \x03(\x0b\x32\x11.cura.proto.Layer\"]\n\x05Layer\x12\n\n\x02id\x18\x01 \x01(\x05\x12\x0e\n\x06height\x18\x02 \x01(\x02\x12\x11\n\tthickness\x18\x03 \x01(\x02\x12%\n\x08polygons\x18\x04 \x03(\x0b\x32\x13.cura.proto.Polygon\"\xe1\x01\n\x07Polygon\x12&\n\x04type\x18\x01 \x01(\x0e\x32\x18.cura.proto.Polygon.Type\x12\x0e\n\x06points\x18\x02 \x01(\x0c\x12\x12\n\nline_width\x18\x03 \x01(\x02\"\x89\x01\n\x04Type\x12\x0c\n\x08NoneType\x10\x00\x12\x0e\n\nInset0Type\x10\x01\x12\x0e\n\nInsetXType\x10\x02\x12\x0c\n\x08SkinType\x10\x03\x12\x0f\n\x0bSupportType\x10\x04\x12\r\n\tSkirtType\x10\x05\x12\x0e\n\nInfillType\x10\x06\x12\x15\n\x11SupportInfillType\x10\x07\"&\n\nGCodeLayer\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\"D\n\x0fObjectPrintTime\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04time\x18\x02 \x01(\x02\x12\x17\n\x0fmaterial_amount\x18\x03 \x01(\x02\"4\n\x0bSettingList\x12%\n\x08settings\x18\x01 \x03(\x0b\x32\x13.cura.proto.Setting\"&\n\x07Setting\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c\"\x1b\n\x0bGCodePrefix\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x62\x06proto3') ) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -65,8 +66,8 @@ _POLYGON_TYPE = _descriptor.EnumDescriptor( ], containing_type=None, options=None, - serialized_start=583, - serialized_end=720, + serialized_start=622, + serialized_end=759, ) _sym_db.RegisterEnumDescriptor(_POLYGON_TYPE) @@ -85,6 +86,13 @@ _OBJECTLIST = _descriptor.Descriptor( message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, options=None), + _descriptor.FieldDescriptor( + name='settings', full_name='cura.proto.ObjectList.settings', index=1, + number=2, type=11, cpp_type=10, label=3, + has_default_value=False, default_value=[], + message_type=None, enum_type=None, containing_type=None, + is_extension=False, extension_scope=None, + options=None), ], extensions=[ ], @@ -93,11 +101,12 @@ _OBJECTLIST = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], serialized_start=26, - serialized_end=75, + serialized_end=114, ) @@ -123,11 +132,12 @@ _SLICE = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=77, - serialized_end=130, + serialized_start=116, + serialized_end=169, ) @@ -181,11 +191,12 @@ _OBJECT = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=132, - serialized_end=243, + serialized_start=171, + serialized_end=282, ) @@ -211,11 +222,12 @@ _PROGRESS = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=245, - serialized_end=271, + serialized_start=284, + serialized_end=310, ) @@ -241,11 +253,12 @@ _SLICEDOBJECTLIST = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=273, - serialized_end=334, + serialized_start=312, + serialized_end=373, ) @@ -278,11 +291,12 @@ _SLICEDOBJECT = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=336, - serialized_end=397, + serialized_start=375, + serialized_end=436, ) @@ -329,11 +343,12 @@ _LAYER = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=399, - serialized_end=492, + serialized_start=438, + serialized_end=531, ) @@ -374,11 +389,12 @@ _POLYGON = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=495, - serialized_end=720, + serialized_start=534, + serialized_end=759, ) @@ -411,11 +427,12 @@ _GCODELAYER = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=722, - serialized_end=760, + serialized_start=761, + serialized_end=799, ) @@ -455,11 +472,12 @@ _OBJECTPRINTTIME = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=762, - serialized_end=830, + serialized_start=801, + serialized_end=869, ) @@ -485,11 +503,12 @@ _SETTINGLIST = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=832, - serialized_end=884, + serialized_start=871, + serialized_end=923, ) @@ -522,11 +541,12 @@ _SETTING = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=886, - serialized_end=924, + serialized_start=925, + serialized_end=963, ) @@ -552,14 +572,16 @@ _GCODEPREFIX = _descriptor.Descriptor( ], options=None, is_extendable=False, + syntax='proto3', extension_ranges=[], oneofs=[ ], - serialized_start=926, - serialized_end=953, + serialized_start=965, + serialized_end=992, ) _OBJECTLIST.fields_by_name['objects'].message_type = _OBJECT +_OBJECTLIST.fields_by_name['settings'].message_type = _SETTING _SLICE.fields_by_name['object_lists'].message_type = _OBJECTLIST _OBJECT.fields_by_name['settings'].message_type = _SETTING _SLICEDOBJECTLIST.fields_by_name['objects'].message_type = _SLICEDOBJECT From 792c3426f891dc7c3ac717e38b7bd6e731687b71 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 18 Aug 2015 18:11:32 +0200 Subject: [PATCH 11/56] Fix convex hull and other bits so they use the new API --- cura/ConvexHullJob.py | 2 +- cura/ConvexHullNode.py | 2 +- cura/OneAtATimeIterator.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cura/ConvexHullJob.py b/cura/ConvexHullJob.py index 9de4f13073..0399148025 100644 --- a/cura/ConvexHullJob.py +++ b/cura/ConvexHullJob.py @@ -45,7 +45,7 @@ class ConvexHullJob(Job): # Then, do a Minkowski hull with a simple 1x1 quad to outset and round the normal convex hull. # This is done because of rounding errors. hull = hull.getMinkowskiHull(Polygon(numpy.array([[-1, -1], [-1, 1], [1, 1], [1, -1]], numpy.float32))) - settings = Application.getInstance().getActiveMachine() + settings = Application.getInstance().getMachineManager().getActiveMachineInstance() if settings.getSettingValueByKey("print_sequence") == "One at a time" and not self._node.getParent().callDecoration("isGroup"): # Printing one at a time and it's not an object in a group diff --git a/cura/ConvexHullNode.py b/cura/ConvexHullNode.py index e24d79522c..6d56fd7364 100644 --- a/cura/ConvexHullNode.py +++ b/cura/ConvexHullNode.py @@ -53,7 +53,7 @@ class ConvexHullNode(SceneNode): def render(self, renderer): if not self._material: - self._material = renderer.createMaterial(Resources.getPath(Resources.ShadersLocation, "basic.vert"), Resources.getPath(Resources.ShadersLocation, "color.frag")) + self._material = renderer.createMaterial(Resources.getPath(Resources.Shaders, "basic.vert"), Resources.getPath(Resources.Shaders, "color.frag")) self._material.setUniformValue("u_color", Color(35, 35, 35, 128)) if self.getParent(): diff --git a/cura/OneAtATimeIterator.py b/cura/OneAtATimeIterator.py index 958d1e5b5f..35adba90b3 100644 --- a/cura/OneAtATimeIterator.py +++ b/cura/OneAtATimeIterator.py @@ -17,7 +17,7 @@ class OneAtATimeIterator(Iterator.Iterator): def _fillStack(self): node_list = [] for node in self._scene_node.getChildren(): - if node.getBoundingBox().height > Application.getInstance().getActiveMachine().getSettingValueByKey("gantry_height"): + if node.getBoundingBox().height > Application.getInstance().getMachineManager().getActiveMachineInstance().getSettingValueByKey("gantry_height"): return if node.callDecoration("getConvexHull"): node_list.append(node) @@ -103,4 +103,4 @@ class _objectOrder(): """ self.order = order self.todo = todo - \ No newline at end of file + From 79bd590656a6f18d33f87197141cf31bceed516b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 19 Aug 2015 19:13:44 +0200 Subject: [PATCH 12/56] Print backtrace on console when we are not running a py2exe/py2app build --- cura/CrashHandler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cura/CrashHandler.py b/cura/CrashHandler.py index 1771a5c548..57d25b9bfa 100644 --- a/cura/CrashHandler.py +++ b/cura/CrashHandler.py @@ -7,9 +7,11 @@ from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR, QCoreApplication from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit def show(type, value, tb): + if not hasattr(sys, "frozen"): + traceback.print_exception(type, value, tb) + application = QCoreApplication.instance() if not application: - traceback.print_exception(type, value, tb) sys.exit(1) dialog = QDialog() From 6fa6b1ac5d541ac10a1bbd035f0f468c584032a2 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 19 Aug 2015 19:14:22 +0200 Subject: [PATCH 13/56] Render ConvexHullNode with different colors depending on setting/profile overrides --- cura/ConvexHullNode.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/cura/ConvexHullNode.py b/cura/ConvexHullNode.py index 6d56fd7364..7de28e777e 100644 --- a/cura/ConvexHullNode.py +++ b/cura/ConvexHullNode.py @@ -22,10 +22,13 @@ class ConvexHullNode(SceneNode): self._inherit_orientation = False self._inherit_scale = False + self._color = Color(35, 35, 35, 0.5) + self._node = node self._node.transformationChanged.connect(self._onNodePositionChanged) self._node.parentChanged.connect(self._onNodeParentChanged) - #self._onNodePositionChanged(self._node) + self._node.decoratorsChanged.connect(self._onNodeDecoratorsChanged) + self._onNodeDecoratorsChanged(self._node) self._hull = hull @@ -55,25 +58,32 @@ class ConvexHullNode(SceneNode): if not self._material: self._material = renderer.createMaterial(Resources.getPath(Resources.Shaders, "basic.vert"), Resources.getPath(Resources.Shaders, "color.frag")) - self._material.setUniformValue("u_color", Color(35, 35, 35, 128)) if self.getParent(): + self._material.setUniformValue("u_color", self._color) renderer.queueNode(self, material = self._material, transparent = True) return True - def _onNodePositionChanged(self, node): - #self.setPosition(node.getWorldPosition()) if node.callDecoration("getConvexHull"): node.callDecoration("setConvexHull", None) node.callDecoration("setConvexHullNode", None) self.setParent(None) - #self._node.transformationChanged.disconnect(self._onNodePositionChanged) - #self._node.parentChanged.disconnect(self._onNodeParentChanged) - def _onNodeParentChanged(self, node): if node.getParent(): self.setParent(self._original_parent) else: self.setParent(None) + + def _onNodeDecoratorsChanged(self, node): + self._color = Color(35, 35, 35, 0.5) + + if not node: + return + + if node.hasDecoration("getProfile"): + self._color.setR(0.75) + + if node.hasDecoration("getSetting"): + self._color.setG(0.75) From fd8185fcb972443706e45445a817ba639da2b2f3 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 19 Aug 2015 19:15:54 +0200 Subject: [PATCH 14/56] Properly send profile and setting changes to the engine This includes everything from the profile and all settings with child settings. --- .../CuraEngineBackend/CuraEngineBackend.py | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 1828fee137..fa76cc08d4 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -179,32 +179,11 @@ class CuraEngineBackend(Backend): verts[:,1] *= -1 obj.vertices = verts.tostring() - if object.getDecorator(SettingOverrideDecorator): - object_settings = object.callDecoration("getAllSettings") - for key, value in object_settings.items(): - if key == "profile": - for key, value in value.getChangedSettings().items(): - setting = obj.settings.add() - setting.name = key - setting.value = str(value).encode() - else: - setting = obj.settings.add() - setting.name = key - setting.value = str(value).encode() + self._handlePerObjectSettings(object, obj) - first = group[0] - if first.getDecorator(SettingOverrideDecorator): - object_settings = first.callDecoration("getAllSettings") - for key, value in object_settings.items(): - if key == "profile": - for key, value in value.getChangedSettings().items(): - setting = group_message.settings.add() - setting.name = key - setting.value = str(value).encode() - else: - setting = group_message.settings.add() - setting.name = key - setting.value = str(value).encode() + # Hack to add per-object settings also to the "MeshGroup" in CuraEngine + # We really should come up with a better solution for this. + self._handlePerObjectSettings(group[0], group_message) self._scene.releaseLock() self._socket.sendMessage(slice_message) @@ -306,3 +285,27 @@ class CuraEngineBackend(Backend): job.start() else: self._layer_view_active = False + + def _handlePerObjectSettings(self, node, message): + profile = node.callDecoration("getProfile") + if profile: + for key, value in profile.getChangedSettings().items(): + setting = message.settings.add() + setting.name = key + setting.value = str(value).encode() + + object_settings = node.callDecoration("getAllSettings") + if not object_settings: + return + + for key, value in object_settings.items(): + setting = message.settings.add() + setting.name = key + setting.value = str(value.getValue()).encode() + + for child in value.getAllChildren(): + setting = message.settings.add() + setting.name = child.getKey() + setting.value = str(child.getValue()).encode() + + From 9888a6eb42ec60c366cbf1afaedb0d21bff71351 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 21 Aug 2015 18:28:53 +0200 Subject: [PATCH 15/56] Fix a merge error --- cura/CuraApplication.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a0e02874de..a7d3f1c2ff 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -38,11 +38,7 @@ from . import PrintInformation from . import CuraActions from . import MultiMaterialDecorator -<<<<<<< HEAD -from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty, Q_ENUMS -======= -from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty, QEvent ->>>>>>> 3cb3cce31c821a56d2395607a90b51030fdf0916 +from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS from PyQt5.QtGui import QColor, QIcon import platform From f081bf40266829cd020a43acb64ce09dc823f0d9 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Fri, 21 Aug 2015 18:29:13 +0200 Subject: [PATCH 16/56] Use the right resource path for locating Qml resources --- cura/CuraApplication.py | 3 +++ resources/qml/AddMachineWizard.qml | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a7d3f1c2ff..d4b737b31b 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -40,6 +40,7 @@ from . import MultiMaterialDecorator from PyQt5.QtCore import pyqtSlot, QUrl, Qt, pyqtSignal, pyqtProperty, QEvent, Q_ENUMS from PyQt5.QtGui import QColor, QIcon +from PyQt5.QtQml import qmlRegisterUncreatableType import platform import sys @@ -206,6 +207,8 @@ class CuraApplication(QtApplication): self._cura_actions = CuraActions.CuraActions(self) engine.rootContext().setContextProperty("CuraActions", self._cura_actions) + qmlRegisterUncreatableType(CuraApplication, "Cura", 1, 0, "ResourceTypes", "Just an Enum type") + def onSelectionChanged(self): if Selection.hasSelection(): if not self.getController().getActiveTool(): diff --git a/resources/qml/AddMachineWizard.qml b/resources/qml/AddMachineWizard.qml index c236c6a19d..1f87c150ae 100644 --- a/resources/qml/AddMachineWizard.qml +++ b/resources/qml/AddMachineWizard.qml @@ -7,6 +7,7 @@ import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 import UM 1.0 as UM +import Cura 1.0 as Cura UM.Wizard { @@ -15,7 +16,7 @@ UM.Wizard wizardPages: [ { title: "Add Printer", - page: "AddMachine.qml" + page: UM.Resources.getPath(Cura.ResourceTypes.QmlFiles, "WizardPages/AddMachine.qml") } ] From 17d3033b9a050d60073a08ac86e7d2ae1bc96019 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 25 Aug 2015 18:11:49 +0200 Subject: [PATCH 17/56] Move new JSON files to the right location --- resources/{settings => machines}/RigidBot.json | 0 resources/{settings => machines}/RigidBotBig.json | 0 resources/{settings => machines}/dual_extrusion_printer.json | 0 resources/{settings => machines}/maker_starter.json | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename resources/{settings => machines}/RigidBot.json (100%) rename resources/{settings => machines}/RigidBotBig.json (100%) rename resources/{settings => machines}/dual_extrusion_printer.json (100%) rename resources/{settings => machines}/maker_starter.json (100%) diff --git a/resources/settings/RigidBot.json b/resources/machines/RigidBot.json similarity index 100% rename from resources/settings/RigidBot.json rename to resources/machines/RigidBot.json diff --git a/resources/settings/RigidBotBig.json b/resources/machines/RigidBotBig.json similarity index 100% rename from resources/settings/RigidBotBig.json rename to resources/machines/RigidBotBig.json diff --git a/resources/settings/dual_extrusion_printer.json b/resources/machines/dual_extrusion_printer.json similarity index 100% rename from resources/settings/dual_extrusion_printer.json rename to resources/machines/dual_extrusion_printer.json diff --git a/resources/settings/maker_starter.json b/resources/machines/maker_starter.json similarity index 100% rename from resources/settings/maker_starter.json rename to resources/machines/maker_starter.json From 1fc4d288641106f9ec8c8fa81f2386cd1ffab840 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 25 Aug 2015 18:12:24 +0200 Subject: [PATCH 18/56] Use firstRun property for the Add machine wizard --- resources/qml/Cura.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index 0a3373d964..a97c6c604f 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -522,7 +522,7 @@ UM.MainWindow { target: Printer onRequestAddPrinter: { addMachineWizard.visible = true - addMachineWizard.printer = false + addMachineWizard.firstRun = true } } From cbd685596e8a9ba9be42c49046650d12a3d98a68 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 25 Aug 2015 18:12:40 +0200 Subject: [PATCH 19/56] Add metadata to dual_extrusion_printer file --- resources/machines/dual_extrusion_printer.json | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/resources/machines/dual_extrusion_printer.json b/resources/machines/dual_extrusion_printer.json index 64e9060c76..616262e3d5 100644 --- a/resources/machines/dual_extrusion_printer.json +++ b/resources/machines/dual_extrusion_printer.json @@ -1,8 +1,12 @@ { - "version": 1, + "version": 1, + "id": "dual_extrusion", + "name": "Dual Extrusion Base File", "inherits": "fdmprinter.json", + "visible": false, + "machine_settings": { "extruder_nr": { "default": 0 }, @@ -277,4 +281,4 @@ } } } -} \ No newline at end of file +} From b9a306865e11d8e71f6c12e051929f9c2c17c36b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 25 Aug 2015 18:13:09 +0200 Subject: [PATCH 20/56] Add some data about wizard pages to ultimaker_original_plus JSON file --- resources/machines/ultimaker_original_plus.json | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/resources/machines/ultimaker_original_plus.json b/resources/machines/ultimaker_original_plus.json index 73fdcc2370..baed0ca3aa 100644 --- a/resources/machines/ultimaker_original_plus.json +++ b/resources/machines/ultimaker_original_plus.json @@ -10,6 +10,13 @@ "inherits": "ultimaker_original.json", + "pages": [ + "SelectUpgradedParts", + "UpgradeFirmware", + "UltimakerCheckup", + "BedLeveling" + ], + "machine_settings": { "machine_heated_bed": { "default": true } } From 9a88176f6f046e7b97216324eb054c7ef26cb67c Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 25 Aug 2015 18:14:48 +0200 Subject: [PATCH 21/56] Clean up Add Machine Wizard and use the new MachineDefintionsModel --- resources/qml/AddMachineWizard.qml | 27 +- resources/qml/WizardPages/AddMachine.qml | 340 ++++++++++------------- 2 files changed, 161 insertions(+), 206 deletions(-) diff --git a/resources/qml/AddMachineWizard.qml b/resources/qml/AddMachineWizard.qml index 1f87c150ae..37b94657d6 100644 --- a/resources/qml/AddMachineWizard.qml +++ b/resources/qml/AddMachineWizard.qml @@ -6,22 +6,27 @@ import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 -import UM 1.0 as UM +import UM 1.1 as UM import Cura 1.0 as Cura +import "WizardPages" + UM.Wizard { - //: Add Printer dialog title - wizardTitle: qsTr("Add Printer") - wizardPages: [ - { - title: "Add Printer", - page: UM.Resources.getPath(Cura.ResourceTypes.QmlFiles, "WizardPages/AddMachine.qml") - } - ] + id: base; + + title: catalog.i18nc("@title", "Add Printer") // This part is optional // This part checks whether there is a printer -> if not: some of the functions (delete for example) are disabled - property bool printer: true - firstRun: printer ? false : true + firstRun: false + + Component.onCompleted: { + base.appendPage(UM.Resources.getPath(Cura.ResourceTypes.QmlFiles, "WizardPages/AddMachine.qml"), catalog.i18nc("@title", "Add Printer")); + base.currentPage = 0; + } + + Item { + UM.I18nCatalog { id: catalog; name: "cura"; } + } } diff --git a/resources/qml/WizardPages/AddMachine.qml b/resources/qml/WizardPages/AddMachine.qml index 39dfd2414d..bce4272c0e 100644 --- a/resources/qml/WizardPages/AddMachine.qml +++ b/resources/qml/WizardPages/AddMachine.qml @@ -7,44 +7,34 @@ import QtQuick.Layouts 1.1 import QtQuick.Window 2.1 import QtQuick.Controls.Styles 1.1 -import UM 1.0 as UM +import UM 1.1 as UM +import Cura 1.0 as Cura import ".." -ColumnLayout +Item { - id: wizardPage - property string title - property int pageWidth - property int pageHeight - property var manufacturers: wizardPage.lineManufacturers() - property int manufacturerIndex: 0 + id: base - SystemPalette{id: palette} - signal reloadModel(var newModel) + property string activeManufacturer: "Ultimaker"; - width: wizardPage.pageWidth - height: wizardPage.pageHeight + property variant wizard; Connections { - target: elementRoot + target: base.wizard onNextClicked: //You can add functions here that get triggered when the final button is clicked in the wizard-element { saveMachine() } - } - - function lineManufacturers(manufacturer) - { - var manufacturers = [] - for (var i = 0; i < UM.Models.availableMachinesModel.rowCount(); i++) + onBackClicked: { - if (UM.Models.availableMachinesModel.getItem(i).manufacturer != manufacturers[manufacturers.length - 1]) + var old_page_count = base.wizard.getPageCount() + // Delete old pages (if any) + for (var i = old_page_count - 1; i > 0; i--) { - manufacturers.push(UM.Models.availableMachinesModel.getItem(i).manufacturer) + base.wizard.removePage(i) } } - return manufacturers } Label @@ -52,7 +42,7 @@ ColumnLayout id: title anchors.left: parent.left anchors.top: parent.top - text: parent.title + text: catalog.i18nc("@title", "Add Printer") font.pointSize: 18; } @@ -61,164 +51,121 @@ ColumnLayout id: subTitle anchors.left: parent.left anchors.top: title.bottom - //: Add Printer wizard page description - text: qsTr("Please select the type of printer:"); + text: catalog.i18nc("@label", "Please select the type of printer:"); } ScrollView { id: machinesHolder - anchors.left: parent.left - anchors.top: subTitle.bottom - implicitWidth: wizardPage.width- UM.Theme.sizes.default_margin.width - implicitHeight: wizardPage.height - subTitle.height - title.height - (machineNameHolder.height * 2) - Component - { - id: machineDelegate - ColumnLayout - { - id: machineLayout - spacing: 0 - anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.width - function showManufacturer() - { - if (model.manufacturer == UM.Models.availableMachinesModel.getItem(index - 1).manufacturer){ - return false - } - else{ - return true - } - } - height: - { - if (machineLayout.showManufacturer() & wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer) - return UM.Theme.sizes.standard_list_lineheight.height * 2 - if (wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer | machineLayout.showManufacturer()) - return UM.Theme.sizes.standard_list_lineheight.height * 1 - else - return 0 - } - Behavior on height - { - NumberAnimation { target: machineLayout; property: "height"; duration: 200} - } - Button - { - id: manufacturer - property color backgroundColor: "transparent" - height: UM.Theme.sizes.standard_list_lineheight.height - visible: machineLayout.showManufacturer() - anchors.top: machineLayout.top - anchors.topMargin: 0 - text: - { - if (wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer) - return model.manufacturer + " ▼" - else - return model.manufacturer + " ►" - } - style: ButtonStyle - { - background: Rectangle - { - id: manufacturerBackground - opacity: 0.3 - border.width: 0 - color: manufacturer.backgroundColor - height: UM.Theme.sizes.standard_list_lineheight.height - } - label: Text - { - renderType: Text.NativeRendering - horizontalAlignment: Text.AlignLeft - text: control.text - color: palette.windowText - font.bold: true - } - } - MouseArea - { - id: mousearea - hoverEnabled: true - anchors.fill: parent - onEntered: manufacturer.backgroundColor = palette.light - onExited: manufacturer.backgroundColor = "transparent" - onClicked: - { - wizardPage.manufacturerIndex = wizardPage.manufacturers.indexOf(model.manufacturer) - machineList.currentIndex = index - } - } - } - - RadioButton - { - id: machineButton - opacity: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? 1 : 0 - height: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? UM.Theme.sizes.standard_list_lineheight.height : 0 - anchors.top: parent.top - anchors.topMargin: machineLayout.showManufacturer() ? manufacturer.height - 5 : 0 - anchors.left: parent.left - anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.width - checked: machineList.currentIndex == index ? true : false - exclusiveGroup: printerGroup; - text: model.name - onClicked: machineList.currentIndex = index; - function getAnimationTime(time) - { - if (machineButton.opacity == 0) - return time - else - return 0 - } - Label - { - id: author - visible: model.author != "Ultimaker" ? true : false - height: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? UM.Theme.sizes.standard_list_lineheight.height : 0 - //: Printer profile caption meaning: this profile is supported by the community - text: qsTr("community supported profile"); - opacity: wizardPage.manufacturers[wizardPage.manufacturerIndex] == model.manufacturer ? 1 : 0 - anchors.left: machineButton.right - anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.height/2 - anchors.verticalCenter: machineButton.verticalCenter - anchors.verticalCenterOffset: UM.Theme.sizes.standard_list_lineheight.height / 4 - font: UM.Theme.fonts.caption; - color: palette.mid - } - Behavior on opacity - { - SequentialAnimation - { - PauseAnimation { duration: machineButton.getAnimationTime(100) } - NumberAnimation { properties:"opacity"; duration: machineButton.getAnimationTime(200) } - } - } - } - - } + anchors{ + left: parent.left; + top: subTitle.bottom; + right: parent.right; + bottom: machineNameHolder.top; } ListView { id: machineList - property int currentIndex: 0 - property int otherMachinesIndex: - { - for (var i = 0; i < UM.Models.availableMachinesModel.rowCount(); i++) - { - if (UM.Models.availableMachinesModel.getItem(i).manufacturer != "Ultimaker") - { - return i + + model: UM.MachineDefinitionsModel { id: machineDefinitionsModel; showVariants: false; } + focus: true + + section.property: "manufacturer" + section.delegate: Button { + text: { + if (base,activeManufacturer == section) + return section + " ▼" + else + return section + " ►" + } + + style: ButtonStyle { + background: Rectangle { + id: manufacturerBackground + opacity: 0.3 + border.width: 0 + color: control.hovered ? palette.light : "transparent"; + height: UM.Theme.sizes.standard_list_lineheight.height + } + label: Text { + horizontalAlignment: Text.AlignLeft + text: control.text + color: palette.windowText + font.bold: true } } + + onClicked: { + base.activeManufacturer = section; + machineList.currentIndex = machineList.model.find("manufacturer", section) + } + } + + delegate: RadioButton { + id: machineButton + + anchors.left: parent.left + anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.width + + opacity: 1; + height: UM.Theme.sizes.standard_list_lineheight.height; + + checked: ListView.isCurrentItem; + + exclusiveGroup: printerGroup; + + text: model.name + + onClicked: { + ListView.view.currentIndex = index; + if(model.pages.length > 0) { + base.wizard.nextAvailable = true; + } else { + base.wizard.nextAvailable = false; + } + } + + Label + { + id: author +// visible: model.author != "Ultimaker" ? true : false + //: Printer profile caption meaning: this profile is supported by the community +// text: qsTr("community supported profile"); + text: model.author; + anchors.left: machineButton.right + anchors.leftMargin: UM.Theme.sizes.standard_list_lineheight.height/2 + anchors.verticalCenter: machineButton.verticalCenter + anchors.verticalCenterOffset: UM.Theme.sizes.standard_list_lineheight.height / 4 + font: UM.Theme.fonts.caption; + color: palette.mid + } + + states: State { + name: "collapsed"; + when: base.activeManufacturer != model.manufacturer; + + PropertyChanges { target: machineButton; opacity: 0; height: 0; } + } + + transitions: [ + Transition { + to: "collapsed"; + SequentialAnimation { + NumberAnimation { property: "opacity"; duration: 75; } + NumberAnimation { property: "height"; duration: 75; } + } + }, + Transition { + from: "collapsed"; + SequentialAnimation { + NumberAnimation { property: "height"; duration: 75; } + NumberAnimation { property: "opacity"; duration: 75; } + } + } + ] } - anchors.fill: parent - model: UM.Models.availableMachinesModel - delegate: machineDelegate - focus: true } } @@ -226,12 +173,11 @@ ColumnLayout { id: machineNameHolder height: childrenRect.height - anchors.top: machinesHolder.bottom + anchors.bottom: parent.bottom; Label { id: insertNameLabel - //: Add Printer wizard field label - text: qsTr("Printer Name:"); + text: catalog.i18nc("@label", "Printer Name:"); } TextField { @@ -242,39 +188,43 @@ ColumnLayout } } - ExclusiveGroup { id: printerGroup; } - - function saveMachine() { if(machineList.currentIndex != -1) { - UM.Models.availableMachinesModel.createMachine(machineList.currentIndex, machineName.text) - var pages = UM.Models.availableMachinesModel.getItem(machineList.currentIndex).pages - var old_page_count = elementRoot.getPageCount() - for(var i = 0; i < UM.Models.count; i++) - { - print(UM.Models.getItem(i)) - } - // Delete old pages (if any) - for (var i = old_page_count - 1; i > 0; i--) - { - elementRoot.removePage(i) - elementRoot.currentPage = 0 - } + var item = machineList.model.getItem(machineList.currentIndex); + machineList.model.createInstance(machineName.text, item.id) + + var pages = machineList.model.getItem(machineList.currentIndex).pages + + console.log(pages) + console.log(pages.length) // Insert new pages (if any) - for(var i = 0; i < pages.count; i++) + for(var i = 0; i < pages.length; i++) { - elementRoot.insertPage(pages.getItem(i).page + ".qml",pages.getItem(i).title,i + 1) - } - - // Hack to ensure the current page is set correctly - if(old_page_count == 1) - { - elementRoot.currentPage += 1 + console.log(pages[i]) + switch(pages[i]) { + case "SelectUpgradedParts": + base.wizard.appendPage(UM.Resources.getPath(Cura.ResourceTypes.QmlFiles, "WizardPages/SelectUpgradedParts.qml"), catalog.i18nc("@title", "Select Upgraded Parts")); + break; + case "UpgradeFirmware": + base.wizard.appendPage(UM.Resources.getPath(Cura.ResourceTypes.QmlFiles, "WizardPages/UpgradeFirmware.qml"), catalog.i18nc("@title", "Upgrade Firmware")); + break; + case "UltimakerCheckup": + base.wizard.appendPage(UM.Resources.getPath(Cura.ResourceTypes.QmlFiles, "WizardPages/UltimakerCheckup.qml"), catalog.i18nc("@title", "Check Printer")); + break; + case "BedLeveling": + base.wizard.appendPage(UM.Resources.getPath(Cura.ResourceTypes.QmlFiles, "WizardPages/Bedleveling.qml"), catalog.i18nc("@title", "Bed Levelling")); + break; + default: + break; + } } } } -} + ExclusiveGroup { id: printerGroup; } + UM.I18nCatalog { id: catalog; name: "cura"; } + SystemPalette { id: palette } +} From 5ee587a7450516b37ec7972afd8c68377cd4557d Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 27 Aug 2015 09:33:07 +0200 Subject: [PATCH 22/56] Options property should now be a key - value dict --- resources/machines/fdmprinter.json | 113 ++++++++++++++--------------- 1 file changed, 55 insertions(+), 58 deletions(-) diff --git a/resources/machines/fdmprinter.json b/resources/machines/fdmprinter.json index 01bb97a5ac..89a5626136 100644 --- a/resources/machines/fdmprinter.json +++ b/resources/machines/fdmprinter.json @@ -372,12 +372,12 @@ "label": "Fill Gaps Between Walls", "description": "Fill the gaps created by walls where they would otherwise be overlapping. This will also fill thin walls. Optionally only the gaps occurring within the top and bottom skin can be filled.", "type": "enum", - "options": [ - "Nowhere", - "Everywhere", - "Skin" - ], - "default": "Everywhere", + "options": { + "nowhere": "Nowhere", + "everywhere": "Everywhere", + "skin": "Skin" + }, + "default": "everywhere", "visible": false, "active_if": { "setting": "remove_overlapping_walls_x_enabled", @@ -388,11 +388,11 @@ "label": "Bottom/Top Pattern", "description": "Pattern of the top/bottom solid fill. This normally is done with lines to get the best possible finish, but in some cases a concentric fill gives a nicer end result.", "type": "enum", - "options": [ - "Lines", - "Concentric" - ], - "default": "Lines", + "options": { + "lines": "Lines", + "concentric": "Concentric" + }, + "default": "lines", "visible": false }, "skin_alternate_rotation": { @@ -440,14 +440,14 @@ "description": "Cura defaults to switching between grid and line infill. But with this setting visible you can control this yourself. The line infill swaps direction on alternate layers of infill, while the grid prints the full cross-hatching on each layer of infill.", "type": "enum", "visible": false, - "options": [ - "Grid", - "Lines", - "Concentric", - "ZigZag" - ], - "default": "Grid", - "inherit_function": "'Lines' if parent_value > 25 else 'Grid'" + "options": { + "grid": "Grid", + "lines": "Lines", + "concentric": "Concentric", + "zigzag": "Zig Zag" + }, + "default": "grid", + "inherit_function": "'lines' if parent_value > 25 else 'grid'" }, "infill_line_distance": { "label": "Line distance", @@ -1099,13 +1099,11 @@ "label": "Placement", "description": "Where to place support structures. The placement can be restricted such that the support structures won't rest on the model, which could otherwise cause scarring.", "type": "enum", - "options": [ - "Touching Buildplate", - "Everywhere" - ], - "default": "Everywhere", - "visible": true, - "inherit_function": "'Everywhere' if support_enable else 'None'", + "options": { + "buildplate": "Touching Buildplate", + "everywhere": "Everywhere" + }, + "default": "everywhere", "active_if": { "setting": "support_enable", "value": true @@ -1273,7 +1271,7 @@ "description": "Use specialized towers to support tiny overhang areas. These towers have a larger diameter than the region they support. Near the overhang the towers' diameter decreases, forming a roof.", "type": "boolean", "default": true, - "visible": true + "visible": false }, "support_minimal_diameter": { "label": "Minimal Diameter", @@ -1317,13 +1315,13 @@ "label": "Pattern", "description": "Cura supports 3 distinct types of support structure. First is a grid based support structure which is quite solid and can be removed as 1 piece. The second is a line based support structure which has to be peeled off line by line. The third is a structure in between the other two; it consists of lines which are connected in an accordeon fashion.", "type": "enum", - "options": [ - "Grid", - "Lines", - "ZigZag" - ], - "default": "ZigZag", - "visible": true, + "options": { + "grid": "Grid", + "lines": "Lines", + "zigzag": "Zig Zag" + }, + "default": "zigzag", + "visible": false, "active_if": { "setting": "support_enable", "value": true @@ -1381,12 +1379,12 @@ "label": "Type", "description": "Different options that help in preventing corners from lifting due to warping. Brim adds a single-layer-thick flat area around your object which is easy to cut off afterwards, and it is the recommended option. Raft adds a thick grid below the object and a thin interface between this and your object. (Note that enabling the brim or raft disables the skirt.)", "type": "enum", - "options": [ - "Skirt", - "Brim", - "Raft" - ], - "default": "Skirt" + "options": { + "skirt": "Skirt", + "brim": "Brim", + "raft": "Raft" + }, + "default": "skirt" }, "skirt_line_count": { "label": "Skirt Line Count", @@ -1681,13 +1679,12 @@ "label": "Draft Shield Limitation", "description": "Whether to limit the height of the draft shield", "type": "enum", - "options": [ - "Full", - "Limited" - ], - "default": "Full", + "options": { + "full": "Full", + "limited": "Limited" + }, + "default": "full", "visible": false, - "inherit_function": "Full", "active_if": { "setting": "draft_shield_enabled", "value": true @@ -1701,7 +1698,7 @@ "min_value": 0, "max_value_warning": 30, "default": 0, - "inherit_function": "9999 if draft_shield_height_limitation == 'Full' and draft_shield_enabled else 0.0", + "inherit_function": "9999 if draft_shield_height_limitation == 'full' and draft_shield_enabled else 0.0", "visible": false, "active_if": { "setting": "draft_shield_height_limitation", @@ -1754,11 +1751,11 @@ "label": "Print sequence", "description": "Whether to print all objects one layer at a time or to wait for one object to finish, before moving on to the next. One at a time mode is only possible if all models are separated such that the whole print head can move between and all models are lower than the distance between the nozzle and the X/Y axles.", "type": "enum", - "options": [ - "All at once", - "One at a time" - ], - "default": "All at once", + "options": { + "all_at_once": "All at Once", + "one_at_a_time": "One at a Time" + }, + "default": "all_at_once", "visible": true }, "magic_mesh_surface_mode": { @@ -1999,12 +1996,12 @@ "label": "WP Strategy", "description": "Strategy for making sure two consecutive layers connect at each connection point. Retraction lets the upward lines harden in the right position, but may cause filament grinding. A knot can be made at the end of an upward line to heighten the chance of connecting to it and to let the line cool; however it may require slow printing speeds. Another strategy is to compensate for the sagging of the top of an upward line; however, the lines won't always fall down as predicted.", "type": "enum", - "options": [ - "Compensate", - "Knot", - "Retract" - ], - "default": "Compensate", + "options": { + "compensate": "Compensate", + "knot": "Knot", + "retract": "Retract" + }, + "default": "compensate", "visible": false, "active_if": { "setting": "wireframe_enabled", From 5637c9ad9428feae6eee526f2b721f42e7bb68e6 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 27 Aug 2015 09:34:22 +0200 Subject: [PATCH 23/56] Remove active machine preference from CuraApplication, it is now handled by MachineManager --- cura/CuraApplication.py | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index d4b737b31b..effa287eda 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -171,19 +171,9 @@ class CuraApplication(QtApplication): self.initializeEngine() manager = self.getMachineManager() - if manager.getMachineInstances(): - active_machine_pref = Preferences.getInstance().getValue("cura/active_machine") - if active_machine_pref: - index = manager.findMachineInstance(active_machine_pref) - if index != -1: - manager.setActiveMachineInstance(manager.getMachineInstance(index)) - - if not manager.getActiveMachineInstance(): - manager.setActiveMachineInstance(manager.getMachineInstance(index)) - else: + if not self.getMachineManager().getMachineInstances(): self.requestAddPrinter.emit() - manager.setActiveProfile(manager.getProfiles()[0]) if self._engine.rootObjects: self.closeSplash() @@ -471,7 +461,6 @@ class CuraApplication(QtApplication): def _onActiveMachineChanged(self): machine = self.getMachineManager().getActiveMachineInstance() if machine: - Preferences.getInstance().setValue("cura/active_machine", machine.getName()) self._volume.setWidth(machine.getSettingValueByKey("machine_width")) self._volume.setHeight(machine.getSettingValueByKey("machine_height")) From 4d4192d6d680633263c0cea4b4ed5f0aa3f156e1 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 27 Aug 2015 09:35:05 +0200 Subject: [PATCH 24/56] Ignore some active machine changes since we need to port code --- cura/CuraApplication.py | 32 +++++++++++++++++--------------- cura/PrintInformation.py | 1 + 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index effa287eda..a0d29e86cb 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -461,26 +461,28 @@ class CuraApplication(QtApplication): def _onActiveMachineChanged(self): machine = self.getMachineManager().getActiveMachineInstance() if machine: + pass + #Preferences.getInstance().setValue("cura/active_machine", machine.getName()) - self._volume.setWidth(machine.getSettingValueByKey("machine_width")) - self._volume.setHeight(machine.getSettingValueByKey("machine_height")) - self._volume.setDepth(machine.getSettingValueByKey("machine_depth")) + #self._volume.setWidth(machine.getSettingValueByKey("machine_width")) + #self._volume.setHeight(machine.getSettingValueByKey("machine_height")) + #self._volume.setDepth(machine.getSettingValueByKey("machine_depth")) - disallowed_areas = machine.getSettingValueByKey("machine_disallowed_areas") - areas = [] - if disallowed_areas: - for area in disallowed_areas: - areas.append(Polygon(numpy.array(area, numpy.float32))) + #disallowed_areas = machine.getSettingValueByKey("machine_disallowed_areas") + #areas = [] + #if disallowed_areas: + #for area in disallowed_areas: + #areas.append(Polygon(numpy.array(area, numpy.float32))) - self._volume.setDisallowedAreas(areas) + #self._volume.setDisallowedAreas(areas) - self._volume.rebuild() + #self._volume.rebuild() - offset = machine.getSettingValueByKey("machine_platform_offset") - if offset: - self._platform.setPosition(Vector(offset[0], offset[1], offset[2])) - else: - self._platform.setPosition(Vector(0.0, 0.0, 0.0)) + #offset = machine.getSettingValueByKey("machine_platform_offset") + #if offset: + #self._platform.setPosition(Vector(offset[0], offset[1], offset[2])) + #else: + #self._platform.setPosition(Vector(0.0, 0.0, 0.0)) def _onFileLoaded(self, job): node = job.getResult() diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index f4a574c0b9..9697e65294 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -176,6 +176,7 @@ class PrintInformation(QObject): self._slice_reason = None def _onActiveMachineChanged(self): + return if self._current_settings: self._current_settings.settingChanged.disconnect(self._onSettingChanged) From e6e563cf09a790de7f3ef724dc4e8964d135ce36 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 27 Aug 2015 09:36:09 +0200 Subject: [PATCH 25/56] Use the profile for getting setting values, not the machine instance --- .../CuraEngineBackend/CuraEngineBackend.py | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index fa76cc08d4..c6a29e4681 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -45,9 +45,10 @@ class CuraEngineBackend(Backend): self._onActiveViewChanged() self._stored_layer_data = None - self._settings = None - Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineChanged) - self._onActiveMachineChanged() + + self._profile = None + Application.getInstance().getMachineManager().activeProfileChanged.connect(self._onActiveProfileChanged) + self._onActiveProfileChanged() self._change_timer = QTimer() self._change_timer.setInterval(500) @@ -115,7 +116,7 @@ class CuraEngineBackend(Backend): return object_groups = [] - if self._settings.getSettingValueByKey("print_sequence") == "One at a time": + if self._profile.getSettingValue("print_sequence") == "one_at_a_time": for node in OneAtATimeIterator(self._scene.getRoot()): temp_list = [] children = node.getAllChildren() @@ -141,7 +142,7 @@ class CuraEngineBackend(Backend): if len(object_groups) == 0: return #No point in slicing an empty build plate - if kwargs.get("settings", self._settings).hasErrorValue(): + if kwargs.get("profile", self._profile).hasErrorValue(): return #No slicing if we have error values since those are by definition illegal values. self._slicing = True @@ -151,7 +152,7 @@ class CuraEngineBackend(Backend): if self._report_progress: self.processingProgress.emit(0.0) - self._sendSettings(kwargs.get("settings", self._settings)) + self._sendSettings(kwargs.get("profile", self._profile)) self._scene.acquireLock() @@ -197,13 +198,14 @@ class CuraEngineBackend(Backend): self._onChanged() - def _onActiveMachineChanged(self): - if self._settings: - self._settings.settingChanged.disconnect(self._onSettingChanged) - self._settings = Application.getInstance().getMachineManager().getActiveMachineInstance() - if self._settings: - self._settings.settingChanged.connect(self._onSettingChanged) + def _onActiveProfileChanged(self): + if self._profile: + self._profile.settingValueChanged.disconnect(self._onSettingChanged) + + self._profile = Application.getInstance().getMachineManager().getActiveProfile() + if self._profile: + self._profile.settingValueChanged.connect(self._onSettingChanged) self._onChanged() def _onSettingChanged(self, setting): @@ -249,17 +251,17 @@ class CuraEngineBackend(Backend): self._socket.registerMessageType(7, Cura_pb2.GCodePrefix) def _onChanged(self): - if not self._settings: + if not self._profile: return self._change_timer.start() - def _sendSettings(self, settings): + def _sendSettings(self, profile): msg = Cura_pb2.SettingList() - for setting in settings.getAllSettings(include_machine=True): + for key, value in profile.getAllSettingValues(include_machine = True).items(): s = msg.settings.add() - s.name = setting.getKey() - s.value = str(setting.getValue()).encode("utf-8") + s.name = key + s.value = str(value).encode("utf-8") self._socket.sendMessage(msg) From 712ec6acdff494b598968138fb0589f5adda9d4f Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Thu, 27 Aug 2015 09:36:52 +0200 Subject: [PATCH 26/56] Fix normal profile and add a very basic High Quality profile --- resources/profiles/High+Quality.cfg | 6 ++++++ resources/profiles/Normal+Quality.cfg | 5 +++-- 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 resources/profiles/High+Quality.cfg diff --git a/resources/profiles/High+Quality.cfg b/resources/profiles/High+Quality.cfg new file mode 100644 index 0000000000..a7621ed392 --- /dev/null +++ b/resources/profiles/High+Quality.cfg @@ -0,0 +1,6 @@ +[general] +version = 1 +name = High Quality + +[settings] +layer_height = 0.06 diff --git a/resources/profiles/Normal+Quality.cfg b/resources/profiles/Normal+Quality.cfg index 234dc39561..c6a82b4910 100644 --- a/resources/profiles/Normal+Quality.cfg +++ b/resources/profiles/Normal+Quality.cfg @@ -1,5 +1,6 @@ -[General] +[general] version = 1 name = Normal Quality -[Settings] +[settings] +layer_height = 0.1 From 47e96a9e2a1b0788499762daf898ae1aebd40f0b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:03:29 +0200 Subject: [PATCH 27/56] Fix ConvexHull{Decorator,Job} to work with the new profile structure --- cura/ConvexHullDecorator.py | 34 +++++++++++++++++++++------------- cura/ConvexHullJob.py | 11 +++++------ 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/cura/ConvexHullDecorator.py b/cura/ConvexHullDecorator.py index 9edb111c77..1f1bc5db34 100644 --- a/cura/ConvexHullDecorator.py +++ b/cura/ConvexHullDecorator.py @@ -14,18 +14,10 @@ class ConvexHullDecorator(SceneNodeDecorator): self._convex_hull_node = None self._convex_hull_job = None - settings = Application.getInstance().getMachineManager().getActiveMachineInstance() - print_sequence_setting = settings.getSettingByKey("print_sequence") - if print_sequence_setting: - print_sequence_setting.valueChanged.connect(self._onPrintSequenceSettingChanged) - - def _onPrintSequenceSettingChanged(self, setting): - if self._convex_hull_job: - self._convex_hull_job.cancel() - self.setConvexHull(None) - if self._convex_hull_node: - self._convex_hull_node.setParent(None) - self._convex_hull_node = None + + self._profile = None + Application.getInstance().getMachineManager().activeProfileChanged.connect(self._onActiveProfileChanged) + self._onActiveProfileChanged() def getConvexHull(self): return self._convex_hull @@ -61,4 +53,20 @@ class ConvexHullDecorator(SceneNodeDecorator): def setConvexHullNode(self, node): self._convex_hull_node = node - \ No newline at end of file + def _onActiveProfileChanged(self): + if self._profile: + self._profile.settingValueChanged.disconnect(self._onSettingValueChanged) + + self._profile = Application.getInstance().getMachineManager().getActiveProfile() + + if self._profile: + self._profile.settingValueChanged.connect(self._onSettingValueChanged) + + def _onSettingValueChanged(self, setting): + if setting == "print_sequence": + if self._convex_hull_job: + self._convex_hull_job.cancel() + self.setConvexHull(None) + if self._convex_hull_node: + self._convex_hull_node.setParent(None) + self._convex_hull_node = None diff --git a/cura/ConvexHullJob.py b/cura/ConvexHullJob.py index 1e87892504..f858d142d4 100644 --- a/cura/ConvexHullJob.py +++ b/cura/ConvexHullJob.py @@ -46,14 +46,14 @@ class ConvexHullJob(Job): # Then, do a Minkowski hull with a simple 1x1 quad to outset and round the normal convex hull. # This is done because of rounding errors. hull = hull.getMinkowskiHull(Polygon(numpy.array([[-1, -1], [-1, 1], [1, 1], [1, -1]], numpy.float32))) - settings = Application.getInstance().getMachineManager().getActiveMachineInstance() - - if settings.getSettingValueByKey("print_sequence") == "One at a time" and not self._node.getParent().callDecoration("isGroup"): + + profile = Application.getInstance().getMachineManager().getActiveProfile() + if profile.getSettingValue("print_sequence") == "one_at_a_time" and not self._node.getParent().callDecoration("isGroup"): # Printing one at a time and it's not an object in a group self._node.callDecoration("setConvexHullBoundary", copy.deepcopy(hull)) - head_hull = hull.getMinkowskiHull(Polygon(numpy.array(settings.getSettingValueByKey("machine_head_with_fans_polygon"),numpy.float32))) + head_hull = hull.getMinkowskiHull(Polygon(numpy.array(profile.getSettingValue("machine_head_with_fans_polygon"),numpy.float32))) self._node.callDecoration("setConvexHullHead", head_hull) - hull = hull.getMinkowskiHull(Polygon(numpy.array(settings.getSettingValueByKey("machine_head_polygon"),numpy.float32))) + hull = hull.getMinkowskiHull(Polygon(numpy.array(profile.getSettingValue("machine_head_polygon"),numpy.float32))) hull_node = ConvexHullNode.ConvexHullNode(self._node, hull, Application.getInstance().getController().getScene().getRoot()) self._node.callDecoration("setConvexHullNode", hull_node) self._node.callDecoration("setConvexHull", hull) @@ -67,4 +67,3 @@ class ConvexHullJob(Job): hull_node = self._node.getParent().callDecoration("getConvexHullNode") if hull_node: hull_node.setParent(None) - From f618b54d695bed0e4d8ac8e49cdf74a1d5006127 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:03:59 +0200 Subject: [PATCH 28/56] Connect to MachineManager's addMachineRequested so we can show the add printer dialog --- cura/CuraApplication.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index a0d29e86cb..ade2caddcd 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -85,6 +85,7 @@ class CuraApplication(QtApplication): self._platform_activity = False self.getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineChanged) + self.getMachineManager().addMachineRequested.connect(self._onAddMachineRequested) self.getController().getScene().sceneChanged.connect(self.updatePlatformActivity) Resources.addType(self.ResourceTypes.QmlFiles, "qml") @@ -520,3 +521,5 @@ class CuraApplication(QtApplication): job.finished.connect(self._onFileLoaded) job.start() + def _onAddMachineRequested(self): + self.requestAddPrinter.emit() From 1f82e83093ddf26abd597fa2f4fe02c91c447266 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:04:55 +0200 Subject: [PATCH 29/56] Use SettingOverrideDecorator::getAllSettingValues to get per-object settings --- plugins/CuraEngineBackend/CuraEngineBackend.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index c6a29e4681..9d4f97ade6 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -296,18 +296,11 @@ class CuraEngineBackend(Backend): setting.name = key setting.value = str(value).encode() - object_settings = node.callDecoration("getAllSettings") + object_settings = node.callDecoration("getAllSettingValues") if not object_settings: return for key, value in object_settings.items(): setting = message.settings.add() setting.name = key - setting.value = str(value.getValue()).encode() - - for child in value.getAllChildren(): - setting = message.settings.add() - setting.name = child.getKey() - setting.value = str(child.getValue()).encode() - - + setting.value = str(value).encode() From 510f5978f0c49397646379c9b6250e2a89127bdf Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:05:31 +0200 Subject: [PATCH 30/56] Remove most of the PrintInformation code and fix the material amount to use profile --- cura/PrintInformation.py | 177 ++------------------------------------- 1 file changed, 7 insertions(+), 170 deletions(-) diff --git a/cura/PrintInformation.py b/cura/PrintInformation.py index 9697e65294..55507fd603 100644 --- a/cura/PrintInformation.py +++ b/cura/PrintInformation.py @@ -40,48 +40,13 @@ class PrintInformation(QObject): def __init__(self, parent = None): super().__init__(parent) - self._enabled = False - - self._minimum_print_time = Duration(None, self) self._current_print_time = Duration(None, self) - self._maximum_print_time = Duration(None, self) self._material_amount = -1 - self._time_quality_value = 50 - self._time_quality_changed_timer = QTimer() - self._time_quality_changed_timer.setInterval(500) - self._time_quality_changed_timer.setSingleShot(True) - self._time_quality_changed_timer.timeout.connect(self._updateTimeQualitySettings) - - self._interpolation_settings = { - "layer_height": { "minimum": "low", "maximum": "high", "curve": "linear", "precision": 2 }, - "fill_sparse_density": { "minimum": "low", "maximum": "high", "curve": "linear", "precision": 0 } - } - - self._low_quality_settings = None - self._current_settings = None - self._high_quality_settings = None - - self._slice_pass = None - self._slice_reason = None - - Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineChanged) - self._onActiveMachineChanged() - - Application.getInstance().getController().getScene().sceneChanged.connect(self._onSceneChanged) - self._backend = Application.getInstance().getBackend() if self._backend: self._backend.printDurationMessage.connect(self._onPrintDurationMessage) - self._backend.slicingStarted.connect(self._onSlicingStarted) - self._backend.slicingCancelled.connect(self._onSlicingCancelled) - - minimumPrintTimeChanged = pyqtSignal() - - @pyqtProperty(Duration, notify = minimumPrintTimeChanged) - def minimumPrintTime(self): - return self._minimum_print_time currentPrintTimeChanged = pyqtSignal() @@ -89,146 +54,18 @@ class PrintInformation(QObject): def currentPrintTime(self): return self._current_print_time - maximumPrintTimeChanged = pyqtSignal() - - @pyqtProperty(Duration, notify = maximumPrintTimeChanged) - def maximumPrintTime(self): - return self._maximum_print_time - materialAmountChanged = pyqtSignal() @pyqtProperty(float, notify = materialAmountChanged) def materialAmount(self): return self._material_amount - timeQualityValueChanged = pyqtSignal() - - @pyqtProperty(int, notify = timeQualityValueChanged) - def timeQualityValue(self): - return self._time_quality_value - - def setEnabled(self, enabled): - if enabled != self._enabled: - self._enabled = enabled - - if self._enabled: - self._updateTimeQualitySettings() - self._onSlicingStarted() - - self.enabledChanged.emit() - - enabledChanged = pyqtSignal() - @pyqtProperty(bool, fset = setEnabled, notify = enabledChanged) - def enabled(self): - return self._enabled - - @pyqtSlot(int) - def setTimeQualityValue(self, value): - if value != self._time_quality_value: - self._time_quality_value = value - self.timeQualityValueChanged.emit() - - self._time_quality_changed_timer.start() - - def _onSlicingStarted(self): - if self._slice_pass is None: - self._slice_pass = self.SlicePass.CurrentSettings - - if self._slice_reason is None: - self._slice_reason = self.SliceReason.Other - - if self._slice_pass == self.SlicePass.CurrentSettings and self._slice_reason != self.SliceReason.SettingChanged: - self._minimum_print_time.setDuration(-1) - self.minimumPrintTimeChanged.emit() - self._maximum_print_time.setDuration(-1) - self.maximumPrintTimeChanged.emit() - def _onPrintDurationMessage(self, time, amount): - if self._slice_pass == self.SlicePass.CurrentSettings: - self._current_print_time.setDuration(time) - self.currentPrintTimeChanged.emit() + #if self._slice_pass == self.SlicePass.CurrentSettings: + self._current_print_time.setDuration(time) + self.currentPrintTimeChanged.emit() - # Material amount is sent as an amount of mm^3, so calculate length from that - r = self._current_settings.getSettingValueByKey("material_diameter") / 2 - self._material_amount = round((amount / (math.pi * r ** 2)) / 1000, 2) - self.materialAmountChanged.emit() - - if not self._enabled: - return - - if self._slice_reason != self.SliceReason.SettingChanged or not self._minimum_print_time.valid or not self._maximum_print_time.valid: - self._slice_pass = self.SlicePass.LowQualitySettings - self._backend.slice(settings = self._low_quality_settings, save_gcode = False, save_polygons = False, force_restart = False, report_progress = False) - else: - self._slice_pass = None - self._slice_reason = None - elif self._slice_pass == self.SlicePass.LowQualitySettings: - self._minimum_print_time.setDuration(time) - self.minimumPrintTimeChanged.emit() - - self._slice_pass = self.SlicePass.HighQualitySettings - self._backend.slice(settings = self._high_quality_settings, save_gcode = False, save_polygons = False, force_restart = False, report_progress = False) - elif self._slice_pass == self.SlicePass.HighQualitySettings: - self._maximum_print_time.setDuration(time) - self.maximumPrintTimeChanged.emit() - - self._slice_pass = None - self._slice_reason = None - - def _onActiveMachineChanged(self): - return - if self._current_settings: - self._current_settings.settingChanged.disconnect(self._onSettingChanged) - - self._current_settings = Application.getInstance().getMachineManager().getActiveMachineInstance() - - if self._current_settings: - self._current_settings.settingChanged.connect(self._onSettingChanged) - self._low_quality_settings = None - self._high_quality_settings = None - self._updateTimeQualitySettings() - - self._slice_reason = self.SliceReason.ActiveMachineChanged - - def _updateTimeQualitySettings(self): - if not self._current_settings or not self._enabled: - return - - if not self._low_quality_settings: - self._low_quality_settings = MachineSettings() - self._low_quality_settings.loadSettingsFromFile(Resources.getPath(Resources.SettingsLocation, self._current_settings.getTypeID() + ".json")) - self._low_quality_settings.loadValuesFromFile(Resources.getPath(Resources.SettingsLocation, "profiles", "low_quality.conf")) - - if not self._high_quality_settings: - self._high_quality_settings = MachineSettings() - self._high_quality_settings.loadSettingsFromFile(Resources.getPath(Resources.SettingsLocation, self._current_settings.getTypeID() + ".json")) - self._high_quality_settings.loadValuesFromFile(Resources.getPath(Resources.SettingsLocation, "profiles", "high_quality.conf")) - - for key, options in self._interpolation_settings.items(): - minimum_value = None - if options["minimum"] == "low": - minimum_value = self._low_quality_settings.getSettingValueByKey(key) - elif options["minimum"] == "high": - minimum_value = self._high_quality_settings.getSettingValueByKey(key) - else: - continue - - maximum_value = None - if options["maximum"] == "low": - maximum_value = self._low_quality_settings.getSettingValueByKey(key) - elif options["maximum"] == "high": - maximum_value = self._high_quality_settings.getSettingValueByKey(key) - else: - continue - - setting_value = round(minimum_value + (maximum_value - minimum_value) * (self._time_quality_value / 100), options["precision"]) - self._current_settings.setSettingValueByKey(key, setting_value) - - def _onSceneChanged(self, source): - self._slice_reason = self.SliceReason.SceneChanged - - def _onSettingChanged(self, source): - self._slice_reason = self.SliceReason.SettingChanged - - def _onSlicingCancelled(self): - self._slice_pass = None + # Material amount is sent as an amount of mm^3, so calculate length from that + r = Application.getInstance().getMachineManager().getActiveProfile().getSettingValue("material_diameter") / 2 + self._material_amount = round((amount / (math.pi * r ** 2)) / 1000, 2) + self.materialAmountChanged.emit() From 5aa95f125860104613753990dd2e6f853fbb379b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:06:03 +0200 Subject: [PATCH 31/56] Use the active machine instance for Build Volume --- cura/BuildVolume.py | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/cura/BuildVolume.py b/cura/BuildVolume.py index 4ee86e2ef0..9c4ea14e42 100644 --- a/cura/BuildVolume.py +++ b/cura/BuildVolume.py @@ -10,6 +10,7 @@ from UM.Mesh.MeshBuilder import MeshBuilder from UM.Math.Vector import Vector from UM.Math.Color import Color from UM.Math.AxisAlignedBox import AxisAlignedBox +from UM.Math.Polygon import Polygon import numpy @@ -33,6 +34,9 @@ class BuildVolume(SceneNode): self.setCalculateBoundingBox(False) + self._active_instance = None + Application.getInstance().getMachineManager().activeMachineInstanceChanged.connect(self._onActiveInstanceChanged) + self._onActiveInstanceChanged() def setWidth(self, width): self._width = width @@ -135,17 +139,18 @@ class BuildVolume(SceneNode): self._aabb = AxisAlignedBox(minimum = Vector(minW, minH - 1.0, minD), maximum = Vector(maxW, maxH, maxD)) - settings = Application.getInstance().getMachineManager().getActiveMachineInstance() - skirt_size = 0.0 - if settings.getSettingValueByKey("adhesion_type") == "None": - skirt_size = settings.getSettingValueByKey("skirt_line_count") * settings.getSettingValueByKey("skirt_line_width") + settings.getSettingValueByKey("skirt_gap") - elif settings.getSettingValueByKey("adhesion_type") == "Brim": - skirt_size = settings.getSettingValueByKey("brim_line_count") * settings.getSettingValueByKey("skirt_line_width") - else: - skirt_size = settings.getSettingValueByKey("skirt_line_width") - skirt_size += settings.getSettingValueByKey("skirt_line_width") + #profile = Application.getInstance().getMachineManager().getActiveProfile() + #if profile: + #if profile.getSettingValue("adhesion_type") == "skirt": + #skirt_size = profile.getSettingValue("skirt_line_count") * profile.getSettingValue("skirt_line_width") + profile.getSettingValue("skirt_gap") + #elif profile.getSettingValue("adhesion_type") == "brim": + #skirt_size = profile.getSettingValue("brim_line_count") * profile.getSettingValue("skirt_line_width") + #else: + #skirt_size = profile.getSettingValue("skirt_line_width") + + #skirt_size += profile.getSettingValue("skirt_line_width") scale_to_max_bounds = AxisAlignedBox( minimum = Vector(minW + skirt_size, minH, minD + skirt_size + disallowed_area_size), @@ -153,3 +158,21 @@ class BuildVolume(SceneNode): ) Application.getInstance().getController().getScene()._maximum_bounds = scale_to_max_bounds + + def _onActiveInstanceChanged(self): + self._active_instance = Application.getInstance().getMachineManager().getActiveMachineInstance() + + if self._active_instance: + self._width = self._active_instance.getMachineSettingValue("machine_width") + self._height = self._active_instance.getMachineSettingValue("machine_height") + self._depth = self._active_instance.getMachineSettingValue("machine_depth") + + disallowed_areas = self._active_instance.getMachineSettingValue("machine_disallowed_areas") + areas = [] + if disallowed_areas: + for area in disallowed_areas: + areas.append(Polygon(numpy.array(area, numpy.float32))) + + self._disallowed_areas = areas + + self.rebuild() From f7ecc1dc40f2284d140ff4574a6f4521aed0a854 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:07:13 +0200 Subject: [PATCH 32/56] Properly set the current index of variant/profile combo boxes --- resources/qml/Sidebar.qml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 36798c2c73..5e0008c3e5 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -78,6 +78,16 @@ Rectangle { model: UM.MachineVariantsModel { } textRole: "name" onActivated: UM.MachineManager.setActiveMachineVariant(model.getItem(index).name); + + currentIndex: { + for(var i = 0; i < model.rowCount(); ++i) { + if(model.getItem(i).name == UM.MachineManager.activeMachineVariant) { + return i; + } + } + + return 0; + } } } } @@ -98,6 +108,15 @@ Rectangle { model: UM.ProfilesModel { } textRole: "name" onActivated: UM.MachineManager.setActiveProfile(model.getItem(index).name) + + currentIndex: { + for(var i = 0; i < model.rowCount(); ++i) { + if(model.getItem(i).name == UM.MachineManager.activeProfile) + return i; + } + + return 0; + } } Button { From 5e3d492aba0609aacfb4161fd90581be98e48806 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:07:45 +0200 Subject: [PATCH 33/56] Set wizard to null so we do not get complaints from QML --- resources/qml/WizardPages/AddMachine.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/WizardPages/AddMachine.qml b/resources/qml/WizardPages/AddMachine.qml index bce4272c0e..3b58352500 100644 --- a/resources/qml/WizardPages/AddMachine.qml +++ b/resources/qml/WizardPages/AddMachine.qml @@ -17,7 +17,7 @@ Item property string activeManufacturer: "Ultimaker"; - property variant wizard; + property variant wizard: null; Connections { From 7161ed63aa0514d9d065a6c45d50acb1976ce6a2 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:08:15 +0200 Subject: [PATCH 34/56] Use rowCount() not count for getting devicesModel's row count --- resources/qml/Cura.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index a97c6c604f..db8a1a3735 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -63,7 +63,7 @@ UM.MainWindow { id: saveAllMenu title: "Save All" iconName: "document-save"; - enabled: devicesModel.count > 0 && UM.Backend.progress > 0.99; + enabled: devicesModel.rowCount() > 0 && UM.Backend.progress > 0.99; Instantiator { model: UM.OutputDevicesModel { id: devicesModel; } From 516c0cd516c7320ce1d062b31a6ce0f839803b69 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:18:26 +0200 Subject: [PATCH 35/56] Change all min/max/warning values in fdmprinter to functions --- resources/machines/fdmprinter.json | 227 +++++++++++++++-------------- 1 file changed, 114 insertions(+), 113 deletions(-) diff --git a/resources/machines/fdmprinter.json b/resources/machines/fdmprinter.json index 89a5626136..9628941ea8 100644 --- a/resources/machines/fdmprinter.json +++ b/resources/machines/fdmprinter.json @@ -109,9 +109,9 @@ "unit": "mm", "type": "float", "default": 0.1, - "min_value": 0.0001, - "min_value_warning": 0.04, - "max_value_warning": 0.32 + "min_value": "0.0001", + "min_value_warning": "0.04", + "max_value_warning": "0.32" }, "layer_height_0": { "label": "Initial Layer Height", @@ -119,18 +119,18 @@ "unit": "mm", "type": "float", "default": 0.3, - "min_value": 0.0001, - "min_value_warning": 0.04, - "max_value_warning": 0.32, + "min_value": "0.0001", + "min_value_warning": "0.04", + "max_value_warning": "0.32", "visible": false }, "line_width": { "label": "Line Width", "description": "Width of a single line. Each line will be printed with this width in mind. Generally the width of each line should correspond to the width of your nozzle, but for the outer wall and top/bottom surface smaller line widths may be chosen, for higher quality.", "unit": "mm", - "min_value": 0.0001, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0.0001", + "min_value_warning": "0.2", + "max_value_warning": "5", "default": 0.4, "type": "float", "visible": false, @@ -140,9 +140,9 @@ "label": "Wall Line Width", "description": "Width of a single shell line. Each line of the shell will be printed with this width in mind.", "unit": "mm", - "min_value": 0.0001, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0.0001", + "min_value_warning": "0.2", + "max_value_warning": "5", "default": 0.4, "type": "float", "visible": false, @@ -152,9 +152,9 @@ "label": "Outer Wall Line Width", "description": "Width of the outermost shell line. By printing a thinner outermost wall line you can print higher details with a larger nozzle.", "unit": "mm", - "min_value": 0.0001, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0.0001", + "min_value_warning": "0.2", + "max_value_warning": "5", "default": 0.4, "type": "float", "visible": false @@ -163,9 +163,9 @@ "label": "Other Walls Line Width", "description": "Width of a single shell line for all shell lines except the outermost one.", "unit": "mm", - "min_value": 0.0001, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0.0001", + "min_value_warning": "0.2", + "max_value_warning": "5", "default": 0.4, "type": "float", "visible": false @@ -176,9 +176,9 @@ "label": "Skirt line width", "description": "Width of a single skirt line.", "unit": "mm", - "min_value": 0.0001, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0.0001", + "min_value_warning": "0.2", + "max_value_warning": "5", "default": 0.4, "type": "float", "visible": false @@ -187,9 +187,9 @@ "label": "Top/bottom line width", "description": "Width of a single top/bottom printed line, used to fill up the top/bottom areas of a print.", "unit": "mm", - "min_value": 0.0001, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0.0001", + "min_value_warning": "0.2", + "max_value_warning": "5", "default": 0.4, "type": "float", "visible": false @@ -198,9 +198,9 @@ "label": "Infill line width", "description": "Width of the inner infill printed lines.", "unit": "mm", - "min_value": 0.0001, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0.0001", + "min_value_warning": "0.2", + "max_value_warning": "5", "default": 0.4, "type": "float", "visible": false @@ -209,9 +209,9 @@ "label": "Support line width", "description": "Width of the printed support structures lines.", "unit": "mm", - "min_value": 0.0001, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0.0001", + "min_value_warning": "0.2", + "max_value_warning": "5", "default": 0.4, "type": "float", "visible": false, @@ -247,25 +247,25 @@ "unit": "mm", "type": "float", "default": 0.8, - "min_value": 0, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0", + "min_value_warning": "0.2", + "max_value_warning": "5", "children": { "wall_thickness": { "label": "Wall Thickness", "description": "The thickness of the outside walls in the horizontal direction. This is used in combination with the nozzle size to define the number of perimeter lines and the thickness of those perimeter lines.", "unit": "mm", "default": 0.8, - "min_value": 0, - "min_value_warning": 0.2, - "max_value_warning": 5, + "min_value": "0", + "min_value_warning": "0.2", + "max_value_warning": "5", "type": "float", "visible": false, "children": { "wall_line_count": { "label": "Wall Line Count", "description": "Number of shell lines. This these lines are called perimeter lines in other tools and impact the strength and structural integrity of your print.", - "min_value": 0, + "min_value": "0", "default": 2, "type": "int", "visible": false, @@ -285,10 +285,10 @@ "description": "This controls the thickness of the bottom and top layers, the amount of solid layers put down is calculated by the layer thickness and this value. Having this value a multiple of the layer thickness makes sense. And keep it near your wall thickness to make an evenly strong part.", "unit": "mm", "default": 0.8, - "min_value": 0, - "max_value": 5, - "min_value_warning": 0.6, - "max_value_warning": 1, + "min_value": "0", + "max_value": "5", + "min_value_warning": "0.6", + "max_value_warning": "1", "type": "float", "visible": false, "children": { @@ -296,7 +296,7 @@ "label": "Top Thickness", "description": "This controls the thickness of the top layers. The number of solid layers printed is calculated from the layer thickness and this value. Having this value be a multiple of the layer thickness makes sense. And keep it nearto your wall thickness to make an evenly strong part.", "unit": "mm", - "min_value": 0, + "min_value": "0", "default": 0.8, "type": "float", "visible": false, @@ -304,7 +304,7 @@ "top_layers": { "label": "Top Layers", "description": "This controls the amount of top layers.", - "min_value": 0, + "min_value": "0", "default": 6, "type": "int", "visible": false, @@ -316,7 +316,7 @@ "label": "Bottom Thickness", "description": "This controls the thickness of the bottom layers. The number of solid layers printed is calculated from the layer thickness and this value. Having this value be a multiple of the layer thickness makes sense. And keep it near to your wall thickness to make an evenly strong part.", "unit": "mm", - "min_value": 0, + "min_value": "0", "default": 0.6, "type": "float", "visible": false, @@ -324,7 +324,7 @@ "bottom_layers": { "label": "Bottom Layers", "description": "This controls the amount of bottom layers.", - "min_value": 0, + "min_value": "0", "default": 6, "type": "int", "visible": false, @@ -434,6 +434,7 @@ "unit": "%", "type": "float", "default": 20, + "max_value_warning": "100.0", "children": { "infill_pattern": { "label": "Infill Pattern", @@ -508,8 +509,8 @@ "unit": "°C", "type": "float", "default": 210, - "min_value": 0, - "max_value_warning": 260 + "min_value": "0", + "max_value_warning": "260" }, "material_bed_temperature": { "label": "Bed Temperature", @@ -517,8 +518,8 @@ "unit": "°C", "type": "float", "default": 60, - "min_value": 0, - "max_value_warning": 260 + "min_value": "0", + "max_value_warning": "260", }, "material_diameter": { "label": "Diameter", @@ -526,8 +527,8 @@ "unit": "mm", "type": "float", "default": 2.85, - "min_value_warning": 0.4, - "max_value_warning": 3.5 + "min_value_warning": "0.4", + "max_value_warning": "3.5" }, "material_flow": { "label": "Flow", @@ -535,9 +536,9 @@ "unit": "%", "default": 100, "type": "float", - "min_value": 5, - "min_value_warning": 50, - "max_value_warning": 150 + "min_value": "5", + "min_value_warning": "50", + "max_value_warning": "150" }, "retraction_enable": { "label": "Enable Retraction", @@ -673,8 +674,8 @@ "description": "The speed at which printing happens. A well-adjusted Ultimaker can reach 150mm/s, but for good quality prints you will want to print slower. Printing speed depends on a lot of factors, so you will need to experiment with optimal settings for this.", "unit": "mm/s", "type": "float", - "min_value": 0.1, - "max_value_warning": 150, + "min_value": "0.1", + "max_value_warning": "150", "default": 50, "children": { "speed_infill": { @@ -682,8 +683,8 @@ "description": "The speed at which infill parts are printed. Printing the infill faster can greatly reduce printing time, but this can negatively affect print quality.", "unit": "mm/s", "type": "float", - "min_value": 0.1, - "max_value_warning": 150, + "min_value": "0.1", + "max_value_warning": "150", "default": 50, "visible": false }, @@ -692,8 +693,8 @@ "description": "The speed at which shell is printed. Printing the outer shell at a lower speed improves the final skin quality.", "unit": "mm/s", "type": "float", - "min_value": 0.1, - "max_value_warning": 150, + "min_value": "0.1", + "max_value_warning": "150", "default": 50, "visible": false, "children": { @@ -702,8 +703,8 @@ "description": "The speed at which outer shell is printed. Printing the outer shell at a lower speed improves the final skin quality. However, having a large difference between the inner shell speed and the outer shell speed will effect quality in a negative way.", "unit": "mm/s", "type": "float", - "min_value": 0.1, - "max_value_warning": 150, + "min_value": "0.1", + "max_value_warning": "150", "default": 50, "visible": false }, @@ -712,8 +713,8 @@ "description": "The speed at which all inner shells are printed. Printing the inner shell fasster than the outer shell will reduce printing time. It is good to set this in between the outer shell speed and the infill speed.", "unit": "mm/s", "type": "float", - "min_value": 0.1, - "max_value_warning": 150, + "min_value": "0.1", + "max_value_warning": "150", "default": 50, "visible": false } @@ -724,8 +725,8 @@ "description": "Speed at which top/bottom parts are printed. Printing the top/bottom faster can greatly reduce printing time, but this can negatively affect print quality.", "unit": "mm/s", "type": "float", - "min_value": 0.1, - "max_value_warning": 150, + "min_value": "0.1", + "max_value_warning": "150", "default": 50, "visible": false }, @@ -734,8 +735,8 @@ "description": "The speed at which exterior support is printed. Printing exterior supports at higher speeds can greatly improve printing time. And the surface quality of exterior support is usually not important, so higher speeds can be used.", "unit": "mm/s", "type": "float", - "min_value": 0.1, - "max_value_warning": 150, + "min_value": "0.1", + "max_value_warning": "150", "default": 50, "visible": false, "inherit_function": "speed_wall_0", @@ -779,8 +780,8 @@ "description": "The speed at which travel moves are done. A well-built Ultimaker can reach speeds of 250mm/s. But some machines might have misaligned layers then.", "unit": "mm/s", "type": "float", - "min_value": 0.1, - "max_value_warning": 300, + "min_value": "0.1", + "max_value_warning": "300", "default": 150 }, "speed_layer_0": { @@ -788,7 +789,7 @@ "description": "The print speed for the bottom layer: You want to print the first layer slower so it sticks to the printer bed better.", "unit": "mm/s", "type": "float", - "min_value": 0.1, + "min_value": "0.1", "default": 15, "visible": false, "children": { @@ -797,7 +798,7 @@ "description": "The speed at which the skirt and brim are printed. Normally this is done at the initial layer speed. But sometimes you want to print the skirt at a different speed.", "unit": "mm/s", "type": "float", - "min_value": 0.1, + "min_value": "0.1", "default": 15, "visible": false } @@ -807,7 +808,7 @@ "label": "Amount of Slower Layers", "description": "The first few layers are printed slower then the rest of the object, this to get better adhesion to the printer bed and improve the overall success rate of prints. The speed is gradually increased over these layers. 4 layers of speed-up is generally right for most materials and printers.", "type": "int", - "min_value": 0, + "min_value": "0", "default": 4, "visible": false } @@ -999,8 +1000,8 @@ "description": "Fan speed used for the print cooling fan on the printer head.", "unit": "%", "type": "float", - "min_value": 0, - "max_value": 100, + "min_value": "0", + "max_value": "100", "default": 100, "visible": false, "inherit_function": "100.0 if parent_value else 0.0", @@ -1010,8 +1011,8 @@ "description": "Normally the fan runs at the minimum fan speed. If the layer is slowed down due to minimum layer time, the fan speed adjusts between minimum and maximum fan speed.", "unit": "%", "type": "float", - "min_value": 0, - "max_value": 100, + "min_value": "0", + "max_value": "100", "default": 100, "visible": false }, @@ -1020,8 +1021,8 @@ "description": "Normally the fan runs at the minimum fan speed. If the layer is slowed down due to minimum layer time, the fan speed adjusts between minimum and maximum fan speed.", "unit": "%", "type": "float", - "min_value": 0, - "max_value": 100, + "min_value": "0", + "max_value": "100", "default": 100, "visible": false } @@ -1034,7 +1035,7 @@ "description": "The height at which the fan is turned on completely. For the layers below this the fan speed is scaled linearly with the fan off for the first layer.", "unit": "mm", "type": "float", - "min_value": 0, + "min_value": "0", "default": 0.5, "visible": false, "children": { @@ -1042,7 +1043,7 @@ "label": "Fan Full on at Layer", "description": "The layer number at which the fan is turned on completely. For the layers below this the fan speed is scaled linearly with the fan off for the first layer.", "type": "int", - "min_value": 0, + "min_value": "0", "default": 4, "visible": false, "inherit_function": "int((parent_value - layer_height_0 + 0.001) / layer_height)" @@ -1054,7 +1055,7 @@ "description": "The minimum time spent in a layer: Gives the layer time to cool down before the next one is put on top. If a layer would print in less time, then the printer will slow down to make sure it has spent at least this many seconds printing the layer.", "unit": "sec", "type": "float", - "min_value": 0, + "min_value": "0", "default": 5, "visible": false }, @@ -1063,7 +1064,7 @@ "description": "The minimum time spent in a layer which will cause the fan to be at minmum speed. The fan speed increases linearly from maximal fan speed for layers taking minimal layer time to minimal fan speed for layers taking the time specified here.", "unit": "sec", "type": "float", - "min_value": 0, + "min_value": "0", "default": 10, "visible": false }, @@ -1114,8 +1115,8 @@ "description": "The maximum angle of overhangs for which support will be added. With 0 degrees being vertical, and 90 degrees being horizontal. A smaller overhang angle leads to more support.", "unit": "°", "type": "float", - "min_value": 0, - "max_value": 90, + "min_value": "0", + "max_value": "90", "default": 60, "visible": false, "active_if": { @@ -1128,8 +1129,8 @@ "description": "Distance of the support structure from the print, in the X/Y directions. 0.7mm typically gives a nice distance from the print so the support does not stick to the surface.", "unit": "mm", "type": "float", - "min_value": 0, - "max_value_warning": 10, + "min_value": "0", + "max_value_warning": "10", "default": 0.7, "visible": false, "active_if": { @@ -1142,8 +1143,8 @@ "description": "Distance from the top/bottom of the support to the print. A small gap here makes it easier to remove the support but makes the print a bit uglier. 0.15mm allows for easier separation of the support structure.", "unit": "mm", "type": "float", - "min_value": 0, - "max_value_warning": 10, + "min_value": "0", + "max_value_warning": "10", "default": 0.15, "visible": false, "active_if": { @@ -1155,8 +1156,8 @@ "label": "Top Distance", "description": "Distance from the top of the support to the print.", "unit": "mm", - "min_value": 0, - "max_value_warning": 10, + "min_value": "0", + "max_value_warning": "10", "default": 0.15, "type": "float", "visible": false @@ -1165,8 +1166,8 @@ "label": "Bottom Distance", "description": "Distance from the print to the bottom of the support.", "unit": "mm", - "min_value": 0, - "max_value_warning": 10, + "min_value": "0", + "max_value_warning": "10", "default": 0.15, "type": "float", "visible": false @@ -1189,8 +1190,8 @@ "description": "The angle of the tilt of conical support. With 0 degrees being vertical, and 90 degrees being horizontal. Smaller angles cause the support to be more sturdy, but consist of more material. Negative angles cause the base of the support to be wider than the top.", "unit": "°", "type": "float", - "min_value": -90, - "max_value": 90, + "min_value": "-90", + "max_value": "90", "default": 30, "visible": false, "active_if": { @@ -1202,7 +1203,7 @@ "label": "Minimal Width", "description": "Minimal width to which conical support reduces the support areas. Small widths can cause the base of the support to not act well as fundament for support above.", "unit": "mm", - "min_value": 0, + "min_value": "0", "default": 3.0, "type": "float", "visible": false, @@ -1302,8 +1303,8 @@ "description": "The angle of the rooftop of a tower. Larger angles mean more pointy towers. ", "unit": "°", "type": "int", - "min_value": 0, - "max_value": 90, + "min_value": "0", + "max_value": "90", "default": 65, "visible": false, "active_if": { @@ -1343,8 +1344,8 @@ "description": "The amount of infill structure in the support, less infill gives weaker support which is easier to remove.", "unit": "%", "type": "float", - "min_value": 0, - "max_value": 100, + "min_value": "0", + "max_value": "100", "default": 15, "visible": false, "active_if": { @@ -1357,7 +1358,7 @@ "description": "Distance between the printed support lines.", "unit": "mm", "type": "float", - "min_value": 0, + "min_value": "0", "default": 2.66, "visible": false, "active_if": { @@ -1615,8 +1616,8 @@ "description": "The fan speed for the raft.", "unit": "%", "type": "float", - "min_value": 0, - "max_value": 100, + "min_value": "0", + "max_value": "100", "default": 100, "visible": false, "children": { @@ -1625,8 +1626,8 @@ "description": "The fan speed for the surface raft layers.", "unit": "%", "type": "float", - "min_value": 0, - "max_value": 100, + "min_value": "0", + "max_value": "100", "default": 100, "visible": false, "inherit": true @@ -1636,8 +1637,8 @@ "description": "The fan speed for the interface raft layer.", "unit": "%", "type": "float", - "min_value": 0, - "max_value": 100, + "min_value": "0", + "max_value": "100", "default": 100, "visible": false, "inherit": true @@ -1647,8 +1648,8 @@ "description": "The fan speed for the base raft layer.", "unit": "%", "type": "float", - "min_value": 0, - "max_value": 100, + "min_value": "0", + "max_value": "100", "default": 100, "visible": false, "inherit": true @@ -1666,8 +1667,8 @@ "description": "Distance of the draft shield from the print, in the X/Y directions.", "unit": "mm", "type": "float", - "min_value": 0, - "max_value_warning": 100, + "min_value": "0", + "max_value_warning": "100", "default": 10, "visible": false, "active_if": { @@ -1695,8 +1696,8 @@ "description": "Height limitation on the draft shield. Above this height no draft shield will be printed.", "unit": "mm", "type": "float", - "min_value": 0, - "max_value_warning": 30, + "min_value": "0", + "max_value_warning": "30", "default": 0, "inherit_function": "9999 if draft_shield_height_limitation == 'full' and draft_shield_enabled else 0.0", "visible": false, From 251ce2f73d2803603ef7f7b455e3b9ff42d56a75 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:18:44 +0200 Subject: [PATCH 36/56] Change active_if to enabled functions --- resources/machines/fdmprinter.json | 104 +++++++++-------------------- 1 file changed, 33 insertions(+), 71 deletions(-) diff --git a/resources/machines/fdmprinter.json b/resources/machines/fdmprinter.json index 9628941ea8..570e81ea5f 100644 --- a/resources/machines/fdmprinter.json +++ b/resources/machines/fdmprinter.json @@ -520,6 +520,7 @@ "default": 60, "min_value": "0", "max_value_warning": "260", + "enabled": "machine_heated_bed" }, "material_diameter": { "label": "Diameter", @@ -1105,10 +1106,7 @@ "everywhere": "Everywhere" }, "default": "everywhere", - "active_if": { - "setting": "support_enable", - "value": true - } + "enabled": "support_enable" }, "support_angle": { "label": "Overhang Angle", @@ -1119,10 +1117,7 @@ "max_value": "90", "default": 60, "visible": false, - "active_if": { - "setting": "support_enable", - "value": true - } + "enabled": "support_enable" }, "support_xy_distance": { "label": "X/Y Distance", @@ -1133,10 +1128,7 @@ "max_value_warning": "10", "default": 0.7, "visible": false, - "active_if": { - "setting": "support_enable", - "value": true - } + "enabled": "support_enable" }, "support_z_distance": { "label": "Z Distance", @@ -1147,10 +1139,8 @@ "max_value_warning": "10", "default": 0.15, "visible": false, - "active_if": { - "setting": "support_enable", - "value": true - }, + "enabled": "support_enable", + "children": { "support_top_distance": { "label": "Top Distance", @@ -1160,7 +1150,8 @@ "max_value_warning": "10", "default": 0.15, "type": "float", - "visible": false + "visible": false, + "enabled": "support_enable" }, "support_bottom_distance": { "label": "Bottom Distance", @@ -1170,7 +1161,8 @@ "max_value_warning": "10", "default": 0.15, "type": "float", - "visible": false + "visible": false, + "enabled": "support_enable" } } }, @@ -1180,10 +1172,7 @@ "type": "boolean", "default": false, "visible": false, - "active_if": { - "setting": "support_enable", - "value": true - } + "enabled": "support_enable" }, "support_conical_angle": { "label": "Cone Angle", @@ -1194,10 +1183,7 @@ "max_value": "90", "default": 30, "visible": false, - "active_if": { - "setting": "support_conical_enabled", - "value": true - } + "enabled": "support_enable" }, "support_conical_min_width": { "label": "Minimal Width", @@ -1207,10 +1193,7 @@ "default": 3.0, "type": "float", "visible": false, - "active_if": { - "setting": "support_conical_enabled", - "value": true - } + "enabled": "support_enable" }, "support_bottom_stair_step_height": { "label": "Stair Step Height", @@ -1219,10 +1202,7 @@ "type": "float", "default": 2, "visible": false, - "active_if": { - "setting": "support_type", - "value": "Everywhere" - } + "enabled": "support_enable" }, "support_join_distance": { "label": "Join Distance", @@ -1230,7 +1210,8 @@ "unit": "mm", "type": "float", "default": 2, - "visible": false + "visible": false, + "enabled": "support_enable" }, "support_offset": { "label": "Horizontal Expansion", @@ -1238,7 +1219,8 @@ "unit": "mm", "type": "float", "default": 0.2, - "visible": false + "visible": false, + "enabled": "support_enable" }, "support_area_smoothing": { "label": "Area Smoothing", @@ -1246,14 +1228,16 @@ "unit": "mm", "type": "float", "default": 0.6, - "visible": false + "visible": false, + "enabled": "support_enable" }, "support_roof_enable": { "label": "Enable Hammock", "description": "Generate a solid support roof on which the model sits.", "type": "boolean", "default": false, - "visible": true + "visible": true, + "enabled": "support_enable" }, "support_roof_height": { "label": "Hammock Thickness", @@ -1262,17 +1246,15 @@ "type": "float", "default": 1, "visible": false, - "active_if": { - "setting": "support_roof_enable", - "value": true - } + "enabled": "support_enable" }, "support_use_towers": { "label": "Use towers.", "description": "Use specialized towers to support tiny overhang areas. These towers have a larger diameter than the region they support. Near the overhang the towers' diameter decreases, forming a roof.", "type": "boolean", "default": true, - "visible": false + "visible": false, + "enabled": "support_enable" }, "support_minimal_diameter": { "label": "Minimal Diameter", @@ -1281,10 +1263,7 @@ "type": "float", "default": 1, "visible": false, - "active_if": { - "setting": "support_use_towers", - "value": true - } + "enabled": "support_enable" }, "support_tower_diameter": { "label": "Tower Diameter", @@ -1293,10 +1272,7 @@ "type": "float", "default": 1, "visible": false, - "active_if": { - "setting": "support_use_towers", - "value": true - } + "enabled": "support_enable" }, "support_tower_roof_angle": { "label": "Tower Roof Angle", @@ -1307,10 +1283,7 @@ "max_value": "90", "default": 65, "visible": false, - "active_if": { - "setting": "support_use_towers", - "value": true - } + "enabled": "support_enable" }, "support_pattern": { "label": "Pattern", @@ -1323,10 +1296,7 @@ }, "default": "zigzag", "visible": false, - "active_if": { - "setting": "support_enable", - "value": true - } + "enabled": "support_enable" }, "support_connect_zigzags": { "label": "Connect ZigZags", @@ -1334,10 +1304,7 @@ "type": "boolean", "default": true, "visible": false, - "active_if": { - "setting": "support_pattern", - "value": "ZigZag" - } + "enabled": "support_enable" }, "support_infill_rate": { "label": "Fill Amount", @@ -1348,10 +1315,8 @@ "max_value": "100", "default": 15, "visible": false, - "active_if": { - "setting": "support_enable", - "value": true - }, + "enabled": "support_enable", + "children": { "support_line_distance": { "label": "Line distance", @@ -1361,10 +1326,7 @@ "min_value": "0", "default": 2.66, "visible": false, - "active_if": { - "setting": "support_enable", - "value": true - }, + "enabled": "support_enable", "inherit_function": "(support_line_width * 100) / parent_value" } } From 2d92bd660fbb246904c474c3214f49444fa13369 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:19:20 +0200 Subject: [PATCH 37/56] Set enabled property to false instead of visible for material settings in UM2 --- resources/machines/ultimaker2.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/machines/ultimaker2.json b/resources/machines/ultimaker2.json index 598a9327c1..6b987af71a 100644 --- a/resources/machines/ultimaker2.json +++ b/resources/machines/ultimaker2.json @@ -87,9 +87,9 @@ }, "overrides": { - "material_print_temperature": { "visible": false }, - "material_bed_temperature": { "visible": false }, - "material_diameter": { "visible": false }, - "material_flow": { "visible": false } + "material_print_temperature": { "enabled": "False" }, + "material_bed_temperature": { "enabled": "False" }, + "material_diameter": { "enabled": "False" }, + "material_flow": { "enabled": "False" } } } From 6306bb8901789054900b1f56eb89c1e2d7e15586 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 15:19:40 +0200 Subject: [PATCH 38/56] Add toggle fullscreen action to view menu --- resources/qml/Cura.qml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/resources/qml/Cura.qml b/resources/qml/Cura.qml index db8a1a3735..cb872caa82 100644 --- a/resources/qml/Cura.qml +++ b/resources/qml/Cura.qml @@ -111,6 +111,10 @@ UM.MainWindow { onObjectRemoved: top_view_menu.removeItem(object) } ExclusiveGroup { id: view_menu_top_group; } + + MenuSeparator { } + + MenuItem { action: actions.toggleFullScreen; } } Menu { id: machineMenu; From 90a7368fce9c3f0ab9d438fcbd82d77364996d0b Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 17:25:37 +0200 Subject: [PATCH 39/56] Fix options that were added to master to be dictionaries rather than arrays --- resources/machines/fdmprinter.json | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/resources/machines/fdmprinter.json b/resources/machines/fdmprinter.json index 4958c8d456..2e38e78b88 100644 --- a/resources/machines/fdmprinter.json +++ b/resources/machines/fdmprinter.json @@ -429,12 +429,12 @@ "label": "Z Seam Alignment", "description": "Starting point of each part in a layer. When parts in consecutive layers start at the same point a vertical seam may show on the print. When aligning these at the back, the seam is easiest to remove. When placed randomly the inaccuracies at the part start will be less noticable. When taking the shortest path the print will be more quick.", "type": "enum", - "options": [ - "Back", - "Shortest", - "Random" - ], - "default": "Shortest", + "options": { + "back": "Back", + "shortest": "Shortest", + "random": "Random" + }, + "default": "shortest", "visible": false } } @@ -1295,13 +1295,13 @@ "description": "The pattern with which the hammock is printed.", "type": "enum", "visible": false, - "options": [ - "Lines", - "Grid", - "Triangles", - "Concentric", - "ZigZag" - ], + "options": { + "lines": "Lines", + "grid": "Grid", + "triangles": "Triangles", + "concentric": "Concentric", + "zigzag": "Zig Zag" + }, "default": "Concentric" }, "support_use_towers": { @@ -1783,11 +1783,11 @@ "label": "Surface Mode", "description": "Print the surface instead of the volume. No infill, no top/bottom skin, just a single wall of which the middle coincides with the surface of the mesh. It's also possible to do both: print the insides of a closed volume as normal, but print all polygons not part of a closed volume as surface.", "type": "enum", - "options": [ - "Normal", - "Surface", - "Both" - ], + "options": { + "normal": "Normal", + "surface": "Surface", + "both": "Both" + }, "default": "Normal", "visible": false }, From 0cda05ae9277e314b92a46d7e73627a86449712c Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 17:28:58 +0200 Subject: [PATCH 40/56] Change "active_if" to "enabled" for all Wireframe settings --- resources/machines/fdmprinter.json | 115 ++++++----------------------- 1 file changed, 23 insertions(+), 92 deletions(-) diff --git a/resources/machines/fdmprinter.json b/resources/machines/fdmprinter.json index 2e38e78b88..eb2acdca5c 100644 --- a/resources/machines/fdmprinter.json +++ b/resources/machines/fdmprinter.json @@ -1812,10 +1812,7 @@ "unit": "mm", "default": 3, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_roof_inset": { "label": "WP Roof Inset Distance", @@ -1824,10 +1821,7 @@ "unit": "mm", "default": 3, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - }, + "enabled": "wireframe_enabled", "inherit_function": "wireframe_height" }, "wireframe_printspeed": { @@ -1837,10 +1831,7 @@ "type": "float", "default": 5, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - }, + "enabled": "wireframe_enabled", "children": { "wireframe_printspeed_bottom": { "label": "WP Bottom Printing Speed", @@ -1850,10 +1841,7 @@ "default": 5, "visible": false, "inherit": true, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_printspeed_up": { "label": "WP Upward Printing Speed", @@ -1863,10 +1851,7 @@ "default": 5, "visible": false, "inherit": true, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_printspeed_down": { "label": "WP Downward Printing Speed", @@ -1876,10 +1861,7 @@ "default": 5, "visible": false, "inherit": true, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_printspeed_flat": { "label": "WP Horizontal Printing Speed", @@ -1889,10 +1871,7 @@ "default": 5, "visible": false, "inherit": true, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" } } }, @@ -1903,10 +1882,7 @@ "default": 100, "type": "float", "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - }, + "enabled": "wireframe_enabled", "children": { "wireframe_flow_connection": { "label": "WP Connection Flow", @@ -1915,10 +1891,7 @@ "default": 100, "type": "float", "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_flow_flat": { "label": "WP Flat Flow", @@ -1927,10 +1900,7 @@ "default": 100, "type": "float", "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" } } }, @@ -1941,10 +1911,7 @@ "type": "float", "default": 0, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_bottom_delay": { "label": "WP Bottom Delay", @@ -1953,10 +1920,7 @@ "type": "float", "default": 0, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_flat_delay": { "label": "WP Flat Delay", @@ -1965,10 +1929,7 @@ "type": "float", "default": 0.1, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_up_half_speed": { "label": "WP Ease Upward", @@ -1977,10 +1938,7 @@ "unit": "mm", "default": 0.3, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_top_jump": { "label": "WP Knot Size", @@ -1989,10 +1947,7 @@ "unit": "mm", "default": 0.6, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_fall_down": { "label": "WP Fall Down", @@ -2001,10 +1956,7 @@ "unit": "mm", "default": 0.5, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_drag_along": { "label": "WP Drag along", @@ -2013,10 +1965,7 @@ "unit": "mm", "default": 0.6, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_strategy": { "label": "WP Strategy", @@ -2029,10 +1978,7 @@ }, "default": "compensate", "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_straight_before_down": { "label": "WP Straighten Downward Lines", @@ -2041,10 +1987,7 @@ "unit": "%", "default": 20, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_roof_fall_down": { "label": "WP Roof Fall Down", @@ -2053,10 +1996,7 @@ "unit": "mm", "default": 2, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_roof_drag_along": { "label": "WP Roof Drag Along", @@ -2065,10 +2005,7 @@ "unit": "mm", "default": 0.8, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_roof_outer_delay": { "label": "WP Roof Outer Delay", @@ -2077,10 +2014,7 @@ "unit": "sec", "default": 0.2, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" }, "wireframe_nozzle_clearance": { "label": "WP Nozzle Clearance", @@ -2089,10 +2023,7 @@ "unit": "mm", "default": 1, "visible": false, - "active_if": { - "setting": "wireframe_enabled", - "value": true - } + "enabled": "wireframe_enabled" } } } From f6dbc73d6d36f3d26ed3827229701cb4fb622b8c Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 17:29:25 +0200 Subject: [PATCH 41/56] Use the right property for active machine instance name --- resources/qml/SidebarHeader.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index e09497fb79..6d5f9f8d33 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -106,7 +106,7 @@ ColumnLayout text: UM.MachineManager.activeMachineInstance; width: parent.width/100*55 height: UM.Theme.sizes.sidebar_header.height - tooltip: UM.Application.machineName; + tooltip: UM.MachineManager.activeMachineInstance; //style: UM.Theme.styles.sidebar_header_button; anchors.right: parent.right anchors.verticalCenter: parent.verticalCenter From c9f62a4eabf6e4aec387a09aa3dc661d5ffdffc1 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Tue, 1 Sep 2015 17:29:37 +0200 Subject: [PATCH 42/56] Remove duplicate i18n catalog --- resources/qml/WizardPages/AddMachine.qml | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/qml/WizardPages/AddMachine.qml b/resources/qml/WizardPages/AddMachine.qml index b266afcf31..c09d41920e 100644 --- a/resources/qml/WizardPages/AddMachine.qml +++ b/resources/qml/WizardPages/AddMachine.qml @@ -19,8 +19,6 @@ Item property variant wizard: null; - UM.I18nCatalog { id: catalog; name: "cura"} - Connections { target: base.wizard From 7d2eb5468ca924cabe9bc49aba3c5be52902767c Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Sep 2015 09:51:32 +0200 Subject: [PATCH 43/56] Reverted to older version of the proto file so it no longer crashes --- plugins/CuraEngineBackend/Cura_pb2.py | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/plugins/CuraEngineBackend/Cura_pb2.py b/plugins/CuraEngineBackend/Cura_pb2.py index a7964118cf..bb0b000541 100644 --- a/plugins/CuraEngineBackend/Cura_pb2.py +++ b/plugins/CuraEngineBackend/Cura_pb2.py @@ -18,7 +18,6 @@ _sym_db = _symbol_database.Default() DESCRIPTOR = _descriptor.FileDescriptor( name='Cura.proto', package='cura.proto', - syntax='proto3', serialized_pb=_b('\n\nCura.proto\x12\ncura.proto\"X\n\nObjectList\x12#\n\x07objects\x18\x01 \x03(\x0b\x32\x12.cura.proto.Object\x12%\n\x08settings\x18\x02 \x03(\x0b\x32\x13.cura.proto.Setting\"5\n\x05Slice\x12,\n\x0cobject_lists\x18\x01 \x03(\x0b\x32\x16.cura.proto.ObjectList\"o\n\x06Object\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x10\n\x08vertices\x18\x02 \x01(\x0c\x12\x0f\n\x07normals\x18\x03 \x01(\x0c\x12\x0f\n\x07indices\x18\x04 \x01(\x0c\x12%\n\x08settings\x18\x05 \x03(\x0b\x32\x13.cura.proto.Setting\"\x1a\n\x08Progress\x12\x0e\n\x06\x61mount\x18\x01 \x01(\x02\"=\n\x10SlicedObjectList\x12)\n\x07objects\x18\x01 \x03(\x0b\x32\x18.cura.proto.SlicedObject\"=\n\x0cSlicedObject\x12\n\n\x02id\x18\x01 \x01(\x03\x12!\n\x06layers\x18\x02 \x03(\x0b\x32\x11.cura.proto.Layer\"]\n\x05Layer\x12\n\n\x02id\x18\x01 \x01(\x05\x12\x0e\n\x06height\x18\x02 \x01(\x02\x12\x11\n\tthickness\x18\x03 \x01(\x02\x12%\n\x08polygons\x18\x04 \x03(\x0b\x32\x13.cura.proto.Polygon\"\xe1\x01\n\x07Polygon\x12&\n\x04type\x18\x01 \x01(\x0e\x32\x18.cura.proto.Polygon.Type\x12\x0e\n\x06points\x18\x02 \x01(\x0c\x12\x12\n\nline_width\x18\x03 \x01(\x02\"\x89\x01\n\x04Type\x12\x0c\n\x08NoneType\x10\x00\x12\x0e\n\nInset0Type\x10\x01\x12\x0e\n\nInsetXType\x10\x02\x12\x0c\n\x08SkinType\x10\x03\x12\x0f\n\x0bSupportType\x10\x04\x12\r\n\tSkirtType\x10\x05\x12\x0e\n\nInfillType\x10\x06\x12\x15\n\x11SupportInfillType\x10\x07\"&\n\nGCodeLayer\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\"D\n\x0fObjectPrintTime\x12\n\n\x02id\x18\x01 \x01(\x03\x12\x0c\n\x04time\x18\x02 \x01(\x02\x12\x17\n\x0fmaterial_amount\x18\x03 \x01(\x02\"4\n\x0bSettingList\x12%\n\x08settings\x18\x01 \x03(\x0b\x32\x13.cura.proto.Setting\"&\n\x07Setting\x12\x0c\n\x04name\x18\x01 \x01(\t\x12\r\n\x05value\x18\x02 \x01(\x0c\"\x1b\n\x0bGCodePrefix\x12\x0c\n\x04\x64\x61ta\x18\x02 \x01(\x0c\x62\x06proto3') ) _sym_db.RegisterFileDescriptor(DESCRIPTOR) @@ -101,7 +100,6 @@ _OBJECTLIST = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -132,7 +130,6 @@ _SLICE = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -191,7 +188,6 @@ _OBJECT = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -222,7 +218,6 @@ _PROGRESS = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -253,7 +248,6 @@ _SLICEDOBJECTLIST = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -291,7 +285,6 @@ _SLICEDOBJECT = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -343,7 +336,6 @@ _LAYER = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -389,7 +381,6 @@ _POLYGON = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -427,7 +418,6 @@ _GCODELAYER = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -472,7 +462,6 @@ _OBJECTPRINTTIME = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -503,7 +492,6 @@ _SETTINGLIST = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -541,7 +529,6 @@ _SETTING = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], @@ -572,7 +559,6 @@ _GCODEPREFIX = _descriptor.Descriptor( ], options=None, is_extendable=False, - syntax='proto3', extension_ranges=[], oneofs=[ ], From b16933d68f3265e592b347c34b97e77ba5845977 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Sep 2015 11:10:05 +0200 Subject: [PATCH 44/56] Fix of crash caused by merge --- cura/CuraApplication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7841c5c462..7196d79f15 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -398,7 +398,7 @@ class CuraApplication(QtApplication): @pyqtSlot(str, result = "QVariant") def getSettingValue(self, key): - if not self.getActiveMachine(): + if not self.getMachineManager().getActiveMachineInstance(): return None return self.getActiveMachine().getSettingValueByKey(key) From 63ddfccd52d127a234e0e4325d19d8e8e1121874 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Sep 2015 11:23:09 +0200 Subject: [PATCH 45/56] updated cura application to new API --- cura/CuraApplication.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index 7196d79f15..dc664fe9ff 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -398,18 +398,18 @@ class CuraApplication(QtApplication): @pyqtSlot(str, result = "QVariant") def getSettingValue(self, key): - if not self.getMachineManager().getActiveMachineInstance(): + if not self.getMachineManager().getActiveProfile(): return None - - return self.getActiveMachine().getSettingValueByKey(key) + return self.getMachineManager().getActiveProfile().getSettingValueByKey(key) + #return self.getActiveMachine().getSettingValueByKey(key) ## Change setting by key value pair @pyqtSlot(str, "QVariant") def setSettingValue(self, key, value): - if not self.getActiveMachine(): + if not self.getMachineManager().getActiveProfile(): return - self.getActiveMachine().setSettingValueByKey(key, value) + self.getMachineManager().getActiveProfile().getSettingValueByKey(key, value) @pyqtSlot() def mergeSelected(self): From ac2184ef713404f81c69a2b132839626abc15fd1 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 2 Sep 2015 12:21:03 +0200 Subject: [PATCH 46/56] Use profile for getting setting values --- cura/OneAtATimeIterator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cura/OneAtATimeIterator.py b/cura/OneAtATimeIterator.py index 35adba90b3..cf767a65ff 100644 --- a/cura/OneAtATimeIterator.py +++ b/cura/OneAtATimeIterator.py @@ -17,7 +17,7 @@ class OneAtATimeIterator(Iterator.Iterator): def _fillStack(self): node_list = [] for node in self._scene_node.getChildren(): - if node.getBoundingBox().height > Application.getInstance().getMachineManager().getActiveMachineInstance().getSettingValueByKey("gantry_height"): + if node.getBoundingBox().height > Application.getInstance().getMachineManager().getActiveProfile().getSettingValue("gantry_height"): return if node.callDecoration("getConvexHull"): node_list.append(node) From 5a3e780ef6405cffe0c3171d63d4b9383afd3827 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 2 Sep 2015 12:21:37 +0200 Subject: [PATCH 47/56] Replace all active_if with enabled functions --- resources/machines/fdmprinter.json | 260 +++++++---------------------- 1 file changed, 57 insertions(+), 203 deletions(-) diff --git a/resources/machines/fdmprinter.json b/resources/machines/fdmprinter.json index eb2acdca5c..bf220f6e1d 100644 --- a/resources/machines/fdmprinter.json +++ b/resources/machines/fdmprinter.json @@ -218,10 +218,7 @@ "default": 0.4, "type": "float", "visible": false, - "active_if": { - "setting": "support_enable", - "value": true - } + "enabled": "support_enable" }, "support_roof_line_width": { "label": "Support Hammock line width", @@ -230,10 +227,7 @@ "default": 0.4, "type": "float", "visible": false, - "active_if": { - "setting": "support_roof_enable", - "value": true - } + "enabled": "support_roof_enable" } } } @@ -382,10 +376,7 @@ }, "default": "everywhere", "visible": false, - "active_if": { - "setting": "remove_overlapping_walls_x_enabled", - "value": true - } + "enabled": "remove_overlapping_walls_x_enabled" }, "top_bottom_pattern": { "label": "Bottom/Top Pattern", @@ -412,10 +403,7 @@ "default": 0, "type": "int", "visible": false, - "active_if": { - "setting": "top_bottom_pattern", - "value": "Lines" - } + "enabled": "top_bottom_pattern" }, "xy_offset": { "label": "Horizontal expansion", @@ -579,10 +567,7 @@ "default": 4.5, "visible": false, "inherit": false, - "active_if": { - "setting": "retraction_enable", - "value": true - } + "enabled": "retraction_enable" }, "retraction_speed": { "label": "Retraction Speed", @@ -592,10 +577,7 @@ "default": 25, "visible": false, "inherit": false, - "active_if": { - "setting": "retraction_enable", - "value": true - }, + "enabled": "retraction_enable", "children": { "retraction_retract_speed": { "label": "Retraction Retract Speed", @@ -604,10 +586,7 @@ "type": "float", "default": 25, "visible": false, - "active_if": { - "setting": "retraction_enable", - "value": true - } + "enabled": "retraction_enable" }, "retraction_prime_speed": { "label": "Retraction Prime Speed", @@ -616,10 +595,7 @@ "type": "float", "default": 25, "visible": false, - "active_if": { - "setting": "retraction_enable", - "value": true - } + "enabled": "retraction_enable" } } }, @@ -631,10 +607,7 @@ "default": 0, "visible": false, "inherit": false, - "active_if": { - "setting": "retraction_enable", - "value": true - } + "enabled": "retraction_enable" }, "retraction_min_travel": { "label": "Retraction Minimum Travel", @@ -644,10 +617,7 @@ "default": 4.5, "visible": false, "inherit": false, - "active_if": { - "setting": "retraction_enable", - "value": true - } + "enabled": "retraction_enable" }, "retraction_count_max": { "label": "Maximal Retraction Count", @@ -656,10 +626,7 @@ "type": "int", "visible": false, "inherit": false, - "active_if": { - "setting": "retraction_enable", - "value": true - } + "enabled": "retraction_enable" }, "retraction_extrusion_window": { "label": "Minimal Extrusion Distance Window", @@ -669,10 +636,7 @@ "default": 4.5, "visible": false, "inherit_function": "retraction_amount", - "active_if": { - "setting": "retraction_enable", - "value": true - } + "enabled": "retraction_enable" }, "retraction_hop": { "label": "Z Hop when Retracting", @@ -682,10 +646,7 @@ "default": 0, "visible": false, "inherit": false, - "active_if": { - "setting": "retraction_enable", - "value": true - } + "enabled": "retraction_enable" } } }, @@ -765,10 +726,7 @@ "default": 50, "visible": false, "inherit_function": "speed_wall_0", - "active_if": { - "setting": "support_enable", - "value": true - }, + "enabled": "support_enable", "children": { "speed_support_lines": { "label": "Support Wall Speed", @@ -778,10 +736,7 @@ "default": 50, "visible": false, "inherit": true, - "active_if": { - "setting": "support_roof_enable", - "value": true - } + "enabled": "support_roof_enable" }, "speed_support_roof": { "label": "Support Hammock Speed", @@ -791,10 +746,7 @@ "default": 40, "visible": false, "inherit": false, - "active_if": { - "setting": "support_roof_enable", - "value": true - } + "enabled": "support_roof_enable" } } } @@ -857,10 +809,7 @@ "type": "boolean", "default": true, "visible": false, - "active_if": { - "setting": "retraction_combing", - "value": true - }, + "enabled": "retraction_combing", "children": { "travel_avoid_distance": { "label": "Avoid Distance", @@ -870,10 +819,7 @@ "default": 1.5, "visible": false, "inherit": false, - "active_if": { - "setting": "retraction_combing", - "value": true - } + "enabled": "retraction_combing" } } }, @@ -892,10 +838,7 @@ "default": 0.064, "visible": false, "inherit": false, - "active_if": { - "setting": "coasting_enable", - "value": true - }, + "enabled": "coasting_enable", "children": { "coasting_volume_retract": { "label": "Retract-Coasting Volume", @@ -905,10 +848,7 @@ "default": 0.064, "visible": false, "inherit": true, - "active_if": { - "setting": "coasting_enable", - "value": true - } + "enabled": "coasting_enable" }, "coasting_volume_move": { "label": "Move-Coasting Volume", @@ -918,10 +858,7 @@ "default": 0.096, "visible": false, "inherit": true, - "active_if": { - "setting": "coasting_enable", - "value": true - } + "enabled": "coasting_enable" } } }, @@ -933,10 +870,7 @@ "default": 0.8, "visible": false, "inherit": false, - "active_if": { - "setting": "coasting_enable", - "value": true - }, + "enabled": "coasting_enable", "children": { "coasting_min_volume_retract": { "label": "Min Volume Retract-Coasting", @@ -946,10 +880,7 @@ "default": 0.6, "visible": false, "inherit": true, - "active_if": { - "setting": "coasting_enable", - "value": true - } + "enabled": "coasting_enable" }, "coasting_min_volume_move": { "label": "Min Volume Move-Coasting", @@ -959,10 +890,7 @@ "default": 0.8, "visible": false, "inherit": true, - "active_if": { - "setting": "coasting_enable", - "value": true - } + "enabled": "coasting_enable" } } }, @@ -974,10 +902,7 @@ "default": 90, "visible": false, "inherit": false, - "active_if": { - "setting": "coasting_enable", - "value": true - }, + "enabled": "coasting_enable", "children": { "coasting_speed_retract": { "label": "Retract-Coasting Speed", @@ -987,10 +912,7 @@ "default": 90, "visible": false, "inherit": true, - "active_if": { - "setting": "coasting_enable", - "value": true - } + "enabled": "coasting_enable" }, "coasting_speed_move": { "label": "Move-Coasting Speed", @@ -1000,10 +922,7 @@ "default": 90, "visible": false, "inherit": true, - "active_if": { - "setting": "coasting_enable", - "value": true - } + "enabled": "coasting_enable" } } } @@ -1412,10 +1331,7 @@ "description": "The skirt is a line drawn around the first layer of the. This helps to prime your extruder, and to see if the object fits on your platform. Setting this to 0 will disable the skirt. Multiple skirt lines can help to prime your extruder better for small objects.", "type": "int", "default": 1, - "active_if": { - "setting": "adhesion_type", - "value": "Skirt" - } + "enabled": "adhesion_type == \"skirt\"" }, "skirt_gap": { "label": "Skirt Distance", @@ -1423,10 +1339,7 @@ "unit": "mm", "type": "float", "default": 3, - "active_if": { - "setting": "adhesion_type", - "value": "Skirt" - } + "enabled": "adhesion_type == \"skirt\"" }, "skirt_minimal_length": { "label": "Skirt Minimum Length", @@ -1434,20 +1347,14 @@ "unit": "mm", "type": "float", "default": 250, - "active_if": { - "setting": "adhesion_type", - "value": "Skirt" - } + "enabled": "adhesion_type == \"skirt\"" }, "brim_line_count": { "label": "Brim Line Count", "description": "The amount of lines used for a brim: More lines means a larger brim which sticks better, but this also makes your effective print area smaller.", "type": "int", "default": 10, - "active_if": { - "setting": "adhesion_type", - "value": "Brim" - } + "enabled": "adhesion_type == \"brim\"" }, "raft_margin": { "label": "Raft Extra Margin", @@ -1455,10 +1362,7 @@ "unit": "mm", "type": "float", "default": 5, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_airgap": { "label": "Raft Air-gap", @@ -1466,20 +1370,14 @@ "unit": "mm", "type": "float", "default": 0.22, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_surface_layers": { "label": "Raft Surface Layers", "description": "The number of surface layers on top of the 2nd raft layer. These are fully filled layers that the object sits on. 2 layers usually works fine.", "type": "int", "default": 2, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_surface_thickness": { "label": "Raft Surface Thickness", @@ -1487,10 +1385,7 @@ "unit": "mm", "type": "float", "default": 0.1, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_surface_line_width": { "label": "Raft Surface Line Width", @@ -1498,10 +1393,7 @@ "unit": "mm", "type": "float", "default": 0.3, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_surface_line_spacing": { "label": "Raft Surface Spacing", @@ -1509,10 +1401,7 @@ "unit": "mm", "type": "float", "default": 0.3, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - }, + "enabled": "adhesion_type == \"raft\"", "inherit_function": "raft_surface_line_width" }, "raft_interface_thickness": { @@ -1521,10 +1410,7 @@ "unit": "mm", "type": "float", "default": 0.27, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_interface_line_width": { "label": "Raft Interface Line Width", @@ -1532,10 +1418,7 @@ "unit": "mm", "type": "float", "default": 1, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_interface_line_spacing": { "label": "Raft Interface Spacing", @@ -1543,10 +1426,7 @@ "unit": "mm", "type": "float", "default": 2, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_base_thickness": { "label": "Raft Base Thickness", @@ -1554,10 +1434,7 @@ "unit": "mm", "type": "float", "default": 0.3, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_base_line_width": { "label": "Raft Base Line Width", @@ -1565,10 +1442,7 @@ "unit": "mm", "type": "float", "default": 1, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_base_line_spacing": { "label": "Raft Line Spacing", @@ -1576,10 +1450,7 @@ "unit": "mm", "type": "float", "default": 5, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - } + "enabled": "adhesion_type == \"raft\"" }, "raft_speed": { "label": "Raft Print Speed", @@ -1587,10 +1458,7 @@ "unit": "mm/s", "type": "float", "default": 30, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - }, + "enabled": "adhesion_type == \"raft\"", "inherit_function": "0.6 * speed_print", "children": { "raft_surface_speed": { @@ -1599,10 +1467,7 @@ "unit": "mm/s", "type": "float", "default": 30, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - }, + "enabled": "adhesion_type == \"raft\"", "inherit_function": "parent_value" }, "raft_interface_speed": { @@ -1611,10 +1476,7 @@ "unit": "mm/s", "type": "float", "default": 15, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - }, + "enabled": "adhesion_type == \"raft\"", "inherit_function": "0.5 * parent_value" }, "raft_base_speed": { @@ -1623,10 +1485,7 @@ "unit": "mm/s", "type": "float", "default": 15, - "active_if": { - "setting": "adhesion_type", - "value": "Raft" - }, + "enabled": "adhesion_type == \"raft\"", "inherit_function": "0.5 * parent_value" } } @@ -1640,6 +1499,7 @@ "max_value": "100", "default": 100, "visible": false, + "enabled": "adhesion_type == \"raft\"", "children": { "raft_surface_fan_speed": { "label": "Raft Surface Fan Speed", @@ -1650,7 +1510,8 @@ "max_value": "100", "default": 100, "visible": false, - "inherit": true + "inherit": true, + "enabled": "adhesion_type == \"raft\"" }, "raft_interface_fan_speed": { "label": "Raft Interface Fan Speed", @@ -1661,7 +1522,8 @@ "max_value": "100", "default": 100, "visible": false, - "inherit": true + "inherit": true, + "enabled": "adhesion_type == \"raft\"" }, "raft_base_fan_speed": { "label": "Raft Base Fan Speed", @@ -1672,7 +1534,8 @@ "max_value": "100", "default": 100, "visible": false, - "inherit": true + "inherit": true, + "enabled": "adhesion_type == \"raft\"" } } }, @@ -1691,10 +1554,7 @@ "max_value_warning": "100", "default": 10, "visible": false, - "active_if": { - "setting": "draft_shield_enabled", - "value": true - } + "enabled": "draft_shield_enabled" }, "draft_shield_height_limitation": { "label": "Draft Shield Limitation", @@ -1706,10 +1566,7 @@ }, "default": "full", "visible": false, - "active_if": { - "setting": "draft_shield_enabled", - "value": true - } + "enabled": "draft_shield_enabled" }, "draft_shield_height": { "label": "Draft Shield Height", @@ -1721,10 +1578,7 @@ "default": 0, "inherit_function": "9999 if draft_shield_height_limitation == 'full' and draft_shield_enabled else 0.0", "visible": false, - "active_if": { - "setting": "draft_shield_height_limitation", - "value": "Limited" - } + "enabled": "draft_shield_height_limitation == \"limited\"" } } }, From 8833e11cdbdfff07ec5b7085d44cfd5a381ba7be Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 2 Sep 2015 12:22:37 +0200 Subject: [PATCH 48/56] Fix machine selection drop down Not sure if this was a merge issue or just not properly renamed --- resources/qml/SidebarHeader.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/SidebarHeader.qml b/resources/qml/SidebarHeader.qml index 304d805218..612ff0aeb3 100644 --- a/resources/qml/SidebarHeader.qml +++ b/resources/qml/SidebarHeader.qml @@ -124,11 +124,11 @@ Item text: model.name; checkable: true; checked: model.active; - exclusiveGroup: machineMenuGroup; + exclusiveGroup: machineSelectionMenuGroup; onTriggered: UM.MachineManager.setActiveMachineInstance(model.name); } - onObjectAdded: machineMenu.insertItem(index, object) - onObjectRemoved: machineMenu.removeItem(object) + onObjectAdded: machineSelectionMenu.insertItem(index, object) + onObjectRemoved: machineSelectionMenu.removeItem(object) } ExclusiveGroup { id: machineSelectionMenuGroup; } From de60fb47bfeed567d47b5df7f24829f23d09a34e Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 2 Sep 2015 12:23:14 +0200 Subject: [PATCH 49/56] Remove superfluous log and unneeded hide --- resources/qml/WizardPages/AddMachine.qml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/resources/qml/WizardPages/AddMachine.qml b/resources/qml/WizardPages/AddMachine.qml index c09d41920e..826a9bc0d7 100644 --- a/resources/qml/WizardPages/AddMachine.qml +++ b/resources/qml/WizardPages/AddMachine.qml @@ -197,9 +197,6 @@ Item var pages = machineList.model.getItem(machineList.currentIndex).pages - console.log(pages) - console.log(pages.length) - // Insert new pages (if any) for(var i = 0; i < pages.length; i++) { @@ -221,11 +218,6 @@ Item break; } } - - if (elementRoot.getPageCount() == elementRoot.currentPage) - { - elementRoot.visible = false - } } } From 39b6f81bdf77f8f89a8e6d9dc2a0c98361c45ca0 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Wed, 2 Sep 2015 12:23:51 +0200 Subject: [PATCH 50/56] Use machine manager to get the platform width/depth --- resources/qml/WizardPages/Bedleveling.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/WizardPages/Bedleveling.qml b/resources/qml/WizardPages/Bedleveling.qml index 3c1dcea552..edfde107d6 100644 --- a/resources/qml/WizardPages/Bedleveling.qml +++ b/resources/qml/WizardPages/Bedleveling.qml @@ -13,8 +13,8 @@ Column id: wizardPage property int leveling_state: 0 property bool three_point_leveling: true - property int platform_width: UM.Models.settingsModel.getMachineSetting("machine_width") - property int platform_height: UM.Models.settingsModel.getMachineSetting("machine_depth") + property int platform_width: UM.MachineManager.getSettingValue("machine_width") + property int platform_height: UM.MachineManager.getSettingValue("machine_depth") anchors.fill: parent; property variant printer_connection: UM.USBPrinterManager.connectedPrinterList.getItem(0).printer Component.onCompleted: printer_connection.homeHead() @@ -51,4 +51,4 @@ Column } -} \ No newline at end of file +} From 482d773971c30b13c2e925ce966a78133d9c38d4 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Sep 2015 13:37:27 +0200 Subject: [PATCH 51/56] Added some hardcoded strings to catalog --- resources/qml/Sidebar.qml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 7d378a5787..cfb34d1168 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -75,7 +75,7 @@ Rectangle spacing: UM.Theme.sizes.default_margin.width; Label { anchors.verticalCenter: parent.verticalCenter; - text: "Variant"; + text: catalog.i18nc("@label","Variant"); } ComboBox { @@ -126,8 +126,8 @@ Rectangle } } - Button { - text: "Save"; + Button{ + text: catalog.i18nc("@action:button", "Save"); } } } From c094344ae7fa445a24f5da96134046e411074f7e Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Sep 2015 13:38:06 +0200 Subject: [PATCH 52/56] Enforcing coding convention --- resources/qml/Sidebar.qml | 45 ++++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index cfb34d1168..5301469f7e 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -63,7 +63,8 @@ Rectangle onCurrentModeIndexChanged: UM.Preferences.setValue("cura/active_mode", currentModeIndex); } - Item { + Item + { id: variantItem; anchors.top: header.bottom; @@ -71,9 +72,11 @@ Rectangle visible: UM.MachineManager.hasVariants; - Row { + Row + { spacing: UM.Theme.sizes.default_margin.width; - Label { + Label + { anchors.verticalCenter: parent.verticalCenter; text: catalog.i18nc("@label","Variant"); } @@ -84,9 +87,12 @@ Rectangle textRole: "name" onActivated: UM.MachineManager.setActiveMachineVariant(model.getItem(index).name); - currentIndex: { - for(var i = 0; i < model.rowCount(); ++i) { - if(model.getItem(i).name == UM.MachineManager.activeMachineVariant) { + currentIndex: + { + for(var i = 0; i < model.rowCount(); ++i) + { + if(model.getItem(i).name == UM.MachineManager.activeMachineVariant) + { return i; } } @@ -97,27 +103,33 @@ Rectangle } } - Item { + Item + { id: profileItem; anchors.top: variantItem.bottom; height: UM.Theme.sizes.setting.height; - Row { + Row + { spacing: UM.Theme.sizes.default_margin.width; - Label { + Label + { anchors.verticalCenter: parent.verticalCenter; text: "Global Profile"; } - ComboBox { + ComboBox + { anchors.verticalCenter: parent.verticalCenter; model: UM.ProfilesModel { } textRole: "name" onActivated: UM.MachineManager.setActiveProfile(model.getItem(index).name) - currentIndex: { - for(var i = 0; i < model.rowCount(); ++i) { + currentIndex: + { + for(var i = 0; i < model.rowCount(); ++i) + { if(model.getItem(i).name == UM.MachineManager.activeProfile) return i; } @@ -126,13 +138,15 @@ Rectangle } } - Button{ + Button + { text: catalog.i18nc("@action:button", "Save"); } } } - Loader { + Loader + { id: sidebarContents; anchors.bottom: saveButton.top anchors.top: profileItem.bottom @@ -160,7 +174,8 @@ Rectangle } } - SaveButton { + SaveButton + { id: saveButton; implicitWidth: base.width implicitHeight: totalHeight From 0daf2301a7944fd213de8a42848993fa664b25c2 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Sep 2015 13:38:59 +0200 Subject: [PATCH 53/56] Addded string to catalog --- resources/qml/Sidebar.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 5301469f7e..76b59489ad 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -116,7 +116,7 @@ Rectangle Label { anchors.verticalCenter: parent.verticalCenter; - text: "Global Profile"; + text: catalog.i18nc("@label","Global Profile"); } ComboBox From a9208ccf3f675fe008634a02bd67c26dec7764ad Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Sep 2015 13:50:04 +0200 Subject: [PATCH 54/56] Fixes namechanges caused by api change --- cura/CuraApplication.py | 4 ++-- resources/qml/Sidebar.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cura/CuraApplication.py b/cura/CuraApplication.py index dc664fe9ff..93e663697c 100644 --- a/cura/CuraApplication.py +++ b/cura/CuraApplication.py @@ -400,7 +400,7 @@ class CuraApplication(QtApplication): def getSettingValue(self, key): if not self.getMachineManager().getActiveProfile(): return None - return self.getMachineManager().getActiveProfile().getSettingValueByKey(key) + return self.getMachineManager().getActiveProfile().getSettingValue(key) #return self.getActiveMachine().getSettingValueByKey(key) ## Change setting by key value pair @@ -409,7 +409,7 @@ class CuraApplication(QtApplication): if not self.getMachineManager().getActiveProfile(): return - self.getMachineManager().getActiveProfile().getSettingValueByKey(key, value) + self.getMachineManager().getActiveProfile().setSettingValue(key, value) @pyqtSlot() def mergeSelected(self): diff --git a/resources/qml/Sidebar.qml b/resources/qml/Sidebar.qml index 76b59489ad..77dcde94e7 100644 --- a/resources/qml/Sidebar.qml +++ b/resources/qml/Sidebar.qml @@ -133,7 +133,7 @@ Rectangle if(model.getItem(i).name == UM.MachineManager.activeProfile) return i; } - + UM.MachineManager.setActiveProfile(model.getItem(0).name) return 0; } } From fc4f8da242ef3758b5adeb45d2fe8778faed7202 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Sep 2015 14:05:49 +0200 Subject: [PATCH 55/56] Added logging when not slicing due to error values --- plugins/CuraEngineBackend/CuraEngineBackend.py | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/CuraEngineBackend/CuraEngineBackend.py b/plugins/CuraEngineBackend/CuraEngineBackend.py index 4d29b9a2f0..84b2ca78ac 100644 --- a/plugins/CuraEngineBackend/CuraEngineBackend.py +++ b/plugins/CuraEngineBackend/CuraEngineBackend.py @@ -144,6 +144,7 @@ class CuraEngineBackend(Backend): return #No point in slicing an empty build plate if kwargs.get("profile", self._profile).hasErrorValue(): + Logger.log('w', "Profile has error values. Aborting slicing") return #No slicing if we have error values since those are by definition illegal values. self._slicing = True From 4861e986245b0bc4292b85386095dff0e905cee5 Mon Sep 17 00:00:00 2001 From: Jaime van Kessel Date: Wed, 2 Sep 2015 14:30:36 +0200 Subject: [PATCH 56/56] Updated sliceobjectlistjob to new API --- plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py b/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py index e38e174238..6300499af7 100644 --- a/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py +++ b/plugins/CuraEngineBackend/ProcessSlicedObjectListJob.py @@ -43,12 +43,12 @@ class ProcessSlicedObjectListJob(Job): else: objectIdMap[id(node)] = node - settings = Application.getInstance().getActiveMachine() - layerHeight = settings.getSettingValueByKey("layer_height") + settings = Application.getInstance().getMachineManager().getActiveProfile() + layerHeight = settings.getSettingValue("layer_height") center = None - if not settings.getSettingValueByKey("machine_center_is_zero"): - center = numpy.array([settings.getSettingValueByKey("machine_width") / 2, 0.0, -settings.getSettingValueByKey("machine_depth") / 2]) + if not settings.getSettingValue("machine_center_is_zero"): + center = numpy.array([settings.getSettingValue("machine_width") / 2, 0.0, -settings.getSettingValue("machine_depth") / 2]) else: center = numpy.array([0.0, 0.0, 0.0])