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

This commit is contained in:
Tim Kuipers 2016-09-13 16:45:45 +02:00
commit ad91c71c2b
9 changed files with 51 additions and 17 deletions

View File

@ -286,7 +286,7 @@ class PrinterOutputDevice(QObject, OutputDevice):
result.append(i18n_catalog.i18nc("@item:material", "No material loaded")) result.append(i18n_catalog.i18nc("@item:material", "No material loaded"))
continue continue
containers = self._container_registry.findInstanceContainers(type = "material", guid = material_id) containers = self._container_registry.findInstanceContainers(type = "material", GUID = material_id)
if containers: if containers:
result.append(containers[0].getName()) result.append(containers[0].getName())
else: else:

View File

@ -349,6 +349,9 @@ class ContainerManager(QObject):
except NotImplementedError: except NotImplementedError:
return { "status": "error", "message": "Unable to serialize container"} return { "status": "error", "message": "Unable to serialize container"}
if contents is None:
return {"status": "error", "message": "Serialization returned None. Unable to write to file"}
with UM.SaveFile(file_url, "w") as f: with UM.SaveFile(file_url, "w") as f:
f.write(contents) f.write(contents)

View File

@ -46,9 +46,11 @@ class SliceInfoJob(Job):
if Platform.isOSX(): if Platform.isOSX():
kwoptions["context"] = ssl._create_unverified_context() kwoptions["context"] = ssl._create_unverified_context()
Logger.log("d", "Sending anonymous slice info to [%s]...", self.url)
try: try:
f = urllib.request.urlopen(self.url, **kwoptions) f = urllib.request.urlopen(self.url, **kwoptions)
Logger.log("i", "Sent anonymous slice info to %s", self.url) Logger.log("i", "Sent anonymous slice info.")
f.close() f.close()
except urllib.error.HTTPError as http_exception: except urllib.error.HTTPError as http_exception:
Logger.log("e", "An HTTP error occurred while trying to send slice information: %s" % http_exception) Logger.log("e", "An HTTP error occurred while trying to send slice information: %s" % http_exception)
@ -59,7 +61,7 @@ class SliceInfoJob(Job):
# The data is only sent when the user in question gave permission to do so. All data is anonymous and # The data is only sent when the user in question gave permission to do so. All data is anonymous and
# no model files are being sent (Just a SHA256 hash of the model). # no model files are being sent (Just a SHA256 hash of the model).
class SliceInfo(Extension): class SliceInfo(Extension):
info_url = "https://stats.youmagine.com/curastats/slice" info_url = "http://stats.youmagine.com/curastats/slice"
def __init__(self): def __init__(self):
super().__init__() super().__init__()

View File

@ -91,12 +91,9 @@ class MachineInstance:
if has_machine_qualities: #This machine now has machine-quality profiles. if has_machine_qualities: #This machine now has machine-quality profiles.
active_material += "_" + variant_materials #That means that the profile was split into multiple. active_material += "_" + variant_materials #That means that the profile was split into multiple.
current_settings = "" #The profile didn't know the definition ID when it was upgraded, so it will have been invalid. Sorry, your current settings are lost now.
else:
current_settings = self._name + "_current_settings"
containers = [ containers = [
current_settings, "", #The current profile doesn't know the definition ID when it was upgraded, only the instance ID, so it will be invalid. Sorry, your current settings are lost now.
active_quality_changes, active_quality_changes,
active_quality, active_quality,
active_material, active_material,

View File

@ -80,7 +80,7 @@ class Profile:
import VersionUpgrade21to22 # Import here to prevent circular dependencies. import VersionUpgrade21to22 # Import here to prevent circular dependencies.
if self._name == "Current settings": if self._name == "Current settings":
self._filename += "_current_settings" #This resolves a duplicate ID arising from how Cura 2.1 stores its current settings. return None #Can't upgrade these, because the new current profile needs to specify the definition ID and the old file only had the machine instance, not the definition.
config = configparser.ConfigParser(interpolation = None) config = configparser.ConfigParser(interpolation = None)

View File

@ -85,9 +85,6 @@ class XmlMaterialProfile(UM.Settings.InstanceContainer):
# base file: global settings + supported machines # base file: global settings + supported machines
# machine / variant combination: only changes for itself. # machine / variant combination: only changes for itself.
def serialize(self): def serialize(self):
if self._read_only:
return
registry = UM.Settings.ContainerRegistry.getInstance() registry = UM.Settings.ContainerRegistry.getInstance()
base_file = self.getMetaDataEntry("base_file", "") base_file = self.getMetaDataEntry("base_file", "")

View File

@ -2715,6 +2715,7 @@
"raft": "Raft" "raft": "Raft"
}, },
"default_value": "brim", "default_value": "brim",
"resolve": "'raft' if 'raft' in extruderValues('adhesion_type') else ('brim' if 'brim' in extruderValues('adhesion_type') else 'skirt')",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": false
}, },
@ -3306,6 +3307,7 @@
"type": "bool", "type": "bool",
"enabled": "machine_extruder_count > 1", "enabled": "machine_extruder_count > 1",
"default_value": false, "default_value": false,
"resolve": "max(extruderValues('prime_tower_enable'))",
"settable_per_mesh": false, "settable_per_mesh": false,
"settable_per_extruder": false "settable_per_extruder": false
}, },

View File

@ -20,18 +20,40 @@ SettingItem
property bool checked: property bool checked:
{ {
switch(propertyProvider.properties.value) // FIXME this needs to go away once 'resolve' is combined with 'value' in our data model.
// Stacklevels
// 0: user -> unsaved change
// 1: quality changes -> saved change
// 2: quality
// 3: material -> user changed material in materials page
// 4: variant
// 5: machine
var value;
if ((propertyProvider.properties.resolve != "None") && (stackLevel != 0) && (stackLevel != 1)) {
// We have a resolve function. Indicates that the setting is not settable per extruder and that
// we have to choose between the resolved value (default) and the global value
// (if user has explicitly set this).
value = propertyProvider.properties.resolve;
} else {
value = propertyProvider.properties.value;
}
switch(value)
{ {
case "True": case "True":
return true return true;
case "False": case "False":
return false return false;
default: default:
return propertyProvider.properties.value return value;
} }
} }
onClicked: { forceActiveFocus(); propertyProvider.setPropertyValue("value", !checked) } onClicked:
{
forceActiveFocus();
propertyProvider.setPropertyValue("value", !checked);
}
Rectangle Rectangle
{ {

View File

@ -96,8 +96,19 @@ SettingItem
} }
function updateCurrentIndex() { function updateCurrentIndex() {
// FIXME this needs to go away once 'resolve' is combined with 'value' in our data model.
var value;
if ((propertyProvider.properties.resolve != "None") && (stackLevel != 0) && (stackLevel != 1)) {
// We have a resolve function. Indicates that the setting is not settable per extruder and that
// we have to choose between the resolved value (default) and the global value
// (if user has explicitly set this).
value = propertyProvider.properties.resolve;
} else {
value = propertyProvider.properties.value;
}
for(var i = 0; i < definition.options.length; ++i) { for(var i = 0; i < definition.options.length; ++i) {
if(definition.options[i].key == propertyProvider.properties.value) { if(definition.options[i].key == value) {
currentIndex = i; currentIndex = i;
return; return;
} }