Merge branch 'master'

This commit is contained in:
Lipu Fei 2017-09-13 17:25:47 +02:00
commit 2e1c6abe0e
390 changed files with 1361 additions and 4887 deletions

View file

@ -278,7 +278,7 @@ class CuraEngineBackend(QObject, Backend):
if job.getResult() == StartSliceJob.StartJobResult.MaterialIncompatible:
if Application.getInstance().platformActivity:
self._error_message = Message(catalog.i18nc("@info:status",
"The selected material is incompatible with the selected machine or configuration."))
"The selected material is incompatible with the selected machine or configuration."), title = catalog.i18nc("@info:title", "Material Details"))
self._error_message.show()
self.backendStateChange.emit(BackendState.Error)
else:
@ -305,7 +305,8 @@ 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", "Setting Details"))
self._error_message.show()
self.backendStateChange.emit(BackendState.Error)
else:
@ -314,7 +315,8 @@ class CuraEngineBackend(QObject, Backend):
if job.getResult() == StartSliceJob.StartJobResult.BuildPlateError:
if Application.getInstance().platformActivity:
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because the prime tower or prime position(s) are invalid."))
self._error_message = Message(catalog.i18nc("@info:status", "Unable to slice because the prime tower or prime position(s) are invalid."),
title = catalog.i18nc("@info:title", "Invalid position"))
self._error_message.show()
self.backendStateChange.emit(BackendState.Error)
else:
@ -322,7 +324,8 @@ class CuraEngineBackend(QObject, Backend):
if job.getResult() == StartSliceJob.StartJobResult.NothingToSlice:
if Application.getInstance().platformActivity:
self._error_message = Message(catalog.i18nc("@info:status", "Nothing to slice because none of the models fit the build volume. Please scale or rotate models to fit."))
self._error_message = Message(catalog.i18nc("@info:status", "Nothing to slice because none of the models fit the build volume. Please scale or rotate models to fit."),
title = catalog.i18nc("@info:title", "Warning"))
self._error_message.show()
self.backendStateChange.emit(BackendState.Error)
else:

View file

@ -235,7 +235,7 @@ class ProcessSlicedLayersJob(Job):
if self.isRunning():
if Application.getInstance().getController().getActiveView().getPluginId() == "LayerView":
if not self._progress:
self._progress = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, 0)
self._progress = Message(catalog.i18nc("@info:status", "Processing Layers"), 0, False, 0, catalog.i18nc("@info:title", "Information"))
if self._progress.getProgress() != 100:
self._progress.show()
else:

View file

@ -319,18 +319,22 @@ class StartSliceJob(Job):
# \param message object_lists message to put the per object settings in
def _handlePerObjectSettings(self, node, message):
stack = node.callDecoration("getStack")
if not stack: # Check if the node has a stack attached to it and the stack has any settings in the top container.
# Check if the node has a stack attached to it and the stack has any settings in the top container.
if not stack:
return
# Check all settings for relations, so we can also calculate the correct values for dependent settings.
top_of_stack = stack.getTop() #Cache for efficiency.
top_of_stack = stack.getTop() # Cache for efficiency.
changed_setting_keys = set(top_of_stack.getAllKeys())
# Add all relations to changed settings as well.
for key in top_of_stack.getAllKeys():
instance = top_of_stack.getInstance(key)
self._addRelations(changed_setting_keys, instance.definition.relations)
Job.yieldThread()
# Ensure that the engine is aware what the build extruder is
# Ensure that the engine is aware what the build extruder is.
if stack.getProperty("machine_extruder_count", "value") > 1:
changed_setting_keys.add("extruder_nr")
@ -339,14 +343,18 @@ class StartSliceJob(Job):
setting = message.addRepeatedMessage("settings")
setting.name = key
extruder = int(round(float(stack.getProperty(key, "limit_to_extruder"))))
if extruder >= 0 and key not in top_of_stack.getAllKeys(): #Limited to a specific extruder, but not overridden by per-object settings.
# Check if limited to a specific extruder, but not overridden by per-object settings.
if extruder >= 0 and key not in changed_setting_keys:
limited_stack = ExtruderManager.getInstance().getActiveExtruderStacks()[extruder]
else:
limited_stack = stack #Just take from the per-object settings itself.
limited_stack = stack
setting.value = str(limited_stack.getProperty(key, "value")).encode("utf-8")
Job.yieldThread()
## Recursive function to put all settings that require eachother for value changes in a list
## Recursive function to put all settings that require each other for value changes in a list
# \param relations_set \type{set} Set of keys (strings) of settings that are influenced
# \param relations list of relation objects that need to be checked.
def _addRelations(self, relations_set, relations):

View file

@ -251,7 +251,10 @@ class GCodeReader(MeshReader):
self._clearValues()
self._message = Message(catalog.i18nc("@info:status", "Parsing G-code"), lifetime=0)
self._message = Message(catalog.i18nc("@info:status", "Parsing G-code"),
lifetime=0,
title = catalog.i18nc("@info:title", "G-code Details"))
self._message.setProgress(0)
self._message.show()
@ -362,7 +365,9 @@ class GCodeReader(MeshReader):
if Preferences.getInstance().getValue("gcodereader/show_caution"):
caution_message = Message(catalog.i18nc(
"@info:generic",
"Make sure the g-code is suitable for your printer and printer configuration before sending the file to it. The g-code representation may not be accurate."), lifetime=0)
"Make sure the g-code is suitable for your printer and printer configuration before sending the file to it. The g-code representation may not be accurate."),
lifetime=0,
title = catalog.i18nc("@info:title", "G-code Details"))
caution_message.show()
# The "save/print" button's state is bound to the backend state.

View file

@ -90,7 +90,8 @@ class LayerView(View):
self._only_show_top_layers = bool(Preferences.getInstance().getValue("view/only_show_top_layers"))
self._compatibility_mode = True # for safety
self._wireprint_warning_message = Message(catalog.i18nc("@info:status", "Cura does not accurately display layers when Wire Printing is enabled"))
self._wireprint_warning_message = Message(catalog.i18nc("@info:status", "Cura does not accurately display layers when Wire Printing is enabled"),
title = catalog.i18nc("@info:title", "Layer View"))
def _resetSettings(self):
self._layer_view_type = 0 # 0 is material color, 1 is color by linetype, 2 is speed

View file

@ -22,18 +22,23 @@ Item
height: {
if (UM.LayerView.compatibilityMode) {
return UM.Theme.getSize("layerview_menu_size_compatibility").height;
} else if (UM.Preferences.getValue("layerview/layer_view_type") == 0) {
return UM.Theme.getSize("layerview_menu_size_material_color_mode").height + UM.LayerView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height)
} else {
return UM.Theme.getSize("layerview_menu_size").height + UM.LayerView.extruderCount * (UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("layerview_row_spacing").height)
}
}
property var buttonTarget: {
var force_binding = parent.y; // ensure this gets reevaluated when the panel moves
return base.mapFromItem(parent.parent, parent.buttonTarget.x, parent.buttonTarget.y);
}
visible: !parent.parent.monitoringPrint
UM.PointingRectangle {
id: layerViewMenu
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
width: parent.width
height: parent.height
@ -41,9 +46,7 @@ Item
color: UM.Theme.getColor("tool_panel_background")
borderWidth: UM.Theme.getSize("default_lining").width
borderColor: UM.Theme.getColor("lining")
target: parent.buttonTarget
arrowSize: UM.Theme.getSize("default_arrow").width
arrowSize: 0 // hide arrow until weird issue with first time rendering is fixed
ColumnLayout {
id: view_settings
@ -64,26 +67,7 @@ Item
anchors.leftMargin: UM.Theme.getSize("default_margin").width
spacing: UM.Theme.getSize("layerview_row_spacing").height
anchors.right: parent.right
anchors.rightMargin: UM.Theme.getSize("default_margin").width * 2
Label
{
id: layersLabel
anchors.left: parent.left
text: catalog.i18nc("@label","View Mode: Layers")
font: UM.Theme.getFont("default_bold");
color: UM.Theme.getColor("setting_control_text")
Layout.fillWidth: true
elide: Text.ElideMiddle;
}
Label
{
id: spaceLabel
anchors.left: parent.left
text: " "
font.pointSize: 0.5
}
anchors.rightMargin: UM.Theme.getSize("default_margin").width
Label
{
@ -199,6 +183,7 @@ Item
width: UM.Theme.getSize("layerview_legend_size").width
height: UM.Theme.getSize("layerview_legend_size").height
color: model.color
radius: width / 2
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("lining")
visible: !view_settings.show_legend
@ -211,7 +196,7 @@ Item
{
text: model.name
elide: Text.ElideRight
color: UM.Theme.getColor("button_text")
color: UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default")
anchors.verticalCenter: parent.verticalCenter
anchors.left: extrudersModelCheckBox.left;
@ -280,7 +265,7 @@ Item
text: label
font: UM.Theme.getFont("default")
elide: Text.ElideRight
color: UM.Theme.getColor("button_text")
color: UM.Theme.getColor("setting_control_text")
anchors.verticalCenter: parent.verticalCenter
anchors.left: legendModelCheckBox.left;
anchors.right: legendModelCheckBox.right;
@ -343,7 +328,7 @@ Item
Layout.fillWidth: true
Layout.preferredHeight: UM.Theme.getSize("layerview_row").height + UM.Theme.getSize("default_lining").height
Layout.preferredWidth: UM.Theme.getSize("layerview_row").width
color: UM.Theme.getColor("button_text")
color: UM.Theme.getColor("setting_control_text")
font: UM.Theme.getFont("default")
}
}
@ -354,7 +339,7 @@ Item
id: slider
width: handleSize
height: parent.height - 2*UM.Theme.getSize("slider_layerview_margin").height
anchors.top: parent.top
anchors.top: parent.bottom
anchors.topMargin: UM.Theme.getSize("slider_layerview_margin").height
anchors.right: layerViewMenu.right
anchors.rightMargin: UM.Theme.getSize("slider_layerview_margin").width
@ -364,7 +349,7 @@ Item
property real minimumRangeHandleSize: UM.Theme.getSize("slider_handle").width / 2
property real trackThickness: UM.Theme.getSize("slider_groove").width
property real trackRadius: trackThickness / 2
property real trackBorderWidth: UM.Theme.getSize("default_lining").width
property real trackBorderWidth: UM.Theme.getSize("default_lining").width / 2
property color upperHandleColor: UM.Theme.getColor("slider_handle")
property color lowerHandleColor: UM.Theme.getColor("slider_handle")
property color rangeHandleColor: UM.Theme.getColor("slider_groove_fill")
@ -434,6 +419,7 @@ Item
color: parent.trackColor
border.width: parent.trackBorderWidth;
border.color: parent.trackBorderColor;
visible: slider.layersVisible
}
Item {
@ -492,8 +478,8 @@ Item
anchors.horizontalCenter: parent.horizontalCenter
radius: parent.handleRadius
color: parent.upperHandleColor
border.width: UM.Theme.getSize("default_lining").width
border.color: UM.Theme.getColor("slider_handle_border")
//border.width: UM.Theme.getSize("default_lining").width
//border.color: UM.Theme.getColor("slider_handle_border")
visible: slider.layersVisible
@ -568,10 +554,10 @@ Item
UM.PointingRectangle
{
x: parent.width + UM.Theme.getSize("slider_layerview_background").width / 2;
x: parent.width - UM.Theme.getSize("slider_layerview_background").width / 2 - width;
y: Math.floor(slider.activeHandle.y + slider.activeHandle.height / 2 - height / 2);
target: Qt.point(0, slider.activeHandle.y + slider.activeHandle.height / 2)
target: Qt.point(parent.width, slider.activeHandle.y + slider.activeHandle.height / 2)
arrowSize: UM.Theme.getSize("default_arrow").width
height: UM.Theme.getSize("slider_handle").height + UM.Theme.getSize("default_margin").height

View file

@ -10,7 +10,7 @@ catalog = i18nCatalog("cura")
def getMetaData():
return {
"view": {
"name": catalog.i18nc("@item:inlistbox", "Layers"),
"name": catalog.i18nc("@item:inlistbox", "Layer view"),
"view_panel": "LayerView.qml",
"weight": 2
}

View file

@ -161,7 +161,8 @@ class PluginBrowser(QObject, Extension):
if plugin_id is None:
msg = i18n_catalog.i18nc("@info:status", "Failed to get plugin ID from <filename>{0}</filename>", file_path)
self._progress_message = Message(msg, lifetime=0, dismissable=False)
msg_title = i18n_catalog.i18nc("@info:tile", "Warning")
self._progress_message = Message(msg, lifetime=0, dismissable=False, title = msg_title)
return
# find a potential license file

View file

@ -86,7 +86,7 @@ class RemovableDriveOutputDevice(OutputDevice):
job.progress.connect(self._onProgress)
job.finished.connect(self._onFinished)
message = Message(catalog.i18nc("@info:progress Don't translate the XML tags <filename>!", "Saving to Removable Drive <filename>{0}</filename>").format(self.getName()), 0, False, -1)
message = Message(catalog.i18nc("@info:progress Don't translate the XML tags <filename>!", "Saving to Removable Drive <filename>{0}</filename>").format(self.getName()), 0, False, -1, catalog.i18nc("@info:title", "Saving"))
message.show()
self.writeStarted.emit(self)
@ -128,9 +128,8 @@ class RemovableDriveOutputDevice(OutputDevice):
self._stream = None
except:
Logger.logException("w", "An execption occured while trying to write to removable drive.")
message = Message(catalog.i18nc("@info:status", "Could not save to removable drive {0}: {1}").format(self.getName(),
str(
job.getError())))
message = Message(catalog.i18nc("@info:status", "Could not save to removable drive {0}: {1}").format(self.getName(),str(job.getError())),
title = catalog.i18nc("@info:title", "Error"))
message.show()
self.writeError.emit(self)
return
@ -138,13 +137,13 @@ class RemovableDriveOutputDevice(OutputDevice):
self._writing = False
self.writeFinished.emit(self)
if job.getResult():
message = Message(catalog.i18nc("@info:status", "Saved to Removable Drive {0} as {1}").format(self.getName(), os.path.basename(job.getFileName())))
message = Message(catalog.i18nc("@info:status", "Saved to Removable Drive {0} as {1}").format(self.getName(), os.path.basename(job.getFileName())), title = catalog.i18nc("@info:title", "File Saved"))
message.addAction("eject", catalog.i18nc("@action:button", "Eject"), "eject", catalog.i18nc("@action", "Eject removable device {0}").format(self.getName()))
message.actionTriggered.connect(self._onActionTriggered)
message.show()
self.writeSuccess.emit(self)
else:
message = Message(catalog.i18nc("@info:status", "Could not save to removable drive {0}: {1}").format(self.getName(), str(job.getError())))
message = Message(catalog.i18nc("@info:status", "Could not save to removable drive {0}: {1}").format(self.getName(), str(job.getError())), title = catalog.i18nc("@info:title", "Warning"))
message.show()
self.writeError.emit(self)
job.getStream().close()
@ -154,7 +153,7 @@ class RemovableDriveOutputDevice(OutputDevice):
if Application.getInstance().getOutputDeviceManager().getOutputDevicePlugin("RemovableDriveOutputDevice").ejectDevice(self):
message.hide()
eject_message = Message(catalog.i18nc("@info:status", "Ejected {0}. You can now safely remove the drive.").format(self.getName()))
eject_message = Message(catalog.i18nc("@info:status", "Ejected {0}. You can now safely remove the drive.").format(self.getName()), title = catalog.i18nc("@info:title", "Safely Remove Hardware"))
else:
eject_message = Message(catalog.i18nc("@info:status", "Failed to eject {0}. Another program may be using the drive.").format(self.getName()))
eject_message = Message(catalog.i18nc("@info:status", "Failed to eject {0}. Another program may be using the drive.").format(self.getName()), title = catalog.i18nc("@info:title", "Warning"))
eject_message.show()

View file

@ -40,7 +40,11 @@ class SliceInfo(Extension):
Preferences.getInstance().addPreference("info/asked_send_slice_info", False)
if not Preferences.getInstance().getValue("info/asked_send_slice_info"):
self.send_slice_info_message = Message(catalog.i18nc("@info", "Cura collects anonymised slicing statistics. You can disable this in the preferences."), lifetime = 0, dismissable = False)
self.send_slice_info_message = Message(catalog.i18nc("@info", "Cura collects anonymised slicing statistics. You can disable this in the preferences."),
lifetime = 0,
dismissable = False,
title = catalog.i18nc("@info:title", "Collecting Data"))
self.send_slice_info_message.addAction("Dismiss", catalog.i18nc("@action:button", "Dismiss"), None, "")
self.send_slice_info_message.actionTriggered.connect(self.messageActionTriggered)
self.send_slice_info_message.show()

View file

@ -9,7 +9,7 @@ i18n_catalog = i18nCatalog("cura")
def getMetaData():
return {
"view": {
"name": i18n_catalog.i18nc("@item:inmenu", "Solid"),
"name": i18n_catalog.i18nc("@item:inmenu", "Solid view"),
"weight": 0
}
}

View file

@ -154,12 +154,12 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self._authentication_id = None
self._authentication_key = None
self._authentication_requested_message = Message(i18n_catalog.i18nc("@info:status", "Access to the printer requested. Please approve the request on the printer"), lifetime = 0, dismissable = False, progress = 0)
self._authentication_failed_message = Message(i18n_catalog.i18nc("@info:status", ""))
self._authentication_requested_message = Message(i18n_catalog.i18nc("@info:status", "Access to the printer requested. Please approve the request on the printer"), lifetime = 0, dismissable = False, progress = 0, title = i18n_catalog.i18nc("@info:title", "Connection status"))
self._authentication_failed_message = Message(i18n_catalog.i18nc("@info:status", ""), title = i18n_catalog.i18nc("@info:title", "Connection Status"))
self._authentication_failed_message.addAction("Retry", i18n_catalog.i18nc("@action:button", "Retry"), None, i18n_catalog.i18nc("@info:tooltip", "Re-send the access request"))
self._authentication_failed_message.actionTriggered.connect(self.requestAuthentication)
self._authentication_succeeded_message = Message(i18n_catalog.i18nc("@info:status", "Access to the printer accepted"))
self._not_authenticated_message = Message(i18n_catalog.i18nc("@info:status", "No access to print with this printer. Unable to send print job."))
self._authentication_succeeded_message = Message(i18n_catalog.i18nc("@info:status", "Access to the printer accepted"), title = i18n_catalog.i18nc("@info:title", "Connection Status"))
self._not_authenticated_message = Message(i18n_catalog.i18nc("@info:status", "No access to print with this printer. Unable to send print job."), title = i18n_catalog.i18nc("@info:title", "Connection Status"))
self._not_authenticated_message.addAction("Request", i18n_catalog.i18nc("@action:button", "Request Access"), None, i18n_catalog.i18nc("@info:tooltip", "Send access request to the printer"))
self._not_authenticated_message.actionTriggered.connect(self.requestAuthentication)
@ -464,7 +464,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
self._connection_state_before_timeout = self._connection_state
self.setConnectionState(ConnectionState.error)
self._connection_message = Message(i18n_catalog.i18nc("@info:status",
"The connection with the network was lost."))
"The connection with the network was lost."),
title = i18n_catalog.i18nc("@info:title", "Connection Status"))
self._connection_message.show()
if self._progress_message:
@ -495,7 +496,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
# Go into timeout state.
Logger.log("d", "We did not receive a response for %0.1f seconds, so it seems the printer is no longer accessible.", time_since_last_response)
self._connection_state_before_timeout = self._connection_state
self._connection_message = Message(i18n_catalog.i18nc("@info:status", "The connection with the printer was lost. Check your printer to see if it is connected."))
self._connection_message = Message(i18n_catalog.i18nc("@info:status", "The connection with the printer was lost. Check your printer to see if it is connected."),
title = i18n_catalog.i18nc("@info:title", "Connection Status"))
self._connection_message.show()
if self._progress_message:
@ -644,7 +646,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
def requestWrite(self, nodes, file_name = None, filter_by_machine = False, file_handler = None, **kwargs):
if self._printer_state not in ["idle", ""]:
self._error_message = Message(
i18n_catalog.i18nc("@info:status", "Unable to start a new print job, printer is busy. Current printer status is %s.") % self._printer_state)
i18n_catalog.i18nc("@info:status", "Unable to start a new print job, printer is busy. Current printer status is %s.") % self._printer_state,
title = i18n_catalog.i18nc("@info:title", "Printer Status"))
self._error_message.show()
return
elif self._authentication_state != AuthState.Authenticated:
@ -668,14 +671,16 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
if self._json_printer_state["heads"][0]["extruders"][index]["hotend"]["id"] == "":
Logger.log("e", "No cartridge loaded in slot %s, unable to start print", index + 1)
self._error_message = Message(
i18n_catalog.i18nc("@info:status", "Unable to start a new print job. No Printcore loaded in slot {0}".format(index + 1)))
i18n_catalog.i18nc("@info:status", "Unable to start a new print job. No Printcore loaded in slot {0}".format(index + 1)),
title = i18n_catalog.i18nc("@info:title", "Error"))
self._error_message.show()
return
if self._json_printer_state["heads"][0]["extruders"][index]["active_material"]["guid"] == "":
Logger.log("e", "No material loaded in slot %s, unable to start print", index + 1)
self._error_message = Message(
i18n_catalog.i18nc("@info:status",
"Unable to start a new print job. No material loaded in slot {0}".format(index + 1)))
"Unable to start a new print job. No material loaded in slot {0}".format(index + 1)),
title = i18n_catalog.i18nc("@info:title", "Error"))
self._error_message.show()
return
@ -831,7 +836,7 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
def startPrint(self):
try:
self._send_gcode_start = time()
self._progress_message = Message(i18n_catalog.i18nc("@info:status", "Sending data to printer"), 0, False, -1)
self._progress_message = Message(i18n_catalog.i18nc("@info:status", "Sending data to printer"), 0, False, -1, i18n_catalog.i18nc("@info:title", "Sending Data"))
self._progress_message.addAction("Abort", i18n_catalog.i18nc("@action:button", "Cancel"), None, "")
self._progress_message.actionTriggered.connect(self._progressMessageActionTrigger)
self._progress_message.show()
@ -900,7 +905,8 @@ class NetworkPrinterOutputDevice(PrinterOutputDevice):
except IOError:
self._progress_message.hide()
self._error_message = Message(i18n_catalog.i18nc("@info:status", "Unable to send data to printer. Is another job still active?"))
self._error_message = Message(i18n_catalog.i18nc("@info:status", "Unable to send data to printer. Is another job still active?"),
title = i18n_catalog.i18nc("@info:title", "Warning"))
self._error_message.show()
except Exception as e:
self._progress_message.hide()

View file

@ -150,7 +150,7 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
def printGCode(self, gcode_list):
Logger.log("d", "Started printing g-code")
if self._progress or self._connection_state != ConnectionState.connected:
self._error_message = Message(catalog.i18nc("@info:status", "Unable to start a new job because the printer is busy or not connected."))
self._error_message = Message(catalog.i18nc("@info:status", "Unable to start a new job because the printer is busy or not connected."), title = catalog.i18nc("@info:title", "Print Details"))
self._error_message.show()
Logger.log("d", "Printer is busy or not connected, aborting print")
self.writeError.emit(self)
@ -453,11 +453,11 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
container_stack = Application.getInstance().getGlobalContainerStack()
if container_stack.getProperty("machine_gcode_flavor", "value") == "UltiGCode":
self._error_message = Message(catalog.i18nc("@info:status", "This printer does not support USB printing because it uses UltiGCode flavor."))
self._error_message = Message(catalog.i18nc("@info:status", "This printer does not support USB printing because it uses UltiGCode flavor."), title = catalog.i18nc("@info:title", "USB Printing"))
self._error_message.show()
return
elif not container_stack.getMetaDataEntry("supports_usb_connection"):
self._error_message = Message(catalog.i18nc("@info:status", "Unable to start a new job because the printer does not support usb printing."))
self._error_message = Message(catalog.i18nc("@info:status", "Unable to start a new job because the printer does not support usb printing."), title = catalog.i18nc("@info:title", "Warning"))
self._error_message.show()
return
@ -622,8 +622,9 @@ class USBPrinterOutputDevice(PrinterOutputDevice):
self._sendCommand("M140 S0")
self._sendCommand("M104 S0")
self._sendCommand("M107")
# Home XY to prevent nozzle resting on aborted print
# Don't home bed because it may crash the printhead into the print on printers that home on the bottom
self.homeHead()
self.homeBed()
self._sendCommand("M84")
self._is_printing = False
self._is_paused = False

View file

@ -105,7 +105,7 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension):
if file_name.startswith("file://"):
file_name = QUrl(file_name).toLocalFile() # File dialogs prepend the path with file://, which we don't need / want
if not self._usb_output_devices:
Message(i18n_catalog.i18nc("@info", "Unable to update firmware because there are no printers connected.")).show()
Message(i18n_catalog.i18nc("@info", "Unable to update firmware because there are no printers connected."), title = i18n_catalog.i18nc("@info:title", "Warning")).show()
return
for printer_connection in self._usb_output_devices:
@ -119,7 +119,7 @@ class USBPrinterOutputDeviceManager(QObject, OutputDevicePlugin, Extension):
self._usb_output_devices[printer_connection].setProgress(100, 100)
Logger.log("w", "No firmware found for printer %s called '%s'", printer_connection, file_name)
Message(i18n_catalog.i18nc("@info",
"Could not find firmware required for the printer at %s.") % printer_connection).show()
"Could not find firmware required for the printer at %s.") % printer_connection, title = i18n_catalog.i18nc("@info:title", "Printer Firmware")).show()
self._firmware_view.close()
continue

View file

@ -9,6 +9,24 @@ from UM.VersionUpgrade import VersionUpgrade #We're inheriting from this.
_renamed_themes = {
"cura": "cura-light"
}
_renamed_i18n = {
"7s": "en_7S",
"de": "de_DE",
"en": "en_US",
"es": "es_ES",
"fi": "fi_FI",
"fr": "fr_FR",
"hu": "hu_HU",
"it": "it_IT",
"jp": "ja_JP",
"ko": "ko_KR",
"nl": "nl_NL",
"pl": "pl_PL",
"ptbr": "pt_BR",
"ru": "ru_RU",
"tr": "tr_TR"
}
class VersionUpgrade27to30(VersionUpgrade):
## Gets the version number from a CFG file in Uranium's 2.7 format.
@ -43,14 +61,89 @@ class VersionUpgrade27to30(VersionUpgrade):
parser["general"]["version"] = "5"
if "metadata" not in parser:
parser["metadata"] = {}
parser["metadata"]["setting_version"] = "2"
parser["metadata"]["setting_version"] = "3"
#Renamed themes.
if "theme" in parser["general"]:
if parser["general"]["theme"] in _renamed_themes:
parser["general"]["theme"] = _renamed_themes[parser["general"]["theme"]]
#Renamed languages.
if "language" in parser["general"]:
if parser["general"]["language"] in _renamed_i18n:
parser["general"]["language"] = _renamed_i18n[parser["general"]["language"]]
# Renamed settings for skin pre-shrink settings
if parser.has_section("general") and "visible_settings" in parser["general"]:
visible_settings = parser["general"]["visible_settings"].split(";")
new_visible_settings = []
renamed_skin_preshrink_names = {"expand_upper_skins": "top_skin_expand_distance",
"expand_lower_skins": "bottom_skin_expand_distance"}
for setting in visible_settings:
if setting == "expand_skins_into_infill":
continue # this one is removed
if setting in renamed_skin_preshrink_names:
new_visible_settings.append(renamed_skin_preshrink_names[setting])
continue #Don't add the original.
new_visible_settings.append(setting) #No special handling, so just add the original visible setting back.
parser["general"]["visible_settings"] = ";".join(new_visible_settings)
# Re-serialise the file.
output = io.StringIO()
parser.write(output)
return [filename], [output.getvalue()]
return [filename], [output.getvalue()]
## Upgrades the given instance container file from version 2.7 to 3.0.
#
# \param serialised The serialised form of the container file.
# \param filename The name of the file to upgrade.
def upgradeOtherContainer(self, serialised, filename):
parser = configparser.ConfigParser(interpolation=None)
parser.read_string(serialised)
# Update the skin pre-shrink settings:
# - Remove the old ones
# - Do not add the new ones. The default values will be used for them.
if parser.has_section("values"):
for remove_key in ["expand_skins_into_infill", "expand_upper_skins", "expand_lower_skins"]:
if remove_key in parser["values"]:
del parser["values"][remove_key]
for each_section in ("general", "metadata"):
if not parser.has_section(each_section):
parser.add_section(each_section)
# Update version numbers
parser["general"]["version"] = "2"
parser["metadata"]["setting_version"] = "3"
# Re-serialise the file.
output = io.StringIO()
parser.write(output)
return [filename], [output.getvalue()]
## Upgrades a container stack from version 2.7 to 3.0.
#
# \param serialised The serialised form of a container stack.
# \param filename The name of the file to upgrade.
def upgradeStack(self, serialised, filename):
parser = configparser.ConfigParser(interpolation=None)
parser.read_string(serialised)
for each_section in ("general", "metadata"):
if not parser.has_section(each_section):
parser.add_section(each_section)
# Update version numbers
if "general" not in parser:
parser["general"] = {}
parser["general"]["version"] = "3"
if "metadata" not in parser:
parser["metadata"] = {}
parser["metadata"]["setting_version"] = "3"
# Re-serialise the file.
output = io.StringIO()
parser.write(output)
return [filename], [output.getvalue()]

View file

@ -9,13 +9,46 @@ def getMetaData():
return {
"version_upgrade": {
# From To Upgrade function
("preferences", 4000002): ("preferences", 5000002, upgrade.upgradePreferences),
("preferences", 4000002): ("preferences", 5000003, upgrade.upgradePreferences),
("machine_stack", 3000002): ("machine_stack", 3000003, upgrade.upgradeStack),
("extruder_train", 3000002): ("extruder_train", 3000003, upgrade.upgradeStack),
("quality_changes", 2000002): ("quality_changes", 2000003, upgrade.upgradeOtherContainer),
("user", 2000002): ("user", 2000003, upgrade.upgradeOtherContainer),
("quality", 2000002): ("quality", 2000003, upgrade.upgradeOtherContainer),
("definition_changes", 2000002): ("definition_changes", 2000003, upgrade.upgradeOtherContainer),
("variant", 2000002): ("variant", 2000003, upgrade.upgradeOtherContainer)
},
"sources": {
"preferences": {
"get_version": upgrade.getCfgVersion,
"location": {"."}
},
"machine_stack": {
"get_version": upgrade.getCfgVersion,
"location": {"./machine_instances"}
},
"extruder_train": {
"get_version": upgrade.getCfgVersion,
"location": {"./extruders"}
},
"quality_changes": {
"get_version": upgrade.getCfgVersion,
"location": {"./quality"}
},
"user": {
"get_version": upgrade.getCfgVersion,
"location": {"./user"}
},
"definition_changes": {
"get_version": upgrade.getCfgVersion,
"location": {"./definition_changes"}
},
"variant": {
"get_version": upgrade.getCfgVersion,
"location": {"./variants"}
}
}
}

View file

@ -9,7 +9,7 @@ catalog = i18nCatalog("cura")
def getMetaData():
return {
"view": {
"name": catalog.i18nc("@item:inlistbox", "X-Ray"),
"name": catalog.i18nc("@item:inlistbox", "X-Ray view"),
"weight": 1
}
}

View file

@ -35,7 +35,7 @@ class XmlMaterialProfile(InstanceContainer):
# \return The corresponding setting_version.
def xmlVersionToSettingVersion(self, xml_version: str) -> int:
if xml_version == "1.3":
return 2
return 3
return 0 #Older than 1.3.
def getInheritedFiles(self):

View file

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