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

This commit is contained in:
Tim Kuipers 2016-07-28 19:52:54 +02:00
commit 07cea792d9
5 changed files with 26 additions and 6 deletions

View file

@ -203,7 +203,7 @@ class CuraApplication(QtApplication):
"dialog_profile_path",
"dialog_material_path"]:
Preferences.getInstance().addPreference("local_file/%s" % key, "~/")
Preferences.getInstance().addPreference("local_file/%s" % key, os.path.expanduser("~/"))
Preferences.getInstance().setDefault("local_file/last_used_type", "text/x-gcode")
@ -896,4 +896,4 @@ class CuraApplication(QtApplication):
self._additional_components[area_id] = []
self._additional_components[area_id].append(component)
self.additionalComponentsChanged.emit(area_id)
self.additionalComponentsChanged.emit(area_id)

View file

@ -244,6 +244,7 @@ class ContainerManager(QObject):
if not type_name or entry["type"] == type_name:
filters.append(filter_string)
filters.append("All Files (*)")
return filters
## Export a container to a file
@ -280,6 +281,9 @@ class ContainerManager(QObject):
return { "status": "error", "message": "Container not found"}
container = containers[0]
if UM.Platform.isOSX() and "." in file_url:
file_url = file_url[:file_url.rfind(".")]
for suffix in mime_type.suffixes:
if file_url.endswith(suffix):
break
@ -301,7 +305,7 @@ class ContainerManager(QObject):
with UM.SaveFile(file_url, "w") as f:
f.write(contents)
return { "status": "success", "message": "Succesfully exported container"}
return { "status": "success", "message": "Succesfully exported container", "path": file_url}
## Imports a profile from a file
#
@ -371,11 +375,20 @@ class ContainerManager(QObject):
"container": container_type
}
suffix_list = "*." + mime_type.preferredSuffix
suffix = mime_type.preferredSuffix
if UM.Platform.isOSX() and "." in suffix:
# OSX's File dialog is stupid and does not allow selecting files with a . in its name
suffix = suffix[suffix.index(".") + 1:]
suffix_list = "*." + suffix
for suffix in mime_type.suffixes:
if suffix == mime_type.preferredSuffix:
continue
if UM.Platform.isOSX() and "." in suffix:
# OSX's File dialog is stupid and does not allow selecting files with a . in its name
suffix = suffix[suffix.index("."):]
suffix_list += ", *." + suffix
name_filter = "{0} ({1})".format(mime_type.comment, suffix_list)

View file

@ -30,6 +30,8 @@ Rectangle
return UM.Theme.getColor("status_paused")
else if (Cura.MachineManager.printerOutputDevices[0].jobState == "error")
return UM.Theme.getColor("status_stopped")
else if (Cura.MachineManager.printerOutputDevices[0].jobState == "offline")
return UM.Theme.getColor("status_offline")
else
return UM.Theme.getColor("text")
}
@ -41,7 +43,10 @@ Rectangle
{
if(!printerConnected)
{
return catalog.i18nc("@label:", "Please check your printer connections")
return catalog.i18nc("@label:", "Not connected to a printer")
} else if(Cura.MachineManager.printerOutputDevices[0].jobState == "offline")
{
return catalog.i18nc("@label:", "Lost connection with the printer")
} else if(Cura.MachineManager.printerOutputDevices[0].jobState == "printing")
{
return catalog.i18nc("@label:", "Printing...")

View file

@ -255,7 +255,7 @@ UM.ManagementPage
else if(result.status == "success")
{
messageDialog.icon = StandardIcon.Information
messageDialog.text = catalog.i18nc("@info:status", "Successfully exported material to <filename>%1</filename>").arg(fileUrl)
messageDialog.text = catalog.i18nc("@info:status", "Successfully exported material to <filename>%1</filename>").arg(result.path)
messageDialog.open()
}
CuraApplication.setDefaultPath("dialog_material_path", folder)

View file

@ -116,6 +116,8 @@ Rectangle
return UM.Theme.getIcon("tab_monitor_paused")
else if (Cura.MachineManager.printerOutputDevices[0].jobState == "error")
return UM.Theme.getIcon("tab_monitor_stopped")
else if (Cura.MachineManager.printerOutputDevices[0].jobState == "offline")
return UM.Theme.getIcon("tab_monitor_offline")
else
return UM.Theme.getIcon("tab_monitor")
}