Merge branch 'master' into container_stack_improvements

This commit is contained in:
ChrisTerBeke 2017-11-06 09:49:44 +01:00
commit d32b7f0091
19 changed files with 616 additions and 57 deletions

View file

@ -293,7 +293,7 @@ class CuraEngineBackend(QObject, Backend):
error_labels.add(definitions[0].label)
error_labels = ", ".join(error_labels)
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice with the current settings. The following settings have errors: {0}".format(error_labels)),
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice with the current settings. The following settings have errors: {0}").format(error_labels),
title = catalog.i18nc("@info:title", "Unable to slice"))
self._error_message.show()
self.backendStateChange.emit(BackendState.Error)

View file

@ -112,7 +112,6 @@ class LayerView(View):
self._layer_pass = LayerPass.LayerPass(1, 1)
self._compatibility_mode = OpenGLContext.isLegacyOpenGL() or bool(Preferences.getInstance().getValue("view/force_layer_view_compatibility_mode"))
self._layer_pass.setLayerView(self)
self.getRenderer().addRenderPass(self._layer_pass)
return self._layer_pass
def getCurrentLayer(self):
@ -310,7 +309,8 @@ class LayerView(View):
if event.type == Event.ViewActivateEvent:
# Make sure the LayerPass is created
self.getLayerPass()
layer_pass = self.getLayerPass()
self.getRenderer().addRenderPass(layer_pass)
Application.getInstance().globalContainerStackChanged.connect(self._onGlobalStackChanged)
self._onGlobalStackChanged()
@ -335,6 +335,7 @@ class LayerView(View):
if self._global_container_stack:
self._global_container_stack.propertyChanged.disconnect(self._onPropertyChanged)
self.getRenderer().removeRenderPass(self._layer_pass)
self._composite_pass.setLayerBindings(self._old_layer_bindings)
self._composite_pass.setCompositeShader(self._old_composite_shader)

View file

@ -103,6 +103,7 @@ class NetworkClusterPrinterOutputDevice(NetworkPrinterOutputDevice.NetworkPrinte
self._can_pause = True
self._can_abort = True
self._can_pre_heat_bed = False
self._can_control_manually = False
self._cluster_size = int(properties.get(b"cluster_size", 0))
self._cleanupRequest()

View file

@ -102,6 +102,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self._target_bed_temperature = 0
self._processing_preheat_requests = True
self._can_control_manually = False
self.setPriority(3) # Make sure the output device gets selected above local file output
self.setName(key)
self.setShortDescription(i18n_catalog.i18nc("@action:button Preceded by 'Ready to'.", "Print over network"))

View file

@ -56,7 +56,8 @@ class XRayView(View):
# Currently the RenderPass constructor requires a size > 0
# This should be fixed in RenderPass's constructor.
self._xray_pass = XRayPass.XRayPass(1, 1)
self.getRenderer().addRenderPass(self._xray_pass)
self.getRenderer().addRenderPass(self._xray_pass)
if not self._xray_composite_shader:
self._xray_composite_shader = OpenGL.getInstance().createShaderProgram(os.path.join(PluginRegistry.getInstance().getPluginPath("XRayView"), "xray_composite.shader"))
@ -74,5 +75,6 @@ class XRayView(View):
self._composite_pass.setCompositeShader(self._xray_composite_shader)
if event.type == Event.ViewDeactivateEvent:
self.getRenderer().removeRenderPass(self._xray_pass)
self._composite_pass.setLayerBindings(self._old_layer_bindings)
self._composite_pass.setCompositeShader(self._old_composite_shader)

View file

@ -33,9 +33,10 @@ class XmlMaterialProfile(InstanceContainer):
#
# \param xml_version: The version number found in an XML file.
# \return The corresponding setting_version.
def xmlVersionToSettingVersion(self, xml_version: str) -> int:
@classmethod
def xmlVersionToSettingVersion(cls, xml_version: str) -> int:
if xml_version == "1.3":
return 4
return CuraApplication.SettingVersion
return 0 #Older than 1.3.
def getInheritedFiles(self):
@ -407,15 +408,16 @@ class XmlMaterialProfile(InstanceContainer):
def getConfigurationTypeFromSerialized(self, serialized: str) -> Optional[str]:
return "materials"
def getVersionFromSerialized(self, serialized: str) -> Optional[int]:
@classmethod
def getVersionFromSerialized(cls, serialized: str) -> Optional[int]:
data = ET.fromstring(serialized)
version = 1
version = XmlMaterialProfile.Version
# get setting version
if "version" in data.attrib:
setting_version = self.xmlVersionToSettingVersion(data.attrib["version"])
setting_version = XmlMaterialProfile.xmlVersionToSettingVersion(data.attrib["version"])
else:
setting_version = self.xmlVersionToSettingVersion("1.2")
setting_version = XmlMaterialProfile.xmlVersionToSettingVersion("1.2")
return version * 1000000 + setting_version

View file

@ -5,24 +5,16 @@ import xml.etree.ElementTree as ET
from UM.VersionUpgrade import VersionUpgrade
from cura.CuraApplication import CuraApplication
from .XmlMaterialProfile import XmlMaterialProfile
class XmlMaterialUpgrader(VersionUpgrade):
def getXmlVersion(self, serialized):
data = ET.fromstring(serialized)
version = 1
# get setting version
if "version" in data.attrib:
setting_version = self._xmlVersionToSettingVersion(data.attrib["version"])
else:
setting_version = self._xmlVersionToSettingVersion("1.2")
return version * 1000000 + setting_version
return XmlMaterialProfile.getVersionFromSerialized(serialized)
def _xmlVersionToSettingVersion(self, xml_version: str) -> int:
if xml_version == "1.3":
return 2
return 0 #Older than 1.3.
return XmlMaterialProfile.xmlVersionToSettingVersion(xml_version)
def upgradeMaterial(self, serialised, filename):
data = ET.fromstring(serialised)

View file

@ -19,7 +19,7 @@ def getMetaData():
"mimetype": "application/x-ultimaker-material-profile"
},
"version_upgrade": {
("materials", 1000000): ("materials", 1000003, upgrader.upgradeMaterial),
("materials", 1000000): ("materials", 1000004, upgrader.upgradeMaterial),
},
"sources": {
"materials": {